This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html Multipage: http://www.whatwg.org/C#events Complete: http://www.whatwg.org/c#events Comment: Need to define "corresponding event handler" Posted from: 173.48.81.109 by bzbarsky@mit.edu User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20121217 Firefox/20.0
The spec uses the term "corresponding event handler" a lot, but doesn't actually define it anywhere. This is especially relevant for things like what setAttribute and removeAttribute should do. Specifically, document.body.removeAttribute("onload") should remove the load event handler on the _Window_, as far as I can tell, and this is entirely non-obvious as things stand.
In theory, this is defined here: http://whatwg.org/html/#handler-window-onload ...using the definitions here: http://whatwg.org/html/#event-handler-attributes Is that insufficient?
That wasn't exactly clear to me when I read this. It's worth just explicitly defining the term "corresponding event handler" in terms of these tables, I think.
As in this?: <p>An <span title="event handlers">event handler</span> has a name. Its <spantitle="event handler IDL attributes">event handler IDL attribute</span>, if any, has the same name. Similarly, its <span title="event handler content attributes">event handler content attribute</span>, if any, has the same name.</p>
What I'm after is something that defines the actual word combination "corresponding event handler" when one starts with an attribute. That means defining that it has the same name, yes, but also defining which object it lives on. Saying that the tables in question determine this last is fine, but it just needs to be said.
"Corresponding" here is just used in its English meaning... I don't understand why this needs a definition beyond that. What other interpretation could there be? The spec explicitly says that the event handlers have "corresponding content attributes and IDL attributes exposed on the body and frameset elements" already.
You're the one who keeps telling people to not read between the lines... The spec is assuming a bijective relationship between attributes and event handlers, but not making it clear anywhere. It defines a mapping from event handlers to attributes, but not the other direction. So for an event handler there is a corresponding attribute, but it's not actually stated that for the attribute there is a corresponding event handler. The English meaning of corresponding just implies a function, not anything about the function being invertible...
I really don't understand what interpretation of the spec is possible other than the one that is intended. I'm not saying you need to read between the lines, I'm saying the text is unambiguous as written as far as I can tell... I've tried to clarify it a bit (see patch below). If that's not enough, please try to explain what other interpretation is possible, and what text you would suggest that would make it unambiguous.
Checked in as WHATWG revision r7637. Check-in comment: Try to clarify event handler stuff http://html5.org/tools/web-apps-tracker?from=7636&to=7637
> I really don't understand what interpretation of the spec is possible The code I was looking at tried removing an event handler on the <body> itself when removeAttribute("onload") was called. Will take a look at the diff later. Thanks!
The new setup is better, yeah. Thank you!
Marking fixed based on comment 11; please reopen if I missed something.