mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Implemented Document.importNode
Spec: http://dom.spec.whatwg.org/#dom-document-importnode
This commit is contained in:
parent
f34a64049a
commit
8a457a2caa
4 changed files with 24 additions and 3 deletions
|
@ -28,6 +28,7 @@ use dom::htmlhtmlelement::HTMLHtmlElement;
|
|||
use dom::htmltitleelement::HTMLTitleElement;
|
||||
use dom::mouseevent::MouseEvent;
|
||||
use dom::node::{Node, ElementNodeTypeId, DocumentNodeTypeId, NodeHelpers, INode};
|
||||
use dom::node::{CloneChildren, DoNotCloneChildren};
|
||||
use dom::text::Text;
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::uievent::UIEvent;
|
||||
|
@ -294,6 +295,22 @@ impl Document {
|
|||
Ok(ProcessingInstruction::new(target, data, abstract_self))
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-importnode
|
||||
pub fn ImportNode(&self, abstract_self: &JS<Document>, node: &JS<Node>, deep: bool) -> Fallible<JS<Node>> {
|
||||
// Step 1.
|
||||
if node.is_document() {
|
||||
return Err(NotSupported);
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
let clone_children = match deep {
|
||||
true => CloneChildren,
|
||||
false => DoNotCloneChildren
|
||||
};
|
||||
|
||||
Ok(Node::clone(node, Some(abstract_self), clone_children))
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-createevent
|
||||
pub fn CreateEvent(&self, interface: DOMString) -> Fallible<JS<Event>> {
|
||||
match interface.as_slice() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue