Class: CSSPool::CSS::DocumentHandler

### Home Classes Methods

### In Files

- lib/csspool/css/document_handler.rb

### Parent

CSSPool::SAC::Document

### Methods

- ::new
- #charset
- #end_document_query
- #end_fontface_rule
- #end_keyframes_block
- #end_media
- #end_supports
- #import_style
- #namespace
- #property
- #start_document
- #start_document_query
- #start_fontface_rule
- #start_keyframes_block
- #start_keyframes_rule
- #start_media
- #start_selector
- #start_supports

### 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::CSS::DocumentHandler

### Attributes

document[RW]
node_start_pos[RW]

### Public Class Methods

new() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 7
    def initialize
      @document     = nil
      @conditional_stack  = []
      @active_keyframes_block = nil
      @active_fontface_rule = nil
    end

### Public Instance Methods

charset(name, location) click to toggle source

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

end_document_query(inner_end_pos = nil, outer_end_pos = nil) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 78
    def end_document_query inner_end_pos = nil, outer_end_pos = nil
      last = @conditional_stack.pop
      last.inner_end_pos = inner_end_pos
      last.outer_end_pos = outer_end_pos
    end

end_fontface_rule() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 112
    def end_fontface_rule
      @active_fontface_rule = nil
    end

end_keyframes_block() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 103
    def end_keyframes_block
      @active_keyframes_block = nil
    end

end_media(media_query_list) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 65
    def end_media media_query_list
      @conditional_stack.pop
    end

end_supports() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 90
    def end_supports
      @conditional_stack.pop
    end

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

    # File lib/csspool/css/document_handler.rb, line 22
    def import_style media, uri, ns = nil, loc = {}
      @document.import_rules << CSS::ImportRule.new(
        uri,
        ns,
        media,
        @document,
        loc
      )
    end

namespace(prefix, uri) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 32
    def namespace prefix, uri
      @document.namespaces << CSS::NamespaceRule.new(
        prefix,
        uri
      )
    end

property(declaration) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 49
    def property declaration
      if !@active_fontface_rule.nil?
        rs = @active_fontface_rule
      elsif !@active_keyframes_block.nil?
        rs = @active_keyframes_block
      else
        rs = @document.rule_sets.last
      end
      declaration.rule_set = rs
      rs.declarations << declaration
    end

start_document() click to toggle source

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

start_document_query(url_functions, inner_start_pos = nil) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 69
    def start_document_query url_functions, inner_start_pos = nil
      dq = CSS::DocumentQuery.new(url_functions)
      dq.outer_start_pos = @node_start_pos
      @node_start_pos = nil
      dq.inner_start_pos = inner_start_pos
      @document.document_queries << dq
      @conditional_stack << dq
    end

start_fontface_rule() click to toggle source

    # File lib/csspool/css/document_handler.rb, line 107
    def start_fontface_rule
      @active_fontface_rule = CSS::FontfaceRule.new
      @document.fontface_rules << @active_fontface_rule
    end

start_keyframes_block(keyText) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 98
    def start_keyframes_block keyText
      @active_keyframes_block = CSS::KeyframesBlock.new(keyText)
      @document.keyframes_rules.last.rule_sets << @active_keyframes_block
    end

start_keyframes_rule(name) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 94
    def start_keyframes_rule name
      @document.keyframes_rules << CSS::KeyframesRule.new(name)
    end

start_media(media_query_list) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 61
    def start_media media_query_list
      @conditional_stack << media_query_list
    end

start_selector(selector_list) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 39
    def start_selector selector_list
      rs = RuleSet.new(
        selector_list,
        [],
        @conditional_stack.last
      )
      @document.rule_sets << rs
      @conditional_stack.last.rule_sets << rs unless @conditional_stack.empty?
    end

start_supports(conditions) click to toggle source

    # File lib/csspool/css/document_handler.rb, line 84
    def start_supports conditions
      sr = CSS::SupportsRule.new(conditions)
      @document.supports_rules << sr
      @conditional_stack << sr
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.