Skip to content

Commit

Permalink
FEATURE: whitelist data for themes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Mar 2, 2018
1 parent 939180e commit d39d2b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/assets/javascripts/pretty-text/white-lister.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ const DEFAULT_LIST = [
'div.quote-controls',
'div.title',
'div[align]',
'div[data-theme-*]',
'div[data-*]', /* This may seem a bit much but polls does
it anyway and this is needed for themes,
special code in sanitizer handles data-*
nothing exists for data-theme-* and we
don't want to slow sanitize for this case
*/
'div[dir]',
'dl',
'dt',
Expand Down
5 changes: 5 additions & 0 deletions spec/components/pretty_text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1262,4 +1262,9 @@ def test_s3_cdn
HTML
end

it "has a proper data whitlist on div" do
cooked = PrettyText.cook("<div data-theme-a='a'>test</div>")
expect(cooked).to include("data-theme-a")
end

end

0 comments on commit d39d2b9

Please sign in to comment.