javascript - Selection::addRange very slow in large DOM -
is there alternative document.getselection().addrange()
?
in content editable frame containing div
s, gets slower go down div
s.
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
Post a Comment