Class Sass::Selector::Sequence
In: lib/sass/selector/sequence.rb
Parent: AbstractSequence

An operator-separated sequence of {SimpleSequence simple selector sequences}.

Methods

Attributes

members  [R]  The array of {SimpleSequence simple selector sequences}, operators, and newlines. The operators are strings such as `"+"` and `">"` representing the corresponding CSS operators, or interpolated SassScript. Newlines are also newline strings; these aren‘t semantically relevant, but they do affect formatting.

@return [Array<SimpleSequence, String|Array<Sass::Tree::Node, String>>]

Public Class methods

@param seqs_and_ops [Array<SimpleSequence, String|Array<Sass::Tree::Node, String>>]

  See \{#members}

Public Instance methods

Add to the {SimpleSequence#sources} sets of the child simple sequences. This destructively modifies this sequence‘s members array, but not the child simple sequences.

@param sources [Set<Sequence>]

Returns whether there‘s a {Parent} selector anywhere in this sequence.

@return [Boolean]

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

@param extends [Sass::Util::SubsetMap{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 replace [Boolean]

  Whether to replace the original selector entirely or include
  it in the result.

@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`.
  These correspond to a {CommaSequence}'s {CommaSequence#members members array}.

@see CommaSequence#do_extend

Sets the name of the file in which this selector was declared, or `nil` if it was not declared in a file (e.g. on stdin). This also sets the filename for all child selectors.

@param filename [String, nil] @return [String, nil]

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

@return [String]

Sets the line of the Sass template on which this selector was declared. This also sets the line for all child selectors.

@param line [Integer] @return [Integer]

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 @param implicit_parent [Boolean] Whether the the parent

  selector should automatically be prepended to the resolved
  selector if it contains no parent refs.

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

Converts the subject operator "!", if it exists, into a ":has()" selector.

@retur [Sequence]

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 cseq [Sequence] @return [Boolean]

Unifies this with another selector sequence to produce a selector that matches (a subset of) the intersection of the two inputs.

@param other [Sequence] @return [CommaSequence, nil] The unified selector, or nil if unification failed. @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

[Validate]