Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CustomScrubber to fix support of data-attr #3217

Merged
merged 1 commit into from
Jul 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions pages/app/presenters/refinery/pages/section_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def initialize(tags, attributes)
@attributes = attributes
end

#see https://github.com/flavorjones/loofah/blob/master/lib/loofah/html5/scrub.rb#L21
def scrub_attributes(node)
node.attribute_nodes.each do |attr_node|
next if attr_node.node_name =~ /\Adata-[\w-]+\z/
def allowed_node?(node)
tags.include?(node.name)
end

super
end
def skip_node?(node)
node.text?
end

def scrub_attribute?(name)
attributes.exclude?(name) && name !~ /\Adata-[\w-]+\z/
end

end
Expand Down