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

Browsers don't allow whitespaces in <script type="module"> type attribute #7018

Closed
hiroshige-g opened this issue Sep 3, 2021 · 2 comments · Fixed by #7019
Closed

Browsers don't allow whitespaces in <script type="module"> type attribute #7018

hiroshige-g opened this issue Sep 3, 2021 · 2 comments · Fixed by #7019

Comments

@hiroshige-g
Copy link
Contributor

According to the spec, <script type=" module "> should be executed, because leading and trailing ASCII whitespace stripped is applied to the type attribute value before comparing with "module".

However, Safari/Firefox/Chromium all reject such cases (WPT: https://wpt.fyi/results/html/semantics/scripting-1/the-script-element/module/type.html?label=experimental&label=master&aligned. the test expects module types with whitespaces NOT to be executed).

(Note: for classic scripts leading/trailing whitespaces are allowed on the all browsers above:
https://wpt.fyi/results/html/semantics/scripting-1/the-script-element/script-type-and-language-js.html?label=experimental&label=master&aligned)

Maybe we might want to change the spec, or fix impls?
(I found this during bug triaging and thus the priority is quite low anyway)

@domenic

@hiroshige-g hiroshige-g changed the title <script type="module"> doesn't allow whitespaces in type attribute value Browsers doesn't allow whitespaces in <script type="module"> type attribute Sep 3, 2021
@hiroshige-g hiroshige-g changed the title Browsers doesn't allow whitespaces in <script type="module"> type attribute Browsers don't allow whitespaces in <script type="module"> type attribute Sep 3, 2021
@domenic
Copy link
Member

domenic commented Sep 3, 2021

Happy to change the spec here! I guess we should move the stripping from its current location in determining "the script block's type string", to the comparison step which checks "JavaScript MIME type essence match". And we should update the note that was just introduced for HTMLScriptElement.supports().

Would you like to submit a pull request for this?

@hiroshige-g
Copy link
Contributor Author

Created a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants