diff --git a/docs/progress.html b/docs/progress.html
index a5bbf2ba..20226f33 100644
--- a/docs/progress.html
+++ b/docs/progress.html
@@ -136,9 +136,9 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
border-*-style | ENUM(none, hidden, dotted, dashed,
@@ -168,10 +168,10 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
decimal, lower-roman, upper-roman, lower-alpha and upper-alpha. See also
CSS 3. Mostly IE lack of support. |
text-align | ENUM(left, right,
diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php
index 105a6797..1948734b 100644
--- a/library/HTMLPurifier/CSSDefinition.php
+++ b/library/HTMLPurifier/CSSDefinition.php
@@ -5,6 +5,7 @@ require_once 'HTMLPurifier/AttrDef/Color.php';
require_once 'HTMLPurifier/AttrDef/Composite.php';
require_once 'HTMLPurifier/AttrDef/CSSLength.php';
require_once 'HTMLPurifier/AttrDef/Percentage.php';
+require_once 'HTMLPurifier/AttrDef/Multiple.php';
class HTMLPurifier_CSSDefinition
{
@@ -28,12 +29,17 @@ class HTMLPurifier_CSSDefinition
$this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
array('left', 'right', 'center', 'justify'), false);
+
+ $border_style =
$this->info['border-bottom-style'] =
$this->info['border-right-style'] =
$this->info['border-left-style'] =
$this->info['border-top-style'] = new HTMLPurifier_AttrDef_Enum(
array('none', 'hidden', 'dotted', 'dashed', 'solid', 'double',
'groove', 'ridge', 'inset', 'outset'), false);
+
+ $this->info['border-style'] = new HTMLPurifier_AttrDef_Multiple($border_style);
+
$this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
array('none', 'left', 'right', 'both'), false);
$this->info['float'] = new HTMLPurifier_AttrDef_Enum(
@@ -51,6 +57,7 @@ class HTMLPurifier_CSSDefinition
array('capitalize', 'uppercase', 'lowercase', 'none'), false);
$this->info['color'] = new HTMLPurifier_AttrDef_Color();
+ $border_color =
$this->info['border-top-color'] =
$this->info['border-bottom-color'] =
$this->info['border-left-color'] =
@@ -60,6 +67,9 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_Color()
));
+ $this->info['border-color'] = new HTMLPurifier_AttrDef_Multiple($border_color);
+
+ $border_width =
$this->info['border-top-width'] =
$this->info['border-bottom-width'] =
$this->info['border-left-width'] =
@@ -68,6 +78,8 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_CSSLength(true) //disallow negative
));
+ $this->info['border-width'] = new HTMLPurifier_AttrDef_Multiple($border_width);
+
$this->info['letter-spacing'] = new HTMLPurifier_AttrDef_Composite(array(
new HTMLPurifier_AttrDef_Enum(array('normal')),
new HTMLPurifier_AttrDef_CSSLength()
@@ -93,6 +105,7 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_Percentage(true)
));
+ $margin =
$this->info['margin-top'] =
$this->info['margin-bottom'] =
$this->info['margin-left'] =
@@ -102,7 +115,10 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_Enum(array('auto'))
));
+ $this->info['margin'] = new HTMLPurifier_AttrDef_Multiple($margin);
+
// non-negative
+ $padding =
$this->info['padding-top'] =
$this->info['padding-bottom'] =
$this->info['padding-left'] =
@@ -111,6 +127,8 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_Percentage(true)
));
+ $this->info['padding'] = new HTMLPurifier_AttrDef_Multiple($padding);
+
$this->info['text-indent'] = new HTMLPurifier_AttrDef_Composite(array(
new HTMLPurifier_AttrDef_CSSLength(),
new HTMLPurifier_AttrDef_Percentage()
diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php
index aff1d656..8c9204c9 100644
--- a/tests/HTMLPurifier/AttrDef/CSSTest.php
+++ b/tests/HTMLPurifier/AttrDef/CSSTest.php
@@ -12,6 +12,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
// regular cases, singular
$this->assertDef('text-align:right;');
$this->assertDef('border-left-style:solid;');
+ $this->assertDef('border-style:solid dotted;');
$this->assertDef('clear:right;');
$this->assertDef('float:left;');
$this->assertDef('font-style:italic;');
@@ -24,8 +25,10 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('background-color:transparent;');
$this->assertDef('color:#F00;');
$this->assertDef('border-top-color:#F00;');
+ $this->assertDef('border-color:#F00 #FF0;');
$this->assertDef('border-top-width:thin;');
$this->assertDef('border-top-width:12px;');
+ $this->assertDef('border-width:5px 1px 4px 2px;');
$this->assertDef('border-top-width:-12px;', false);
$this->assertDef('letter-spacing:normal;');
$this->assertDef('letter-spacing:2px;');
@@ -42,8 +45,10 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('margin-left:5px;');
$this->assertDef('margin-right:20%;');
$this->assertDef('margin-top:auto;');
+ $this->assertDef('margin:auto 5%;');
$this->assertDef('padding-bottom:5px;');
$this->assertDef('padding-top:20%;');
+ $this->assertDef('padding:20% 10%;');
$this->assertDef('padding-top:-20%;', false);
$this->assertDef('text-indent:3em;');
$this->assertDef('text-indent:5%;');
|