Sha256: 31c339282836a7db949cb7e437c65acb8af31622a4ff4f3235ba48de68b95bd2
Contents?: true
Size: 596 Bytes
Versions: 24
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true module ThemeCheck class ImgLazyLoading < HtmlCheck severity :suggestion categories :html, :performance doc docs_url(__FILE__) ACCEPTED_LOADING_VALUES = %w[lazy eager] def on_img(node) loading = node.attributes["loading"]&.downcase return if ACCEPTED_LOADING_VALUES.include?(loading) if loading == "auto" add_offense("Prefer loading=\"lazy\" to defer loading of images", node: node) else add_offense("Add a loading=\"lazy\" attribute to defer loading of images", node: node) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems