Skip to content

Find a better way to explain ad-hoc script prepare/cleanup pairs for promise-based APIs #12080

@noamr

Description

@noamr

What is the issue with the HTML Standard?

We have (at least) two places in the HTML standard where we explicitly wrap some operation in a script prepare/cleanup pair:

  1. The navigation API
  2. when activating a view transition during page reveal.

This feels unintuitive and edge-casey, and makes it harder to explain how microtasks work.

The issue at the core of (1) is to make sure all the promises are fired after all the events.

The issue at the core of (2), is that calling the promise resolution algorithm queues a microtask, and that microtask would only resolve either when some unrelated event handler or callback is called, or after painting (end of the rendering task).

There might be a better way to explain this, e.g. split those complex task to "stages" where each stage runs its own checkpoint, or as a "task that is actually a chain of multiple tasks" or something to that effect.

Open to suggestions and discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions