This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint There's a note there that says "This will be removed once mutation observers have been updated to use the microtask queue." Make it so! The reason I want this is that if one is able to queue two MutationObserver microtasks before and after another microtask that doesn't run scripts, it would be possible to test with precision that the microtask in the middle runs exactly when it should and does what it should. (For this to work, each MutationObserver must queue a microtask separately, they can't be batched as they currently are.)
Mutation Observers won't behave the way you are wanting because they require a delivery order which isn't based on the time of the mutation (it's based on the time the mutation observers are created). However, ES Promises will work the way you want. Once https://codereview.chromium.org/167683003/ lands, ES microtask work will be scheduled correctly relative to DOM microtask work and you'll be able to verify this with tests.
(In reply to Rafael Weinstein from comment #1) > Mutation Observers won't behave the way you are wanting because they require > a delivery order which isn't based on the time of the mutation (it's based > on the time the mutation observers are created). That sounds like it would work as well, as long as invoking the callbacks isn't batched together in a single microtask. > However, ES Promises will work the way you want. > > Once https://codereview.chromium.org/167683003/ lands, ES microtask work > will be scheduled correctly relative to DOM microtask work and you'll be > able to verify this with tests. Cool, what kind of code would one write to have a callback run in a microtask? (Searched for "promises microtask" without finding anything concrete.)
Here's a unit test from v8: https://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/harmony/microtask-delivery.js
Ian provided more detail on what to do. *** This bug has been marked as a duplicate of bug 24810 ***