-
Notifications
You must be signed in to change notification settings - Fork 368
New Features In One Point Three
Character and word-based Range and Selection manipulation, relative to the visible text on the page. This is a major new module with some powerful features:
-
moveStart()
,moveEnd()
,move()
andexpand()
Range methods inspired by IE'sTextRange
object - Page text search, using a string or a regular expression
- Character offset-based selection save and restore, immune to changes in
innerHTML
- Selection snap to words
- Cross-browser
innerText
implementation - Selection and range trimming
API to allow creation, removal, serialization and deserialization of highlights within a page. It uses either character offsets relative to the page's textContent
or the TextRange module's character-based features to keep track of highlight positions. This should be an improvement on the approach of the previous, unofficial Highlighter module, whose performance worsened exponentially as the number of highlights increased.
The file name in the latest Rangy build is now rangy-classapplier.js rather than rangy-cssclassapplier.js.
The old methods are still present as aliases but are deprecated and may be removed in the future.
-
rangy.createCssClassApplier()
renamed torangy.createClassApplier()
-
rangy.getIframeSelection()
is now redundant. Userangy.getSelection()
instead. -
rangy.createIframeRange()
is now redundant. Userangy.createRange()
instead. -
rangy.createIframeRangyRange()
is now redundant. Userangy.createRangyRange()
instead.
- AMD support
- NPM module called
rangy
- Bower support via rangy-release repository
- Browserify support
- Rangy's main entry functions are now much more permissive. For example,
rangy.createRange()
andrangy.getSelection()
and all related methods now accept aWindow
,Document
or iframe element - Added
setStartAndEnd()
convenience method to Range - Added
getBookmark()
andmoveToBookmark()
methods to Range and Selection - Added new
useExistingElements
option to class applier options object (issue 111) - Selection
setSingleRange()
now accepts an additional second parameter,direction
- Every
backwards
Boolean API parameter replaced with stringdirection
parameter. Booleans are still accepted, as are the strings "backwards", "backward", "forwards" and "forward" - Added
applyToRanges()
,unapplyToRanges()
andtoggleRanges()
to class applier - Added
removeEmptyElements
option to class applier. When true, empty elements generated by (or appearing to be generated by) the applier are removed when applying or unapplying to a range or selection - Added
getNativeTextRange()
method to selection - Module loading improved: module script include order no longer matters, so long as rangy-core.js comes first. Modules now initialize automatically if Rangy has initialized. Also, the console now provides more helpful warning messages when modules fail to load.
- New config option
alertOnFail
to allow control over whether Rangy displays an alert when it fails to initialize - New config option
autoInitialize
to allow control over whether Rangy automatically initializes when the page loads - Build script now works on non-Windows platforms
- Various additions to
rangy.dom