Class: CSSPool::Selector

### Home Classes Methods

### In Files

- lib/csspool/selector.rb

### Parent

CSSPool::Node

### Methods

- ::new
- #declarations
- #specificity

### Files

- CHANGELOG.rdoc
- Manifest.txt

### Class/Module Index

Quicksearch

- CSSPool
- CSSPool::CSS
- CSSPool::CSS::Charset
- CSSPool::CSS::Declaration
- CSSPool::CSS::Document
- CSSPool::CSS::DocumentHandler
- CSSPool::CSS::DocumentQuery
- CSSPool::CSS::FontfaceRule
- CSSPool::CSS::ImportRule
- CSSPool::CSS::KeyframesBlock
- CSSPool::CSS::KeyframesRule
- CSSPool::CSS::MediaFeature
- CSSPool::CSS::MediaQuery
- CSSPool::CSS::MediaQueryList
- CSSPool::CSS::MediaType
- CSSPool::CSS::NamespaceRule
- CSSPool::CSS::Parser
- CSSPool::CSS::RuleSet
- CSSPool::CSS::SupportsRule
- CSSPool::CSS::Tokenizer
- CSSPool::CSS::Tokenizer::ScanError
- CSSPool::Collection
- CSSPool::Node
- CSSPool::SAC
- CSSPool::SAC::Document
- CSSPool::SAC::Parser
- CSSPool::Selector
- CSSPool::Selectors
- CSSPool::Selectors::Additional
- CSSPool::Selectors::Attribute
- CSSPool::Selectors::Class
- CSSPool::Selectors::Id
- CSSPool::Selectors::PseudoClass
- CSSPool::Selectors::PseudoElement
- CSSPool::Selectors::Simple
- CSSPool::Selectors::Type
- CSSPool::Selectors::Universal
- CSSPool::Terms
- CSSPool::Terms::Function
- CSSPool::Terms::Hash
- CSSPool::Terms::Ident
- CSSPool::Terms::Math
- CSSPool::Terms::Number
- CSSPool::Terms::Ratio
- CSSPool::Terms::Resolution
- CSSPool::Terms::Rgb
- CSSPool::Terms::String
- CSSPool::Terms::URI
- CSSPool::Visitors
- CSSPool::Visitors::Children
- CSSPool::Visitors::Comparable
- CSSPool::Visitors::Iterator
- CSSPool::Visitors::ToCSS
- CSSPool::Visitors::ToMinifiedCSS
- CSSPool::Visitors::Visitor

No matching classes.

# CSSPool::Selector

### Attributes

parse_location[RW]
rule_set[RW]
simple_selectors[RW]

### Public Class Methods

new(simple_selectors = [], parse_location = {}) click to toggle source

    # File lib/csspool/selector.rb, line 7
    def initialize simple_selectors = [], parse_location = {}
      @simple_selectors = simple_selectors
      @parse_location   = parse_location
      @rule_set         = nil
    end

### Public Instance Methods

declarations() click to toggle source

    # File lib/csspool/selector.rb, line 13
    def declarations
      @rule_set.declarations
    end

specificity() click to toggle source

    # File lib/csspool/selector.rb, line 17
    def specificity
      a = b = c = 0
      simple_selectors.each do |s|
        if s.is_a?(Selectors::Type) && s.name && s.name != ''
          c += 1
        end
        s.additional_selectors.each do |additional_selector|
          case additional_selector
          when Selectors::Id
            a += 1
          when Selectors::PseudoElement
            c += 1
          when Selectors::Class, Selectors::PseudoClass, Selectors::Attribute
            b += 1
          end
        end
      end
      [a, b, c]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.