Sha256: 407e84c0c5f85558e3897bbe895ddd9fc524bb6d37355c4e40fd36f3e0da50f9
Contents?: true
Size: 742 Bytes
Versions: 4
Compression:
Stored size: 742 Bytes
Contents
# encoding: utf-8 class ScriptCheckable < ::HTML::Proofer::Checkable def src real_attr @src end def missing_src? !src end def blank? @text.strip.empty? end end class ScriptCheck < ::HTML::Proofer::CheckRunner def run @html.css('script').each do |s| script = ScriptCheckable.new s, self next if script.ignore? next unless script.blank? # does the script exist? if script.missing_src? add_issue('script is empty and has no src attribute', s.line) elsif script.remote? add_to_external_urls script.src else add_issue("internal script #{script.src} does not exist", s.line) unless script.exists? end end external_urls end end
Version data entries
4 entries across 4 versions & 1 rubygems