class Blinkr::Extensions::InlineCss
Public Class Methods
new(config)
click to toggle source
# File lib/blinkr/extensions/inline_css.rb, line 7 def initialize config @config = config end
Public Instance Methods
collect(page)
click to toggle source
# File lib/blinkr/extensions/inline_css.rb, line 11 def collect page page.body.css('[style]').each do |elm| elm_clone = Nokogiri.make(elm.to_s) elm_clone.inner_html = "" if elm['style'] == "" page.errors << Blinkr::Error.new({:severity => 'info', :category => 'HTML Compatibility/Correctness', :type => 'style attribute is empty', :title => %Q{"#{elm['style']}" (line #{elm.line})}, :message => 'style attribute is empty', :snippet => elm_clone.to_s, :icon => 'fa-info'}) else page.errors << Blinkr::Error.new({:severity => 'info', :category => 'HTML Compatibility/Correctness', :type => 'Inline CSS detected', :title => %Q{"#{elm['style']}" (line #{elm.line})}, :message => 'inline style', :snippet => elm_clone.to_s, :icon => 'fa-info'}) end end end