Skip to content

Do not strip whitespace from non-classic script types - #13031

Merged
zcorpan merged 1 commit into
mainfrom
annevk/script-type-whitespace
Oct 5, 2026
Merged

zcorpan merged 1 commit into
mainfrom
annevk/script-type-whitespace

Conversation

@annevk

@annevk annevk commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

As in WebKit and Chromium, only strip leading and trailing ASCII whitespace from the type attribute value for the JavaScript MIME type check, so that, e.g., type=" module " is not a module script.

Fixes #13012. This is a follow-up to 36470c1.

(See WHATWG Working Mode: Changes for more details.)


/scripting.html ( diff )

As in WebKit and Chromium, only strip leading and trailing ASCII whitespace from the type attribute value for the JavaScript MIME type check, so that, e.g., type=" module " is not a module script.

Fixes #13012. This is a follow-up to 36470c1.
@annevk
annevk requested review from emilio and zcorpan October 3, 2026 11:06

@emilio emilio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks sensible to me, can you file a Gecko bug to change this?

@zcorpan
zcorpan merged commit ac737fa into main Oct 5, 2026
2 checks passed
@zcorpan
zcorpan deleted the annevk/script-type-whitespace branch October 5, 2026 13:53
mrobinson pushed a commit to mrobinson/servo that referenced this pull request Oct 12, 2026
…rvo#48831)

Switch to `get_attribute_string_ref` and updates the logic to reflect
the specification changes in whatwg/html#13031.
Also, `script_text` was changed to a `TracedDOMString`.

Testing: Test expectations updated

---------

Signed-off-by: Gae24 <[email protected]>
Co-authored-by: Narfinger <[email protected]>
log101 pushed a commit to log101/servo that referenced this pull request Oct 14, 2026
…rvo#48831)

Switch to `get_attribute_string_ref` and updates the logic to reflect
the specification changes in whatwg/html#13031.
Also, `script_text` was changed to a `TracedDOMString`.

Testing: Test expectations updated

---------

Signed-off-by: Gae24 <[email protected]>
Co-authored-by: Narfinger <[email protected]>
aphrody-dev pushed a commit to aphrody-labs/browser that referenced this pull request Nov 16, 2026
…8831)

Switch to `get_attribute_string_ref` and updates the logic to reflect
the specification changes in whatwg/html#13031.
Also, `script_text` was changed to a `TracedDOMString`.

Testing: Test expectations updated

---------

Signed-off-by: Gae24 <[email protected]>
Co-authored-by: Narfinger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Is whitespace around type="module" stripped?

3 participants