feat(script): parse script element importmap type (#37547)

Support parsing script element to `importmap` type

Testing: Pass WPT
Fixes: part of https://github.com/servo/servo/issues/37316

Signed-off-by: Jason Tsai <git@pews.dev>
This commit is contained in:
Jason Tsai 2025-06-19 16:06:18 +09:00 committed by GitHub
parent 49be5ca05a
commit 07ecf34e64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 10 deletions

View file

@ -1313,6 +1313,10 @@ impl HTMLScriptElement {
return Some(ScriptType::Module);
}
if ty.to_ascii_lowercase().trim_matches(HTML_SPACE_CHARACTERS) == "importmap" {
return Some(ScriptType::ImportMap);
}
if SCRIPT_JS_MIMES
.contains(&ty.to_ascii_lowercase().trim_matches(HTML_SPACE_CHARACTERS))
{

View file

@ -1,10 +0,0 @@
[external-import-map-errors.html]
expected: TIMEOUT
[Test that an external import map fires an error event]
expected: TIMEOUT
[Test that an external import map fires an error event, regardless of attribute order]
expected: NOTRUN
[Test that an external import map in markup fires an error event]
expected: NOTRUN