[whatwg] on* attributes on DOM elements

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