Closed Bug 1180927 Opened 7 years ago Closed 6 years ago

MutationObserver callbacks should be called before executing defer scritps

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 789315

People

(Reporter: zbraniecki, Assigned: smaug)

Details

Attachments

(2 files)

This doesn't seem to be spec'ed currently (I filled a W3C bug [0]) but if would be nice to follow the implementation of Chrome and Safari here and execute Mutation Observer callbacks before we execute deferred scripts.

That would allow us to prototype API's with shims that rely on Mutation Observer.


[0] https://www.w3.org/Bugs/Public/show_bug.cgi?id=28920
Olli, can you help me move this forward? I don't know who to ping in the w3c bug :)
Flags: needinfo?(bugs)
I've pinged Anne at least, who might work on the spec a bit if Hixie isn't available.
Flags: needinfo?(bugs)
Attached file modeferred.html
This is a minimized testcase of the behavior.

The first script is synchronous and it uses MutationObserver to shim a WebAPI.

The second script is deferred and wants to operate on DOM and wants to assume that any elements that were injected into DOM were already modified by the shim's MutationObserver.

This behavior works well in Safari and Chrome and is non deterministic in Gecko.
I'll change our defer script handling to be more async. I hope it doesn't slow down stuff too much on b2g.
Assignee: nobody → bugs
Attached file testcase
The original testcase doesn't test defer handling, but inline script handling.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 789315
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.