Mutation Observers do not coalesce Text node mutations (they appear as two records)

Confirmed Issue #14708138 • Assigned to travil

Details

Author
Travis L.
Created
Nov 16, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Standard affected
DOM Standard

Found in build #
16.17040
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Test case: https://quirksmode.org/dom/events/tests/mutation.html

It appears that the mutation record in Edge contains two entries for each text change: one for removing the old text node, and one for inserting the new one. All other browsers create only one record, with one addedNode and one removedNode.

From the spec it doesn’t become obvious that Edge’s behaviour is a bug, or that the behaviour of the other browsers is a bug. Nonetheless it’s a difference, and I’d like to know if there are specific reasons mutation observers work this way in Edge, or if it’s something that’s going to change.

My particular use case is distinguishing between childList mutations that actually replace element nodes and ones that only replace text. In the other browsers I can simply go through the addedNodes and removedNodes of the record, and if at least one of them is an element node the mutation as a whole was an element mutation. (In the test page I set trueType to either childList or characterData). This approach is less feasible in Edge, since I’d have to collate information from several mutation records. That’s not impossible, but I thought I’d ask you first.

Thanks!
(PPK)

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “travil”

      Changed Status to “Confirmed”

    You need to sign in to your Microsoft account to add a comment.

    Sign in