Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore the behavior of cssSelector before v1.16.2 for elements with an id #2283

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

PhuNH
Copy link
Contributor

@PhuNH PhuNH commented Mar 9, 2025

Fixes #2282

  • Utilize id for not only the element itself, but also for its parent elements;
  • Stop the processing when encountering an element with a unique id.

In case of an extremely deeply nested element, which is the reason for the changes in v1.16.2, this can possibly greatly reduce the size of the output of cssSelector if one of the element's parents has an id.

@jhy jhy self-assigned this Mar 10, 2025
@jhy jhy added the improvement An improvement / new feature idea label Mar 10, 2025
@jhy jhy added this to the 1.19.2 milestone Mar 10, 2025
@jhy jhy merged commit 062d190 into jhy:master Mar 10, 2025
12 checks passed
@jhy
Copy link
Owner

jhy commented Mar 10, 2025

Thanks! Merged. I tweaked the impl a little to not have to call id() and ownerDoc() as much.

@PhuNH PhuNH deleted the cssselector-id branch March 10, 2025 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An improvement / new feature idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cssSelector behavior changed since v1.16.2
2 participants