lib/nokogiri/css/node.rb in nokogiri-maglev--1.5.2 vs lib/nokogiri/css/node.rb in nokogiri-maglev--1.5.3

- old
+ new

@@ -1,8 +1,10 @@ module Nokogiri module CSS class Node + ALLOW_COMBINATOR_ON_SELF = [:DIRECT_ADJACENT_SELECTOR, :FOLLOWING_SELECTOR, :CHILD_SELECTOR] + # Get the type of this node attr_accessor :type # Get the value of this node attr_accessor :value @@ -19,9 +21,10 @@ ### # Convert this CSS node to xpath with +prefix+ using +visitor+ def to_xpath prefix = '//', visitor = XPathVisitor.new self.preprocess! + prefix = '.' if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil? prefix + visitor.accept(self) end # Preprocess this node tree def preprocess!