-
Notifications
You must be signed in to change notification settings - Fork 580
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
Mojo::DOM doesn't handle nested descendant selectors correctly #2025
Comments
Selectors match right to left, so the slow matching behaviour makes sense. While the performance could be better, i'm not gonna call this a bug. |
I call it a bug for two reasons:
So: If you take seemingly harmless code using a selector like |
Right to left matching is actually standard, and used just the same in browsers. If you get better results there it merely means that they have additional optimisations for the case. |
I mean, I get better results both right-to-left and left-to-right: https://github.com/mauke/HTML-Blitz/blob/9f0496ac28260675f8bbaabb68ddad477c09231a/t/selector-combinators.t#L155-L169 (The "optimisation" here is not to use backtracking; cf. https://research.swtch.com/glob.) |
PRs with backtracking optimisations would of course be very welcome. |
Steps to reproduce the behavior
Expected behavior
Test passes.
Since the document does not contain an element with
id="gobbledygook"
, the search should fail immediately.Actual behavior
Test hangs; doesn't finish.
The text was updated successfully, but these errors were encountered: