Class: BetterHtml::TestHelper::SafeErb::NoStatements

Inherits:
Base
  • Object
show all
Defined in:
lib/better_html/test_helper/safe_erb/no_statements.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



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

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

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

  @parser.nodes_with_type(:cdata, :comment).each do |node|
    no_statements(node)
  end
end