Class: Hexp::CssSelector::CommaSequence

Inherits:
Object
  • Object
show all
Includes:
Members
Defined in:
lib/hexp/css_selector.rb

Overview

Top level parse tree node of a CSS selector

Contains a number of Sequence objects

For example : `span .big, a'

Instance Attribute Summary

Attributes included from Members

#members

Instance Method Summary (collapse)

Methods included from Members

included, #initialize, #inspect

Instance Method Details

- (Boolean) matches?(element)

Does any sequence in this comma sequence fully match the given element

This method does not recurse, it only checks if any of the sequences in this CommaSequence with a length of one can fully match the given element.

Parameters:

Returns:

  • (Boolean)


82
83
84
85
86
87
# File 'lib/hexp/css_selector.rb', line 82

def matches?(element)
  members.any? do |sequence|
    sequence.members.count == 1 &&
      sequence.head_matches?(element)
  end
end