summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2021-09-07 08:12:41 +0100
committerAndreas Kling <kling@serenityos.org>2021-09-07 17:22:24 +0200
commit44b8afdbc4518f596980e0b4ca88e7d1aaeeba26 (patch)
tree697b749779cfee4aa1930501a03cbbdc58c2032b
parent405b282bc3e102b4078e90b57d56996d7a028d80 (diff)
downloadserenity-44b8afdbc4518f596980e0b4ca88e7d1aaeeba26.zip
LibWeb: Don't trim whitespace when checking for "module" type on scripts
No major engine allows whitespace in the type when checking for "module". This was also reflected in the relevant web platform test, but not in the spec. The spec has been changed to match this behaviour: https://github.com/whatwg/html/commit/23c723e3e94103e495a6b67e60ffc8a1a164334b
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
index 78d2ede8ce..7a43ed85a3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
@@ -126,12 +126,12 @@ void HTMLScriptElement::prepare_script()
|| (!has_type && !has_language)) {
script_block_type = "text/javascript";
} else if (has_type) {
- script_block_type = attribute(HTML::AttributeNames::type).trim_whitespace();
+ script_block_type = attribute(HTML::AttributeNames::type);
} else if (!attribute(HTML::AttributeNames::language).is_empty()) {
script_block_type = String::formatted("text/{}", attribute(HTML::AttributeNames::language));
}
- if (is_javascript_mime_type_essence_match(script_block_type)) {
+ if (is_javascript_mime_type_essence_match(script_block_type.trim_whitespace())) {
m_script_type = ScriptType::Classic;
} else if (script_block_type.equals_ignoring_case("module")) {
m_script_type = ScriptType::Module;