Sha256: 8372b6aad843ecf7110cc75e73724e1eaeed6bf5fde68ae5dbb65822c6d4c47d
Contents?: true
Size: 1.63 KB
Versions: 9
Compression:
Stored size: 1.63 KB
Contents
# frozen_string_literal: true # This is a temporary fix to ignore some HTML/CSS validation issues with the # Decidim HTML validation process. # # See: # - https://github.com/decidim/decidim/issues/8596 # - https://github.com/decidim/decidim/pull/10014 # Related: # - https://github.com/w3c/css-validator/issues/355 # - https://github.com/rails/rails/issues/46405 # - https://github.com/foundation/foundation-sites/pull/12496 module W3CValidators class NuValidator protected alias validate_nu validate unless method_defined?(:validate_nu) def validate(options) # :nodoc: filter_results(validate_nu(options)) end def ignore_errors @ignore_errors ||= [ "CSS: “--content-height”: One operand must be a number.", "An “input” element with a “type” attribute whose value is “hidden” must not have an “autocomplete” attribute whose value is “on” or “off”.", "An “input” element with a “type” attribute whose value is “hidden” must not have any “aria-*” attributes." ] end def filter_results(results) messages = results.instance_variable_get(:@messages) messages.delete_if do |msg| msg.is_error? && ignore_errors.include?(msg.message) end results.instance_variable_set(:@validity, messages.none?(&:is_error?)) results end end end # This allows us to dynamically load the validator URL from the ENV. module W3cRspecValidators class Config def self.get @config ||= { w3c_service_uri: ENV.fetch("VALIDATOR_HTML_URI", "https://validator.w3.org/nu/") }.stringify_keys end end end
Version data entries
9 entries across 9 versions & 1 rubygems