Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement <template> #7531

Merged
merged 6 commits into from Sep 8, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Implement adopting steps

  • Loading branch information
nox committed Sep 8, 2015
commit e2b8febfd523ad26a72be27b85c3fc2ff89ea088
@@ -1415,24 +1415,19 @@ impl Node {
// https://dom.spec.whatwg.org/#concept-node-adopt
pub fn adopt(node: &Node, document: &Document) {
// Step 1.
let parent_node = node.GetParentNode();
match parent_node {
Some(ref parent) => {
Node::remove(node, parent, SuppressObserver::Unsuppressed);
}
None => (),
}

let old_doc = node.owner_doc();
// Step 2.
let node_doc = document_from_node(node);
if node_doc.r() != document {
node.remove_self();
if &*old_doc != document {
// Step 3.
for descendant in node.traverse_preorder() {
descendant.r().set_owner_doc(document);
descendant.set_owner_doc(document);
}
// Step 4.
for descendant in node.traverse_preorder() {
vtable_for(&descendant).adopting_steps(&old_doc);
}
}

// Step 3.
// If node is an element, it is _affected by a base URL change_.
}

// https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
@@ -98,7 +98,14 @@ pub trait VirtualMethods {
}
}

/// https://dom.spec.whatwg.org/#concept-node-clone (step 5)
/// https://dom.spec.whatwg.org/#concept-node-adopt-ext
fn adopting_steps(&self, old_doc: &Document) {
if let Some(ref s) = self.super_type() {
s.adopting_steps(old_doc);
}
}

/// https://dom.spec.whatwg.org/#concept-node-clone-ext
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag) {
if let Some(ref s) = self.super_type() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.