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

fix: css pseudo-class error raised by XPathVisitor #3223

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

After some thought, I decided I didn't like the solution to #3193 introduced in #3197, in which the exception was raised by the CSS parser, because it's an XPath translation problem and not a CSS problem.

This PR reverts that change, and instead raises the exception from the XPathVisitor class when it tries to translate the pseudo-class selector or function into an XPath function call.

Have you included adequate test coverage?

Yes.

Does this change affect the behavior of either the C or the Java implementations?

N/A

This is an alternative to #3197 (which was reverted) in which the
exception is raised from the XPathVisitor and not the CSS
Parser.

Semantically, this is valid CSS, and so the Parser shouldn't
raise. But it is invalid XPath, and so it's the responsibility of the
Visitor to raise.

Closes #3193.
lib/nokogiri/css/tokenizer.rb Dismissed Show dismissed Hide dismissed
@flavorjones flavorjones merged commit 47884cc into main Jun 11, 2024
132 checks passed
@flavorjones flavorjones deleted the flavorjones-move-css-pseudo-class-error-to-visitor branch June 11, 2024 14:41
@flavorjones flavorjones added this to the v1.17.0 milestone Jun 14, 2024
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.

1 participant