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: regression with XPath attributes in CSS selectors #2422

Merged
merged 7 commits into from Jan 13, 2022

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

Issue #2419 reported that a regression in v1.13.0 that raised an Nokogiri::XML::XPath::SyntaxError when parsing XPath attributes mixed into the CSS query, for example node.css("img/@href").

Although this mash-up of XPath and CSS syntax previously worked unintentionally, it is now an officially supported feature and is documented as such.

Have you included adequate test coverage?

Yes!

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

No.

so it's easier to do focused test runs
This commit removes "@" from the IDENT token so that we can create a
new grammar rule in the parser for XPath attributes.

Fixes #2419
All attribute references end up as an :ATTRIB_NAME node without the
"@" present, which simplifies the XPath visitor code.
And officially document the XPath attribute extensions to CSS selector
syntax that we support.

See #2419 for context
@CvX
Copy link

CvX commented Jan 12, 2022

On my end I can confirm this makes Discourse specs pass again! 🎉

@flavorjones flavorjones merged commit 9b8fd5a into main Jan 13, 2022
@flavorjones flavorjones deleted the 2419-css-at-attribute-syntax branch January 13, 2022 01:59
flavorjones added a commit that referenced this pull request Jan 13, 2022
…ibute-syntax

Backport #2422: fix: regression with XPath attributes in CSS selectors

branch created by cherry-picking 3240a07..538e11d
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.

None yet

2 participants