Skip to content
Permalink
Browse files

[] (0) Be better about how we define the creation of scripts for even…

…t handler attributes (specifically, how we interact with the JS spec).

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977

git-svn-id: http://svn.whatwg.org/webapps@5933 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Mar 4, 2011
1 parent 0f140e5 commit c804cda1c5be57604d617fec317639959f1acf3b
Showing with 143 additions and 32 deletions.
  1. +46 −11 complete.html
  2. +46 −11 index
  3. +51 −10 source
following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content
attribute to its new value:</p>

<ol><li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for
<ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event
handler</a> to null.</li>

<li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for
JavaScript.</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>Using this script execution environment, create a function
object (as defined in ECMAScript edition 5 section 13.2 Creating
Function Objects), with:</p>
<p>If <var title="">body</var> is not parsable as
<i>FunctionBody</i> then abort these steps.</p>

<p class=note><i>FunctionBody</i> is defined in ECMAScript
edition 5 section 13 Function Definition. <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>

<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 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>

<p>Using the script execution environment created 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>


<dt>Function body <var title="">FunctionBody</var></dt>

<dd>The <a href=#event-handler-content-attributes title="event handler content attributes">event
handler content attribute</a>'s new value.</dd>
<dd>The result of parsing <var title="">body</var> above.</dd>

<dt>Lexical Environment <var title="">Scope</var></dt>


<dt>Boolean flag <var title="">Strict</var></dt>

<dd>False.</dd>
<dd>The value of <var title="">strict</var>.</dd>

</dl><p>Let this new function be the only entry in the script's
<a href=#list-of-code-entry-points>list of code entry-points</a>.</p>

</li>

<li><p>If the previous steps failed to compile the script, then set
the corresponding <a href=#event-handlers title="event handlers">event handler</a>
to null and abort these steps.</li>

<li><p>Set up the <a href="#script's-global-object">script's global object</a>, the
<a href="#script's-browsing-context">script's browsing context</a>, the <a href="#script's-document">script's
document</a>, the <a href="#script's-url-character-encoding">script's URL character encoding</a>,
57 index
following steps to create a <a href=#concept-script title=concept-script>script</a> after setting the content
attribute to its new value:</p>

<ol><li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for
<ol><li><p>Set the corresponding <a href=#event-handlers title="event handlers">event
handler</a> to null.</li>

<li><p>Set up a <a href=#script-execution-environment>script execution environment</a> for
JavaScript.</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>Using this script execution environment, create a function
object (as defined in ECMAScript edition 5 section 13.2 Creating
Function Objects), with:</p>
<p>If <var title="">body</var> is not parsable as
<i>FunctionBody</i> then abort these steps.</p>

<p class=note><i>FunctionBody</i> is defined in ECMAScript
edition 5 section 13 Function Definition. <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>

<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 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>

<p>Using the script execution environment created 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>


<dt>Function body <var title="">FunctionBody</var></dt>

<dd>The <a href=#event-handler-content-attributes title="event handler content attributes">event
handler content attribute</a>'s new value.</dd>
<dd>The result of parsing <var title="">body</var> above.</dd>

<dt>Lexical Environment <var title="">Scope</var></dt>


<dt>Boolean flag <var title="">Strict</var></dt>

<dd>False.</dd>
<dd>The value of <var title="">strict</var>.</dd>

</dl><p>Let this new function be the only entry in the script's
<a href=#list-of-code-entry-points>list of code entry-points</a>.</p>

</li>

<li><p>If the previous steps failed to compile the script, then set
the corresponding <a href=#event-handlers title="event handlers">event handler</a>
to null and abort these steps.</li>

<li><p>Set up the <a href="#script's-global-object">script's global object</a>, the
<a href="#script's-browsing-context">script's browsing context</a>, the <a href="#script's-document">script's
document</a>, the <a href="#script's-url-character-encoding">script's URL character encoding</a>,
61 source

<ol>

<li><p>Set the corresponding <span title="event handlers">event
handler</span> to null.</p></li>

<li><p>Set up a <span>script execution environment</span> for
JavaScript.</p></li>

<li><p>Let <var title="">body</var> be the <span title="event
handler content attributes">event handler content
attribute</span>'s new value.</p></li>

<li>

<p>Using this script execution environment, create a function
object (as defined in ECMAScript edition 5 section 13.2 Creating
Function Objects), with:</p>
<p>If <var title="">body</var> is not parsable as
<i>FunctionBody</i> then abort these steps.</p>

<p class="note"><i>FunctionBody</i> is defined in ECMAScript
edition 5 section 13 Function Definition. <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>

<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 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>

<p>Using the script execution environment created above, create a
function object (as defined in ECMAScript edition 5 section 13.2
Creating Function Objects), with:</p>

<dl>


<dt>Function body <var title="">FunctionBody</var></dt>

<dd>The <span title="event handler content attributes">event
handler content attribute</span>'s new value.</dd>
<dd>The result of parsing <var title="">body</var> above.</dd>

<dt>Lexical Environment <var title="">Scope</var></dt>


<dt>Boolean flag <var title="">Strict</var></dt>

<dd>False.</dd>
<dd>The value of <var title="">strict</var>.</dd>

</dl>


</li>

<li><p>If the previous steps failed to compile the script, then set
the corresponding <span title="event handlers">event handler</span>
to null and abort these steps.</p></li>

<li><p>Set up the <span>script's global object</span>, the
<span>script's browsing context</span>, the <span>script's
document</span>, the <span>script's URL character encoding</span>,

0 comments on commit c804cda

Please sign in to comment.
You can’t perform that action at this time.