class ERBLint::Linters::GitHub::Accessibility::IframeHasTitle

Constants

MESSAGE

Public Instance Methods

run(processed_source) click to toggle source
# File lib/erblint-github/linters/github/accessibility/iframe_has_title.rb, line 16
def run(processed_source)
  tags(processed_source).each do |tag|
    next if tag.name != "iframe"
    next if tag.closing?

    title = possible_attribute_values(tag, "title")

    generate_offense(self.class, processed_source, tag) if title.empty? && !aria_hidden?(tag)
  end

  rule_disabled?(processed_source)
end

Private Instance Methods

aria_hidden?(tag) click to toggle source
# File lib/erblint-github/linters/github/accessibility/iframe_has_title.rb, line 31
def aria_hidden?(tag)
  tag.attributes["aria-hidden"]&.value&.present?
end