Skip to content

Commit

Permalink
fix: raise CSS::SyntaxError if a pseudo-class is not an XPath Name
Browse files Browse the repository at this point in the history
Some pseudo-classes cannot be converted into an XPath function name,
and libxml2 will raise an Nokogiri::XML::XPath::SyntaxError at
query-time:

    nokogiri/xml/searchable.rb:238:in `evaluate': ERROR: Invalid expression: //*:div[nokogiri:-moz-drag-over(.)] (Nokogiri::XML::XPath::SyntaxError)

This change moves the error from query-time to parse-time, in the
hopes that this is more rescuable (and the error is more descriptive):

    nokogiri/css/parser_extras.rb:86:in `on_error': unexpected '-' after ':' (Nokogiri::CSS::SyntaxError)

Closes #3193
  • Loading branch information
flavorjones committed May 20, 2024
1 parent 2083f33 commit e2f2905
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 236 deletions.
Loading

0 comments on commit e2f2905

Please sign in to comment.