Skip to content

Conversation

@adamreichold
Copy link
Member

Note that we cannot easily extend NodeRef as the types comes from ego-tree, not scaper.

(We could use an extension trait and such, but I think starting from an ElementRef is common enough, especially when using these iterators to stay within the elements.)

Closes #157

@Caellian
Copy link

Caellian commented Nov 4, 2023

Why not add the trait (e.g. TraverseElements) to extend NodeRef as well and then implement added functions for ElementRef through that?

I wouldn't say it closes #157 as it currently adresses only half of the suggestion.

@adamreichold
Copy link
Member Author

adamreichold commented Nov 4, 2023

Why not add the trait (e.g. TraverseElements) to extend NodeRef as well and then implement added functions for ElementRef through that?

I wouldn't say it closes #157 as it currently adresses only half of the suggestion.

As written above

(We could use an extension trait and such, but I think starting from an ElementRef is common enough, especially when using these iterators to stay within the elements.)

i.e. I don't think the additional complexity is warranted especially since one will most likely stay within the ElementRef-typed world using these traversal helpers.

@cfvescovo
Copy link
Member

LGTM

@cfvescovo cfvescovo merged commit 509bcb3 into rust-scraper:master Nov 9, 2023
@adamreichold adamreichold deleted the element-iterators branch November 9, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make element traversal more convenient

3 participants