Class Sass::Selector::Pseudo
In: lib/sass/selector/pseudo.rb
Parent: Simple

A pseudoclass (e.g. `:visited`) or pseudoelement (e.g. `::first-line`) selector. It can have arguments (e.g. `:nth-child(2n+1)`) which can contain selectors (e.g. `:nth-child(2n+1 of .foo)`).

Methods

Constants

ACTUALLY_ELEMENTS = %w(after before first-line first-letter).to_set   Some pseudo-class-syntax selectors are actually considered pseudo-elements and must be treated differently. This is a list of such selectors.

@return [Set<String>]

Attributes

arg  [R]  The argument to the selector, or `nil` if no argument was given.

@return [String, nil]

name  [R]  The name of the selector.

@return [String]

selector  [R]  The selector argument, or `nil` if no selector exists.

If this and \{arg\} are both set, \{arg\} is considered a non-selector prefix.

@return [CommaSequence]

syntactic_type  [R]  Like \{type}, but returns the type of selector this looks like, rather than the type it is semantically. This only differs from type for selectors in \{ACTUALLY_ELEMENTS}.

@return [Symbol]

Public Class methods

@param syntactic_type [Symbol] See \{syntactic_type} @param name [String] See \{name} @param arg [nil, String] See \{arg} @param selector [nil, CommaSequence] See \{selector}

Public Instance methods

Like \{name\}, but without any vendor prefix.

@return [String]

Returns whether or not this selector matches all elements that the given selector matches (as well as possibly more).

@example

  (.foo).superselector?(.foo.bar) #=> true
  (.foo).superselector?(.bar) #=> false

@param their_sseq [SimpleSequence] @param parents [Array<SimpleSequence, String>] The parent selectors of `their_sseq`, if any. @return [Boolean]

@see Selector#to_s

The type of the selector. `:class` if this is a pseudoclass selector, `:element` if it‘s a pseudoelement.

@return [Symbol]

Returns `nil` if this is a pseudoelement selector and `sels` contains a pseudoelement selector different than this one.

@see SimpleSequence#unify

Returns a copy of this with \{selector} set to \{new_selector}.

@param new_selector [CommaSequence] @return [Array<Simple>]

[Validate]