aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-05-13 06:55:19 -0400
committerbors-servo <release+servo@mozilla.com>2014-05-13 06:55:19 -0400
commita9f08fd7c4702e96fb993b8c28492ffb7037296d (patch)
tree9ce20fdf4f37c977b9792f1f1d67743f9c426d18 /src/components/script/html/hubbub_html_parser.rs
parentfbcfe78bf675ffb1fdbe549da3b96a0d1a5f0be8 (diff)
parentcb9d875aef37b9c28df37032328b016765672855 (diff)
downloadservo-a9f08fd7c4702e96fb993b8c28492ffb7037296d.tar.gz
servo-a9f08fd7c4702e96fb993b8c28492ffb7037296d.zip
auto merge of #2414 : Ms2ger/servo/parser-attribute, r=SimonSapin
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 38fc676ce08..46f047053f5 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -17,7 +17,9 @@ use html::cssparse::{StylesheetProvenance, UrlProvenance, spawn_css_parser};
use script_task::Page;
use hubbub::hubbub;
+use hubbub::hubbub::{NullNs, XLinkNs, XmlNs, XmlNsNs};
use servo_net::resource_task::{Load, Payload, Done, ResourceTask, load_whole_resource};
+use servo_util::namespace;
use servo_util::namespace::Null;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
use servo_util::task::spawn_named;
@@ -327,10 +329,17 @@ pub fn parse_html(page: &Page,
debug!("-- attach attrs");
for attr in tag.attributes.iter() {
- //FIXME: this should have proper error handling or explicitly drop
- // exceptions on the ground
- assert!(element.set_attr(attr.name.clone(),
- attr.value.clone()).is_ok());
+ let (namespace, prefix) = match attr.ns {
+ NullNs => (namespace::Null, None),
+ XLinkNs => (namespace::XLink, Some("xlink")),
+ XmlNs => (namespace::XML, Some("xml")),
+ XmlNsNs => (namespace::XMLNS, Some("xmlns")),
+ ns => fail!("Not expecting namespace {:?}", ns),
+ };
+ element.set_attribute_from_parser(attr.name.clone(),
+ attr.value.clone(),
+ namespace,
+ prefix.map(|p| p.to_owned()));
}
//FIXME: workaround for https://github.com/mozilla/rust/issues/13246;