diff options
4 files changed, 18 insertions, 50 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 5ecdaa27903..aec5422fd07 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -170,9 +170,25 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { // these steps at this point. The script is not executed. // Step 12. - // TODO: If the script element has an `event` attribute and a `for` attribute, then run - // these substeps... + match element.get_attribute(ns!(""), &atom!("for")).root() { + Some(for_script) => { + if for_script.r().Value().to_ascii_lowercase().trim_matches(HTML_SPACE_CHARACTERS) != "window" { + return; + } + } + _ => { } + } + match element.get_attribute(ns!(""), &Atom::from_slice("event")).root() { + Some(event) => { + let event = event.r().Value().to_ascii_lowercase(); + let event = event.trim_matches(HTML_SPACE_CHARACTERS); + if event != "onload" && event != "onload()" { + return; + } + } + _ => { } + } // Step 13. // TODO: If the script element has a `charset` attribute, then let the script block's // character encoding for this script element be the result of getting an encoding from the diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.html.ini deleted file mode 100644 index 7f199914f0f..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.html.ini +++ /dev/null @@ -1,38 +0,0 @@ -[script-for-event.html] - type: testharness - [Script 0] - expected: FAIL - - [Script 1] - expected: FAIL - - [Script 2] - expected: FAIL - - [Script 3] - expected: FAIL - - [Script 4] - expected: FAIL - - [Script 5] - expected: FAIL - - [Script 6] - expected: FAIL - - [Script 7] - expected: FAIL - - [Script 8] - expected: FAIL - - [Script 9] - expected: FAIL - - [Script 10] - expected: FAIL - - [Script 11] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.xhtml.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.xhtml.ini deleted file mode 100644 index 64ead721c2c..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-event.xhtml.ini +++ /dev/null @@ -1,5 +0,0 @@ -[script-for-event.xhtml] - type: testharness - [Scripts with for and event attributes should not run.] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-onload.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-onload.html.ini deleted file mode 100644 index 57edaf28ab9..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-for-onload.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[script-for-onload.html] - type: testharness - [Script for and onload attributes] - expected: FAIL - |