aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/domparser.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2013-10-17 16:42:51 +0100
committerJosh Matthews <josh@joshmatthews.net>2013-10-24 18:07:46 +0200
commit4e47d59165d186d0938fe9ffd726b2c1b83d50f4 (patch)
tree20159443d4afcc00b75ab0b34766d77fbc0021a6 /src/components/script/dom/domparser.rs
parentb1c068b2034b8df2fab4a0943273c5a59bf759ed (diff)
downloadservo-4e47d59165d186d0938fe9ffd726b2c1b83d50f4.tar.gz
servo-4e47d59165d186d0938fe9ffd726b2c1b83d50f4.zip
Make Document a Node.
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)
+ }
}
}