replaceRange triggers beforeSelectionChange which is unexpected.
That is intentional, though. Changing the document will change the selection, so the relevant events are fired.
ok but see the plunkr above, the selection does not change after replaceRange …