[whatwg] on* attributes on DOM elements

Ian Hickson ian at hixie.ch
Fri Jun 17 11:57:20 PDT 2011


On Fri, 17 Jun 2011, Boris Zbarsky wrote:
> 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.

You're right, my statement was an oversimplification to the point of 
error.


> > 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.

I'm all in favour of making this generic across all vocabularies. I'm 
happy to work with Anne and Ms2ger to move all the HTML and SVG event 
handler attributes (does MathML have any?) to Element. It would not be an 
uncontroversial change.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list