- Notifications
You must be signed in to change notification settings - Fork15
Describe and resolve DOM Range objects using XPath
License
openannotation/xpath-range
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This module is for describing and resolving a DOMRange using XPath.
Using npm:
npm install xpath-rangeThe module provides functions for converting to and from DOM Range objectsusing a combination of XPath expressions and text offsets.
The presence of a working XPath evaluator is not strictly required. Without it,the library will only support XPath expressions that use a child axis andnode names with number literal positions. All XPath expressions generated bythis library fit this description. For instance, the library can generate andconsume an expression like/html/body/article/p[3].
Convert aRange to a pair of XPath expressions and offsets.
If the optional parameterroot is supplied, the computed XPath expressionswill be relative to it.
Returns an object with the following properties:
- start
- startOffset
- end
- endOffset
Construct aRange from the given XPath expressions and offsets.
If the optional parameterroot is supplied, the XPath expressions areevaluated as relative to it.
Returns aRange object.
This library should work with any browser implementing basicRange support.
- Basic support can be achieved with therangy shim.
- There is no support for namespaces in X(HT)ML documents (issue #17).
Originally, this code was part of theAnnotator project.
Any discussion should happen on theannotator-dev mailinglist.
To contribute, fork this repository and send a pull request with your changes,including any necessary test and documentation updates.
You can run the command-line test suite by executingnpm test.
To run the test suite, install the karma test runner with the commandnpm install -g karma-cli and then runkarma start. Karma will printinstructions for debugging the tests in a browser.
About
Describe and resolve DOM Range objects using XPath
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.