W3C home > Mailing lists > Public > public-webapi@w3.org > March 2006

Re: ACTION-70: Define the scope chain of onFoo events reference issue-1

From: Jim Ley <jim@jibbering.com>
Date: Tue, 14 Mar 2006 20:16:18 -0000
Message-ID: <006601c647a4$2761b040$2502a8c0@Snufkin>
To: "\"Web APIs WG \(public\)\"" <public-webapi@w3.org>

"Maciej Stachowiak" <mjs@apple.com>
>> Inconsistency is very annoying for the author.
> 1) Safari, Firefox, Opera and IE all have live event listener  attributes.

IE does not, it only has live properties ie onclick=function() {} works but 
setAttribute("onclick","alert(1)");  does not result in an alert if you 
click it.  (you can pass a function as the 2nd parameter to setAttribute, 
but that would be non-conformant, and doesn't work in any other UA)

There are further differences, in Opera 8.5/9 and Mozilla:

document.body.onclick=function() { chicken() }

the getAttribute doesn't reflect the change to the onclick property - but 
does result in the function being called not the attribute, so the UA's are 
not simply re-executing the attribute at each point in time, so it's not 
clear why changing the attribute should have an effect.

In firefox 1.5:
       document.body.onclick=function() { alert(2) }
results in both 2 and 3 being alerted.

So I don't really agree that there is great consistency in setAttribute and 
event properties, none of the 3 I've tested here interopate at all - given 
that I would prefer to say only the one that is universal - the property, is 
the one that should be used and setAttribute should not, as that provides 
maximum compatibilty.



crappy test case at http://jibbering.com/2006/3/scriptTest.html you'll need 
to view source. 
Received on Tuesday, 14 March 2006 20:17:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:20 UTC