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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14175</bug_id>
          
          <creation_ts>2011-09-16 06:52:15 +0000</creation_ts>
          <short_desc>onerror: Defer firing the onerror from compiling an event handler until it&apos;s used</short_desc>
          <delta_ts>2011-11-10 23:32:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#event-handler-content-attributes</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>14174</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ap</cc>
    
    <cc>bugs</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>w3c</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>56882</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-09-16 06:52:15 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html
Multipage: http://www.whatwg.org/C#event-handler-content-attributes
Complete: http://www.whatwg.org/c#event-handler-content-attributes

Comment:
should allow deferring these steps until the event handler would be invoked
(observable with window.onerror)

Posted from: 85.227.155.223 by simonp@opera.com
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.5.8; U; en) Presto/2.9.168 Version/11.51</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58473</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-19 23:19:26 +0000</bug_when>
    <thetext>Why?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58518</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-20 08:20:21 +0000</bug_when>
    <thetext>Because browsers do that for perf reasons. (Well, Opera does at least.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58555</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-20 20:05:06 +0000</bug_when>
    <thetext>Seems like that would allow for variance in behaviour leading to reduce interoperability. The perf win seems minimal; do you have any numbers to support whether it&apos;s worth it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58566</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-20 20:18:32 +0000</bug_when>
    <thetext>The only variance in behavior would be when window.onerror is invoked in case the attribute contains a compile error. No?

I don&apos;t have numbers. But I know Opera (we don&apos;t have a public build with onerror support yet), Firefox and Chrome all do this.

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1216

So possibly you could require that compiling the attribute is delayed until an event is fired.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58858</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-25 04:46:39 +0000</bug_when>
    <thetext>That would make more sense, yeah. Or at least, deferring firing the onerror.

Is this onerror sync with the handler that would have been called?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58892</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-25 07:32:10 +0000</bug_when>
    <thetext>Yes. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1230</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59028</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-26 23:54:59 +0000</bug_when>
    <thetext>Looks like no: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1236

Seems like Firefox sets it lazily and finds the error the first time it&apos;s fetched, whether for execution or because it&apos;s being serialised; it then fires onerror (but doesn&apos;t throw an exception) and sets it to null.

IE fires onerror as soon as the attribute is parsed by the HTML parser, and treats the attribute as being null afterwards.

Chrome tries to compile it every time it&apos;s accessed, and throws an exception each time (leading to onerror if it&apos;s not caught).

(Safari and Opera don&apos;t seem to support onerror.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59041</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-10-27 04:19:30 +0000</bug_when>
    <thetext>Safari (or really, WebCore JavaScriptCore bindings) parses such inline scripts when they are first needed. They can be re-parsed if the attribute moves to another node. Also, they are re-parsed each time if parsing failed - failure isn&apos;t currently cached.

So, sounds pretty much like Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59043</commentid>
    <comment_count>9</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-10-27 05:47:18 +0000</bug_when>
    <thetext>Olli knows better the details of how/when we parse event handlers.

I wouldn&apos;t be entirely opposed to giving some leeway here as to allow implementations to optimize parsing speed. Clearly multiple browser vendors has run into performance issues with parsing event handlers too eagerly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59050</commentid>
    <comment_count>10</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-27 08:12:59 +0000</bug_when>
    <thetext>In Opera with onerror support the output is:

log: before1
log: &gt;undefined
log: before2
log: onerror called
log: after1
log: &gt;undefined
log: after2
log: onerror called
log: onerror called</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59560</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-03 16:22:27 +0000</bug_when>
    <thetext>I think the Firefox behaviour is probably the one to spec. It means defining the getter for event handler IDL attributes in more detail. To make the model simpler to explain I&apos;ll have the spec compile it straight away, but delay the reporting of the error until the first time it&apos;s needed (reading the attribute or handling an event), and then at that point reset it to null.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59853</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-10 23:32:06 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see bug 14176
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>