Skip to content

Commit 6c70219

Browse files
committed
Allow CSS properties: min-height, max-height
1 parent 5ac17a8 commit 6c70219

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/loofah/html5/safelist.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,9 @@ module SafeList
662662
"line-height",
663663
"list-style",
664664
"list-style-type",
665+
"max-height",
665666
"max-width",
667+
"min-height",
666668
"min-width",
667669
"order",
668670
"overflow",

test/html5/test_sanitizer.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,27 @@ def test_css_function_sanitization_strips_style_attributes_with_unsafe_functions
493493
assert_match(%r/<span><\/span>/, sane.inner_html)
494494
end
495495

496+
def test_css_max_height
497+
html = '<div style="max-height: 100%;"></div>'
498+
sane = Nokogiri::HTML(Loofah.scrub_html4_fragment(html, :escape).to_xml)
499+
500+
assert_match(/max-height/, sane.inner_html)
501+
end
502+
496503
def test_css_max_width
497504
html = '<div style="max-width: 100%;"></div>'
498505
sane = Nokogiri::HTML(Loofah.scrub_html4_fragment(html, :escape).to_xml)
499506

500507
assert_match(/max-width/, sane.inner_html)
501508
end
502509

510+
def test_css_min_height
511+
html = '<div style="min-height: 100%;"></div>'
512+
sane = Nokogiri::HTML(Loofah.scrub_html4_fragment(html, :escape).to_xml)
513+
514+
assert_match(/min-height/, sane.inner_html)
515+
end
516+
503517
def test_css_min_width
504518
html = '<div style="min-width: 100%;"></div>'
505519
sane = Nokogiri::HTML(Loofah.scrub_html4_fragment(html, :escape).to_xml)

0 commit comments

Comments
 (0)