Package Exports
- selection-range
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (selection-range) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
selection-range
Get or set the selection range, or cursor position. Useful for saving and restoring selections when your are programatically changing the dom.
Installation
$ component install bmcmahen/selection-range
$ npm install selection-rangeUsage
var select = require('selection-range');
select(el, { start: 5, end: 25 }); // select range of el from 5 - 25
select(el, { start: 5 }); // set the cursor at 5
var pos = select(el); // get range of selection
// pos.start = start index
// pos.end = end index
// pos.atStart = boolean. true if cursor should appear at start of el
// pos = undefined if no cursor
select(el, pos);Tests
npm install component-test -g
component test browserLicense
MIT