-
Notifications
You must be signed in to change notification settings - Fork 318
Closed
Labels
compatStandard is not web compatible or proprietary feature needs standardizingStandard is not web compatible or proprietary feature needs standardizingtopic: shadowRelates to shadow trees (as defined in DOM)Relates to shadow trees (as defined in DOM)
Description
Based on: jsdom/jsdom#2398 (comment)
While implementing MutationObserver in jsdom, I wasn't able to make the following test pass while following the spec: https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/slotchange-event.html#L540-L594
The test run the following steps:
- Adds 2 mutation observers (one on
idattribute and another one ontitle) and a slot with aslotchangeevent handler. - Update the
idattribute and the append a child in the light dom of the host. We then enqueue a microtask to notify the listeners. At this point theidattribute mutation observer contains 1 mutation record, and the signal slot list contains the slot. - The notifiy mutation observer algorithm is executed later on:
- The mutation observer list is copied, it contains the 2 mutation observers, and it iterates over the 2 mutation observers
- The callback for the
idmutation observer is executed and in it's callback it updates title attribute and append a new element the light dom of the host. By updating thetitleattribute a new mutation record is enqueued but this time for thetitlemutation observer. - The callback for the
titlemutation observer is invoked because it has a mutation record. And the test throws here since it expects that theslotchangeevent is invoked first.
Chrome and Webkit don't run into the same issue since they keep track of an active mutation observer list instead of iterating over all the mutation observers.
Metadata
Metadata
Assignees
Labels
compatStandard is not web compatible or proprietary feature needs standardizingStandard is not web compatible or proprietary feature needs standardizingtopic: shadowRelates to shadow trees (as defined in DOM)Relates to shadow trees (as defined in DOM)