Class: CSSInliner::CSSDocumentHandler

Inherits:
CSSPool::CSS::DocumentHandler
  • Object
show all
Defined in:
lib/css_inliner/extractor.rb

Instance Method Summary collapse

Instance Method Details

#start_documentObject



18
19
20
# File 'lib/css_inliner/extractor.rb', line 18

def start_document
  @document = CSSDocument.new
end

#start_selector(selector_list) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/css_inliner/extractor.rb', line 22

def start_selector selector_list
  super
  selector_list.each do |selector|
    index = @document.sorted_selectors.bsearch_upper_boundary { |existing|
      existing.specificity <=> selector.specificity
    }
    @document.sorted_selectors.insert index, selector
  end
end