Skip to content

Commit

Permalink
add page-break to safelist
Browse files Browse the repository at this point in the history
  • Loading branch information
ahorek committed Jul 24, 2020
1 parent e48f298 commit 680505b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/loofah/html5/safelist.rb
Expand Up @@ -576,6 +576,9 @@ module SafeList
"list-style-type",
"max-width",
"overflow",
"page-break-after",
"page-break-before",
"page-break-inside",
"pause",
"pause-after",
"pause-before",
Expand Down
19 changes: 19 additions & 0 deletions test/html5/test_sanitizer.rb
Expand Up @@ -379,6 +379,25 @@ def test_css_max_width
assert_match %r/max-width/, sane.inner_html
end

def test_css_page_break_after
html = '<div style="page-break-after:always;"></div>'
sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
assert_match %r/page-break-after:always/, sane.inner_html
end

def test_css_page_break_before
html = '<div style="page-break-before:always;"></div>'
sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
assert_match %r/page-break-before:always/, sane.inner_html
end

def test_css_page_break_inside
html = '<div style="page-break-inside:auto;"></div>'
sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
assert_match %r/page-break-inside:auto/, sane.inner_html
end


def test_issue_90_slow_regex
skip("timing tests are hard to make pass and have little regression-testing value")

Expand Down

0 comments on commit 680505b

Please sign in to comment.