class Sass::Selector::Attribute - sass-3.2.19 Documentation

# class Sass::Selector::Attribute

An attribute selector (e.g. `[href^=“http://”]`).

### Attributes

flags[R]

Flags for the attribute selector (e.g. `i`).

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

name[R]

The attribute name.

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

namespace[R]

The attribute namespace. `nil` means the default namespace, `[“”]` means no namespace, `[“*”]` means any namespace.

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

operator[R]

The matching operator, e.g. `“=”` or `“^=”`.

@return [String]

value[R]

The right-hand side of the operator.

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

### Public Class Methods

new(name, namespace, operator, value, flags) click to toggle source

@param name [Array<String, Sass::Script::Node>] The attribute name @param namespace [Array<String, Sass::Script::Node>, nil] See {#namespace} @param operator [String] The matching operator, e.g. `“=”` or `“^=”` @param value [Array<String, Sass::Script::Node>] See {#value} @param value [Array<String, Sass::Script::Node>] See {#flags}

    # File lib/sass/selector.rb, line 322
    def initialize(name, namespace, operator, value, flags)
      @name = name
      @namespace = namespace
      @operator = operator
      @value = value
      @flags = flags
    end

### Public Instance Methods

specificity() click to toggle source

@see Sass::Selector::AbstractSequence#specificity

    # File lib/sass/selector.rb, line 341
    def specificity
      SPECIFICITY_BASE
    end

to_a() click to toggle source

@see Selector#to_a

    # File lib/sass/selector.rb, line 331
    def to_a
      res = ["["]
      res.concat(@namespace) << "|" if @namespace
      res.concat @name
      (res << @operator).concat @value if @value
      (res << " ").concat @flags if @flags
      res << "]"
    end