I recently noticed the following message in chrome's console log, while using aloha editor:
aloha.js:14579 - 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.
While trying to find a replacement, i couldn't find anything besides that they are going to remove it, so i would like to know what are the alternatives for Selection.addRange() to get rid of this message.
The trick is to use
removeAllRanges()on your selection before adding your new range usingaddRange(range). Here is an example when using it to select all content ofelem: