Class: LightningcssRb::AST::Selectors::Attribute
- Defined in:
- lib/lightningcss_rb/ast/selectors/attribute.rb
Constant Summary collapse
- OPERATORS =
{ "equal" => "=", "includes" => "~=", "dash-match" => "|=", "prefix" => "^=", "substring" => "*=", "suffix" => "$=" }.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#to_css ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods inherited from Base
from_ast, #initialize, node_attr_reader, #to_s
Constructor Details
This class inherits a constructor from LightningcssRb::AST::Selectors::Base
Instance Method Details
#to_css ⇒ Object
rubocop:disable Metrics/MethodLength
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lightningcss_rb/ast/selectors/attribute.rb', line 18 def to_css # rubocop:disable Metrics/MethodLength ns = namespace_prefix s = "[#{ns}#{name}" if operation op = OPERATORS[operation[:operator]] val = operation[:value] s += "#{op}\"#{val}\"" case operation[:caseSensitivity] when "ascii-case-insensitive" then s += " i" when "explicit-case-sensitive" then s += " s" end end "#{s}]" end |