0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

Implement all useful table properties.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@325 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-08-27 01:45:23 +00:00
parent 692a9abc0f
commit 78414abafd
5 changed files with 31 additions and 7 deletions

1
NEWS
View File

@ -7,6 +7,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- API documentation completed
- Shorthand CSS properties implemented: font, border
- Basic color keywords translated into hexadecimal values
- Table CSS properties implementeds
1.0.0beta, released 2006-08-16
- First public release, most functionality implemented. Notable omissions are:

3
TODO
View File

@ -2,7 +2,6 @@ Todo List
Core:
- Finish table and shorthand CSS attributes
- border-collapse, caption-side, empty-cells, table-layout, vertical-align
- background (and friends)
- list-style
- Implement all non-essential attribute transforms
@ -30,3 +29,5 @@ Enhancements:
offer default implementation
- Auto-paragraphing (be sure to leverage fact that we know when things
shouldn't be paragraphed, such as lists and tables).
- Automatically add non-breaking spaces to empty table cells when
empty-cells:show is applied to have compatibility with Internet Explorer

View File

@ -191,12 +191,12 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
<tbody>
<tr><th colspan="2">Table</th></tr>
<tr><td>border-collapse</td><td>ENUM(collapse, seperate)</td></tr>
<tr><td>caption-side</td><td>ENUM(top, bottom)</td></tr>
<tr><td>empty-cells</td><td>ENUM(show, hide), No IE support, possible fix
with &amp;nbsp;?</td></tr>
<tr><td>table-layout</td><td>ENUM(auto, fixed)</td></tr>
<tr class="css1"><td>vertical-align</td><td>COMPOSITE(ENUM(baseline, sub,
<tr class="impl-yes"><td>border-collapse</td><td>ENUM(collapse, seperate)</td></tr>
<tr class="impl-yes"><td>caption-side</td><td>ENUM(top, bottom)</td></tr>
<tr><td>empty-cells</td><td>ENUM(show, hide), No IE support makes this useless,
possible fix with &amp;nbsp;?</td></tr>
<tr class="impl-yes"><td>table-layout</td><td>ENUM(auto, fixed)</td></tr>
<tr class="impl-yes css1"><td>vertical-align</td><td>COMPOSITE(ENUM(baseline, sub,
super, top, text-top, middle, bottom, text-bottom), &lt;percentage&gt;,
&lt;length&gt;) Also applies to others with explicit height</td></tr>
</tbody>

View File

@ -178,6 +178,22 @@ class HTMLPurifier_CSSDefinition
$this->info['border-left'] =
$this->info['border-right'] = new HTMLPurifier_AttrDef_Border();
$this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(array(
'collapse', 'seperate'));
$this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(array(
'top', 'bottom'));
$this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(array(
'auto', 'fixed'));
$this->info['vertical-align'] = new HTMLPurifier_AttrDef_Composite(array(
new HTMLPurifier_AttrDef_Enum(array('baseline', 'sub', 'super',
'top', 'text-top', 'middle', 'bottom', 'text-bottom')),
new HTMLPurifier_AttrDef_CSSLength(),
new HTMLPurifier_AttrDef_Percentage()
));
}
}

View File

@ -63,6 +63,12 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('font:12px serif;');
$this->assertDef('border:1px solid #000;');
$this->assertDef('border-bottom:2em double #FF00FA;');
$this->assertDef('border-collapse:collapse;');
$this->assertDef('caption-side:top;');
$this->assertDef('vertical-align:middle;');
$this->assertDef('vertical-align:12px;');
$this->assertDef('vertical-align:50%;');
$this->assertDef('table-layout:fixed;');
// duplicates
$this->assertDef('text-align:right;text-align:left;',