javascript - Selection::addRange very slow in large DOM -


is there alternative document.getselection().addrange()?

in content editable frame containing divs, gets slower go down divs.

are running removeallranges first? mdn article , this answer make seem call required / recommended.

an example script mdn article:

/* select strong elements in html document */  var strongs = document.getelementsbytagname("strong"); var s = window.getselection();  if(s.rangecount > 0) s.removeallranges();  for(var = 0; < strongs.length; i++) {   var range = document.createrange();   range.selectnode(strongs[i]);   s.addrange(range); } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -