Skip to content

Commit

Permalink
Make module scripts modify less global script state
Browse files Browse the repository at this point in the history
They set document.currentScript to null, and no longer fire
beforescriptexecute and afterscriptexecute events.

Closes #997. See #1013 for a future alternative to
document.currentScript, and #943 for more discussion of the events.
  • Loading branch information
domenic committed Apr 14, 2016
1 parent e0863d9 commit 177d30d
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -9053,12 +9053,14 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
<dd>

<p>Returns the <code>script</code> element, or the <span>SVG <code>script</code></span> element,
that is currently executing. In the case of reentrant script execution, returns the one that
most recently started executing amongst those that have not yet finished executing.</p>
that is currently executing, as long as the element represents a <span>classic script</span>.
In the case of reentrant script execution, returns the one that most recently started executing
amongst those that have not yet finished executing.</p>

<p>Returns null if the <code>Document</code> is not currently executing a <code>script</code>
or <span>SVG <code>script</code></span> element (e.g., because the running script is an event
handler, or a timeout).</p>
handler, or a timeout), or if the currently executing <code>script</code> or <span>SVG
<code>script</code></span> element represents a <span>module script</span>.</p>

</dd>

Expand All @@ -9067,9 +9069,9 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
<div w-nodev>

<p>The <dfn><code data-x="dom-document-currentScript">currentScript</code></dfn> attribute, on
getting, must return the value to which it was most recently initialised. When the
<code>Document</code> is created, the <code
data-x="dom-document-currentScript">currentScript</code> must be initialised to null.</p>
getting, must return the value to which it was most recently set. When the <code>Document</code>
is created, the <code data-x="dom-document-currentScript">currentScript</code> must be
initialised to null.</p>

</div>

Expand Down Expand Up @@ -59012,7 +59014,8 @@ o............A....e

<li>

<p><span>Fire a simple event</span> named <code
<p>If <span data-x="concept-script-type">the script's type</span> is "<code
data-x="">classic</code>", <span>fire a simple event</span> named <code
data-x="event-beforescriptexecute">beforescriptexecute</code> that bubbles and is cancelable
at the <code>script</code> element.</p>

Expand All @@ -59035,22 +59038,7 @@ o............A....e
<p>Let <var>old script element</var> be the value to which the <code>script</code>
element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> object was most recently
initialised.</p>

</li>

<li>

<p>Initialise the <code>script</code> element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> object to the <code>script</code>
element.</p>

</li>

<li>

<p>Let <var>settings object</var> be the <span>environment settings object</span> of the
<code>script</code> element's <span>node document</span>'s <code>Window</code> object.</p>
set.</p>

</li>

Expand All @@ -59061,23 +59049,34 @@ o............A....e
<dl class="switch">
<dt>"<code data-x="">classic</code>"</dt>
<dd>
<p><span data-x="run a classic script">Run the classic script</span> given by <span
data-x="concept-script-script">the script's script</span>.</p>
<ol>
<li><p>Set the <code>script</code> element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> attribute to the
<code>script</code> element.</p></li>

<li><p><span data-x="run a classic script">Run the classic script</span> given by <span
data-x="concept-script-script">the script's script</span>.</p></li>
</ol>
</dd>

<dt>"<code data-x="">module</code>"</dt>
<dd>
<p><span data-x="run a module script">Run the module script</span> given by <span
data-x="concept-script-script">the script's script</span>.</p>
<ol>
<li><p>Set the <code>script</code> element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> attribute to null.</p></li>

<li><p><span data-x="run a module script">Run the module script</span> given by <span
data-x="concept-script-script">the script's script</span>.</p></li>
</ol>
</dd>
</dl>

</li>

<li>

<p>Initialise the <code>script</code> element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> object to <var>old script
<p>Set the <code>script</code> element's <span>node document</span>'s <code
data-x="dom-document-currentScript">currentScript</code> attribute to <var>old script
element</var>.</p>

</li>
Expand All @@ -59090,7 +59089,8 @@ o............A....e

<li>

<p><span>Fire a simple event</span> named <code
<p>If <span data-x="concept-script-type">the script's type</span> is "<code
data-x="">classic</code>", <span>fire a simple event</span> named <code
data-x="event-afterscriptexecute">afterscriptexecute</code> that bubbles (but is not
cancelable) at the <code>script</code> element.</p>

Expand Down

0 comments on commit 177d30d

Please sign in to comment.