# class Sass::Selector::Attribute

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

### Attributes

flags[R]

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

@return [String]

name[R]

The attribute name.

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

namespace[R]

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

@return [String, nil]

operator[R]

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

@return [String]

value[R]

The right-hand side of the operator.

@return [String]

### Public Class Methods

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

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

    # File lib/sass/selector.rb, line 303
    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 322
    def specificity
      SPECIFICITY_BASE
    end

to_s(opts = {}) click to toggle source

@see Selector#to_s

    # File lib/sass/selector.rb, line 312
    def to_s(opts = {})
      res = "["
      res << @namespace << "|" if @namespace
      res << @name
      res << @operator << @value if @value
      res << " " << @flags if @flags
      res << "]"
    end