diff --git a/NEWS b/NEWS index a6d7aec6..f42dd0d3 100644 --- a/NEWS +++ b/NEWS @@ -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: diff --git a/TODO b/TODO index afa780b9..ba9d4070 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/docs/progress.html b/docs/progress.html index 22204377..8766199b 100644 --- a/docs/progress.html +++ b/docs/progress.html @@ -191,12 +191,12 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;} Table -border-collapseENUM(collapse, seperate) -caption-sideENUM(top, bottom) -empty-cellsENUM(show, hide), No IE support, possible fix - with &nbsp;? -table-layoutENUM(auto, fixed) -vertical-alignCOMPOSITE(ENUM(baseline, sub, +border-collapseENUM(collapse, seperate) +caption-sideENUM(top, bottom) +empty-cellsENUM(show, hide), No IE support makes this useless, + possible fix with &nbsp;? +table-layoutENUM(auto, fixed) +vertical-alignCOMPOSITE(ENUM(baseline, sub, super, top, text-top, middle, bottom, text-bottom), <percentage>, <length>) Also applies to others with explicit height diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php index a46b13c6..e8bf00f4 100644 --- a/library/HTMLPurifier/CSSDefinition.php +++ b/library/HTMLPurifier/CSSDefinition.php @@ -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() + )); + } } diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php index 3806826f..d4c0e077 100644 --- a/tests/HTMLPurifier/AttrDef/CSSTest.php +++ b/tests/HTMLPurifier/AttrDef/CSSTest.php @@ -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;',