CSSOM View: MediaQueryList - fixed list of listeners

What is the behavior of addListener/removeListener when invoked during the callback of the list of media query list listeners?

For example, consider a MQL that has 3 listeners (A, B, C). The evaluation changes so a dispatch begins.

1.       If B calls addListener(D), then does D get called back for the current dispatch?

2.       If B calls removeListener(C), then does C get called back for the current dispatch?

Given the timing of when the spec currently indicates when to queue tasks, I believe the behavior is that addListener/removeListener have no effect on the current dispatch (they add/remove listeners to the list of listeners, but do not add/remove tasks from the queue to be invoked). This is similar to how addEventListener/removeEventListener behave on the currentTarget during DOM event dispatch.

I agree with this behavior. But it might be good to call this out specifically, perhaps as an example.

--Jacob Rossi [MSFT]

Received on Saturday, 2 April 2011 00:42:02 UTC