aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/treewalker.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-06-23 15:52:50 +0200
committerMs2ger <ms2ger@gmail.com>2015-06-23 15:52:50 +0200
commitdc02ebacc6d0a5956105dba1b29968d27439e4e1 (patch)
tree3909e6a41eeb4ed80ce6ad028a695f3ce10729f7 /components/script/dom/treewalker.rs
parent3fbf0161420b86c62328a3100f84e74823c32961 (diff)
downloadservo-dc02ebacc6d0a5956105dba1b29968d27439e4e1.tar.gz
servo-dc02ebacc6d0a5956105dba1b29968d27439e4e1.zip
Update 'traverse children' to the latest spec.
Diffstat (limited to 'components/script/dom/treewalker.rs')
-rw-r--r--components/script/dom/treewalker.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index a85530df31e..84f91a598b8 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -298,14 +298,16 @@ impl<'a> PrivateTreeWalkerHelpers for &'a TreeWalker {
{
// "To **traverse children** of type *type*, run these steps:"
// "1. Let node be the value of the currentNode attribute."
- // "2. Set node to node's first child if type is first, and node's last child if type is last."
let cur = self.current_node.get().root();
+
+ // "2. Set node to node's first child if type is first, and node's last child if type is last."
+ // "3. If node is null, return null."
let mut node = match next_child(cur.r()) {
Some(node) => node,
None => return Ok(None),
};
- // 3. Main: While node is not null, run these substeps:
+ // 4. Main: Repeat these substeps:
'main: loop {
// "1. Filter node and let result be the return value."
let result = try!(self.accept_node(node.r()));
@@ -331,7 +333,7 @@ impl<'a> PrivateTreeWalkerHelpers for &'a TreeWalker {
},
_ => {}
}
- // "4. While node is not null, run these substeps:"
+ // "4. Repeat these subsubsteps:"
loop {
// "1. Let sibling be node's next sibling if type is next,
// and node's previous sibling if type is previous."
@@ -359,8 +361,6 @@ impl<'a> PrivateTreeWalkerHelpers for &'a TreeWalker {
}
}
}
- // "4. Return null."
- Ok(None)
}
// https://dom.spec.whatwg.org/#concept-traverse-siblings