This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20549 - Need to define "corresponding event handler"
Summary: Need to define "corresponding event handler"
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-02 18:14 UTC by contributor
Modified: 2013-03-06 22:38 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2013-01-02 18:14:40 UTC
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
Comment 1 Boris Zbarsky 2013-01-02 18:15:42 UTC
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.
Comment 2 Ian 'Hixie' Hickson 2013-01-05 04:03:51 UTC
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?
Comment 3 Boris Zbarsky 2013-01-05 04:17:35 UTC
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.
Comment 4 Ian 'Hixie' Hickson 2013-01-05 04:40:21 UTC
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>
Comment 5 Boris Zbarsky 2013-01-05 05:18:23 UTC
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.
Comment 6 Ian 'Hixie' Hickson 2013-01-05 06:45:28 UTC
"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.
Comment 7 Boris Zbarsky 2013-01-05 06:50:27 UTC
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...
Comment 8 Ian 'Hixie' Hickson 2013-01-05 19:57:18 UTC
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.
Comment 9 contributor 2013-01-05 19:58:21 UTC
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
Comment 10 Boris Zbarsky 2013-01-06 00:51:07 UTC
> 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!
Comment 11 Boris Zbarsky 2013-01-06 01:32:29 UTC
The new setup is better, yeah.  Thank you!
Comment 12 Ian 'Hixie' Hickson 2013-03-06 22:38:28 UTC
Marking fixed based on comment 11; please reopen if I missed something.