-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow all data attributes #3187
Conversation
#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/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/\Adata-[\w-]+\z/
Why do we hardcoded this regex and don't let the dev to be able to override it in a config?
@bricesanchez @parndt suggested he preferred this approach and asked me to submit a new pull request. |
36917c5
to
c6158b6
Compare
@nzgrover yes, I think what @bricesanchez is asking is whether we can move the regular expression itself to be configurable. I don't personally think we need to worry about that as it's easy enough for someone to write their own Presenter and Scrubber. Thanks for your work! |
Hmm, looks like "render_content_page" method from '/refinery/content_page' template still removes the data-attributes.
As one can see here, Scrubber has removed the 'data-no-retina' attruibute. PS
in my section_presenter.rb |
@parndt New PR to allow all "data-" attributes.