get-selection-range-from-elm
v2.0.1
Published
window.getSelection().rangeAt(0) but only if it exists & is within an element
Downloads
4
Readme
get-selection-range-from-elm
window.getSelection().rangeAt(0) but only if it exists & is within an element
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install get-selection-range-from-elm --save
Usage
import getSelectionRangeFromElm from 'get-selection-range-from-elm';
const range = getSelectionRangeFromElm(document.querySelector('#foo'));
console.log('range is set if selection is within the element #foo');
console.log(range.startContainer);
Tests
npm install
npm test
Dependencies
None
Dev Dependencies
- babel-cli: Babel command line.
- babel-core: Babel compiler core.
- babel-preset-es2015: Babel preset for all es2015 plugins.
- babel-tape-runner: Babel + Tape for running your ES Next tests
- babelify: Babel browserify transform
- browserify: browser-side require() the node way
- devtool: runs Node.js programs through Chromium DevTools
- faucet: human-readable TAP summarizer
- package-json-to-readme: Generate a README.md from package.json contents
- semistandard: All the goodness of
feross/standard
with semicolons sprinkled on top. - snazzy: Format JavaScript Standard Style as Stylish (i.e. snazzy) output
- tapava: the syntax of ava, run through tape
License
MIT
Generated by package-json-to-readme