class FaviconCheck

Public Instance Methods

run() click to toggle source
# File lib/html-proofer/check/favicon.rb, line 3
def run
  found = false
  @html.xpath('//link[not(ancestor::pre or ancestor::code)]').each do |node|
    favicon = create_element(node)
    next if favicon.ignore?

    found = true if favicon.rel.split(' ').last.eql? 'icon'
    break if found
  end

  return if found

  return if immediate_redirect?

  add_issue('no favicon specified')
end

Private Instance Methods

immediate_redirect?() click to toggle source

allow any instant-redirect meta tag

# File lib/html-proofer/check/favicon.rb, line 23
def immediate_redirect?
  @html.xpath("//meta[@http-equiv='refresh']").attribute('content').value.start_with? '0;'
rescue StandardError
  false
end