You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ES6 Iterator that iterates over the Nodes of a Range
Installation
$ npm install range-iterator
Example
importRangeIteratorfrom'range-iterator';letrange=document.createRange();range.selectNodeContents(document.body);// Iterate over all TextNodes and BR elements within the Range selectionletiterator=RangeIterator(range,NodeFilter.SHOW_ALL,function(node){returnnode.nodeType===Node.TEXT_NODE||node.nodeName==='BR';})letnode;for(nodeofiterator){// do something with Node `node`console.log(node);}