Skip to content

Commit

Permalink
Editorial: cleanup "create an element"
Browse files Browse the repository at this point in the history
While here we also teach the remaining "enqueue a custom element callback reaction" callers about lists.

Corresponding DOM PR: whatwg/dom#1331.
  • Loading branch information
annevk authored Dec 12, 2024
1 parent f23f559 commit aa1c505
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -11328,8 +11328,8 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

<ol>
<li><p>Let <var>element</var> be the result of <span data-x="create an element">creating an
element</span> given the <span>document element</span>'s <span>node document</span>, <code
data-x="SVG title">title</code>, and the <span>SVG namespace</span>.</p>
element</span> given the <span>document element</span>'s <span>node document</span>, "<code
data-x="">title</code>", and the <span>SVG namespace</span>.</p>

<li><p>Insert <var>element</var> as the <span>first child</span> of the <span>document
element</span>.</p></li>
Expand All @@ -11354,8 +11354,8 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

<ol>
<li><p>Let <var>element</var> be the result of <span data-x="create an element">creating an
element</span> given the <span>document element</span>'s <span>node document</span>,
<code>title</code>, and the <span>HTML namespace</span>.</p>
element</span> given the <span>document element</span>'s <span>node document</span>, "<code
data-x="">title</code>", and the <span>HTML namespace</span>.</p>

<li><p><span data-x="concept-node-append">Append</span> <var>element</var> to <span>the
<code>head</code> element</span>.</p></li>
Expand Down Expand Up @@ -14717,8 +14717,8 @@ interface <dfn interface>DOMStringMap</dfn> {
<li><p>Advance <var>position</var> to the next code point in <var>input</var>.</p></li>

<li><p><span data-x="concept-node-append">Append</span> the result of <span data-x="create an
element">creating an element</span> given <var>document</var>, <code>br</code>, and the
<span>HTML namespace</span> to <var>fragment</var>.</p></li>
element">creating an element</span> given <var>document</var>, "<code data-x="">br</code>",
and the <span>HTML namespace</span> to <var>fragment</var>.</p></li>
</ol>
</li>
</ol>
Expand Down Expand Up @@ -29917,7 +29917,7 @@ img.decode().then(() => {
data-x="concept-document-window">associated <code>Document</code></span>.</p></li>

<li><p>Let <var>img</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>img</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">img</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p>If <var>width</var> is given, then <span data-x="concept-element-attributes-set-value">set
Expand Down Expand Up @@ -35450,7 +35450,7 @@ interface <dfn interface>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span>
data-x="concept-document-window">associated <code>Document</code></span>.</p></li>

<li><p>Let <var>audio</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>audio</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">audio</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p><span data-x="concept-element-attributes-set-value">Set an attribute value</span> for
Expand Down Expand Up @@ -43565,8 +43565,8 @@ interface <dfn interface>HTMLTableSectionElement</dfn> : <span>HTMLElement</span
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>table row</var> be the result of <span data-x="create an element">creating an
element</span> given this element's <span>node document</span>, <code>tr</code>, and the
<span>HTML namespace</span>.</p></li>
element</span> given this element's <span>node document</span>, "<code data-x="">tr</code>", and
the <span>HTML namespace</span>.</p></li>

<li><p>If <var>index</var> is &#x2212;1 or equal to the number of items in the <code
data-x="dom-tbody-rows">rows</code> collection, then <span
Expand Down Expand Up @@ -43843,8 +43843,8 @@ interface <dfn interface>HTMLTableRowElement</dfn> : <span>HTMLElement</span> {
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>table cell</var> be the result of <span data-x="create an element">creating an
element</span> given this <code>tr</code> element's <span>node document</span>, <code>td</code>,
and the <span>HTML namespace</span>.</p></li>
element</span> given this <code>tr</code> element's <span>node document</span>, "<code
data-x="">td</code>", and the <span>HTML namespace</span>.</p></li>

<li><p>If <var>index</var> is equal to &#x2212;1 or equal to the number of items in <code
data-x="dom-tr-cells">cells</code> collection, then <span
Expand Down Expand Up @@ -54675,7 +54675,7 @@ interface <dfn interface>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
data-x="concept-document-window">associated <code>Document</code></span>.</p></li>

<li><p>Let <var>option</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>option</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">option</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p>If <var>text</var> is not the empty string, then append to <var>option</var> a new
Expand Down Expand Up @@ -72482,7 +72482,7 @@ document.body.append(parent);
<p>The <span data-x="concept-form-reset-control">reset algorithm</span> for <span
data-x="form-associated custom element">form-associated custom elements</span> is to <span>enqueue
a custom element callback reaction</span> with the element, callback name "<code
data-x="">formResetCallback</code>", and an empty argument list.</p>
data-x="">formResetCallback</code>", and « ».</p>

<hr>

Expand Down Expand Up @@ -73113,13 +73113,12 @@ customElements.define("x-foo", class extends HTMLElement {

<li><p>For each <var>attribute</var> in <var>element</var>'s <span>attribute list</span>, in
order, <span>enqueue a custom element callback reaction</span> with <var>element</var>, callback
name "<code data-x="">attributeChangedCallback</code>", and an argument list containing
<var>attribute</var>'s local name, null, <var>attribute</var>'s value, and <var>attribute</var>'s
namespace.</p></li>
name "<code data-x="">attributeChangedCallback</code>", and « <var>attribute</var>'s local name,
null, <var>attribute</var>'s value, <var>attribute</var>'s namespace ».</p></li>

<li><p>If <var>element</var> is <span>connected</span>, then <span>enqueue a custom element
callback reaction</span> with <var>element</var>, callback name "<code
data-x="">connectedCallback</code>", and an empty argument list.</p></li>
data-x="">connectedCallback</code>", and « ».</p></li>

<li><p>Add <var>element</var> to the end of <var>definition</var>'s <span
data-x="concept-custom-element-definition-construction-stack">construction stack</span>.</p></li>
Expand Down Expand Up @@ -73788,15 +73787,14 @@ dictionary <dfn dictionary>ValidityStateFlags</dfn> {
element</span>'s <span data-x="face-state">state</span>, for example <span data-x="restore
persisted state">after navigation</span> or restarting the user agent, they may <span>enqueue a
custom element callback reaction</span> with that element, callback name "<code
data-x="">formStateRestoreCallback</code>", an argument list containing the state to be
restored, and "<code data-x="">restore</code>".</p>
data-x="">formStateRestoreCallback</code>", and « the state to be restored, "<code
data-x="">restore</code>" ».</p>

<p>If the user agent has a form-filling assist feature, then when the feature is invoked,
it may <span>enqueue a custom element callback reaction</span> with
a <span>form-associated custom element</span>, callback name
"<code data-x="">formStateRestoreCallback</code>", an argument list containing the state value
determined by history of state value and some heuristics, and
"<code data-x="">autocomplete</code>".</p>
<p>If the user agent has a form-filling assist feature, then when the feature is invoked, it may
<span>enqueue a custom element callback reaction</span> with a <span>form-associated custom
element</span>, callback name "<code data-x="">formStateRestoreCallback</code>", and « the state
value determined by history of state value and some heuristics, "<code
data-x="">autocomplete</code>" ».</p>

<p>In general, the <span data-x="face-state">state</span> is information specified by a user, and
the <span data-x="face-submission-value">submission value</span> is a value after canonicalization
Expand Down Expand Up @@ -104969,15 +104967,15 @@ new PaymentRequest(&hellip;); // Allowed to use

<ol>
<li><p>Let <var>html</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>html</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">html</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p>Let <var>head</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>head</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">head</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p>Let <var>body</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <code>body</code>, and the <span>HTML
element</span> given <var>document</var>, "<code data-x="">body</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p><span data-x="concept-node-append">Append</span> <var>html</var> to
Expand Down Expand Up @@ -115040,7 +115038,8 @@ enum <dfn enum>DOMParserSupportedType</dfn> {

<li><p>If <var>parent</var> is a <code>DocumentFragment</code>, set <var>parent</var> to the
result of <span data-x="create an element">creating an element</span> given <span>this</span>'s
<span>node document</span>, <code>body</code>, and the <span>HTML namespace</span>.</p></li>
<span>node document</span>, "<code data-x="">body</code>", and the <span>HTML
namespace</span>.</p></li>

<li><p>Let <var>fragment</var> be the result of invoking the <span>fragment parsing algorithm
steps</span> given <var>parent</var> and <var>compliantString</var>.</p></li>
Expand Down Expand Up @@ -115141,8 +115140,8 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
</ul>

<p>set <var>context</var> to the result of <span data-x="create an element">creating an
element</span> given <span>this</span>'s <span>node document</span>, <code>body</code>, and
the <span>HTML namespace</span>.</p>
element</span> given <span>this</span>'s <span>node document</span>, "<code
data-x="">body</code>", and the <span>HTML namespace</span>.</p>
</li>

<li>
Expand Down Expand Up @@ -115254,8 +115253,8 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
</ul>

<p>then set <var>element</var> to the result of <span data-x="create an element">creating an
element</span> given <span>this</span>'s <span>node document</span>, <code>body</code>, and the
<span>HTML namespace</span>.</p>
element</span> given <span>this</span>'s <span>node document</span>, "<code
data-x="">body</code>", and the <span>HTML namespace</span>.</p>
</li>

<li><p>Let <var>fragment node</var> be the result of invoking the <span>fragment parsing
Expand Down Expand Up @@ -129198,12 +129197,12 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
definition">looking up a custom element definition</span> given <var>document</var>, <var>given
namespace</var>, <var>local name</var>, and <var>is</var>.</p></li>

<li><p>If <var>definition</var> is non-null and the parser was not created as part of the
<span>HTML fragment parsing algorithm</span>, then let <var>will execute script</var> be true.
Otherwise, let it be false.</p></li>
<li><p>Let <var>willExecuteScript</var> be true if <var>definition</var> is non-null and the
parser was not created as part of the <span>HTML fragment parsing algorithm</span>; otherwise
false.</p></li>

<li>
<p>If <var>will execute script</var> is true, then:</p>
<p>If <var>willExecuteScript</var> is true:</p>

<ol>
<li><p>Increment <var>document</var>'s <span>throw-on-dynamic-markup-insertion
Expand All @@ -129219,12 +129218,11 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {

<li>
<p>Let <var>element</var> be the result of <span data-x="create an element">creating an
element</span> given <var>document</var>, <var>localName</var>, <var>given
namespace</var>, null, and <var>is</var>. If <var>will execute script</var> is true, set the
<var>synchronous custom elements flag</var>; otherwise, leave it unset.</p>
element</span> given <var>document</var>, <var>localName</var>, <var>given namespace</var>,
null, <var>is</var>, and <var>willExecuteScript</var>.</p>

<p class="note">This will cause <span data-x="custom element constructor">custom element
constructors</span> to run, if <var>will execute script</var> is true. However, since we
constructors</span> to run, if <var>willExecuteScript</var> is true. However, since we
incremented the <span>throw-on-dynamic-markup-insertion counter</span>, this cannot cause <span
data-x="dom-document-write">new characters to be inserted into the tokenizer</span>, or <span
data-x="dom-document-open">the document to be blown away</span>.</p>
Expand All @@ -129245,7 +129243,7 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
</li>

<li>
<p>If <var>will execute script</var> is true, then:</p>
<p>If <var>willExecuteScript</var> is true:</p>

<ol>
<li><p>Let <var>queue</var> be the result of popping from <var>document</var>'s <span>relevant
Expand Down

0 comments on commit aa1c505

Please sign in to comment.