Skip to content

Commit

Permalink
Execute <script> in shadow trees
Browse files Browse the repository at this point in the history
This makes <script> elements work when used in shadow trees.

Note that document.currentScript is set to null while running a <script>
in a shadow tree; see #1013 for details.

This takes care of most of #762, but it remains to make the "load" event
scoped, so we'll leave that issue open for now.
  • Loading branch information
annevk authored and domenic committed Apr 26, 2016
1 parent c08c0a0 commit caf203f
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,12 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
data-x="concept-node-remove-ext">removing steps</span> are invoked with it as argument and it is
now no longer <span>in a document</span>.</p>

<p>A <dfn>node is connected</dfn> when the <span data-x="concept-node-insert-ext">insertion
steps</span> are invoked with it as argument and it is now <span>in a shadow-including
document</span>. Analogously, a <dfn>node is disconnected</dfn> when the <span
data-x="concept-node-remove-ext">removing steps</span> are invoked with it as argument and it is
now no longer <span>in a shadow-including document</span>.</p>


<h4>Scripting</h4>

Expand Down Expand Up @@ -58540,23 +58546,21 @@ o............A....e
<hr>

<p>When a <code>script</code> element that is not marked as being <span>"parser-inserted"</span>
experiences one of the events listed in the following list, the user agent must <span>immediately</span>
<span data-x="prepare a script">prepare</span> the <code>script</code> element:</p>
experiences one of the events listed in the following list, the user agent must
<span>immediately</span> <span data-x="prepare a script">prepare</span> the <code>script</code>
element:</p>

<ul>

<li>The <code>script</code> element gets <span data-x="node is inserted into a document">inserted
into a document</span>, at the time the <span data-x="nodes are inserted">node is inserted</span>
according to the DOM, after any other <code>script</code> elements inserted at the same time that
are earlier in the <code>Document</code> in <span>tree order</span>.</li>
<li>The <code>script</code> element gets <span data-x="node is connected">connected</span>.</li>

<li>The <code>script</code> element is <span>in a <code>Document</code></span> and a node or
<li>The <code>script</code> element is <span>in a shadow-including document</span> and a node or
document fragment is <span data-x="nodes are inserted">inserted</span> into the
<code>script</code> element, after any <code>script</code> elements <span data-x="nodes are
inserted">inserted</span> at that time.</li>

<li>The <code>script</code> element is <span>in a <code>Document</code></span> and has a <code
data-x="attr-script-src">src</code> attribute set where previously the element had no such
<li>The <code>script</code> element is <span>in a shadow-including document</span> and has a
<code data-x="attr-script-src">src</code> attribute set where previously the element had no such
attribute.</li>

</ul>
Expand Down Expand Up @@ -59128,9 +59132,10 @@ o............A....e
<dt>"<code data-x="">classic</code>"</dt>
<dd>
<ol>
<li><p>Set the <code>script</code> element's <span>node document</span>'s <code
<li><p>If the <code>script</code> element is <span>in a document</span>, then 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>
<code>script</code> element. Otherwise, set it to null.</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>
Expand Down Expand Up @@ -59174,6 +59179,7 @@ o............A....e

<p>Otherwise <span>queue a task</span> to <span>fire a simple event</span> named <code
data-x="event-load">load</code> at the <code>script</code> element.</p>
<!-- Shadow TODO: this event needs to be scoped -->

</li>

Expand Down

0 comments on commit caf203f

Please sign in to comment.