WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
95566
WebKit accepts event listeners in onfoo attributes while no other browser does
https://bugs.webkit.org/show_bug.cgi?id=95566
Summary
WebKit accepts event listeners in onfoo attributes while no other browser does
Kyle Huey (Mozilla Developer)
Reported
2012-08-31 06:45:32 PDT
http://people.mozilla.org/~khuey/test-event-handlers.html
Gecko and Presto alert null once. Trident alerts Object once. WebKit alerts Object and ohai. Gecko and Presto treat assigning an object to an onfoo property as assigning null to it (which is correct per-spec, as far as I can tell). Trident does some crazy thing where it allows the onfoo property to be set but doesn't actually invoke the handleEvent function. WebKit allows the onfoo property to be set and the event listener is fired.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-08-31 10:03:06 PDT
> which is correct per-spec, as far as I can tell
Could you please quote the spec you're looking at? For example, DOM 2 Events explicitly says that "implementors may view the setting of attributes which represent event handlers as the creation and registration of an EventListener on the EventTarget". I agree that we should strongly consider matching other browsers, but spec story seems unclear here. Also, it's a non-trivial question which objects should be considered callable (cf. for example
bug 40012
), which is why I'm interested in the exact text.
Kyle Huey (Mozilla Developer)
Comment 2
2012-08-31 10:08:53 PDT
HTML defines the relevant properties on Window.[0] attribute EventHandler onabort; ... attribute EventHandler onload; Where EventHandler is defined as [1] [TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler; As far as a definition of what constitutes callable, I don't know. I would assume that's in ES somewhere, if it's defined. [0]
http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#window
[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler
Ms2ger (he/him; ⌚ UTC+1/+2)
Comment 3
2012-08-31 10:25:14 PDT
<ap> Ms2ger: care to quote any spec at all? <Ms2ger> Sure <ap> Ms2ger: and if that spec disagrees with previous spec, be sure to explain in detail why that was OK <Ms2ger>
http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler
<Ms2ger> And
http://dev.w3.org/2006/webapi/WebIDL/#TreatNonCallableAsNull
<Ms2ger> The spec disagrees with the previous spec because the previous spec wasn't implemented <Ms2ger> Except by webkit, apparently
Ahmad Saleem
Comment 4
2022-05-29 08:52:28 PDT
I searched the URL on Wayback Archive Machine and then created following fiddle: Link -
https://jsfiddle.net/ahp68r14/
Upon running, it just fire once [object Object] and it matches with Chrome Canary 104 and Firefox Nightly 102 output. Since it matches with other browsers, should this be closed? Thanks!
Anne van Kesteren
Comment 5
2022-05-30 00:28:16 PDT
The specification ended up aligning with WebKit:
https://github.com/whatwg/webidl/commit/4043b051d492d4a2f21064f0edf91e642c5a6249
and
https://lists.w3.org/Archives/Public/public-script-coord/2013OctDec/0412.html
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug