class Nokogiri::XML::Node

def matches? selector

Returns true if this Node matches +selector+
##
def matches? selector
  ancestors.last.search(selector).include?(self)
end