aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2013-08-06 14:40:30 -0600
committerJack Moffitt <jack@metajack.im>2013-08-06 20:18:03 -0600
commit4d71918366f2971ec1b042f79767767eff2e0a37 (patch)
treea75e913c7168f90553314b4520e8b0ac5d054651 /src/components/script/html/hubbub_html_parser.rs
parent1337583878fa9e65e54bf1ee3373c18cd2ca49ec (diff)
downloadservo-4d71918366f2971ec1b042f79767767eff2e0a37.tar.gz
servo-4d71918366f2971ec1b042f79767767eff2e0a37.zip
Implement support for style attributes.
If a style attribute is given for a node, it is parsed and attached to the Element. When selector matching runs on the Element, the style attribute's stylesheet is passed in. Fixes #86.
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 8bb6afd22b2..931f93c52c6 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -314,6 +314,13 @@ pub fn parse_html(cx: *JSContext,
do node.as_mut_element |element| {
for tag.attributes.iter().advance |attr| {
element.attrs.push(Attr::new(attr.name.clone(), attr.value.clone()));
+
+ if "style" == attr.name {
+ element.style_attribute = Some(
+ Stylesheet::from_attribute(
+ url::from_str("http://www.example.com/").unwrap(),
+ attr.value));
+ }
}
}
@@ -374,7 +381,6 @@ pub fn parse_html(cx: *JSContext,
}
}
- //TODO (Issue #86): handle inline styles ('style' attr)
_ => {}
}