javascript - How to fix the error "Selection.addRange()"? -
this question has answer here:
i need fix error :
the behavior selection.addrange() merges existing range , specified range deprecated , removed in m58, around april 2017. see https://www.chromestatus.com/features/6680566019653632 more details.
i can't edit, or destroy element of website.
from this github issue, have call removeallranges()
before adding range selection:
selection = window.getselection(); // save selection. range = document.createrange(); range.selectnodecontents(elem); selection.removeallranges(); // remove ranges selection. selection.addrange(range); // add new range.
Comments
Post a Comment