<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>95566</bug_id>
          
          <creation_ts>2012-08-31 06:45:32 -0700</creation_ts>
          <short_desc>WebKit accepts event listeners in onfoo attributes while no other browser does</short_desc>
          <delta_ts>2022-05-30 00:28:16 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>UI Events</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Kyle Huey (Mozilla Developer)">me</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>barraclough</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>oliver</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>709580</commentid>
    <comment_count>0</comment_count>
    <who name="Kyle Huey (Mozilla Developer)">me</who>
    <bug_when>2012-08-31 06:45:32 -0700</bug_when>
    <thetext>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&apos;t actually invoke the handleEvent function.
WebKit allows the onfoo property to be set and the event listener is fired.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>709738</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-08-31 10:03:06 -0700</bug_when>
    <thetext>&gt; which is correct per-spec, as far as I can tell

Could you please quote the spec you&apos;re looking at? For example, DOM 2 Events explicitly says that &quot;implementors may view the setting of attributes which represent event handlers as the creation and registration of an EventListener on the EventTarget&quot;.

I agree that we should strongly consider matching other browsers, but spec story seems unclear here.

Also, it&apos;s a non-trivial question which objects should be considered callable (cf. for example bug 40012), which is why I&apos;m interested in the exact text.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>709749</commentid>
    <comment_count>2</comment_count>
    <who name="Kyle Huey (Mozilla Developer)">me</who>
    <bug_when>2012-08-31 10:08:53 -0700</bug_when>
    <thetext>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&apos;t know.  I would assume that&apos;s in ES somewhere, if it&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>709757</commentid>
    <comment_count>3</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2012-08-31 10:25:14 -0700</bug_when>
    <thetext>&lt;ap&gt; Ms2ger: care to quote any spec at all?
&lt;Ms2ger&gt; Sure
&lt;ap&gt; Ms2ger: and if that spec disagrees with previous spec, be sure to explain in detail why that was OK
&lt;Ms2ger&gt; http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler
&lt;Ms2ger&gt; And http://dev.w3.org/2006/webapi/WebIDL/#TreatNonCallableAsNull
&lt;Ms2ger&gt; The spec disagrees with the previous spec because the previous spec wasn&apos;t implemented
&lt;Ms2ger&gt; Except by webkit, apparently</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1872625</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-05-29 08:52:28 -0700</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1872692</commentid>
    <comment_count>5</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2022-05-30 00:28:16 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>