timdown / rangy

A cross-browser JavaScript range and selection library.
MIT License
2.25k stars 368 forks source link

Page structure change issue #215

Open srinivasuk opened 10 years ago

srinivasuk commented 10 years ago

We have create an JS application (bookmarklet) to highlight a webpage using your library.

When an highlight created in chrome browser and tried to render the text selection in firefox browser, it is not rendering properly

is there anyway we can avoid serialization or a fix to this problem?

srinivasuk commented 10 years ago

the problem we identified is if there is slightest change in the webpage structure it is not working even though the selected text is not changed.

timdown commented 10 years ago

The serialization module is very sensitive, which is a consequence of the approach it takes. In version 1.3, you have other built-in option based on character offsets, such as the getBookmark() and moveToBookmark() methods of Range. The Highlighter module optionally uses these methods to save and restore selections. Also, the TextRange module has a more complicated and much slower set of functions for saving and restoring ranges as character offsets relative to text the user sees, taking into account collapsed white space, line breaks implied by
and block elements, elements hidden by CSS etc.

HaNdTriX commented 10 years ago

Dublicate of https://github.com/timdown/rangy/issues/216 ?