Class: Rails::Html::TargetScrubber

Inherits:
PermitScrubber show all
Defined in:
lib/rails/html/scrubbers.rb

Overview

Rails::Html::TargetScrubber

Where Rails::Html::PermitScrubber picks out tags and attributes to permit in sanitization, Rails::Html::TargetScrubber targets them for removal.

tags= If set, elements included will be stripped.

attributes= If set, attributes included will be removed.

Instance Attribute Summary

Attributes inherited from PermitScrubber

#attributes, #tags

Instance Method Summary collapse

Methods inherited from PermitScrubber

#initialize, #scrub

Constructor Details

This class inherits a constructor from Rails::Html::PermitScrubber

Instance Method Details

#allowed_node?(node) ⇒ Boolean


139
140
141
# File 'lib/rails/html/scrubbers.rb', line 139

def allowed_node?(node)
  !@tags.include?(node.name)
end

#scrub_attribute?(name) ⇒ Boolean


143
144
145
# File 'lib/rails/html/scrubbers.rb', line 143

def scrub_attribute?(name)
  @attributes.include?(name)
end