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



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

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