Class: Dommy::Internal::SelectorAST::PseudoClass

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argumentObject

Returns the value of attribute argument

Returns:

  • (Object)

    the current value of argument



90
91
92
# File 'lib/dommy/internal/selector_ast.rb', line 90

def argument
  @argument
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



90
91
92
# File 'lib/dommy/internal/selector_ast.rb', line 90

def name
  @name
end

Instance Method Details

#specificityObject



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/dommy/internal/selector_ast.rb', line 91

def specificity
  case name
  when "is", "not", "has"
    argument_specificity
  when "where"
    ZERO
  when "nth-child", "nth-last-child"
    CLASS + (argument&.of_selector_list&.specificity || ZERO)
  else
    CLASS
  end
end