Skip to content

Commit

Permalink
Clarify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrove committed Jan 11, 2021
1 parent fac1a2e commit eaaaa9d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/sanitize/transformers/clean_element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ def call(env)
attr_name = attr.name.downcase

unless attr_allowlist.include?(attr_name)
# The attribute isn't allowed.
# The attribute isn't in the allowlist, but may still be allowed if
# it's a data attribute.

# Arbitrary data attributes are allowed. If this is a data
# attribute, continue.
unless allow_data_attributes && attr_name.start_with?('data-') &&
attr_name =~ REGEX_DATA_ATTR
unless allow_data_attributes && attr_name.start_with?('data-') && attr_name =~ REGEX_DATA_ATTR
# Either the attribute isn't a data attribute or arbitrary data
# attributes aren't allowed. Remove the attribute.
attr.unlink
Expand Down

0 comments on commit eaaaa9d

Please sign in to comment.