Re: [dom] removeEventListener doesn't handle currently dispatching events (#84)

That's starting to sound like the setup ES uses for `Map` and `Set`, which works as follows:

There is a list of things, each of which is either an entry or a removed-entry marker (e.g. in the case of `Map` the removed-entry marker is an entry record with `[[key]]` set to empty; in our case the removed-entry marker could be something like storing an `EventListener?` and treating null as the removed-entry marker).  Operations on the list skip over removed-entry markers, and the removed-entry markers are never explicitly observed (this is important).  As a spec device the list never shrinks.  Removal of an entry simply replaces it in the list with a removed-entry marker.  Implementations, of course, would never implement it this way, but are free to do anything that produces equivalent observable behavior (e.g. having some way to notify all live iterators when a removal happens and actually removing from the list).

It's not quite exactly what we want here, because we want the event dispatch iteration to not consider newly added stuff.  But we could do that by grabbing the index to stop at up front in the dispatch and then stopping there, I think.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/84#issuecomment-155820747

Received on Wednesday, 11 November 2015 15:41:49 UTC