diff options
author | Prabhjyot Singh Sodhi <prabhjyotsingh95@gmail.com> | 2015-02-07 15:32:24 +0530 |
---|---|---|
committer | Prabhjyot Singh Sodhi <prabhjyotsingh95@gmail.com> | 2015-02-21 04:58:27 +0530 |
commit | 44e2e2747cc5c5a786b068475bec1031bbb52456 (patch) | |
tree | 20ecd337c1687022cf7512fc048328a6a55ec6ad /components/script/dom/htmlscriptelement.rs | |
parent | 4ab928728e3d65ac4c6ca72cd6c8aa0c75fde33b (diff) | |
download | servo-44e2e2747cc5c5a786b068475bec1031bbb52456.tar.gz servo-44e2e2747cc5c5a786b068475bec1031bbb52456.zip |
implementing step 12 of 'prepare a script' algorithm
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 20 |
1 files changed, 18 insertions, 2 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 |