aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-02-20 17:03:53 -0700
committerbors-servo <metajack+bors@gmail.com>2015-02-20 17:03:53 -0700
commite39e75865bdcef639b47a6a448a84cf2ca4894cf (patch)
tree622022b42ba3d905499be82c3298b5f5cfa1073c /components
parentff10deb81415d2d1822166d1c0ca0d9f484f48c6 (diff)
parent44e2e2747cc5c5a786b068475bec1031bbb52456 (diff)
downloadservo-e39e75865bdcef639b47a6a448a84cf2ca4894cf.tar.gz
servo-e39e75865bdcef639b47a6a448a84cf2ca4894cf.zip
auto merge of #4865 : psdh/servo/prepscript, r=Ms2ger
#4176
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/htmlscriptelement.rs20
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