lib/sanitize.rb in sanitize-4.6.1 vs lib/sanitize.rb in sanitize-4.6.2

- old
+ new

@@ -196,11 +196,11 @@ # Only replace the content-type meta tag if <meta> isn't whitelisted or # the original document didn't actually include a content-type meta tag. replace_meta = !@config[:elements].include?('meta') || node.xpath('/html/head/meta[@http-equiv]').none? do |meta| - meta['http-equiv'].downcase == 'content-type' + meta['http-equiv'].casecmp('content-type').zero? end end so = Nokogiri::XML::Node::SaveOptions @@ -215,15 +215,17 @@ html.gsub!(regex_meta, '\1') if replace_meta html end def transform_node!(node, node_whitelist) + node_name = node.name.downcase + @transformers.each do |transformer| result = transformer.call( :config => @config, :is_whitelisted => node_whitelist.include?(node), :node => node, - :node_name => node.name.downcase, + :node_name => node_name, :node_whitelist => node_whitelist ) if result.is_a?(Hash) && result[:node_whitelist].respond_to?(:each) node_whitelist.merge(result[:node_whitelist])