bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Annotator text selection algorithm fails on various cases

RESOLVED FIXED

Status

Add-on SDK
General
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: ochameau, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 585409 [details]
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!
(Reporter)

Comment 1

7 years ago
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+

Comment 3

7 years ago
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

Updated

7 years ago
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.