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

"the script is ready" doesn't really work #5217

Closed
annevk opened this issue Jan 17, 2020 · 2 comments · Fixed by #7876
Closed

"the script is ready" doesn't really work #5217

annevk opened this issue Jan 17, 2020 · 2 comments · Fixed by #7876
Assignees

Comments

@annevk
Copy link
Member

annevk commented Jan 17, 2020

The user agent must delay the load event of the element's node document until the script is ready.

Does not say what it wants to say I think. In particular, I would be very surprised if in

<script>
  const delaysLoadEvent = document.createElement("script");
</script>

delaysLoadEvent actually ends up delaying the load event.

@domenic
Copy link
Member

domenic commented Jan 17, 2020

I think the escape clause here is the very-subtle wording in the definition of "delays the load event":

Spin the event loop until there is nothing that delays the load event in the Document.

(this should presumably be updated to in a document tree, or maybe in a shadow-including document tree?)

In particular the same "issue" applies to img, style, link, and other things that delay the load event.

@annevk
Copy link
Member Author

annevk commented Nov 19, 2020

Somewhat related: #5160.

@domenic domenic self-assigned this Apr 29, 2022
domenic added a commit that referenced this issue May 19, 2022
* Modernize the definitions and usage of various fields associated with script element, e.g. by removing "scare quotes", changing names from verbose things like "the script's type" to just "type", changing flags to booleans, ensuring initial values are defined, etc. Notable field changes:
    * Rename "the script's script" to "result". This serves as preparation for other specifications, such as import maps, which will expand what that field can contain.  
    * Rename "non-blocking" to "force async" to better communicate its connection to the async="" content attribute and to avoid confusion with the blocking="" content attribute.
* Revamp "the script is ready" into three separate concepts: "delaying the load event", "mark as ready", and "steps to run when the result is ready". Fixes #5217, in particular making it so that script elements which are never marked as ready (e.g., <script type="foobar">) don't delay the load event indefinitely.
* Un-export "prepare a script". All uses of it in external specs are either monkeypatches or non-normative references.
* Rename "prepare a script" to "prepare the script element" to emphasize it's about the `<script>` element, not about the separate script concept.
* Rewrite the final of "prepare the script element" from a switch into a series of nested if/else blocks, which better communicates how we can land in the various different script element execution modes.
* Rename "execute a script block" to "execute the script element", since "block" is a strange term.
* Various other editorial improvements to those two algorithms.
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
* Modernize the definitions and usage of various fields associated with script element, e.g. by removing "scare quotes", changing names from verbose things like "the script's type" to just "type", changing flags to booleans, ensuring initial values are defined, etc. Notable field changes:
    * Rename "the script's script" to "result". This serves as preparation for other specifications, such as import maps, which will expand what that field can contain.  
    * Rename "non-blocking" to "force async" to better communicate its connection to the async="" content attribute and to avoid confusion with the blocking="" content attribute.
* Revamp "the script is ready" into three separate concepts: "delaying the load event", "mark as ready", and "steps to run when the result is ready". Fixes whatwg#5217, in particular making it so that script elements which are never marked as ready (e.g., <script type="foobar">) don't delay the load event indefinitely.
* Un-export "prepare a script". All uses of it in external specs are either monkeypatches or non-normative references.
* Rename "prepare a script" to "prepare the script element" to emphasize it's about the `<script>` element, not about the separate script concept.
* Rewrite the final of "prepare the script element" from a switch into a series of nested if/else blocks, which better communicates how we can land in the various different script element execution modes.
* Rename "execute a script block" to "execute the script element", since "block" is a strange term.
* Various other editorial improvements to those two algorithms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants