Skip to content

Commit a9e1d2a

Browse files
dtapuskadomenic
authored andcommitted
Add "queue an element task" algorithm
This is a specialization of "queue a task", where the event loop and the document are derived from the element. This helps with #4980. For now only a couple instances were converted, but the other 200+ will follow.
1 parent f3f1f62 commit a9e1d2a

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

source

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27904,7 +27904,8 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</code
2790427904
pixel density</var>.</p></li>
2790527905

2790627906
<li>
27907-
<p><span>Queue a task</span> to:</p>
27907+
<p><span>Queue an element task</span> on the <span>DOM manipulation task source</span>
27908+
given the <code>img</code> element and following steps:</p>
2790827909

2790927910
<ol>
2791027911
<li><p>If <i>restart animation</i> is set, then <span>restart the
@@ -27954,12 +27955,20 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</code
2795427955
image request</span> for the <span>current request</span> and the <span>pending request</span>,
2795527956
and set <span>pending request</span> to null.</p></li>
2795627957

27957-
<li><p>&#x231B; <span>Queue a task</span> to change the <span>current request</span>'s <span
27958-
data-x="img-req-url">current URL</span> to the empty string, and then, if the element has a
27959-
<code data-x="attr-img-src">src</code> attribute or it <span data-x="use srcset or
27960-
picture">uses <code>srcset</code> or <code>picture</code></span>, <span
27961-
data-x="concept-event-fire">fire an event</span> named <code data-x="event-error">error</code>
27962-
at the <code>img</code> element.</p></li>
27958+
<li>
27959+
<p>&#x231B; <span>Queue an element task</span> on the <span>DOM manipulation task
27960+
source</span> given the <code>img</code> element and the following steps:</p>
27961+
27962+
<ol>
27963+
<li><p>Change the <span>current request</span>'s <span data-x="img-req-url">current
27964+
URL</span> to the empty string.</p></li>
27965+
27966+
<li><p>If the element has a <code data-x="attr-img-src">src</code> attribute or it <span
27967+
data-x="use srcset or picture">uses <code>srcset</code> or <code>picture</code></span>, <span
27968+
data-x="concept-event-fire">fire an event</span> named <code
27969+
data-x="event-error">error</code> at the <code>img</code> element.</p></li>
27970+
</ol>
27971+
</li>
2796327972

2796427973
<li><p>&#x231B; Return.</p></li>
2796527974
</ol>
@@ -91539,12 +91548,15 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
9153991548

9154091549
<p>To <dfn data-export="">queue a task</dfn> on a <span>task source</span> <var>source</var>,
9154191550
which performs a series of steps <var>steps</var>, optionally given an event loop <var>event
91542-
loop</var>:</p>
91551+
loop</var> and a document <var>document</var>:</p>
9154391552

9154491553
<ol>
9154591554
<li><p>If <var>event loop</var> was not given, set <var>event loop</var> to the <span>implied
9154691555
event loop</span>.</p></li>
9154791556

91557+
<li><p>If <var>document</var> was not given, set <var>document</var> to the <span>implied
91558+
document</span>.</p></li>
91559+
9154891560
<li><p>Let <var>task</var> be a new <span data-x="concept-task">task</span>.</p></li>
9154991561

9155091562
<li><p>Set <var>task</var>'s <span data-x="concept-task-steps">steps</span> to
@@ -91554,7 +91566,7 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
9155491566
<var>source</var>.</p></li>
9155591567

9155691568
<li><p>Set <var>task</var>'s <span data-x="concept-task-document">document</span> to the
91557-
<span>implied document</span>.</p></li>
91569+
<var>document</var>.</p></li>
9155891570

9155991571
<li><p>Set <var>task</var>'s <span>script evaluation environment settings object set</span> to an
9156091572
empty <span>set</span>.</p></li>
@@ -91565,13 +91577,32 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
9156591577
<li><p><span data-x="list append">Append</span> <var>task</var> to <var>queue</var>.</p></li>
9156691578
</ol>
9156791579

91580+
<p>To <dfn data-export="">queue an element task</dfn> on a <span>task source</span>
91581+
<var>source</var>, with an element <var>element</var> and a series of steps
91582+
<var>steps</var>:</p>
91583+
91584+
<ol>
91585+
<li><p>Let <var>document</var> be <var>element</var>'s <span>node document</span>.</p></li>
91586+
91587+
<li><p>Let <var>event loop</var> be <var>document</var>'s <span
91588+
data-x="concept-relevant-realm">relevant realm</span>'s corresponding <span>agent</span>'s
91589+
<span>event loop</span>.</p></li>
91590+
91591+
<li><p><span>Queue a task</span> given <var>source</var>, <var>event loop</var>,
91592+
<var>document</var>, and <var>steps</var>.</p></li>
91593+
</ol>
91594+
9156891595
<p>To <dfn data-export="">queue a microtask</dfn> which performs a series of steps
91569-
<var>steps</var>, optionally given an event loop <var>event loop</var>:</p>
91596+
<var>steps</var>, optionally given an event loop <var>event loop</var> and a document
91597+
<var>document</var>:</p>
9157091598

9157191599
<ol>
9157291600
<li><p>If <var>event loop</var> was not given, set <var>event loop</var> to the <span>implied
9157391601
event loop</span>.</p></li>
9157491602

91603+
<li><p>If <var>document</var> was not given, set <var>document</var> to the <span>implied
91604+
document</span>.</p></li>
91605+
9157591606
<li><p>Let <var>microtask</var> be a new <span data-x="concept-task">task</span>.</p></li>
9157691607

9157791608
<li><p>Set <var>microtask</var>'s <span data-x="concept-task-steps">steps</span> to
@@ -91580,8 +91611,8 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
9158091611
<li><p>Set <var>microtask</var>'s <span data-x="concept-task-source">source</span> to the
9158191612
<dfn>microtask task source</dfn>.</p></li>
9158291613

91583-
<li><p>Set <var>microtask</var>'s <span data-x="concept-task-document">document</span> to the
91584-
<span>implied document</span>.</p></li>
91614+
<li><p>Set <var>microtask</var>'s <span data-x="concept-task-document">document</span> to
91615+
<var>document</var>.</p></li>
9158591616

9158691617
<li><p>Set <var>task</var>'s <span>script evaluation environment settings object set</span> to an
9158791618
empty <span>set</span>.</p></li>

0 commit comments

Comments
 (0)