mirror of
https://github.com/servo/servo.git
synced 2025-10-17 00:39:15 +01:00
Revert "Make Document a Node." for breaking Acid1
This reverts commit 4e47d59165
.
Conflicts:
src/components/script/dom/domparser.rs
This commit is contained in:
parent
bce5285506
commit
baba35adc9
10 changed files with 96 additions and 94 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue