Skip to content

Commit

Permalink
Add HTMLScriptElement.supports(type)
Browse files Browse the repository at this point in the history
  • Loading branch information
horo-t authored Sep 3, 2021
1 parent b10b69b commit 33ff054
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion source
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The terms <dfn data-x="concept-collection" data-x-href="https://dom.spec.whatwg.org/#concept-collection">collection</dfn> and <dfn data-x-href="https://dom.spec.whatwg.org/#represented-by-the-collection">represented by the collection</dfn></li>

<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-domtokenlist"><code>DOMTokenList</code></dfn> interface, and its
<dfn data-x="dom-DOMTokenList-value" data-x-href="https://dom.spec.whatwg.org/#dom-domtokenlist-value"><code>value</code></dfn> attribute</li>
<dfn data-x="dom-DOMTokenList-value" data-x-href="https://dom.spec.whatwg.org/#dom-domtokenlist-value"><code>value</code></dfn> attribute and
<dfn data-x="dom-DOMTokenList-supports" data-x-href="https://dom.spec.whatwg.org/#dom-domtokenlist-supports"><code>supports</code></dfn> operation</li>

<li><dfn data-x="dom-DOMImplementation-createDocument" data-x-href="https://dom.spec.whatwg.org/#dom-domimplementation-createdocument"><code>createDocument()</code></dfn> method</li>
<li><dfn data-x="dom-DOMImplementation-createHTMLDocument" data-x-href="https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument"><code>createHTMLDocument()</code></dfn> method</li>
Expand Down Expand Up @@ -58348,6 +58349,8 @@ interface <dfn interface>HTMLScriptElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-integrity">integrity</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-referrerPolicy">referrerPolicy</span>;

static boolean <span data-x="dom-script-supports">supports</span>(DOMString type);

// <a href="#HTMLScriptElement-partial">also has obsolete members</a>
};</code></pre>
</dd>
Expand Down Expand Up @@ -58570,6 +58573,14 @@ interface <dfn interface>HTMLScriptElement</dfn> : <span>HTMLElement</span> {

<p>Can be set, to replace the element's children with the given value.</p>
</dd>

<dt><code data-x=""><code>HTMLScriptElement</code>.<span subdfn data-x="dom-script-supports">supports</span>(<var>type</var>)</code></dt>

<dd>
<p>Returns true if the given <var>type</var> is a script type supported by the user agent.
The possible script types in this specification are "<code data-x="">classic</code>" and
"<code data-x="">module</code>", but others might be added in the future.
</dd>
</dl>

<div w-nodev>
Expand All @@ -58589,6 +58600,27 @@ interface <dfn interface>HTMLScriptElement</dfn> : <span>HTMLElement</span> {
<code data-x="dom-innerHTML">innerHTML</code> and <code data-x="dom-outerHTML">outerHTML</code>
attributes, they do not execute at all.</p>

<p>The <dfn method for="script"><code
data-x="dom-script-supports">supports(<var>type</var>)</code></dfn> method steps are:</p>

<ol>
<li><p>If <var>type</var> <span>is</span> "<code data-x="">classic</code>", then return
true.</p></li>

<li><p>If <var>type</var> <span>is</span> "<code data-x="">module</code>", then return
true.</p></li>

<li><p>Return false.</p></li>
</ol>

<p class="note">The <var>type</var> argument has to exactly match these values; we do not
<span>strip leading and trailing ASCII whitespace</span> or perform an <span>ASCII
case-insensitive</span> match. This is different from how <code
data-x="attr-script-type">type</code> content attribute values are treated, and how
<code>DOMTokenList</code>'s <code data-x="dom-DOMTokenList-supports">supports()</code> method
works, but it aligns with the <code>WorkerType</code> enumeration used in the <code
data-x="dom-Worker">Worker()</code> constructor.</p>

<div class="example">

<p>In this example, two <code>script</code> elements are used. One embeds an external
Expand Down Expand Up @@ -126970,6 +127002,7 @@ INSERT INTERFACES HERE
Trey Eckels,
triple-underscore, <!-- GitHub -->
Tristan Fraipont, <!-- Kaiido on GitHub -->
保呂 毅 (Tsuyoshi Horo),
Tyler Close,
Valentin Gosu,
Vardhan Gupta,
Expand Down

0 comments on commit 33ff054

Please sign in to comment.