Skip to content

micnews/get-selection-range-from-elm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

License

MIT

Generated by package-json-to-readme

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published