Skip to content

Commit

Permalink
src/dom_tree/traversal.rs: update Traversal::find_descendant_elements
Browse files Browse the repository at this point in the history
  • Loading branch information
niklak committed Jan 15, 2025
1 parent 19adebf commit 9057e01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dom_tree/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ impl Traversal {
let mut candidates = vec![];

while let Some(node_id) = ops.pop() {
// Since these nodes are descendants of the primary node and
// were previously extracted from the `Tree` with only elements remaining,
// `else` case should be unreachable.
let Some(node_name) = nodes
.get(node_id.value)
.and_then(|n| n.as_element().map(|el| el.node_name()))
else {
continue;
unreachable!();

Check warning on line 113 in src/dom_tree/traversal.rs

View check run for this annotation

Codecov / codecov/patch

src/dom_tree/traversal.rs#L113

Added line #L113 was not covered by tests
};

if node_name.as_ref() == *name {
Expand Down

0 comments on commit 9057e01

Please sign in to comment.