mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-03-23 14:27:02 +00:00
Implement all composite CSS definitions.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@271 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
490fc003c8
commit
1388beb456
@ -159,7 +159,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
|
|||||||
100, 200, 300, 400, 500, 600, 700, 800, 900), maybe special code for
|
100, 200, 300, 400, 500, 600, 700, 800, 900), maybe special code for
|
||||||
in-between integers</td></tr>
|
in-between integers</td></tr>
|
||||||
<tr class="css1 impl-yes"><td>letter-spacing</td><td>COMPOSITE(<length>, normal)</td></tr>
|
<tr class="css1 impl-yes"><td>letter-spacing</td><td>COMPOSITE(<length>, normal)</td></tr>
|
||||||
<tr class="css1"><td>line-height</td><td>COMPOSITE(<number>,
|
<tr class="css1 impl-yes"><td>line-height</td><td>COMPOSITE(<number>,
|
||||||
<length>, <percentage>, normal)</td></tr>
|
<length>, <percentage>, normal)</td></tr>
|
||||||
<tr class="css1 impl-yes"><td>list-style-position</td><td>ENUM(inside, outside),
|
<tr class="css1 impl-yes"><td>list-style-position</td><td>ENUM(inside, outside),
|
||||||
Strange behavior in browsers</td></tr>
|
Strange behavior in browsers</td></tr>
|
||||||
@ -169,21 +169,21 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
|
|||||||
CSS 3. Mostly IE lack of support.</td></tr>
|
CSS 3. Mostly IE lack of support.</td></tr>
|
||||||
<tr class="css1"><td>list-style</td><td>SHORTHAND</td></tr>
|
<tr class="css1"><td>list-style</td><td>SHORTHAND</td></tr>
|
||||||
<tr class="css1"><td>margin</td><td>MULTIPLE</td></tr>
|
<tr class="css1"><td>margin</td><td>MULTIPLE</td></tr>
|
||||||
<tr class="css1"><td>margin-*</td><td>COMPOSITE(<length>,
|
<tr class="css1 impl-yes"><td>margin-*</td><td>COMPOSITE(<length>,
|
||||||
<percentage>, auto)</td></tr>
|
<percentage>, auto)</td></tr>
|
||||||
<tr class="css1"><td>padding</td><td>MULTIPLE</td></tr>
|
<tr class="css1"><td>padding</td><td>MULTIPLE</td></tr>
|
||||||
<tr class="css1"><td>padding-*</td><td>COMPOSITE(<length>(positive),
|
<tr class="css1 impl-yes"><td>padding-*</td><td>COMPOSITE(<length>(positive),
|
||||||
<percentage>(positive))</td></tr>
|
<percentage>(positive))</td></tr>
|
||||||
<tr class="css1 impl-yes"><td>text-align</td><td>ENUM(left, right,
|
<tr class="css1 impl-yes"><td>text-align</td><td>ENUM(left, right,
|
||||||
center, justify)</td></tr>
|
center, justify)</td></tr>
|
||||||
<tr class="css1"><td>text-decoration</td><td>No blink (argh my eyes), not
|
<tr class="css1"><td>text-decoration</td><td>No blink (argh my eyes), not
|
||||||
enum, can be combined (composite sorta): underline, overline,
|
enum, can be combined (composite sorta): underline, overline,
|
||||||
line-through</td></tr>
|
line-through</td></tr>
|
||||||
<tr class="css1"><td>text-indent</td><td>COMPOSITE(<length>,
|
<tr class="css1 impl-yes"><td>text-indent</td><td>COMPOSITE(<length>,
|
||||||
<percentage>)</td></tr>
|
<percentage>)</td></tr>
|
||||||
<tr class="css1 impl-yes"><td>text-transform</td><td>ENUM(capitalize, uppercase,
|
<tr class="css1 impl-yes"><td>text-transform</td><td>ENUM(capitalize, uppercase,
|
||||||
lowercase, none)</td></tr>
|
lowercase, none)</td></tr>
|
||||||
<tr class="css1"><td>width</td><td>COMPOSITE(<length>,
|
<tr class="css1 impl-yes"><td>width</td><td>COMPOSITE(<length>,
|
||||||
<percentage>, auto), Interesting</td></tr>
|
<percentage>, auto), Interesting</td></tr>
|
||||||
<tr class="css1 impl-yes"><td>word-spacing</td><td>COMPOSITE(<length>, auto),
|
<tr class="css1 impl-yes"><td>word-spacing</td><td>COMPOSITE(<length>, auto),
|
||||||
IE 5 no support</td></tr>
|
IE 5 no support</td></tr>
|
||||||
|
@ -86,7 +86,41 @@ class HTMLPurifier_CSSDefinition
|
|||||||
new HTMLPurifier_AttrDef_CSSLength()
|
new HTMLPurifier_AttrDef_CSSLength()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->info['line-height'] = new HTMLPurifier_AttrDef_Composite(array(
|
||||||
|
new HTMLPurifier_AttrDef_Enum(array('normal')),
|
||||||
|
new HTMLPurifier_AttrDef_Number(true), // no negatives
|
||||||
|
new HTMLPurifier_AttrDef_CSSLength(true),
|
||||||
|
new HTMLPurifier_AttrDef_Percentage(true)
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->info['margin-top'] =
|
||||||
|
$this->info['margin-bottom'] =
|
||||||
|
$this->info['margin-left'] =
|
||||||
|
$this->info['margin-right'] = new HTMLPurifier_AttrDef_Composite(array(
|
||||||
|
new HTMLPurifier_AttrDef_CSSLength(),
|
||||||
|
new HTMLPurifier_AttrDef_Percentage(),
|
||||||
|
new HTMLPurifier_AttrDef_Enum(array('auto'))
|
||||||
|
));
|
||||||
|
|
||||||
|
// non-negative
|
||||||
|
$this->info['padding-top'] =
|
||||||
|
$this->info['padding-bottom'] =
|
||||||
|
$this->info['padding-left'] =
|
||||||
|
$this->info['padding-right'] = new HTMLPurifier_AttrDef_Composite(array(
|
||||||
|
new HTMLPurifier_AttrDef_CSSLength(true),
|
||||||
|
new HTMLPurifier_AttrDef_Percentage(true)
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->info['text-indent'] = new HTMLPurifier_AttrDef_Composite(array(
|
||||||
|
new HTMLPurifier_AttrDef_CSSLength(),
|
||||||
|
new HTMLPurifier_AttrDef_Percentage()
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->info['width'] = new HTMLPurifier_AttrDef_Composite(array(
|
||||||
|
new HTMLPurifier_AttrDef_CSSLength(true),
|
||||||
|
new HTMLPurifier_AttrDef_Percentage(true),
|
||||||
|
new HTMLPurifier_AttrDef_Enum(array('auto'))
|
||||||
|
));
|
||||||
|
|
||||||
// this could use specialized code
|
// this could use specialized code
|
||||||
$this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
|
$this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
|
||||||
|
@ -34,6 +34,24 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
|||||||
$this->assertDef('font-size:200%;');
|
$this->assertDef('font-size:200%;');
|
||||||
$this->assertDef('font-size:larger;');
|
$this->assertDef('font-size:larger;');
|
||||||
$this->assertDef('font-size:12pt;');
|
$this->assertDef('font-size:12pt;');
|
||||||
|
$this->assertDef('line-height:2;');
|
||||||
|
$this->assertDef('line-height:2em;');
|
||||||
|
$this->assertDef('line-height:20%;');
|
||||||
|
$this->assertDef('line-height:normal;');
|
||||||
|
$this->assertDef('line-height:-20%;', false);
|
||||||
|
$this->assertDef('margin-left:5px;');
|
||||||
|
$this->assertDef('margin-right:20%;');
|
||||||
|
$this->assertDef('margin-top:auto;');
|
||||||
|
$this->assertDef('padding-bottom:5px;');
|
||||||
|
$this->assertDef('padding-top:20%;');
|
||||||
|
$this->assertDef('padding-top:-20%;', false);
|
||||||
|
$this->assertDef('text-indent:3em;');
|
||||||
|
$this->assertDef('text-indent:5%;');
|
||||||
|
$this->assertDef('text-indent:-3em;');
|
||||||
|
$this->assertDef('width:50%;');
|
||||||
|
$this->assertDef('width:50px;');
|
||||||
|
$this->assertDef('width:auto;');
|
||||||
|
$this->assertDef('width:-50px;', false);
|
||||||
|
|
||||||
// duplicates
|
// duplicates
|
||||||
$this->assertDef('text-align:right;text-align:left;',
|
$this->assertDef('text-align:right;text-align:left;',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user