aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/domparser.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-10-24 09:15:55 -0700
committerbors-servo <release+servo@mozilla.com>2013-10-24 09:15:55 -0700
commit13644ccab1942c053c3fd5e4a19bb75d9ebe8739 (patch)
tree38d66cafb51053d5c5d7304521e8948a828f1ca7 /src/components/script/dom/domparser.rs
parenta9e23299395b59edbf8bd0a65f7a088cb03fda76 (diff)
parent4e47d59165d186d0938fe9ffd726b2c1b83d50f4 (diff)
downloadservo-13644ccab1942c053c3fd5e4a19bb75d9ebe8739.tar.gz
servo-13644ccab1942c053c3fd5e4a19bb75d9ebe8739.zip
auto merge of #1079 : jdm/servo/docnode, r=jdm,metajack
The bit I don't like about these changes is that I ended up hiding the document node from the CSS selecting/matching code, so it continues thinking of the document's first child as the root. When I tried to send the full tree including the document node to layout, the layout code refused to create any child flows. When I sent the document's first child without hiding the document, it saw inherited values for properties like font-family, and later tried to treat the document node as an Element when searching for named nodes.
Diffstat (limited to 'src/components/script/dom/domparser.rs')
-rw-r--r--src/components/script/dom/domparser.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/components/script/dom/domparser.rs b/src/components/script/dom/domparser.rs
index cc3db3e07a7..a29cdfb32ff 100644
--- a/src/components/script/dom/domparser.rs
+++ b/src/components/script/dom/domparser.rs
@@ -4,13 +4,9 @@
use dom::bindings::codegen::DOMParserBinding;
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
-use dom::bindings::utils::{DOMString, Fallible, Reflector, Reflectable};
+use dom::bindings::utils::{DOMString, Fallible, Reflector, Reflectable, FailureUnknown};
use dom::document::{AbstractDocument, Document, XML};
-use dom::element::HTMLHtmlElementTypeId;
use dom::htmldocument::HTMLDocument;
-use dom::htmlelement::HTMLElement;
-use dom::htmlhtmlelement::HTMLHtmlElement;
-use dom::node::Node;
use dom::window::Window;
pub struct DOMParser {
@@ -41,25 +37,17 @@ impl DOMParser {
ty: DOMParserBinding::SupportedType)
-> Fallible<AbstractDocument> {
let cx = self.owner.get_cx();
- let document = match ty {
+ match ty {
Text_html => {
- HTMLDocument::new(self.owner)
+ Ok(HTMLDocument::new(self.owner))
}
Text_xml => {
- AbstractDocument::as_abstract(cx, @mut Document::new(self.owner, XML))
+ Ok(AbstractDocument::as_abstract(cx, @mut Document::new(self.owner, XML)))
}
_ => {
- fail!("unsupported document type")
+ Err(FailureUnknown)
}
- };
-
- let root = @HTMLHtmlElement {
- htmlelement: HTMLElement::new(HTMLHtmlElementTypeId, ~"html", document)
- };
- let root = unsafe { Node::as_abstract_node(cx, root) };
- document.set_root(root);
-
- Ok(document)
+ }
}
}