Class: CSSPool::CSS::DocumentHandler

### Home Classes Methods

### In Files

- lib/csspool/css/document_handler.rb

### Parent

CSSPool::SAC::Document

### Methods

- ::new
- #charset
- #end_media
- #import_style
- #property
- #start_document
- #start_media
- #start_selector

### Files

- CHANGELOG.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- CSSPool
- CSSPool::CSS
- CSSPool::CSS::Charset
- CSSPool::CSS::Declaration
- CSSPool::CSS::Document
- CSSPool::CSS::DocumentHandler
- CSSPool::CSS::ImportRule
- CSSPool::CSS::Media
- CSSPool::CSS::Parser
- CSSPool::CSS::RuleSet
- 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::Simple
- CSSPool::Selectors::Type
- CSSPool::Selectors::Universal
- CSSPool::Terms
- CSSPool::Terms::Function
- CSSPool::Terms::Hash
- CSSPool::Terms::Ident
- CSSPool::Terms::Number
- 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::CSS::DocumentHandler

### Attributes

document[RW]

### Public Class Methods

new() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 6
    def initialize
      @document     = nil
      @media_stack  = []
    end

### Public Instance Methods

charset(name, location) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 15
    def charset name, location
      @document.charsets << CSS::Charset.new(name, location)
    end

end_media(media_list, parse_location = {}) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 46
    def end_media media_list, parse_location = {}
      @media_stack.pop
    end

import_style(media_list, uri, ns = nil, loc = {}) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 19
    def import_style media_list, uri, ns = nil, loc = {}
      @document.import_rules << CSS::ImportRule.new(
        uri,
        ns,
        media_list.map { |x| CSS::Media.new(x, loc) },
        @document,
        loc
      )
    end

property(name, exp, important) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 37
    def property name, exp, important
      rs = @document.rule_sets.last
      rs.declarations << Declaration.new(name, exp, important, rs)
    end

start_document() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 11
    def start_document
      @document = CSSPool::CSS::Document.new
    end

start_media(media_list, parse_location = {}) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 42
    def start_media media_list, parse_location = {}
      @media_stack << media_list.map { |x| CSS::Media.new(x, parse_location) }
    end

start_selector(selector_list) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 29
    def start_selector selector_list
      @document.rule_sets << RuleSet.new(
        selector_list,
        [],
        @media_stack.last || []
      )
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.