move prefix and ns into XPathVisitor#3225
Merged
flavorjones merged 4 commits intomainfrom Jun 11, 2024
Merged
Conversation
Previously we've been handling it as a separate input to the CSS.xpath_for method. This simplifies the code and the parser cache key.
Previously this was passed into CSS::Parser.new and used during the parsing phase. Now it's passed into the visitor and we do namespace munging there, where it should be. Note the namespaces has also been moved out of the top-level parser cache key into XPathVisitor#config. Finally, note that namespaces is nil by default (instead of being an empty Hash) which should prevent some unnecessary object creation in the most common use cases.
35ec2cf to
99be08f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem is this PR intended to solve?
Refactoring the CSS parser internals a bit to separate concerns between the parser and the xpath visitor.
Have you included adequate test coverage?
This is mostly a refactor of internals, existing test coverage is mostly sufficient, and I added some tests for edge cases and new attributes.
Does this change affect the behavior of either the C or the Java implementations?
N/A