0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 23:28:42 +00:00

Add relative length units from CSS 3

cf. https://www.w3schools.com/cssref/css_units.asp
This commit is contained in:
Jan Dageförde 2017-10-15 19:02:38 +02:00 committed by Edward Z. Yang
parent df64746caa
commit 67c3798922
2 changed files with 8 additions and 2 deletions

View File

@ -26,12 +26,14 @@ class HTMLPurifier_Length
protected $isValid; protected $isValid;
/** /**
* Array Lookup array of units recognized by CSS 2.1 * Array Lookup array of units recognized by CSS 3
* @type array * @type array
*/ */
protected static $allowedUnits = array( protected static $allowedUnits = array(
'em' => true, 'ex' => true, 'px' => true, 'in' => true, 'em' => true, 'ex' => true, 'px' => true, 'in' => true,
'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true 'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true,
'ch' => true, 'rem' => true, 'vw' => true, 'vh' => true,
'vmin' => true, 'vmax' => true
); );
/** /**

View File

@ -66,6 +66,10 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('min-width:50px;'); $this->assertDef('min-width:50px;');
$this->assertDef('min-width:auto;'); $this->assertDef('min-width:auto;');
$this->assertDef('min-width:-50px;', false); $this->assertDef('min-width:-50px;', false);
$this->assertDef('min-width:50ch;');
$this->assertDef('min-width:50rem;');
$this->assertDef('min-width:50vw;');
$this->assertDef('min-width:-50vw;', false);
$this->assertDef('text-decoration:underline;'); $this->assertDef('text-decoration:underline;');
$this->assertDef('font-family:sans-serif;'); $this->assertDef('font-family:sans-serif;');
$this->assertDef("font-family:Gill, 'Times New Roman', sans-serif;"); $this->assertDef("font-family:Gill, 'Times New Roman', sans-serif;");