[webkit-dev] Setting event handlers on the global context

Adam Barth abarth at webkit.org
Sun Jul 19 10:31:14 PDT 2009

You should test the same thing with window.onload.  If I recall
correctly, you'll see similar inoperability.


On Sun, Jul 19, 2009 at 9:29 AM, Drew Wilson<atwilson at google.com> wrote:
> I was writing a new worker unit test and I noticed that all of our unit
> tests set event handlers in worker global context like so:
> onmessage = function(event) { ... do something ... };
> I note that Firefox also allows setting event handlers like this:
> function onmessage(event) { ... do something ... };
> In WebKit, the latter form creates a function at global scope named
> "onmessage" but does not set it as an event handler.
> I'm trying to figure out what the correct behavior should be - I've asked
> IanH, and his response was that he dimly recalls that both forms should be
> valid "(through a convoluted argument that I forget right now, but which
> should be examined carefully by whoever implements this, and which requires
> careful examination of at least the ECMAScript spec and maybe also the
> WebIDL and HTML5 specs)" - basically, he wasn't entirely certain and thought
> I should check here and with the Mozilla devs to get your opinions.
> Anyone familiar enough with the various specs to make a definitive argument
> one way or the other?
> -atw
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

More information about the webkit-dev mailing list