class Shamu::Attributes::HtmlSanitation::PermitScrubber
Public Class Methods
new()
click to toggle source
# File lib/shamu/attributes/html_sanitation.rb, line 173 def initialize @direction = :bottom_up end
Public Instance Methods
allowed_element?( name )
click to toggle source
# File lib/shamu/attributes/html_sanitation.rb, line 190 def allowed_element?( name ) end
scrub( node )
click to toggle source
# File lib/shamu/attributes/html_sanitation.rb, line 177 def scrub( node ) if node.type == Nokogiri::XML::Node::ELEMENT_NODE if allowed_element?( node.name ) Loofah::HTML5::Scrub.scrub_attributes node else node.before node.children unless unsafe_element?( node.name ) node.remove end end Loofah::Scrubber::CONTINUE end
unsafe_element?( name )
click to toggle source
# File lib/shamu/attributes/html_sanitation.rb, line 193 def unsafe_element?( name ) UNSAFE_TAGS.include?( name.upcase ) end