Class/Module Index [+]

Quicksearch

Sass::Selector::Pseudo

A pseudoclass (e.g. `:visited`) or pseudoelement (e.g. `::first-line`) selector. It can have arguments (e.g. `:nth-child(2n+1)`).

Constants

FINAL_SELECTORS

Some psuedo-class-syntax selectors (`:after` and `:before) are actually considered pseudo-elements and must be at the end of the selector to function properly.

@return [Array<String>]

Attributes

arg[R]

The argument to the selector, or `nil` if no argument was given.

This may include SassScript nodes that will be run during resolution. Note that this should not include SassScript nodes after resolution has taken place.

@return [Array<String, Sass::Script::Node>, nil]

name[R]

The name of the selector.

@return [Array<String, Sass::Script::Node>]

type[R]

The type of the selector. `:class` if this is a pseudoclass selector, `:element` if it's a pseudoelement.

@return [Symbol]

Public Class Methods

new(type, name, arg) click to toggle source

@param type [Symbol] See {#type} @param name [Array<String, Sass::Script::Node>] The name of the selector @param arg [nil, Array<String, Sass::Script::Node>] The argument to the selector,

or nil if no argument was given
# File lib/sass/selector.rb, line 382
def initialize(type, name, arg)
  @type = type
  @name = name
  @arg = arg
end

Public Instance Methods

final?() click to toggle source
# File lib/sass/selector.rb, line 388
def final?
  type == :class && FINAL_SELECTORS.include?(name.first)
end
specificity() click to toggle source

@see AbstractSequence#specificity

# File lib/sass/selector.rb, line 413
def specificity
  type == :class ? SPECIFICITY_BASE : 1
end
to_a() click to toggle source

@see Selector#to_a

# File lib/sass/selector.rb, line 393
def to_a
  res = [@type == :class ? ":" : "::"] + @name
  (res << "(").concat(Sass::Util.strip_string_array(@arg)) << ")" if @arg
  res
end
unify(sels) click to toggle source

Returns `nil` if this is a pseudoelement selector and `sels` contains a pseudoelement selector different than this one.

@see Selector#unify

# File lib/sass/selector.rb, line 403
def unify(sels)
  return if type == :element && sels.any? do |sel|
    sel.is_a?(Pseudo) && sel.type == :element &&
      (sel.name != self.name || sel.arg != self.arg)
  end
  return sels + [self] if final?
  super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.