Class: LightningcssRb::AST::Selectors::PseudoElement

Inherits:
Base
  • Object
show all
Defined in:
lib/lightningcss_rb/ast/selectors/pseudo_element.rb

Constant Summary collapse

SIMPLE =
%w[
  after before first-line first-letter details-content target-text
  search-text marker cue cue-region view-transition picker-icon
  checkmark grammar-error spelling-error
].freeze
VENDOR_PREFIXED =
%w[selection placeholder backdrop file-selector-button].freeze

Instance Attribute Summary

Attributes inherited from Base

#node

Instance Method Summary collapse

Methods inherited from Base

from_ast, #initialize, node_attr_reader

Constructor Details

This class inherits a constructor from LightningcssRb::AST::Selectors::Base

Instance Method Details

#to_cssObject

rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lightningcss_rb/ast/selectors/pseudo_element.rb', line 17

def to_css # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize
  if SIMPLE.include?(kind)
    "::#{kind}"
  elsif VENDOR_PREFIXED.include?(kind)
    "::#{vendor_prefix_str(node[:vendorPrefix])}#{kind}"
  else
    case kind
    when "highlight-function"  then "::highlight(#{node[:name]})"
    when "cue-function"        then "::cue(#{render_selector(node[:selector])})"
    when "cue-region-function" then "::cue-region(#{render_selector(node[:selector])})"
    when "picker-function"     then "::picker(#{node[:identifier]})"
    when "slotted"             then "::slotted(#{render_selector(node[:selector])})"
    when "part"                then "::part(#{node[:names].join(" ")})"
    when "custom"              then "::#{node[:name]}"
    when "custom-function"     then "::#{node[:name]}()"
    when "view-transition-group", "view-transition-image-pair",
         "view-transition-old", "view-transition-new"
      "::#{kind}(#{view_transition_part(node[:part])})"
    when "webkit-scrollbar"
      "::-webkit-scrollbar#{webkit_scrollbar_suffix(node[:value])}"
    else
      "::#{kind}"
    end
  end
end

#to_sObject



43
# File 'lib/lightningcss_rb/ast/selectors/pseudo_element.rb', line 43

def to_s = to_css