Class: Dommy::Internal::SelectorAST::CompoundSelector

Inherits:
Struct
  • Object
show all
Defined in:
lib/dommy/internal/selector_ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pseudo_elementObject

Returns the value of attribute pseudo_element

Returns:

  • (Object)

    the current value of pseudo_element



57
58
59
# File 'lib/dommy/internal/selector_ast.rb', line 57

def pseudo_element
  @pseudo_element
end

#subclass_selectorsObject

Returns the value of attribute subclass_selectors

Returns:

  • (Object)

    the current value of subclass_selectors



57
58
59
# File 'lib/dommy/internal/selector_ast.rb', line 57

def subclass_selectors
  @subclass_selectors
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



57
58
59
# File 'lib/dommy/internal/selector_ast.rb', line 57

def type
  @type
end

Instance Method Details

#specificityObject



62
63
64
65
66
67
# File 'lib/dommy/internal/selector_ast.rb', line 62

def specificity
  sum = type ? type.specificity : ZERO
  subclass_selectors.each { |selector| sum += selector.specificity }
  sum += pseudo_element.specificity if pseudo_element
  sum
end

#without_pseudo_elementObject



58
59
60
# File 'lib/dommy/internal/selector_ast.rb', line 58

def without_pseudo_element
  self.class.new(type, subclass_selectors, nil)
end