Class Sass::Selector::SimpleSequence
In: lib/sass/selector/simple_sequence.rb
Parent: AbstractSequence

A unseparated sequence of selectors that all apply to a single element. For example, `.foo#bar[attr=baz]` is a simple sequence of the selectors `.foo`, `bar`, and `[attr=baz]`.

Methods

Attributes

members  [RW]  The array of individual selectors.

@return [Array<Simple>]

source_range  [RW]  This sequence source range.

@return [Sass::Source::Range]

sources  [RW]  The extending selectors that caused this selector sequence to be generated. For example:
    a.foo { ... }
    b.bar {@extend a}
    c.baz {@extend b}

The generated selector `b.foo.bar` has `{b.bar}` as its `sources` set, and the generated selector `c.foo.bar.baz` has `{b.bar, c.baz}` as its `sources` set.

This is populated during the {Sequence#do_extend} process.

@return {Set<Sequence>}

subject  [W]  @see \{subject?}

Public Class methods

@param selectors [Array<Simple>] See \{members} @param subject [Boolean] See \{subject?} @param source_range [Sass::Source::Range]

Public Instance methods

Returns the element or universal selector in this sequence, if it exists.

@return [Element, Universal, nil]

Non-destructively extends this selector with the extensions specified in a hash (which should come from {Sass::Tree::Visitors::Cssize}).

@param extends [{Selector::Simple =>

                 Sass::Tree::Visitors::Cssize::Extend}]
  The extensions to perform on this selector

@param parent_directives [Array<Sass::Tree::DirectiveNode>]

  The directives containing this selector.

@param seen [Set<Array<Selector::Simple>>]

  The set of simple sequences that are currently being replaced.

@param original [Boolean]

  Whether this is the original selector being extended, as opposed to
  the result of a previous extension that's being re-extended.

@return [Array<Sequence>] A list of selectors generated

  by extending this selector with `extends`.

@see CommaSequence#do_extend

Returns a string representation of the sequence. This is basically the selector string.

@return [String]

Resolves the {Parent} selectors within this selector by replacing them with the given parent selector, handling commas appropriately.

@param super_cseq [CommaSequence] The parent selector @return [CommaSequence] This selector, with parent references resolved @raise [Sass::SyntaxError] If a parent selector is invalid

Returns the non-base, non-pseudo-element selectors in this sequence.

@return [Set<Simple>]

Whether or not this compound selector is the subject of the parent selector; that is, whether it is prepended with `$` and represents the actual element that will be selected.

@return [Boolean]

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]

Unifies this selector with another {SimpleSequence}, returning another `SimpleSequence` that is a subselector of both input selectors.

@param other [SimpleSequence] @return [SimpleSequence, nil] A {SimpleSequence} matching both `sels` and this selector,

  or `nil` if this is impossible (e.g. unifying `#foo` and `#bar`)

@raise [Sass::SyntaxError] If this selector cannot be unified.

  This will only ever occur when a dynamic selector,
  such as {Parent} or {Interpolation}, is used in unification.
  Since these selectors should be resolved
  by the time extension and unification happen,
  this exception will only ever be raised as a result of programmer error

Return a copy of this simple sequence with `sources` merged into the {SimpleSequence#sources} set.

@param sources [Set<Sequence>] @return [SimpleSequence]

[Validate]