class Nokogiri::CSS::XPathVisitor
When translating CSS
selectors to XPath queries with Nokogiri::CSS.xpath_for
, the XPathVisitor
class allows for changing some of the behaviors related to builtin xpath functions and quirks of HTML5
.
Public Class Methods
Source
# File lib/nokogiri/css/xpath_visitor.rb, line 57 def initialize(builtins: BuiltinsConfig::NEVER, doctype: DoctypeConfig::XML) unless BuiltinsConfig::VALUES.include?(builtins) raise(ArgumentError, "Invalid values #{builtins.inspect} for builtins: keyword parameter") end unless DoctypeConfig::VALUES.include?(doctype) raise(ArgumentError, "Invalid values #{doctype.inspect} for doctype: keyword parameter") end @builtins = builtins @doctype = doctype end
- Parameters
-
builtins:
(BuiltinsConfig
) Determine when to use Nokogiri’s built-in xpath functions for performance improvements. -
doctype:
(DoctypeConfig
) Make document-type-specific accommodations forCSS
queries.
- Returns
Public Instance Methods
Source
# File lib/nokogiri/css/xpath_visitor.rb, line 74 def config { builtins: @builtins, doctype: @doctype } end
- Returns
-
a Hash representing the configuration of the
XPathVisitor
, suitable for use as part of theCSS
cache key.