[html5] r8303 - [giow] (3) Move the event handler content attribute compiling logic to later in [...]
whatwg at whatwg.org
whatwg at whatwg.org
Wed Nov 20 13:09:26 PST 2013
Author: ianh
Date: 2013-11-20 13:09:24 -0800 (Wed, 20 Nov 2013)
New Revision: 8303
Modified:
complete.html
index
source
Log:
[giow] (3) Move the event handler content attribute compiling logic to later in the pipeline, for better consistency with Firefox/Safari (and other browsers, though to a lesser extent).
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23836
Affected topics: DOM APIs
Modified: complete.html
===================================================================
--- complete.html 2013-11-19 23:20:29 UTC (rev 8302)
+++ complete.html 2013-11-20 21:09:24 UTC (rev 8303)
@@ -298,7 +298,7 @@
<header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 19 November 2013</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 20 November 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -70994,9 +70994,10 @@
<p>An <a href=#event-handlers title="event handlers">event handler</a> has a name, which always starts with
"<code title="">on</code>" and is followed by the name of the event for which it is intended.</p>
- <p>An <a href=#event-handlers title="event handlers">event handler</a> can either have the value null or be set
- to a callback object. This is defined using the <code><a href=#eventhandler>EventHandler</a></code> callback function type.
- <span class=impl>Initially, event handlers must be set to null.</span></p>
+ <p>An <a href=#event-handlers title="event handlers">event handler</a> can either have the value null, or be set
+ to a callback object<span class=impl>, or be set to an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled
+ handler</a></span>. The <code><a href=#eventhandler>EventHandler</a></code> callback function type describes how this is
+ exposed to scripts. <span class=impl>Initially, event handlers must be set to null.</span></p>
<p>Event handlers are exposed in one of two ways.</p>
@@ -71013,9 +71014,9 @@
attribute for a specific <a href=#event-handlers title="event handlers">event handler</a>. The name of the IDL
attribute is the same as the name of the <a href=#event-handlers title="event handlers">event handler</a>.</p>
- <p><a href=#event-handler-idl-attributes>Event handler IDL attributes</a>, on setting, must set the corresponding event handler
- to their new value, and on getting, must return whatever the current value of the corresponding
- event handler is (possibly null).</p>
+ <p><a href=#event-handler-idl-attributes>Event handler IDL attributes</a>, on setting, must set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to their new value, and on getting, must return the
+ result of <a href=#getting-the-current-value-of-the-event-handler>getting the current value of the event handler</a> in question (this can throw
+ an exception, in which case the getting propagates it to the caller, it does not catch it).</p>
<p>If an <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL attribute</a> exposes an
<a href=#event-handlers title="event handlers">event handler</a> of an object that doesn't exist, it must always
@@ -71029,11 +71030,6 @@
the <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
<code><a href=#messageport>MessagePort</a></code> objects.</p>
- <p>On getting, <a href=#event-handler-idl-attributes>event handler IDL attributes</a> must return the value of their
- corresponding <a href=#event-handlers>event handlers</a>, except when the value is an <a href=#concept-handler-error title=concept-handler-error>internal error value</a>, in which case the user agent must set
- the corresponding event handler to null, and then throw an exception corresponding to the error
- condition.</p>
-
<hr></div>
<p>An <dfn id=event-handler-content-attributes title="event handler content attributes">event handler content attribute</dfn> is a
@@ -71047,129 +71043,13 @@
<div class=impl>
- <!-- SCRIPT EXEC -->
<p>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a>
is set, if the element is owned by a <code><a href=#document>Document</a></code> that is in a <a href=#browsing-context>browsing
context</a>, and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> for that
- <a href=#browsing-context>browsing context</a>, the user agent must run the following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content attribute to its new value:</p>
+ <a href=#browsing-context>browsing context</a>, the user agent must set the corresponding <a href=#event-handlers title="event
+ handlers">event handler</a> to an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a> consisting of
+ the attribute's new value and the script location where the attribute was set to this value</p>
- <ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to null.</li>
-
- <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a> of the
- <code><a href=#window>Window</a></code> object associated with the <a href=#browsing-context>browsing context</a> to which belongs the
- <code><a href=#document>Document</a></code> of the element in question.</li>
-
- <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
-
- <li><p>Let <var title="">body</var> be the <a href=#event-handler-content-attributes title="event handler content attributes">event
- handler content attribute</a>'s new value.</li>
-
- <li>
-
- <p>If <var title="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects an
- <i>early error</i> then <a href=#set-the-event-handler-content-attribute-to-an-error>set the event handler content attribute to an error</a> as
- defined below, and abort these steps.</p>
-
- <p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
- Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
-
- </li>
-
- <li>
-
- <p>If <var title="">body</var> begins with a Directive Prologue that contains a Use Strict
- Directive then let <var title="">strict</var> be true, otherwise let <var title="">strict</var>
- be false.</p> <!-- we can't defer to 10.1.1 since we're not using a Function constructor but
- doing it ourselves. -->
-
- <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
- ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
-
- </li>
-
-<!--
-currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
- <li>
-
- <p>If <var title="">strict</var> is true, and anything in <var title="">body</var> is a
- <code>SyntaxError</code> according to the Strict Mode Restrictions, then <span>set the event
- handler content attribute to an error</span> as defined below, and abort these steps.</p>
-
- <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
- 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
-
- </li>
--->
-
- <li>
-
-<!--CLEANUP-->
- <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function object (as defined in
- ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
-
- <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
-
- <dd>
-
- <dl class=switch><dt>If the attribute is an <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attribute
- corresponding to an <span>event handler</span> of a <code><a href=#window>Window</a></code> object (that is, the
- <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attributes on <code><a href=#the-body-element>body</a></code> and
- <code><a href=#frameset>frameset</a></code> elements)</dt>
-
- <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">colno</code>,
- and <code title="">error</code>.</dd>
- <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
- <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
-
- <dt>Otherwise</dt>
-
- <dd>Let the function have a single argument called <code title="">event</code>.</dd>
-
- </dl></dd>
-
- <dt>Function body <var title="">FunctionBody</var></dt>
-
- <dd>The result of parsing <var title="">body</var> above.</dd>
-
- <dt>Lexical Environment <var title="">Scope</var></dt>
-
- <dd>
-
- <ol><li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's
- <code><a href=#document>Document</a></code>, the <var title="">global environment</var>).</li>
-
- <li>If the element has a <a href=#form-owner>form owner</a>, let <var title="">Scope</var> be the result
- of NewObjectEnvironment(the element's <a href=#form-owner>form owner</a>, <var title="">Scope</var>).</li>
-
- <li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's object,
- <var title="">Scope</var>).</li>
-
- </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
- NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
-
- </dd>
-
- <dt>Boolean flag <var title="">Strict</var></dt>
-
- <dd>The value of <var title="">strict</var>.</dd>
-
- </dl><!--CLEANUP--><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code entry-point</a>.</p>
-
- </li>
-
- <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
- <var title="">script settings</var>.</li>
-
- <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to the
- aforementioned function.</li>
-
- </ol><p>When a user agent is required, by the steps above, to <dfn id=set-the-event-handler-content-attribute-to-an-error>set the event handler content
- attribute to an error</dfn>, the user agent must set the corresponding <a href=#event-handlers title="event
- handlers">event handler</a> to an <dfn id=concept-handler-error title=concept-handler-error>internal error value</dfn>
- representing the error condition, keeping track of the <a href=#url>URL</a> of the resource where the
- <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a> was set, and
- the relevant line number inside that resource where the error occurred.</p>
-
<p>When an event handler content attribute is removed, the user agent must set the corresponding
<a href=#event-handlers title="event handlers">event handler</a> to null.</p>
<!--
@@ -71178,16 +71058,10 @@
see http://www.w3.org/Bugs/Public/show_bug.cgi?id=7626#c5 for reasoning
-->
- </div>
-
<p class=note>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
attribute</a> is set on an element owned by a <code><a href=#document>Document</a></code> that is not in a
<a href=#browsing-context>browsing context</a>, the corresponding event handler is not changed.</p>
- <!-- v2: we should probably support HTML4's Content-Script-Type header here. -->
-
- <div class=impl>
-
<hr><p>When an <a href=#event-handlers title="event handlers">event handler</a> <var title="">H</var> of an element
or object <var title="">T</var> implementing the <code><a href=#eventtarget>EventTarget</a></code> interface is first set
to a non-null value, the user agent must append an <a href=#concept-event-listener title=concept-event-listener>event
@@ -71238,19 +71112,15 @@
handler</a> <var title="">H</var> and an <code><a href=#event>Event</a></code> object <var title="">E</var> is as
follows:</p>
- <ol><li><p>If <var title="">H</var>'s value is null, then abort these steps.</li>
+ <ol><li>
- <li><p>If <var title="">H</var>'s value is an <a href=#concept-handler-error title=concept-handler-error>internal error
- value</a>, then: set the <a href=#event-handlers title="event handlers">event handler</a> to null and then
- <a href=#report-the-error>report the error</a> for the appropriate <a href=#concept-script title=concept-script>script</a> and
- with the appropriate position (line number and column number), as established when the error was
- detected, using the <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code> as the target. If
- the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error
- may be reported to the user. Finally, abort these steps.</li>
+ <p>Let <var title="">callback</var> be the result of <a href=#getting-the-current-value-of-the-event-handler>getting the current value of the
+ event handler</a> <var title="">H</var>.</p>
- <li><p>Let <var title="">callback</var> be <var title="">H</var>'s value, the callback that the
- <a href=#event-handlers title="event handlers">event handler</a> was last set to.</li>
+ </li>
+ <li><p>If <var title="">callback</var> is null, then abort these steps.</li>
+
<li>
<p>Process the <code><a href=#event>Event</a></code> object <var title="">E</var> as follows:</p>
@@ -71276,6 +71146,7 @@
<dd>
+<!--CLEANUP-->
<p><a href=#concept-invoke-event-handler title=concept-invoke-event-handler>Invoke</a> <var title="">callback</var> with one argument, the value of which is the
<code><a href=#event>Event</a></code> object <var title="">E</var>, with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let <var title="">return value</var> be the callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>
@@ -71366,7 +71237,159 @@
<!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
+ <div class=impl>
+ <hr><p>An <dfn id=internal-raw-uncompiled-handler>internal raw uncompiled handler</dfn> is a tuple with the following information:</p>
+
+ <ul class=brief><li>An uncompiled script body
+
+ <li>A location where the script body originated, in case an error needs to be reported
+
+ </ul><p>When the user agent is to <dfn id=getting-the-current-value-of-the-event-handler title="getting the current value of the event handler">get the
+ current value of the event handler</dfn> <var title="">H</var>, it must run these steps:</p>
+
+ <ol><li>
+
+ <p>If <var title="">H</var>'s value is an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a>, run these
+ substeps:</p>
+
+ <ol><li><p>Let <var title="">body</var> be the uncompiled script body in the <a href=#internal-raw-uncompiled-handler>internal raw
+ uncompiled handler</a>.</li>
+
+ <li><p>Let <var title="">location</var> be the location where the script body originated, as
+ given by the <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a>.</li>
+
+ <li>
+
+ <p>If <var title="">H</var> is an element's <a href=#event-handlers title="event handlers">event
+ handler</a>, then let <var title="">element</var> be the element, and <var title="">document</var> be the element's <code><a href=#document>Document</a></code>.</p>
+
+ <p>Otherwise, <var title="">H</var> is a <code><a href=#window>Window</a></code> object's <a href=#event-handlers title="event
+ handlers">event handler</a>: let <var title="">element</var> be null, and let <var title="">document</var> be the <code><a href=#document>Document</a></code> most recently associated with that
+ <code><a href=#window>Window</a></code> object.</p>
+
+ </li>
+
+ <li><p>If <var title="">element</var> is not null and <var title="">element</var> has a
+ <a href=#form-owner>form owner</a>, let <var title="">form owner</var> be that <a href=#form-owner>form owner</a>.
+ Otherwise, let <var title="">form owner</var> be null.</li>
+
+ <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a>
+ created for the <code><a href=#window>Window</a></code> object with which <var title="">document</var> is
+ currently associated.</li>
+
+ <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
+ <!-- v2: we could support HTML4's Content-Script-Type header here -->
+
+ <li>
+
+ <p>If <var title="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects
+ an <i>early error</i>, then follow these substeps:</p>
+
+ <ol><li><p>Set <var title="">H</var>'s value to null.</li>
+
+ <li><p><a href=#report-the-error>Report the error</a> for the appropriate <a href=#concept-script title=concept-script>script</a> and with the appropriate position (line number and
+ column number) given by <var title="">location</var>, using the <a href=#global-object>global object</a>
+ specified by <var title="">script settings</var> as the target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported
+ to the user.</li>
+
+ <li><p>Jump to the step labeled <i>end</i> below.</li>
+
+ </ol><p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
+ Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">body</var> begins with a Directive Prologue that contains a Use Strict
+ Directive then let <var title="">strict</var> be true, otherwise let <var title="">strict</var> be false.</p> <!-- we can't defer to 10.1.1 since we're not using a
+ Function constructor but doing it ourselves. -->
+
+ <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
+ ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </li>
+
+ <!-- currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
+ <li>
+
+ <p>If <var title="">strict</var> is true, and anything in <var title="">body</var> is a
+ <code>SyntaxError</code> according to the Strict Mode Restrictions, then [...handle the error
+ as described above...].</p>
+
+ <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
+ 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+ -->
+
+ <li>
+
+ <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function
+ object (as defined in ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
+
+ <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
+
+ <dd>
+
+ <dl class=switch><dt>If <var title="">H</var> is an <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handlers title="event handlers">event handler</a> of a <code><a href=#window>Window</a></code> object</dt>
+
+ <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">colno</code>, and
+ <code title="">error</code>.</dd>
+
+ <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
+ <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
+
+ <dt>Otherwise</dt>
+
+ <dd>Let the function have a single argument called <code title="">event</code>.</dd>
+
+ </dl></dd>
+
+ <dt>Function body <var title="">FunctionBody</var></dt>
+
+ <dd>The result of parsing <var title="">body</var> above.</dd>
+
+ <dt>Lexical Environment <var title="">Scope</var></dt>
+
+ <dd>
+
+ <ol><li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(<var title="">document</var>, the <var title="">global environment</var>).</li>
+
+ <li>If <var title="">form owner</var> is not null, let <var title="">Scope</var> be the
+ result of NewObjectEnvironment(<var title="">>form owner</var>, <var title="">Scope</var>).</li>
+
+ <li>If <var title="">element</var> is not null, let <var title="">Scope</var> be the
+ result of NewObjectEnvironment(<var title="">element</var>, <var title="">Scope</var>).</li>
+
+ </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
+ NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </dd>
+
+ <dt>Boolean flag <var title="">Strict</var></dt>
+
+ <dd>The value of <var title="">strict</var>.</dd>
+
+ </dl><!-- SCRIPT EXEC --><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
+ entry-point</a>.</p>
+
+ </li>
+
+ <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
+ <var title="">script settings</var>.</li>
+
+ <li><p>Set <var title="">H</var> to the aforementioned function.</li>
+
+ </ol></li>
+
+ <li><p><i>End</i>: Return <var title="">H</var>'s value.</li>
+
+ </ol></div>
+
+
+
<h5 id=event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.5.2 </span>Event handlers on elements, <code><a href=#document>Document</a></code> objects, and <code><a href=#window>Window</a></code> objects</h5>
<p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
Modified: index
===================================================================
--- index 2013-11-19 23:20:29 UTC (rev 8302)
+++ index 2013-11-20 21:09:24 UTC (rev 8303)
@@ -298,7 +298,7 @@
<header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 19 November 2013</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 20 November 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -70994,9 +70994,10 @@
<p>An <a href=#event-handlers title="event handlers">event handler</a> has a name, which always starts with
"<code title="">on</code>" and is followed by the name of the event for which it is intended.</p>
- <p>An <a href=#event-handlers title="event handlers">event handler</a> can either have the value null or be set
- to a callback object. This is defined using the <code><a href=#eventhandler>EventHandler</a></code> callback function type.
- <span class=impl>Initially, event handlers must be set to null.</span></p>
+ <p>An <a href=#event-handlers title="event handlers">event handler</a> can either have the value null, or be set
+ to a callback object<span class=impl>, or be set to an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled
+ handler</a></span>. The <code><a href=#eventhandler>EventHandler</a></code> callback function type describes how this is
+ exposed to scripts. <span class=impl>Initially, event handlers must be set to null.</span></p>
<p>Event handlers are exposed in one of two ways.</p>
@@ -71013,9 +71014,9 @@
attribute for a specific <a href=#event-handlers title="event handlers">event handler</a>. The name of the IDL
attribute is the same as the name of the <a href=#event-handlers title="event handlers">event handler</a>.</p>
- <p><a href=#event-handler-idl-attributes>Event handler IDL attributes</a>, on setting, must set the corresponding event handler
- to their new value, and on getting, must return whatever the current value of the corresponding
- event handler is (possibly null).</p>
+ <p><a href=#event-handler-idl-attributes>Event handler IDL attributes</a>, on setting, must set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to their new value, and on getting, must return the
+ result of <a href=#getting-the-current-value-of-the-event-handler>getting the current value of the event handler</a> in question (this can throw
+ an exception, in which case the getting propagates it to the caller, it does not catch it).</p>
<p>If an <a href=#event-handler-idl-attributes title="event handler IDL attributes">event handler IDL attribute</a> exposes an
<a href=#event-handlers title="event handlers">event handler</a> of an object that doesn't exist, it must always
@@ -71029,11 +71030,6 @@
the <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
<code><a href=#messageport>MessagePort</a></code> objects.</p>
- <p>On getting, <a href=#event-handler-idl-attributes>event handler IDL attributes</a> must return the value of their
- corresponding <a href=#event-handlers>event handlers</a>, except when the value is an <a href=#concept-handler-error title=concept-handler-error>internal error value</a>, in which case the user agent must set
- the corresponding event handler to null, and then throw an exception corresponding to the error
- condition.</p>
-
<hr></div>
<p>An <dfn id=event-handler-content-attributes title="event handler content attributes">event handler content attribute</dfn> is a
@@ -71047,129 +71043,13 @@
<div class=impl>
- <!-- SCRIPT EXEC -->
<p>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a>
is set, if the element is owned by a <code><a href=#document>Document</a></code> that is in a <a href=#browsing-context>browsing
context</a>, and <a href=#concept-bc-script title=concept-bc-script>scripting is enabled</a> for that
- <a href=#browsing-context>browsing context</a>, the user agent must run the following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content attribute to its new value:</p>
+ <a href=#browsing-context>browsing context</a>, the user agent must set the corresponding <a href=#event-handlers title="event
+ handlers">event handler</a> to an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a> consisting of
+ the attribute's new value and the script location where the attribute was set to this value</p>
- <ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to null.</li>
-
- <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a> of the
- <code><a href=#window>Window</a></code> object associated with the <a href=#browsing-context>browsing context</a> to which belongs the
- <code><a href=#document>Document</a></code> of the element in question.</li>
-
- <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
-
- <li><p>Let <var title="">body</var> be the <a href=#event-handler-content-attributes title="event handler content attributes">event
- handler content attribute</a>'s new value.</li>
-
- <li>
-
- <p>If <var title="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects an
- <i>early error</i> then <a href=#set-the-event-handler-content-attribute-to-an-error>set the event handler content attribute to an error</a> as
- defined below, and abort these steps.</p>
-
- <p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
- Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
-
- </li>
-
- <li>
-
- <p>If <var title="">body</var> begins with a Directive Prologue that contains a Use Strict
- Directive then let <var title="">strict</var> be true, otherwise let <var title="">strict</var>
- be false.</p> <!-- we can't defer to 10.1.1 since we're not using a Function constructor but
- doing it ourselves. -->
-
- <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
- ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
-
- </li>
-
-<!--
-currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
- <li>
-
- <p>If <var title="">strict</var> is true, and anything in <var title="">body</var> is a
- <code>SyntaxError</code> according to the Strict Mode Restrictions, then <span>set the event
- handler content attribute to an error</span> as defined below, and abort these steps.</p>
-
- <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
- 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
-
- </li>
--->
-
- <li>
-
-<!--CLEANUP-->
- <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function object (as defined in
- ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
-
- <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
-
- <dd>
-
- <dl class=switch><dt>If the attribute is an <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attribute
- corresponding to an <span>event handler</span> of a <code><a href=#window>Window</a></code> object (that is, the
- <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> content attributes on <code><a href=#the-body-element>body</a></code> and
- <code><a href=#frameset>frameset</a></code> elements)</dt>
-
- <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">colno</code>,
- and <code title="">error</code>.</dd>
- <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
- <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
-
- <dt>Otherwise</dt>
-
- <dd>Let the function have a single argument called <code title="">event</code>.</dd>
-
- </dl></dd>
-
- <dt>Function body <var title="">FunctionBody</var></dt>
-
- <dd>The result of parsing <var title="">body</var> above.</dd>
-
- <dt>Lexical Environment <var title="">Scope</var></dt>
-
- <dd>
-
- <ol><li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's
- <code><a href=#document>Document</a></code>, the <var title="">global environment</var>).</li>
-
- <li>If the element has a <a href=#form-owner>form owner</a>, let <var title="">Scope</var> be the result
- of NewObjectEnvironment(the element's <a href=#form-owner>form owner</a>, <var title="">Scope</var>).</li>
-
- <li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(the element's object,
- <var title="">Scope</var>).</li>
-
- </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
- NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
-
- </dd>
-
- <dt>Boolean flag <var title="">Strict</var></dt>
-
- <dd>The value of <var title="">strict</var>.</dd>
-
- </dl><!--CLEANUP--><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code entry-point</a>.</p>
-
- </li>
-
- <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
- <var title="">script settings</var>.</li>
-
- <li><p>Set the corresponding <a href=#event-handlers title="event handlers">event handler</a> to the
- aforementioned function.</li>
-
- </ol><p>When a user agent is required, by the steps above, to <dfn id=set-the-event-handler-content-attribute-to-an-error>set the event handler content
- attribute to an error</dfn>, the user agent must set the corresponding <a href=#event-handlers title="event
- handlers">event handler</a> to an <dfn id=concept-handler-error title=concept-handler-error>internal error value</dfn>
- representing the error condition, keeping track of the <a href=#url>URL</a> of the resource where the
- <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a> was set, and
- the relevant line number inside that resource where the error occurred.</p>
-
<p>When an event handler content attribute is removed, the user agent must set the corresponding
<a href=#event-handlers title="event handlers">event handler</a> to null.</p>
<!--
@@ -71178,16 +71058,10 @@
see http://www.w3.org/Bugs/Public/show_bug.cgi?id=7626#c5 for reasoning
-->
- </div>
-
<p class=note>When an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content
attribute</a> is set on an element owned by a <code><a href=#document>Document</a></code> that is not in a
<a href=#browsing-context>browsing context</a>, the corresponding event handler is not changed.</p>
- <!-- v2: we should probably support HTML4's Content-Script-Type header here. -->
-
- <div class=impl>
-
<hr><p>When an <a href=#event-handlers title="event handlers">event handler</a> <var title="">H</var> of an element
or object <var title="">T</var> implementing the <code><a href=#eventtarget>EventTarget</a></code> interface is first set
to a non-null value, the user agent must append an <a href=#concept-event-listener title=concept-event-listener>event
@@ -71238,19 +71112,15 @@
handler</a> <var title="">H</var> and an <code><a href=#event>Event</a></code> object <var title="">E</var> is as
follows:</p>
- <ol><li><p>If <var title="">H</var>'s value is null, then abort these steps.</li>
+ <ol><li>
- <li><p>If <var title="">H</var>'s value is an <a href=#concept-handler-error title=concept-handler-error>internal error
- value</a>, then: set the <a href=#event-handlers title="event handlers">event handler</a> to null and then
- <a href=#report-the-error>report the error</a> for the appropriate <a href=#concept-script title=concept-script>script</a> and
- with the appropriate position (line number and column number), as established when the error was
- detected, using the <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code> as the target. If
- the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error
- may be reported to the user. Finally, abort these steps.</li>
+ <p>Let <var title="">callback</var> be the result of <a href=#getting-the-current-value-of-the-event-handler>getting the current value of the
+ event handler</a> <var title="">H</var>.</p>
- <li><p>Let <var title="">callback</var> be <var title="">H</var>'s value, the callback that the
- <a href=#event-handlers title="event handlers">event handler</a> was last set to.</li>
+ </li>
+ <li><p>If <var title="">callback</var> is null, then abort these steps.</li>
+
<li>
<p>Process the <code><a href=#event>Event</a></code> object <var title="">E</var> as follows:</p>
@@ -71276,6 +71146,7 @@
<dd>
+<!--CLEANUP-->
<p><a href=#concept-invoke-event-handler title=concept-invoke-event-handler>Invoke</a> <var title="">callback</var> with one argument, the value of which is the
<code><a href=#event>Event</a></code> object <var title="">E</var>, with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let <var title="">return value</var> be the callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>
@@ -71366,7 +71237,159 @@
<!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
+ <div class=impl>
+ <hr><p>An <dfn id=internal-raw-uncompiled-handler>internal raw uncompiled handler</dfn> is a tuple with the following information:</p>
+
+ <ul class=brief><li>An uncompiled script body
+
+ <li>A location where the script body originated, in case an error needs to be reported
+
+ </ul><p>When the user agent is to <dfn id=getting-the-current-value-of-the-event-handler title="getting the current value of the event handler">get the
+ current value of the event handler</dfn> <var title="">H</var>, it must run these steps:</p>
+
+ <ol><li>
+
+ <p>If <var title="">H</var>'s value is an <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a>, run these
+ substeps:</p>
+
+ <ol><li><p>Let <var title="">body</var> be the uncompiled script body in the <a href=#internal-raw-uncompiled-handler>internal raw
+ uncompiled handler</a>.</li>
+
+ <li><p>Let <var title="">location</var> be the location where the script body originated, as
+ given by the <a href=#internal-raw-uncompiled-handler>internal raw uncompiled handler</a>.</li>
+
+ <li>
+
+ <p>If <var title="">H</var> is an element's <a href=#event-handlers title="event handlers">event
+ handler</a>, then let <var title="">element</var> be the element, and <var title="">document</var> be the element's <code><a href=#document>Document</a></code>.</p>
+
+ <p>Otherwise, <var title="">H</var> is a <code><a href=#window>Window</a></code> object's <a href=#event-handlers title="event
+ handlers">event handler</a>: let <var title="">element</var> be null, and let <var title="">document</var> be the <code><a href=#document>Document</a></code> most recently associated with that
+ <code><a href=#window>Window</a></code> object.</p>
+
+ </li>
+
+ <li><p>If <var title="">element</var> is not null and <var title="">element</var> has a
+ <a href=#form-owner>form owner</a>, let <var title="">form owner</var> be that <a href=#form-owner>form owner</a>.
+ Otherwise, let <var title="">form owner</var> be null.</li>
+
+ <li><p>Let <var title="">script settings</var> be the <a href=#script-settings-object>script settings object</a>
+ created for the <code><a href=#window>Window</a></code> object with which <var title="">document</var> is
+ currently associated.</li>
+
+ <li><p>Obtain the <a href=#script-execution-environment>script execution environment</a> for JavaScript from <var title="">script settings</var>.</li>
+ <!-- v2: we could support HTML4's Content-Script-Type header here -->
+
+ <li>
+
+ <p>If <var title="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects
+ an <i>early error</i>, then follow these substeps:</p>
+
+ <ol><li><p>Set <var title="">H</var>'s value to null.</li>
+
+ <li><p><a href=#report-the-error>Report the error</a> for the appropriate <a href=#concept-script title=concept-script>script</a> and with the appropriate position (line number and
+ column number) given by <var title="">location</var>, using the <a href=#global-object>global object</a>
+ specified by <var title="">script settings</var> as the target. If the error is still <i title=concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported
+ to the user.</li>
+
+ <li><p>Jump to the step labeled <i>end</i> below.</li>
+
+ </ol><p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
+ Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">body</var> begins with a Directive Prologue that contains a Use Strict
+ Directive then let <var title="">strict</var> be true, otherwise let <var title="">strict</var> be false.</p> <!-- we can't defer to 10.1.1 since we're not using a
+ Function constructor but doing it ourselves. -->
+
+ <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
+ ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </li>
+
+ <!-- currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
+ <li>
+
+ <p>If <var title="">strict</var> is true, and anything in <var title="">body</var> is a
+ <code>SyntaxError</code> according to the Strict Mode Restrictions, then [...handle the error
+ as described above...].</p>
+
+ <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
+ 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+ -->
+
+ <li>
+
+ <p>Using the <a href=#script-execution-environment>script execution environment</a> obtained above, create a function
+ object (as defined in ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
+
+ <dl><dt>Parameter list <var title="">FormalParameterList</var></dt>
+
+ <dd>
+
+ <dl class=switch><dt>If <var title="">H</var> is an <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> <a href=#event-handlers title="event handlers">event handler</a> of a <code><a href=#window>Window</a></code> object</dt>
+
+ <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">colno</code>, and
+ <code title="">error</code>.</dd>
+
+ <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
+ <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
+
+ <dt>Otherwise</dt>
+
+ <dd>Let the function have a single argument called <code title="">event</code>.</dd>
+
+ </dl></dd>
+
+ <dt>Function body <var title="">FunctionBody</var></dt>
+
+ <dd>The result of parsing <var title="">body</var> above.</dd>
+
+ <dt>Lexical Environment <var title="">Scope</var></dt>
+
+ <dd>
+
+ <ol><li>Let <var title="">Scope</var> be the result of NewObjectEnvironment(<var title="">document</var>, the <var title="">global environment</var>).</li>
+
+ <li>If <var title="">form owner</var> is not null, let <var title="">Scope</var> be the
+ result of NewObjectEnvironment(<var title="">>form owner</var>, <var title="">Scope</var>).</li>
+
+ <li>If <var title="">element</var> is not null, let <var title="">Scope</var> be the
+ result of NewObjectEnvironment(<var title="">element</var>, <var title="">Scope</var>).</li>
+
+ </ol><p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
+ NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
+
+ </dd>
+
+ <dt>Boolean flag <var title="">Strict</var></dt>
+
+ <dd>The value of <var title="">strict</var>.</dd>
+
+ </dl><!-- SCRIPT EXEC --><p>Let this new function be a new <a href=#concept-script title=concept-script>script</a>'s <a href=#code-entry-point>code
+ entry-point</a>.</p>
+
+ </li>
+
+ <li><p>Let that <a href=#concept-script title=concept-script>script</a>'s <a href=#settings-object>settings object</a> be
+ <var title="">script settings</var>.</li>
+
+ <li><p>Set <var title="">H</var> to the aforementioned function.</li>
+
+ </ol></li>
+
+ <li><p><i>End</i>: Return <var title="">H</var>'s value.</li>
+
+ </ol></div>
+
+
+
<h5 id=event-handlers-on-elements,-document-objects,-and-window-objects><span class=secno>7.1.5.2 </span>Event handlers on elements, <code><a href=#document>Document</a></code> objects, and <code><a href=#window>Window</a></code> objects</h5>
<p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
Modified: source
===================================================================
--- source 2013-11-19 23:20:29 UTC (rev 8302)
+++ source 2013-11-20 21:09:24 UTC (rev 8303)
@@ -79279,9 +79279,10 @@
<p>An <span data-x="event handlers">event handler</span> has a name, which always starts with
"<code data-x="">on</code>" and is followed by the name of the event for which it is intended.</p>
- <p>An <span data-x="event handlers">event handler</span> can either have the value null or be set
- to a callback object. This is defined using the <code>EventHandler</code> callback function type.
- <span class="impl">Initially, event handlers must be set to null.</span></p>
+ <p>An <span data-x="event handlers">event handler</span> can either have the value null, or be set
+ to a callback object<span class="impl">, or be set to an <span>internal raw uncompiled
+ handler</span></span>. The <code>EventHandler</code> callback function type describes how this is
+ exposed to scripts. <span class="impl">Initially, event handlers must be set to null.</span></p>
<p>Event handlers are exposed in one of two ways.</p>
@@ -79300,9 +79301,10 @@
attribute for a specific <span data-x="event handlers">event handler</span>. The name of the IDL
attribute is the same as the name of the <span data-x="event handlers">event handler</span>.</p>
- <p><span>Event handler IDL attributes</span>, on setting, must set the corresponding event handler
- to their new value, and on getting, must return whatever the current value of the corresponding
- event handler is (possibly null).</p>
+ <p><span>Event handler IDL attributes</span>, on setting, must set the corresponding <span
+ data-x="event handlers">event handler</span> to their new value, and on getting, must return the
+ result of <span>getting the current value of the event handler</span> in question (this can throw
+ an exception, in which case the getting propagates it to the caller, it does not catch it).</p>
<p>If an <span data-x="event handler IDL attributes">event handler IDL attribute</span> exposes an
<span data-x="event handlers">event handler</span> of an object that doesn't exist, it must always
@@ -79316,12 +79318,6 @@
the <code data-x="handler-MessagePort-onmessage">onmessage</code> attribute of
<code>MessagePort</code> objects.</p>
- <p>On getting, <span>event handler IDL attributes</span> must return the value of their
- corresponding <span>event handlers</span>, except when the value is an <span
- data-x="concept-handler-error">internal error value</span>, in which case the user agent must set
- the corresponding event handler to null, and then throw an exception corresponding to the error
- condition.</p>
-
<hr>
</div>
@@ -79337,152 +79333,13 @@
<div class="impl">
- <!-- SCRIPT EXEC -->
<p>When an <span data-x="event handler content attributes">event handler content attribute</span>
is set, if the element is owned by a <code>Document</code> that is in a <span>browsing
context</span>, and <span data-x="concept-bc-script">scripting is enabled</span> for that
- <span>browsing context</span>, the user agent must run the following steps to create a <span
- data-x="concept-script">script</span> after setting the content attribute to its new value:</p>
+ <span>browsing context</span>, the user agent must set the corresponding <span data-x="event
+ handlers">event handler</span> to an <span>internal raw uncompiled handler</span> consisting of
+ the attribute's new value and the script location where the attribute was set to this value</p>
- <ol>
-
- <li><p>Set the corresponding <span data-x="event handlers">event handler</span> to null.</p></li>
-
- <li><p>Let <var data-x="">script settings</var> be the <span>script settings object</span> of the
- <code>Window</code> object associated with the <span>browsing context</span> to which belongs the
- <code>Document</code> of the element in question.</p></li>
-
- <li><p>Obtain the <span>script execution environment</span> for JavaScript from <var
- data-x="">script settings</var>.</p></li>
-
- <li><p>Let <var data-x="">body</var> be the <span data-x="event handler content attributes">event
- handler content attribute</span>'s new value.</p></li>
-
- <li>
-
- <p>If <var data-x="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects an
- <i>early error</i> then <span>set the event handler content attribute to an error</span> as
- defined below, and abort these steps.</p>
-
- <p class="note"><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
- Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a
- href="#refsECMA262">[ECMA262]</a></p>
-
- </li>
-
- <li>
-
- <p>If <var data-x="">body</var> begins with a Directive Prologue that contains a Use Strict
- Directive then let <var data-x="">strict</var> be true, otherwise let <var data-x="">strict</var>
- be false.</p> <!-- we can't defer to 10.1.1 since we're not using a Function constructor but
- doing it ourselves. -->
-
- <p class="note">The terms "Directive Prologue" and "Use Strict Directive" are defined in
- ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a
- href="#refsECMA262">[ECMA262]</a></p>
-
- </li>
-
-<!--
-currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
- <li>
-
- <p>If <var data-x="">strict</var> is true, and anything in <var data-x="">body</var> is a
- <code>SyntaxError</code> according to the Strict Mode Restrictions, then <span>set the event
- handler content attribute to an error</span> as defined below, and abort these steps.</p>
-
- <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
- 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
-
- </li>
--->
-
- <li>
-
-<!--CLEANUP-->
- <p>Using the <span>script execution environment</span> obtained above, create a function object (as defined in
- ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
-
- <dl>
-
- <dt>Parameter list <var data-x="">FormalParameterList</var></dt>
-
- <dd>
-
- <dl class="switch">
-
- <dt>If the attribute is an <code data-x="handler-onerror">onerror</code> content attribute
- corresponding to an <span>event handler</span> of a <code>Window</code> object (that is, the
- <code data-x="handler-onerror">onerror</code> content attributes on <code>body</code> and
- <code>frameset</code> elements)</dt>
-
- <dd>Let the function have five arguments, named <code data-x="">event</code>, <code
- data-x="">source</code>, <code data-x="">lineno</code>, <code data-x="">colno</code>,
- and <code data-x="">error</code>.</dd>
- <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
- <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
-
- <dt>Otherwise</dt>
-
- <dd>Let the function have a single argument called <code data-x="">event</code>.</dd>
-
- </dl>
-
- </dd>
-
- <dt>Function body <var data-x="">FunctionBody</var></dt>
-
- <dd>The result of parsing <var data-x="">body</var> above.</dd>
-
- <dt>Lexical Environment <var data-x="">Scope</var></dt>
-
- <dd>
-
- <ol>
-
- <li>Let <var data-x="">Scope</var> be the result of NewObjectEnvironment(the element's
- <code>Document</code>, the <var data-x="">global environment</var>).</li>
-
- <li>If the element has a <span>form owner</span>, let <var data-x="">Scope</var> be the result
- of NewObjectEnvironment(the element's <span>form owner</span>, <var
- data-x="">Scope</var>).</li>
-
- <li>Let <var data-x="">Scope</var> be the result of NewObjectEnvironment(the element's object,
- <var data-x="">Scope</var>).</li>
-
- </ol>
-
- <p class="note">NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
- NewObjectEnvironment (O, E). <a href="#refsECMA262">[ECMA262]</a></p>
-
- </dd>
-
- <dt>Boolean flag <var data-x="">Strict</var></dt>
-
- <dd>The value of <var data-x="">strict</var>.</dd>
-
- </dl>
-
-<!--CLEANUP-->
- <p>Let this new function be a new <span data-x="concept-script">script</span>'s <span>code entry-point</span>.</p>
-
- </li>
-
- <li><p>Let that <span data-x="concept-script">script</span>'s <span>settings object</span> be
- <var data-x="">script settings</var>.</p></li>
-
- <li><p>Set the corresponding <span data-x="event handlers">event handler</span> to the
- aforementioned function.</p></li>
-
- </ol>
-
- <p>When a user agent is required, by the steps above, to <dfn>set the event handler content
- attribute to an error</dfn>, the user agent must set the corresponding <span data-x="event
- handlers">event handler</span> to an <dfn data-x="concept-handler-error">internal error value</dfn>
- representing the error condition, keeping track of the <span>URL</span> of the resource where the
- <span data-x="event handler content attributes">event handler content attribute</span> was set, and
- the relevant line number inside that resource where the error occurred.</p>
-
<p>When an event handler content attribute is removed, the user agent must set the corresponding
<span data-x="event handlers">event handler</span> to null.</p>
<!--
@@ -79491,16 +79348,10 @@
see http://www.w3.org/Bugs/Public/show_bug.cgi?id=7626#c5 for reasoning
-->
- </div>
-
<p class="note">When an <span data-x="event handler content attributes">event handler content
attribute</span> is set on an element owned by a <code>Document</code> that is not in a
<span>browsing context</span>, the corresponding event handler is not changed.</p>
- <!-- v2: we should probably support HTML4's Content-Script-Type header here. -->
-
- <div class="impl">
-
<hr>
<p>When an <span data-x="event handlers">event handler</span> <var data-x="">H</var> of an element
@@ -79557,19 +79408,15 @@
<ol>
- <li><p>If <var data-x="">H</var>'s value is null, then abort these steps.</p></li>
+ <li>
- <li><p>If <var data-x="">H</var>'s value is an <span data-x="concept-handler-error">internal error
- value</span>, then: set the <span data-x="event handlers">event handler</span> to null and then
- <span>report the error</span> for the appropriate <span data-x="concept-script">script</span> and
- with the appropriate position (line number and column number), as established when the error was
- detected, using the <code>Window</code> object of that <code>Document</code> as the target. If
- the error is still <i data-x="concept-error-nothandled">not handled</i> after this, then the error
- may be reported to the user. Finally, abort these steps.</p></li>
+ <p>Let <var data-x="">callback</var> be the result of <span>getting the current value of the
+ event handler</span> <var data-x="">H</var>.</p>
- <li><p>Let <var data-x="">callback</var> be <var data-x="">H</var>'s value, the callback that the
- <span data-x="event handlers">event handler</span> was last set to.</p></li>
+ </li>
+ <li><p>If <var data-x="">callback</var> is null, then abort these steps.</p></li>
+
<li>
<p>Process the <code>Event</code> object <var data-x="">E</var> as follows:</p>
@@ -79598,6 +79445,7 @@
<dd>
+<!--CLEANUP-->
<p><span data-x="concept-invoke-event-handler">Invoke</span> <var data-x="">callback</var> with one argument, the value of which is the
<code>Event</code> object <var data-x="">E</var>, with the <i
data-x="dfn-callback-this-value">callback this value</i> set to <var data-x="">E</var>'s <code
@@ -79705,7 +79553,203 @@
<!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
+ <div class="impl">
+ <hr>
+
+ <p>An <dfn>internal raw uncompiled handler</dfn> is a tuple with the following information:</p>
+
+ <ul class="brief">
+
+ <li>An uncompiled script body
+
+ <li>A location where the script body originated, in case an error needs to be reported
+
+ </ul>
+
+ <p>When the user agent is to <dfn data-x="getting the current value of the event handler">get the
+ current value of the event handler</dfn> <var data-x="">H</var>, it must run these steps:</p>
+
+ <ol>
+
+ <li>
+
+ <p>If <var data-x="">H</var>'s value is an <span>internal raw uncompiled handler</span>, run these
+ substeps:</p>
+
+ <ol>
+
+ <li><p>Let <var data-x="">body</var> be the uncompiled script body in the <span>internal raw
+ uncompiled handler</span>.</p></li>
+
+ <li><p>Let <var data-x="">location</var> be the location where the script body originated, as
+ given by the <span>internal raw uncompiled handler</span>.</p></li>
+
+ <li>
+
+ <p>If <var data-x="">H</var> is an element's <span data-x="event handlers">event
+ handler</span>, then let <var data-x="">element</var> be the element, and <var
+ data-x="">document</var> be the element's <code>Document</code>.</p>
+
+ <p>Otherwise, <var data-x="">H</var> is a <code>Window</code> object's <span data-x="event
+ handlers">event handler</span>: let <var data-x="">element</var> be null, and let <var
+ data-x="">document</var> be the <code>Document</code> most recently associated with that
+ <code>Window</code> object.</p>
+
+ </li>
+
+ <li><p>If <var data-x="">element</var> is not null and <var data-x="">element</var> has a
+ <span>form owner</span>, let <var data-x="">form owner</var> be that <span>form owner</span>.
+ Otherwise, let <var data-x="">form owner</var> be null.</p></li>
+
+ <li><p>Let <var data-x="">script settings</var> be the <span>script settings object</span>
+ created for the <code>Window</code> object with which <var data-x="">document</var> is
+ currently associated.</p></li>
+
+ <li><p>Obtain the <span>script execution environment</span> for JavaScript from <var
+ data-x="">script settings</var>.</p></li>
+ <!-- v2: we could support HTML4's Content-Script-Type header here -->
+
+ <li>
+
+ <p>If <var data-x="">body</var> is not parsable as <i>FunctionBody</i> or if parsing detects
+ an <i>early error</i>, then follow these substeps:</p>
+
+ <ol>
+
+ <li><p>Set <var data-x="">H</var>'s value to null.</p></li>
+
+ <li><p><span>Report the error</span> for the appropriate <span
+ data-x="concept-script">script</span> and with the appropriate position (line number and
+ column number) given by <var data-x="">location</var>, using the <span>global object</span>
+ specified by <var data-x="">script settings</var> as the target. If the error is still <i
+ data-x="concept-error-nothandled">not handled</i> after this, then the error may be reported
+ to the user.</p></li>
+
+ <li><p>Jump to the step labeled <i>end</i> below.</p></li>
+
+ </ol>
+
+ <p class="note"><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
+ Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a
+ href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>If <var data-x="">body</var> begins with a Directive Prologue that contains a Use Strict
+ Directive then let <var data-x="">strict</var> be true, otherwise let <var
+ data-x="">strict</var> be false.</p> <!-- we can't defer to 10.1.1 since we're not using a
+ Function constructor but doing it ourselves. -->
+
+ <p class="note">The terms "Directive Prologue" and "Use Strict Directive" are defined in
+ ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a
+ href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+
+ <!-- currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
+ <li>
+
+ <p>If <var data-x="">strict</var> is true, and anything in <var data-x="">body</var> is a
+ <code>SyntaxError</code> according to the Strict Mode Restrictions, then [...handle the error
+ as described above...].</p>
+
+ <p class="note">The Strict Mode Restrictions are those listed in ECMAScript edition 5 section
+ 13.1 Strict Mode Restrictions. <a href="#refsECMA262">[ECMA262]</a></p>
+
+ </li>
+ -->
+
+ <li>
+
+ <p>Using the <span>script execution environment</span> obtained above, create a function
+ object (as defined in ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
+
+ <dl>
+
+ <dt>Parameter list <var data-x="">FormalParameterList</var></dt>
+
+ <dd>
+
+ <dl class="switch">
+
+ <dt>If <var data-x="">H</var> is an <code data-x="handler-onerror">onerror</code> <span
+ data-x="event handlers">event handler</span> of a <code>Window</code> object</dt>
+
+ <dd>Let the function have five arguments, named <code data-x="">event</code>, <code
+ data-x="">source</code>, <code data-x="">lineno</code>, <code data-x="">colno</code>, and
+ <code data-x="">error</code>.</dd>
+
+ <!-- /colno/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 and 22800 -->
+ <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
+
+ <dt>Otherwise</dt>
+
+ <dd>Let the function have a single argument called <code data-x="">event</code>.</dd>
+
+ </dl>
+
+ </dd>
+
+ <dt>Function body <var data-x="">FunctionBody</var></dt>
+
+ <dd>The result of parsing <var data-x="">body</var> above.</dd>
+
+ <dt>Lexical Environment <var data-x="">Scope</var></dt>
+
+ <dd>
+
+ <ol>
+
+ <li>Let <var data-x="">Scope</var> be the result of NewObjectEnvironment(<var
+ data-x="">document</var>, the <var data-x="">global environment</var>).</li>
+
+ <li>If <var data-x="">form owner</var> is not null, let <var data-x="">Scope</var> be the
+ result of NewObjectEnvironment(<var data-x="">>form owner</var>, <var
+ data-x="">Scope</var>).</li>
+
+ <li>If <var data-x="">element</var> is not null, let <var data-x="">Scope</var> be the
+ result of NewObjectEnvironment(<var data-x="">element</var>, <var
+ data-x="">Scope</var>).</li>
+
+ </ol>
+
+ <p class="note">NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
+ NewObjectEnvironment (O, E). <a href="#refsECMA262">[ECMA262]</a></p>
+
+ </dd>
+
+ <dt>Boolean flag <var data-x="">Strict</var></dt>
+
+ <dd>The value of <var data-x="">strict</var>.</dd>
+
+ </dl>
+
+ <!-- SCRIPT EXEC -->
+ <p>Let this new function be a new <span data-x="concept-script">script</span>'s <span>code
+ entry-point</span>.</p>
+
+ </li>
+
+ <li><p>Let that <span data-x="concept-script">script</span>'s <span>settings object</span> be
+ <var data-x="">script settings</var>.</p></li>
+
+ <li><p>Set <var data-x="">H</var> to the aforementioned function.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p><i>End</i>: Return <var data-x="">H</var>'s value.</p></li>
+
+ </ol>
+
+ </div>
+
+
+
<h5>Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</h5>
<p>The following are the <span>event handlers</span> (and their corresponding <span data-x="event
More information about the Commit-Watchers
mailing list