Method: Sass::Script::Value::Helpers#parse_complex_selector

Defined in:
lib/sass/script/value/helpers.rb

#parse_complex_selector(value, name = nil, allow_parent_ref = false) ⇒ Sass::Selector::Sequence

Parses a user-provided complex selector.

A complex selector can contain combinators but cannot contain commas.

Parameters:

  • value (Sass::Script::Value::String, Sass::Script::Value::List)

    The selector to parse. This can be either a string or a list of strings.

  • name (Symbol, nil) (defaults to: nil)

    If provided, the name of the selector argument. This is used for error reporting.

  • allow_parent_ref (Boolean) (defaults to: false)

    Whether the parsed selector should allow parent references.

Returns:

Raises:

  • (ArgumentError)

Since:

  • 3.3.0



170
171
172
173
174
175
176
177
# File 'lib/sass/script/value/helpers.rb', line 170

def parse_complex_selector(value, name = nil, allow_parent_ref = false)
  selector = parse_selector(value, name, allow_parent_ref)
  return seq if selector.members.length == 1

  err = "#{value.inspect} is not a complex selector"
  err = "$#{name.to_s.tr('_', '-')}: #{err}" if name
  raise ArgumentError.new(err)
end