2

I need help to fix this error :

The behavior that Selection.addRange() merges existing Range and the specified Range is deprecated and will be removed in M58, around April 2017. See https://www.chromestatus.com/features/6680566019653632 for more details.

I can't edit, or destroy element of my website.

Mistalis
  • 17,793
  • 13
  • 73
  • 97
Fremin33
  • 23
  • 3

1 Answers1

3

From this Github issue, now you have to call removeAllRanges() before adding a range to your selection:

selection = window.getSelection();    // Save the selection.
range = document.createRange();
range.selectNodeContents(elem);
selection.removeAllRanges();          // Remove all ranges from the selection.
selection.addRange(range);            // Add the new range.
Mistalis
  • 17,793
  • 13
  • 73
  • 97