Class: BetterHtml::TestHelper::SafeErb::ScriptInterpolation

Inherits:
Base
  • Object
show all
Defined in:
lib/better_html/test_helper/safe_erb/script_interpolation.rb

Instance Attribute Summary

Attributes inherited from Base

#errors

Instance Method Summary collapse

Methods inherited from Base

#add_error, #initialize

Constructor Details

This class inherits a constructor from BetterHtml::TestHelper::SafeErb::Base

Instance Method Details

#validateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/better_html/test_helper/safe_erb/script_interpolation.rb', line 10

def validate
  script_tags.each do |tag, content_node|
    if content_node.present? && (tag.attributes["type"]&.value || "text/javascript") == "text/javascript"
      validate_script(content_node)
    end
  end

  if @parser.template_language == :javascript
    @parser.nodes_with_type(:text).each do |node|
      validate_script(node)
    end
  end
end