The Selection API alone is such a minefield of divergent browser implementations that it's a massive PITA.
And that's just the start. Check what happens in different browsers when you hit backspace in a contenteditable containing a single space character.
Overall there are a lot of such changing, undocumented behaviours.