Closed Bug 714797 Opened 13 years ago Closed 13 years ago

Annotator text selection algorithm fails on various cases

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Unassigned)

Details

Attachments

(1 file)

Attached file Pull request 317
I noticed that annotator example is failing to select text on many cases.
It works correctly on wiki pages, but except that, it fails because :
- `jQuery.text` method behavor. This method includes <script> tags!!
- the code assume that a parent node of the selection has an ID

In this pull request, I've implemented a better text selection algorithm, that doesn't use textContent nor jQuery.text in order to ignore <script> tags. I fixed the parent node assumption and removed useless `$`.

This pull request is on top of PR #316, from bug 714778. As it allows to make annotator example work again!
Comment on attachment 585409 [details]
Pull request 317

On the first hand, this patch looks like a bugfix that would be good to have in 1.4, but on the other hand, we lived with this behavior for many releases ...
Attachment #585409 - Flags: review?(myk)
Comment on attachment 585409 [details]
Pull request 317

Looks good, works well, r=@mykmelez.

This doesn't look very scary, but since it's very late in the cycle for 1.4, I think we should reduce risk as much as possible by waiting to ship this in 1.5.
Attachment #585409 - Flags: review?(myk) → review+
Commit pushed to https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/1f4ca9ebb2f7713c913650511aac3f12cc14408a
Merge pull request #317 from ochameau/improve-annotator

fix bug 714797 - Improve annotator text selection algorithm; r=@mykmelez
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: