diff --git a/NEWS b/NEWS index 153852ad..092cb3f7 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ ERRATA - Improved adherence to Unicode by checking for non-character codepoints. Thanks Geoffrey Sneddon for reporting. This may result in degraded performance for extremely large inputs. +- Allow CSS property-value pair ''text-decoration: none'' . Added HTMLPurifier_UnitConverter and HTMLPurifier_Length for convenient handling of CSS-style lengths. HTMLPurifier_AttrDef_CSS_Length now uses this class. diff --git a/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php b/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php index 501ab261..ab452780 100644 --- a/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php +++ b/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php @@ -15,10 +15,13 @@ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef static $allowed_values = array( 'line-through' => true, 'overline' => true, - 'underline' => true + 'underline' => true, ); $string = strtolower($this->parseCDATA($string)); + + if ($string === 'none') return $string; + $parts = explode(' ', $string); $final = ''; foreach ($parts as $part) { diff --git a/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php b/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php index fb0ccf4f..84f11368 100644 --- a/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php +++ b/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php @@ -10,6 +10,9 @@ class HTMLPurifier_AttrDef_CSS_TextDecorationTest extends HTMLPurifier_AttrDefHa $this->def = new HTMLPurifier_AttrDef_CSS_TextDecoration(); + $this->assertDef('none'); + $this->assertDef('none underline', 'underline'); + $this->assertDef('underline'); $this->assertDef('overline'); $this->assertDef('line-through overline underline');