Skip to content

Align the test's expectation with the latest spec.#58514

Merged
rniwa merged 1 commit intoweb-platform-tests:masterfrom
rniwa:fix-the-script-element-execution-timing-148
Mar 16, 2026
Merged

Align the test's expectation with the latest spec.#58514
rniwa merged 1 commit intoweb-platform-tests:masterfrom
rniwa:fix-the-script-element-execution-timing-148

Conversation

@rniwa
Copy link
Copy Markdown
Contributor

@rniwa rniwa commented Mar 16, 2026

To "prepare the script element" [1] exits early when the element is disconnected. In this test, the script element represented by frag_script_2 which logs "inline script #3" is disconnected in the preceeding script (frag_script_1 / "inline script #2"). Since post-connection steps [2] are executed in the tree order, by the time we are to "prepare the script element" on frag_script_2 / "inline script #3", the script element is already disconnected and the script will not be executed.

This test failing in Chrome and Safari but passing in Firefox. After the change, the test passes in Chrome and Safari and fails in Firefox.

[1] https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
[2] https://dom.spec.whatwg.org/#concept-node-post-connection-ext

To "prepare the script element" [1] exits early when the element is disconnected.
In this test, the script element represented by frag_script_2 which logs "inline script #3"
is disconnected in the preceeding script (frag_script_1 / "inline script #2").
Since post-connection steps [2] are executed in the tree order, by the time we are to
"prepare the script element" on frag_script_2 / "inline script #3", the script element is
already disconnected and the script will not be executed.

This test failing in Chrome and Safari but passing in Firefox. After the change, the test
passes in Chrome and Safari and fails in Firefox.

[1] https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
[2] https://dom.spec.whatwg.org/#concept-node-post-connection-ext
Copy link
Copy Markdown
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smaug---- FYI.

@domfarolino seems this was missed when updating tests for post-insertion steps.

Copy link
Copy Markdown
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, thanks for catching this @rniwa, nice find.

@rniwa rniwa merged commit 2ba7ecc into web-platform-tests:master Mar 16, 2026
26 checks passed
@rniwa rniwa deleted the fix-the-script-element-execution-timing-148 branch March 16, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants