@@ -3113,7 +3113,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
3113
3113
<li><dfn data-noexport="" data-x="dom-Element-id" data-x-href="https://dom.spec.whatwg.org/#dom-element-id"><code>id</code></dfn> attribute</li>
3114
3114
<li><dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#dom-node-textcontent"><code>textContent</code></dfn> attribute</li>
3115
3115
3116
- <li>The <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#concept-tree">tree</dfn> concept</li>
3116
+ <li>The <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#concept-tree">tree</dfn> and <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/# concept-shadow-tree">shadow tree</dfn> concepts </li>
3117
3117
<li>The <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#concept-tree-order">tree order</dfn> concept</li>
3118
3118
<li>The <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#concept-tree-root">root</dfn> concept</li>
3119
3119
<li>The <dfn data-noexport="" data-x-href="https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor">inclusive ancestor</dfn> concept</li>
@@ -8536,7 +8536,7 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
8536
8536
[SameObject] readonly attribute <span>HTMLCollection</span> <span data-x="dom-document-forms">forms</span>;
8537
8537
[SameObject] readonly attribute <span>HTMLCollection</span> <span data-x="dom-document-scripts">scripts</span>;
8538
8538
NodeList <span data-x="dom-document-getElementsByName">getElementsByName</span>(DOMString elementName);
8539
- readonly attribute <span>HTMLOrSVGScriptElement</span>? <span data-x="dom-document-currentScript">currentScript</span>;
8539
+ readonly attribute <span>HTMLOrSVGScriptElement</span>? <span data-x="dom-document-currentScript">currentScript</span>; // classic scripts in a document only
8540
8540
8541
8541
// <span>dynamic markup insertion</span>
8542
8542
<span>Document</span> <span data-x="dom-document-open">open</span>(optional DOMString type = "text/html", optional DOMString replace = "");
@@ -9053,12 +9053,14 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
9053
9053
<dd>
9054
9054
9055
9055
<p>Returns the <code>script</code> element, or the <span>SVG <code>script</code></span> element,
9056
- that is currently executing. In the case of reentrant script execution, returns the one that
9057
- most recently started executing amongst those that have not yet finished executing.</p>
9056
+ that is currently executing, as long as the element represents a <span>classic script</span>.
9057
+ In the case of reentrant script execution, returns the one that most recently started executing
9058
+ amongst those that have not yet finished executing.</p>
9058
9059
9059
9060
<p>Returns null if the <code>Document</code> is not currently executing a <code>script</code>
9060
9061
or <span>SVG <code>script</code></span> element (e.g., because the running script is an event
9061
- handler, or a timeout).</p>
9062
+ handler, or a timeout), or if the currently executing <code>script</code> or <span>SVG
9063
+ <code>script</code></span> element represents a <span>module script</span>.</p>
9062
9064
9063
9065
</dd>
9064
9066
@@ -9067,12 +9069,19 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
9067
9069
<div w-nodev>
9068
9070
9069
9071
<p>The <dfn><code data-x="dom-document-currentScript">currentScript</code></dfn> attribute, on
9070
- getting, must return the value to which it was most recently initialised . When the
9071
- <code>Document</code> is created, the <code
9072
- data-x="dom-document-currentScript">currentScript</code> must be initialised to null.</p>
9072
+ getting, must return the value to which it was most recently set . When the <code>Document</code>
9073
+ is created, the <code data-x="dom-document-currentScript">currentScript</code> must be
9074
+ initialised to null.</p>
9073
9075
9074
9076
</div>
9075
9077
9078
+ <p class="note">This API has fallen out of favor in the implementor and standards community, as
9079
+ it globally exposes <code>script</code> or <span>SVG <code>script</code></span> elements. As such,
9080
+ it is not available in newer contexts, such as when running <span data-x="module script">module
9081
+ scripts</span> or when running scripts in a <span>shadow tree</span>. We are looking into creating
9082
+ a new solution for identifying the running script in such contexts, which does not make it
9083
+ globally available: see issue <a href="https://github.com/whatwg/html/issues/1013">#1013</a>.</p>
9084
+
9076
9085
<div w-nodev>
9077
9086
9078
9087
<hr>
@@ -59012,7 +59021,8 @@ o............A....e
59012
59021
59013
59022
<li>
59014
59023
59015
- <p><span>Fire a simple event</span> named <code
59024
+ <p>If <span data-x="concept-script-type">the script's type</span> is "<code
59025
+ data-x="">classic</code>", <span>fire a simple event</span> named <code
59016
59026
data-x="event-beforescriptexecute">beforescriptexecute</code> that bubbles and is cancelable
59017
59027
at the <code>script</code> element.</p>
59018
59028
@@ -59035,22 +59045,7 @@ o............A....e
59035
59045
<p>Let <var>old script element</var> be the value to which the <code>script</code>
59036
59046
element's <span>node document</span>'s <code
59037
59047
data-x="dom-document-currentScript">currentScript</code> object was most recently
59038
- initialised.</p>
59039
-
59040
- </li>
59041
-
59042
- <li>
59043
-
59044
- <p>Initialise the <code>script</code> element's <span>node document</span>'s <code
59045
- data-x="dom-document-currentScript">currentScript</code> object to the <code>script</code>
59046
- element.</p>
59047
-
59048
- </li>
59049
-
59050
- <li>
59051
-
59052
- <p>Let <var>settings object</var> be the <span>environment settings object</span> of the
59053
- <code>script</code> element's <span>node document</span>'s <code>Window</code> object.</p>
59048
+ set.</p>
59054
59049
59055
59050
</li>
59056
59051
@@ -59061,23 +59056,34 @@ o............A....e
59061
59056
<dl class="switch">
59062
59057
<dt>"<code data-x="">classic</code>"</dt>
59063
59058
<dd>
59064
- <p><span data-x="run a classic script">Run the classic script</span> given by <span
59065
- data-x="concept-script-script">the script's script</span>.</p>
59059
+ <ol>
59060
+ <li><p>Set the <code>script</code> element's <span>node document</span>'s <code
59061
+ data-x="dom-document-currentScript">currentScript</code> attribute to the
59062
+ <code>script</code> element.</p></li>
59063
+
59064
+ <li><p><span data-x="run a classic script">Run the classic script</span> given by <span
59065
+ data-x="concept-script-script">the script's script</span>.</p></li>
59066
+ </ol>
59066
59067
</dd>
59067
59068
59068
59069
<dt>"<code data-x="">module</code>"</dt>
59069
59070
<dd>
59070
- <p><span data-x="run a module script">Run the module script</span> given by <span
59071
- data-x="concept-script-script">the script's script</span>.</p>
59071
+ <ol>
59072
+ <li><p>Set the <code>script</code> element's <span>node document</span>'s <code
59073
+ data-x="dom-document-currentScript">currentScript</code> attribute to null.</p></li>
59074
+
59075
+ <li><p><span data-x="run a module script">Run the module script</span> given by <span
59076
+ data-x="concept-script-script">the script's script</span>.</p></li>
59077
+ </ol>
59072
59078
</dd>
59073
59079
</dl>
59074
59080
59075
59081
</li>
59076
59082
59077
59083
<li>
59078
59084
59079
- <p>Initialise the <code>script</code> element's <span>node document</span>'s <code
59080
- data-x="dom-document-currentScript">currentScript</code> object to <var>old script
59085
+ <p>Set the <code>script</code> element's <span>node document</span>'s <code
59086
+ data-x="dom-document-currentScript">currentScript</code> attribute to <var>old script
59081
59087
element</var>.</p>
59082
59088
59083
59089
</li>
@@ -59090,7 +59096,8 @@ o............A....e
59090
59096
59091
59097
<li>
59092
59098
59093
- <p><span>Fire a simple event</span> named <code
59099
+ <p>If <span data-x="concept-script-type">the script's type</span> is "<code
59100
+ data-x="">classic</code>", <span>fire a simple event</span> named <code
59094
59101
data-x="event-afterscriptexecute">afterscriptexecute</code> that bubbles (but is not
59095
59102
cancelable) at the <code>script</code> element.</p>
59096
59103
0 commit comments