This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24810 - "invoke MutationObserver object" should be updated for microtasks
Summary: "invoke MutationObserver object" should be updated for microtasks
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
: 24725 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-25 18:57 UTC by Ian 'Hixie' Hickson
Modified: 2014-04-23 15:38 UTC (History)
5 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2014-02-25 18:57:03 UTC
http://dom.spec.whatwg.org/#mutation-observers

See bug 22296. Mutation observers should now queue a "compound microtask", and each time they call a callback, they should "execute a compound microtask subtask" to run the steps that invoke the callback. (This microtask might end up interrupted and queued on the main event loop, letting the compound microtask immediately continue.)
Comment 1 Anne 2014-03-18 09:17:33 UTC
*** Bug 24725 has been marked as a duplicate of this bug. ***
Comment 2 Anne 2014-03-18 09:37:42 UTC
I'm not sure I'm fully following the new world order.

http://dom.spec.whatwg.org/#concept-mo-invoke is all I have right now. It seems the substeps of step 2 can be wrapped in a "execute a compound microtask subtask" to do those steps. 

I guess each time a mutation record is added to a record queue I could check a global flag to see if a compound microtask is already queued and if not, add a compound microtask to the queue that'll invoke "concept-mo-invoke" and add a step 4 to "concept-mo-invoke" to clear this new flag, but I'm not a 100% sure that will do the right thing.
Comment 3 Rafael Weinstein 2014-03-18 18:35:12 UTC
That's close to what blink actually does, except that clearing the flag is step 0, rather than step 4, and step 3 just goes away.
Comment 4 Anne 2014-03-18 19:18:20 UTC
I see. 3 goes away because at that point you'd have a new compound microtask scheduled. Okay, I think I got it now. I will fix this tomorrow hopefully.
Comment 6 Ian 'Hixie' Hickson 2014-03-20 21:02:35 UTC
<annevk> scripting environment is no longer a thing DOM has now or needs HTML to define so you can remove that
<annevk> and under microtask checkpoint there's a bit of cleanup you can do
Comment 7 Ian 'Hixie' Hickson 2014-04-23 15:38:31 UTC
r8577 http://html5.org/r/8577