mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
Update 'traverse children' to the latest spec.
This commit is contained in:
parent
3fbf016142
commit
dc02ebacc6
1 changed files with 5 additions and 5 deletions
|
@ -298,14 +298,16 @@ impl<'a> PrivateTreeWalkerHelpers for &'a TreeWalker {
|
||||||
{
|
{
|
||||||
// "To **traverse children** of type *type*, run these steps:"
|
// "To **traverse children** of type *type*, run these steps:"
|
||||||
// "1. Let node be the value of the currentNode attribute."
|
// "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();
|
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()) {
|
let mut node = match next_child(cur.r()) {
|
||||||
Some(node) => node,
|
Some(node) => node,
|
||||||
None => return Ok(None),
|
None => return Ok(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3. Main: While node is not null, run these substeps:
|
// 4. Main: Repeat these substeps:
|
||||||
'main: loop {
|
'main: loop {
|
||||||
// "1. Filter node and let result be the return value."
|
// "1. Filter node and let result be the return value."
|
||||||
let result = try!(self.accept_node(node.r()));
|
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 {
|
loop {
|
||||||
// "1. Let sibling be node's next sibling if type is next,
|
// "1. Let sibling be node's next sibling if type is next,
|
||||||
// and node's previous sibling if type is previous."
|
// 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
|
// https://dom.spec.whatwg.org/#concept-traverse-siblings
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue