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

Html script element supports method #7008

Merged
merged 8 commits into from
Sep 3, 2021
Merged
Changes from all 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
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>
horo-t marked this conversation as resolved.
Show resolved Hide resolved
attributes, they do not execute at all.</p>
domenic marked this conversation as resolved.
Show resolved Hide resolved

domenic marked this conversation as resolved.
Show resolved Hide resolved
<p>The <dfn method for="script"><code
data-x="dom-script-supports">supports(<var>type</var>)</code></dfn> method steps are:</p>

horo-t marked this conversation as resolved.
Show resolved Hide resolved
<ol>
<li><p>If <var>type</var> <span>is</span> "<code data-x="">classic</code>", then return
true.</p></li>

domenic marked this conversation as resolved.
Show resolved Hide resolved
domenic marked this conversation as resolved.
Show resolved Hide resolved
<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 @@ -126849,6 +126881,7 @@ INSERT INTERFACES HERE
Trey Eckels,
triple-underscore, <!-- GitHub -->
Tristan Fraipont, <!-- Kaiido on GitHub -->
保呂 毅 (Tsuyoshi Horo),
Tyler Close,
Valentin Gosu,
Vardhan Gupta,
Expand Down