### Home Classes Methods

### In Files

- lib/sass/selector/sequence.rb

### Parent

AbstractSequence

### Methods

- ::new
- #add_sources!
- #do_extend
- #filename=
- #inspect
- #line=
- #resolve_parent_refs
- #superselector?
- #to_a

### Class/Module Index

Quicksearch

- Sass
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Generic
- Sass::Exec::Sass
- Sass::Exec::SassConvert
- Sass::Exec::Scss
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::ArgList
- Sass::Script::Bool
- Sass::Script::Color
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Interpolation
- Sass::Script::Lexer
- Sass::Script::List
- Sass::Script::Literal
- Sass::Script::Node
- Sass::Script::Null
- Sass::Script::Number
- Sass::Script::Operation
- Sass::Script::Parser
- Sass::Script::String
- Sass::Script::StringInterpolation
- Sass::Script::UnaryOperation
- Sass::Script::Variable
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Interpolation
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::SelectorPseudoClass
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::Shared
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::MultibyteStringScanner
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object

No matching classes.

# Sass::Selector::Sequence

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

### 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

new(seqs_and_ops) click to toggle source

@param seqs_and_ops [Array<SimpleSequence, String|Array<Sass::Tree::Node, String>>] See {#members}

    # File lib/sass/selector/sequence.rb, line 37
    def initialize(seqs_and_ops)
      @members = seqs_and_ops
    end

### Public Instance Methods

add_sources!(sources) click to toggle source

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>]

    # File lib/sass/selector/sequence.rb, line 125
    def add_sources!(sources)
      members.map! {|m| m.is_a?(SimpleSequence) ? m.with_more_sources(sources) : m}
    end

do_extend(extends, parent_directives, seen = Set.new) click to toggle source

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

@overload def do_extend(extends, parent_directives) @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.

@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

    # File lib/sass/selector/sequence.rb, line 80
    def do_extend(extends, parent_directives, seen = Set.new)
      extended_not_expanded = members.map do |sseq_or_op|
        next [[sseq_or_op]] unless sseq_or_op.is_a?(SimpleSequence)
        extended = sseq_or_op.do_extend(extends, parent_directives, seen)
        choices = extended.map {|seq| seq.members}
        choices.unshift([sseq_or_op]) unless extended.any? {|seq| seq.superselector?(sseq_or_op)}
        choices
      end
      weaves = Sass::Util.paths(extended_not_expanded).map {|path| weave(path)}
      Sass::Util.flatten(trim(weaves), 1).map {|p| Sequence.new(p)}
    end

filename=(filename) click to toggle source

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]

    # File lib/sass/selector/sequence.rb, line 22
    def filename=(filename)
      members.each {|m| m.filename = filename if m.is_a?(SimpleSequence)}
      filename
    end

inspect() click to toggle source

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

@return [String]

    # File lib/sass/selector/sequence.rb, line 116
    def inspect
      members.map {|m| m.inspect}.join(" ")
    end

line=(line) click to toggle source

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

@param line [Fixnum] @return [Fixnum]

    # File lib/sass/selector/sequence.rb, line 11
    def line=(line)
      members.each {|m| m.line = line if m.is_a?(SimpleSequence)}
      line
    end

resolve_parent_refs(super_seq) click to toggle source

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

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

    # File lib/sass/selector/sequence.rb, line 48
    def resolve_parent_refs(super_seq)
      members = @members.dup
      nl = (members.first == "\n" && members.shift)
      unless members.any? do |seq_or_op|
          seq_or_op.is_a?(SimpleSequence) && seq_or_op.members.first.is_a?(Parent)
        end
        old_members, members = members, []
        members << nl if nl
        members << SimpleSequence.new([Parent.new], false)
        members += old_members
      end

      Sequence.new(
        members.map do |seq_or_op|
          next seq_or_op unless seq_or_op.is_a?(SimpleSequence)
          seq_or_op.resolve_parent_refs(super_seq)
        end.flatten)
    end

superselector?(sseq) click to toggle source

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
    (.bar .foo).superselector?(.foo) #=> false

@param sseq [SimpleSequence] @return [Boolean]

    # File lib/sass/selector/sequence.rb, line 101
    def superselector?(sseq)
      return false unless members.size == 1
      members.last.superselector?(sseq)
    end

to_a() click to toggle source

@see Simple#to_a

    # File lib/sass/selector/sequence.rb, line 107
    def to_a
      ary = @members.map {|seq_or_op| seq_or_op.is_a?(SimpleSequence) ? seq_or_op.to_a : seq_or_op}
      Sass::Util.intersperse(ary, " ").flatten.compact
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.