class Sass::Selector::SimpleSequence

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

def _eql?(other)

def _eql?(other)
  other.base.eql?(self.base) && Sass::Util.set_eql?(other.rest, self.rest) &&
    other.subject? == self.subject?
end

def _hash

def _hash
  [base, Sass::Util.set_hash(rest)].hash
end

def base

Returns:
  • (Element, Universal, nil) -
def base
  @base ||= (members.first if members.first.is_a?(Element) || members.first.is_a?(Universal))
end

def check_directives_match!(extend, parent_directives)

def check_directives_match!(extend, parent_directives)
  dirs1 = extend.directives.map {|d| d.resolved_value}
  dirs2 = parent_directives.map {|d| d.resolved_value}
  return true if Sass::Util.subsequence?(dirs1, dirs2)
  Sass::Util.sass_warn <<WARNING
ATION WARNING on line #{extend.node.line}#{" of #{extend.node.filename}" if extend.node.filename}:
ending an outer selector from within #{extend.directives.last.name} is deprecated.
may only @extend selectors within the same directive.
 will be an error in Sass 3.3.
an only work once @extend is supported natively in the browser.
G
  return false
end

def do_extend(extends, parent_directives, seen = Set.new)

Other tags:
    See: CommaSequence#do_extend -

Returns:
  • (Array) - A list of selectors generated

Parameters:
  • parent_directives (Array) --
  • extends ({Selector::Simple =>) -- xtends [{Selector::Simple =>

Overloads:
  • def do_extend(extends, parent_directives)
def do_extend(extends, parent_directives, seen = Set.new)
  Sass::Util.group_by_to_a(extends.get(members.to_set)) {|ex, _| ex.extender}.map do |seq, group|
    sels = group.map {|_, s| s}.flatten
    # If A {@extend B} and C {...},
    # seq is A, sels is B, and self is C
    self_without_sel = self.members - sels
    group.each {|e, _| e.result = :failed_to_unify}
    next unless unified = seq.members.last.unify(self_without_sel, subject?)
    group.each {|e, _| e.result = :succeeded}
    next if group.map {|e, _| check_directives_match!(e, parent_directives)}.none?
    new_seq = Sequence.new(seq.members[0...-1] + [unified])
    new_seq.add_sources!(sources + [seq])
    [sels, new_seq]
  end.compact.map do |sels, seq|
    seen.include?(sels) ? [] : seq.do_extend(extends, parent_directives, seen + [sels])
  end.flatten.uniq
end

def initialize(selectors, subject, sources = Set.new)

Parameters:
  • sources (Set) --
  • subject (Boolean) -- See \{#subject?}
  • selectors (Array) -- See \{#members}
def initialize(selectors, subject, sources = Set.new)
  @members = selectors
  @subject = subject
  @sources = sources
end

def inspect

Returns:
  • (String) -
def inspect
  members.map {|m| m.inspect}.join
end

def resolve_parent_refs(super_seq)

Raises:
  • (Sass::SyntaxError) - If a parent selector is invalid

Returns:
  • (Array) - This selector, with parent references resolved.

Parameters:
  • super_seq (Sequence) -- The parent selector sequence
def resolve_parent_refs(super_seq)
  # Parent selector only appears as the first selector in the sequence
  return [self] unless @members.first.is_a?(Parent)
  return super_seq.members if @members.size == 1
  unless super_seq.members.last.is_a?(SimpleSequence)
    raise Sass::SyntaxError.new("Invalid parent selector: " + super_seq.to_a.join)
  end
  super_seq.members[0...-1] +
    [SimpleSequence.new(super_seq.members.last.members + @members[1..-1], subject?)]
end

def rest

Returns:
  • (Set) -
def rest
  @rest ||= Set.new(base ? members[1..-1] : members)
end

def subject?

Returns:
  • (Boolean) -
def subject?
  @subject
end

def superselector?(sseq)

Returns:
  • (Boolean) -

Parameters:
  • sseq (SimpleSequence) --
def superselector?(sseq)
  (base.nil? || base.eql?(sseq.base)) && rest.subset?(sseq.rest)
end

def to_a

Other tags:
    See: Simple#to_a -
def to_a
  res = @members.map {|sel| sel.to_a}.flatten
  res << '!' if subject?
  res
end

def unify(sels, other_subject)

Raises:
  • (Sass::SyntaxError) - If this selector cannot be unified.

Returns:
  • (SimpleSequence, nil) - A {SimpleSequence} matching both `sels` and this selector,

Parameters:
  • subject (Boolean) -- Whether the {SimpleSequence} being merged is a subject.
  • sels (Array) -- A {SimpleSequence}'s {SimpleSequence#members members array}
def unify(sels, other_subject)
  return unless sseq = members.inject(sels) do |sseq, sel|
    return unless sseq
    sel.unify(sseq)
  end
  SimpleSequence.new(sseq, other_subject || subject?)
end

def with_more_sources(sources)

Returns:
  • (SimpleSequence) -

Parameters:
  • sources (Set) --
def with_more_sources(sources)
  sseq = dup
  sseq.members = members.dup
  sseq.sources.merge sources
  sseq
end