[whatwg] postMessage feedback

Jeff Walden jwalden+whatwg at MIT.EDU
Sat Apr 26 15:07:59 PDT 2008


Maciej Stachowiak wrote:
> If anything this event should dispatch to the window, not the document, 
> since that is what gets the postMessage call. But posting to the 
> document and bubbling to the window seems ok too.

The event currently doesn't bubble to accommodate <event-source>:

http://lists.whatwg.org/htdig.cgi/commit-watchers-whatwg.org/2008/000436.html

So right now, either you use a bubbling listener (capturing works too, although the web may end up dictating that that's a bug that won't be fixt) on the document or a capturing listener (ugh) on window or you don't get it.  I'm not entirely sure why the event doesn't bubble for postMessage; it seems like a postMessage event doesn't necessarily have to do the same thing as an <event-source> event, but maybe there's precedent here that I don't know.

As far as I can tell the event is dispatched at the document only because Opera's original implementation had postMessage on document.  I sort of prefer dispatching to the window as well, but that change would have to be made ASAP to make Firefox 3.  It's a one-line change (+30ish for addEventListener calls in tests, also easy to do), as is the bubbling change, but it's extraordinarily late for us to make these changes (async cuts it very, very fine as-is), and nobody would be happy if the spec converged on something that Firefox 3 didn't actually implement.

Jeff

-- 
Life would be so much easier if humans had a natural affinity for remembering 128-bit integers.



More information about the whatwg mailing list