mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb: Minor cleanups in NodeIterator and TreeWalker
- Use TRY() when invoking the NodeFilter - Say "nullptr" instead of "RefPtr<Node> {}"
This commit is contained in:
parent
ccee8953d0
commit
a0b0b29fa1
2 changed files with 8 additions and 12 deletions
|
@ -65,17 +65,15 @@ JS::ThrowCompletionOr<RefPtr<Node>> TreeWalker::parent_node()
|
|||
// 2. If node is non-null and filtering node within this returns FILTER_ACCEPT,
|
||||
// then set this’s current to node and return node.
|
||||
if (node) {
|
||||
auto result = filter(*node);
|
||||
if (result.is_throw_completion())
|
||||
return result.release_error();
|
||||
if (result.value() == NodeFilter::FILTER_ACCEPT) {
|
||||
auto result = TRY(filter(*node));
|
||||
if (result == NodeFilter::FILTER_ACCEPT) {
|
||||
m_current = *node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RefPtr<Node> {};
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-treewalker-firstchild
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue