Class: ThemeCheck::ImgWidthAndHeight
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- ThemeCheck::ImgWidthAndHeight
- Includes:
- RegexHelpers
- Defined in:
- lib/theme_check/checks/img_width_and_height.rb
Overview
Reports errors when trying to use parser-blocking script tags
Constant Summary collapse
- IMG_TAG =
Not implemented with lookbehinds and lookaheads because performance was shit!
%r{<img#{HTML_ATTRIBUTES}/?>}oxim
- SRC_ATTRIBUTE =
/\s(src)=(#{QUOTED_LIQUID_ATTRIBUTE})/oxim
- WIDTH_ATTRIBUTE =
/\s(width)=(#{QUOTED_LIQUID_ATTRIBUTE})/oxim
- HEIGHT_ATTRIBUTE =
/\s(height)=(#{QUOTED_LIQUID_ATTRIBUTE})/oxim
- FIELDS =
[WIDTH_ATTRIBUTE, HEIGHT_ATTRIBUTE]
- ENDS_IN_CSS_UNIT =
/(cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)$/i
Constants inherited from LiquidCheck
LiquidCheck::ATTR, LiquidCheck::HTML_ATTRIBUTE, LiquidCheck::HTML_ATTRIBUTES, LiquidCheck::QUOTED_LIQUID_ATTRIBUTE, LiquidCheck::START_OR_END_QUOTE, LiquidCheck::TAG, LiquidCheck::VARIABLE
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods included from RegexHelpers
Methods inherited from LiquidCheck
Methods included from ChecksTracking
Methods included from ParsingHelpers
Methods inherited from Check
all, can_disable, #can_disable?, categories, #categories, category, #code_name, #doc, doc, docs_url, #ignore!, #ignored?, #severity, severity, #to_s, #unignore!
Methods included from JsonHelpers
Instance Method Details
#on_document(node) ⇒ Object
19 20 21 22 23 |
# File 'lib/theme_check/checks/img_width_and_height.rb', line 19 def on_document(node) @source = node.template.source @node = node record_offenses end |