From 5b60310a6952e0b42baf63cfbb7676c8a0a1e589 Mon Sep 17 00:00:00 2001 From: Yu Wei Wu Date: Fri, 6 Jun 2025 20:07:27 +0900 Subject: [PATCH] Resolve step 31 Signed-off-by: Yu Wei Wu --- components/script/dom/htmlscriptelement.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 8e4d7c10f26..8ed4710599f 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -823,7 +823,11 @@ impl HTMLScriptElement { if let Some(src) = element.get_attribute(&ns!(), &local_name!("src")) { // Step 31. If el has a src content attribute, then: - // TODO: Step 31.1. If el's type is "importmap". + // Step 31.1. If el's type is "importmap". + if let ScriptType::ImportMap = script_type { + self.queue_error_event(); + return; + } // Step 31.2. Let src be the value of el's src attribute. let src = src.value(); @@ -960,7 +964,8 @@ impl HTMLScriptElement { ); }, ScriptType::ImportMap => { - // TODO: Let result be the result of creating an import map parse result given source text and base URL. + // TODO: Let result be the result of creating an import map + // parse result given source text and base URL. }, } } @@ -1067,7 +1072,8 @@ impl HTMLScriptElement { self.run_a_module_script(&script, false, can_gc); }, ScriptType::ImportMap => { - // TODO: Register an import map given el's relevant global object and el's result. + // TODO: Register an import map given el's relevant + // global object and el's result. }, }