window.getSelection().rangeAt(0) but only if it exists & is within an element
Download node at nodejs.org and install it, if you haven't already.
npm install get-selection-range-from-elm --save
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);
npm install
npm test
None
- 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
MIT
Generated by package-json-to-readme