aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-03-14 12:00:42 +0100
committerMs2ger <ms2ger@gmail.com>2014-03-20 19:42:42 +0100
commit038a195eade5476601a183f4b74e669f8619d6a4 (patch)
tree1f956099ff9997778b5d1992dd9e15a8ba325d91 /src/components/script/html/hubbub_html_parser.rs
parent0265fb9784baff3ea025198f3e5e73e6b81fe18e (diff)
downloadservo-038a195eade5476601a183f4b74e669f8619d6a4.tar.gz
servo-038a195eade5476601a183f4b74e669f8619d6a4.zip
Move attributes-related functions onto JS<Element>.
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 1d07c4228d4..5b6e1e80bb2 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -7,7 +7,7 @@ use dom::bindings::codegen::InheritTypes::HTMLIFrameElementCast;
use dom::bindings::js::JS;
use dom::bindings::utils::Reflectable;
use dom::document::Document;
-use dom::element::{HTMLLinkElementTypeId, HTMLIFrameElementTypeId};
+use dom::element::{AttributeHandlers, HTMLLinkElementTypeId, HTMLIFrameElementTypeId};
use dom::htmlelement::HTMLElement;
use dom::htmlheadingelement::{Heading1, Heading2, Heading3, Heading4, Heading5, Heading6};
use dom::htmliframeelement::IFrameSize;
@@ -337,20 +337,18 @@ pub fn parse_html(page: &Page,
debug!("-- attach attrs");
for attr in tag.attributes.iter() {
- let elem = element.clone();
//FIXME: this should have proper error handling or explicitly drop
// exceptions on the ground
- assert!(element.get_mut().set_attr(&elem,
- attr.name.clone(),
- attr.value.clone()).is_ok());
+ assert!(element.set_attr(attr.name.clone(),
+ attr.value.clone()).is_ok());
}
// Spawn additional parsing, network loads, etc. from tag and attrs
match element.get().node.type_id {
// Handle CSS style sheets from <link> elements
ElementNodeTypeId(HTMLLinkElementTypeId) => {
- match (element.get().get_attribute(Null, "rel"),
- element.get().get_attribute(Null, "href")) {
+ match (element.get_attribute(Null, "rel"),
+ element.get_attribute(Null, "href")) {
(Some(ref rel), Some(ref href)) if rel.get()
.value_ref()
.split(HTML_SPACE_CHARACTERS.
@@ -372,7 +370,7 @@ pub fn parse_html(page: &Page,
HTMLIFrameElementCast::to(&element).unwrap();
let sandboxed = iframe_element.get().is_sandboxed();
let elem: JS<Element> = ElementCast::from(&iframe_element);
- let src_opt = elem.get().get_attribute(Null, "src").map(|x| x.get().Value());
+ let src_opt = elem.get_attribute(Null, "src").map(|x| x.get().Value());
for src in src_opt.iter() {
let iframe_url = parse_url(*src, Some(url2.clone()));
iframe_element.get_mut().set_frame(iframe_url.clone());
@@ -463,7 +461,7 @@ pub fn parse_html(page: &Page,
complete_script: |script| {
unsafe {
let script: JS<Element> = NodeWrapping::from_hubbub_node(script);
- match script.get().get_attribute(Null, "src") {
+ match script.get_attribute(Null, "src") {
Some(src) => {
debug!("found script: {:s}", src.get().Value());
let new_url = parse_url(src.get().value_ref(), Some(url3.clone()));