Class: FaviconCheck

Inherits:
HTMLProofer::Check show all
Defined in:
lib/html-proofer/check/favicon.rb

Instance Attribute Summary

Attributes inherited from HTMLProofer::Check

#element, #external_urls, #html, #issues, #node, #options, #path, #src

Instance Method Summary collapse

Methods inherited from HTMLProofer::Check

#add_issue, #add_path_for_url, #add_to_external_urls, #blank?, #create_element, #initialize, subchecks

Constructor Details

This class inherits a constructor from HTMLProofer::Check

Instance Method Details

#runObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/html-proofer/check/favicon.rb', line 2

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 is_immediate_redirect?

  add_issue('no favicon specified')
end