Revert "Make Document a Node." for breaking Acid1

This reverts commit 4e47d59165.

Conflicts:

	src/components/script/dom/domparser.rs
This commit is contained in:
Patrick Walton 2013-10-24 15:08:09 -07:00
parent bce5285506
commit baba35adc9
10 changed files with 96 additions and 94 deletions

View file

@ -4,9 +4,13 @@
use dom::bindings::codegen::DOMParserBinding;
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
use dom::bindings::utils::{DOMString, Fallible, Reflector, Reflectable, FailureUnknown, reflect_dom_object};
use dom::bindings::utils::{DOMString, Fallible, Reflector, Reflectable, reflect_dom_object};
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;
use js::jsapi::{JSContext, JSObject};
@ -38,17 +42,25 @@ impl DOMParser {
ty: DOMParserBinding::SupportedType)
-> Fallible<AbstractDocument> {
let cx = self.owner.get_cx();
match ty {
let document = match ty {
Text_html => {
Ok(HTMLDocument::new(self.owner))
HTMLDocument::new(self.owner)
}
Text_xml => {
Ok(AbstractDocument::as_abstract(cx, @mut Document::new(self.owner, XML)))
AbstractDocument::as_abstract(cx, @mut Document::new(self.owner, XML))
}
_ => {
Err(FailureUnknown)
fail!("unsupported document type")
}
}
};
let root = @HTMLHtmlElement {
htmlelement: HTMLElement::new(HTMLHtmlElementTypeId, ~"html", document)
};
let root = unsafe { Node::as_abstract_node(cx, root) };
document.set_root(root);
Ok(document)
}
}