draw-selection
v1.0.0
Published
A node module for drawing boxes around a DOM selection.
Readme
draw-selection
A node module for drawing boxes around a DOM selection.
Install
npm install draw-selectionRun
drawSelection([containerEl [, styles]])
args
containerEl- (optional)Elementto insert the boxes (assumes the selection is relative to that container)styles- (optional)objectthat contains CSS properties and values to apply to the boxes (default{ outline: '1px solid red', 'pointer-events': 'none' })
returns
els- an array ofElements that were created
<html>
<body>
<p>hello, world!</p>
</body>
</html>
var drawSelection = require('draw-selection')
var sel = window.getSelection()
sel.removeAllRanges()
var range = document.createRange()
range.selectNode(document.querySelector('p'))
sel.addRange(range)
drawSelection({
outline: '1px inset blue'
})License
Copyright 2015 Cameron Lakenen
