From a9e1d2ad5a7569010c685b271965ae4a3a34a64b Mon Sep 17 00:00:00 2001 From: Dave Tapuska Date: Thu, 5 Dec 2019 12:15:14 -0800 Subject: [PATCH] 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. --- source | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/source b/source index 35e3e808f84..108ed090f8a 100644 --- a/source +++ b/source @@ -27904,7 +27904,8 @@ was an English <a href="/wiki/Music_hall">music hall</a> singer, ....

  • -

    Queue a task to:

    +

    Queue an element task on the DOM manipulation task source + given the img element and following steps:

    1. If restart animation is set, then restart the @@ -27954,12 +27955,20 @@ was an English <a href="/wiki/Music_hall">music hall</a> singer, ... for the current request and the pending request, and set pending request to null.

    2. -
    3. Queue a task to change the current request's current URL to the empty string, and then, if the element has a - src attribute or it uses srcset or picture, fire an event named error - at the img element.

    4. +
    5. +

      Queue an element task on the DOM manipulation task + source given the img element and the following steps:

      + +
        +
      1. Change the current request's current + URL to the empty string.

      2. + +
      3. If the element has a src attribute or it uses srcset or picture, fire an event named error at the img element.

      4. +
      +
    6. ⌛ Return.

    @@ -91539,12 +91548,15 @@ dictionary PromiseRejectionEventInit : EventInit {

    To queue a task on a task source source, which performs a series of steps steps, optionally given an event loop event - loop:

    + loop and a document document:

    1. If event loop was not given, set event loop to the implied event loop.

    2. +
    3. If document was not given, set document to the implied + document.

    4. +
    5. Let task be a new task.

    6. Set task's steps to @@ -91554,7 +91566,7 @@ dictionary PromiseRejectionEventInit : EventInit { source.

    7. Set task's document to the - implied document.

    8. + document.

    9. Set task's script evaluation environment settings object set to an empty set.

    10. @@ -91565,13 +91577,32 @@ dictionary PromiseRejectionEventInit : EventInit {
    11. Append task to queue.

    +

    To queue an element task on a task source + source, with an element element and a series of steps + steps:

    + +
      +
    1. Let document be element's node document.

    2. + +
    3. Let event loop be document's relevant realm's corresponding agent's + event loop.

    4. + +
    5. Queue a task given source, event loop, + document, and steps.

    6. +
    +

    To queue a microtask which performs a series of steps - steps, optionally given an event loop event loop:

    + steps, optionally given an event loop event loop and a document + document:

    1. If event loop was not given, set event loop to the implied event loop.

    2. +
    3. If document was not given, set document to the implied + document.

    4. +
    5. Let microtask be a new task.

    6. Set microtask's steps to @@ -91580,8 +91611,8 @@ dictionary PromiseRejectionEventInit : EventInit {

    7. Set microtask's source to the microtask task source.

    8. -
    9. Set microtask's document to the - implied document.

    10. +
    11. Set microtask's document to + document.

    12. Set task's script evaluation environment settings object set to an empty set.