W3C home > Mailing lists > Public > public-html@w3.org > April 2008

Re: postMessage feedback

From: Jeff Walden <jwalden+whatwg@MIT.EDU>
Date: Sat, 26 Apr 2008 18:07:59 -0400
Message-ID: <4813A7BF.4060600@mit.edu>
To: Maciej Stachowiak <mjs@apple.com>
CC: Ian Hickson <ian@hixie.ch>, HTML WG <public-html@w3.org>, "whatwg@whatwg.org" <whatwg@whatwg.org>

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.
Received on Sunday, 27 April 2008 00:46:36 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:54 UTC