javascript - Rangy: New method for getting selected nodes -


it looks newest alpha version of rangy has deprecated createnodeiterator() method , replaced more general createiterator() instead. seems syntax using bit different well.

say user has gone through , made multiple selections document , applied css classes selections. goal make sure user unable make overlapping selections text has rangy-applied css class.

could still createiterator function? there built-in function me otherwise?

i went solution:

var ishighlighted = false, range = rangy.getselection().getrangeat(0);  var = range.getnodes([3], function(node) {     return node.parentnode.tagname == 'span' && node.parentnode.classname == 'highlight'; });  if (it.length > 0)     ishighlighted = true;  return ishighlighted; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -