Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow script #1100

Merged
merged 3 commits into from
Apr 26, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -58533,23 +58539,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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the rremoval of the ", at the time..." clause here problematic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since the hook it's using is only run once for each node. However, there is a problem with script execution as illustrated by http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4098.

I think technically we need to invoke the insertion steps twice. Once with "don't execute scripts" and once (once everything is actually in the tree) with "execute scripts". That flag might only need to be set to "don't" in the case of document fragments.

@smaug---- had a thought I believe how we could address this in a different way, but I forgot.


<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 @@ -59121,9 +59125,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uppercase I

<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 @@ -59167,6 +59172,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