W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2011

Re: Functions that Implement the EventListener Interface (DOM Level 3 Events)

From: Rob Brackett <rbrackett@apple.com>
Date: Thu, 23 Jun 2011 15:24:49 -0700
Cc: Olli@pettay.fi, www-dom@w3.org, Jacob Rossi <jrossi@microsoft.com>
Message-id: <1838D697-4FE6-45B4-9D50-01871059E66D@apple.com>
To: Cameron McCormack <cam@mcc.id.au>

On Jun 22, 2011, at 3:13 PM, Cameron McCormack wrote:

> Olli Pettay:
>> D3E could be clarified, but seems like this is anyway defined in WebIDL.
> I agree, it is defined in Web IDL.  I remember changing the order in
> which the handler is checked for (between the property and the function
> itself) some time ago, due to feedback.
> Here is a test:
> http://people.mozilla.org/~cmccormack/tests/eventlistener-property.html
> The first sub-test is doing
>  addEventListener(, { handleEvent: function() {  } }, );
> and the second sub-test is doing
>  function b() {  }
>  b.handleEvent = function() {  };
>  addEventListener(, b, );
> The results are that every browser invokes the handler in the first
> sub-test, and for the second sub-test, Firefox/Chrome/Opera/IE use the
> function object itself, while Safari uses the property.
> I agree that preferring the property makes some sense to me (especially
> if you consider JS implementing an interface with more than one
> operation on it), but the change was made to match the implementations.

What implementations already behaved this way that the spec changed to match (besides IE)? Were the pre-existing implementations that did this doing it for all [Callback]-type interfaces, or only for EventListener? As I understand it, the browser on Android before 2.2 uses JavaScriptCore instead of V8 and would have this problem as well. I'm not sure how many of the wide variety of other mobile browsers also might be using WebKit+JavaScriptCore (and so would follow the same behavior as Safari), but I do know that WebKit is becoming fairly ubiquitous as the browser of choice for many mobile implementations.

Received on Thursday, 23 June 2011 22:25:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:17 UTC