W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] on* attributes on DOM elements

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 17 Jun 2011 14:38:37 -0400
Message-ID: <4DFB9F2D.3070404@mit.edu>
On 6/17/11 2:17 PM, Ian Hickson wrote:
> Since the IDL attributes just reflect the content attributes

No, they don't.  Setting the event handler IDL attribute doesn't affect 
the content attribute in Presto, Gecko, or WebKit.  Testcase:

data:text/html,<body><script>document.documentElement.onclick = 
function() { alert("I'm here"); }; 
alert(document.documentElement.hasAttribute("onclick"));</script></body>

Now _setting_ the content attribute on an HTML element will affect the 
value stored in the event handler IDL attribute.  But that's not a 
reflection; it's just one-way change propagation.  The IDL attributes 
can exist just fine without the content attributes; you just can't set 
them using setAttribute in that situation is all.

> I don't know how that could be separated.

See above?

> The main reason I didn't put them on Element rather than HTMLElement is
> that I didn't expect other vocabularies would appreciate it.

Sure.  I understand the reasons the spec is what it is now.  I'm just 
not sure it's where we want to be.

-Boris
Received on Friday, 17 June 2011 11:38:37 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC