diff --git a/TODO.txt b/TODO.txt index 70358cf7..f41cbd9a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,4 +6,7 @@ Primary: Code issues: - Rename AbstractTest to Harness - - (?) Create a TokenFactory to prevent really long lines \ No newline at end of file + - (?) Create a TokenFactory to prevent really long lines + +Enhancements: + - Do fixes for Firefox's inability to handle COL alignment props (Bug 915) \ No newline at end of file diff --git a/library/HTMLPurifier/AttrDef/NumberSpan.php b/library/HTMLPurifier/AttrDef/NumberSpan.php new file mode 100644 index 00000000..9ff6de4f --- /dev/null +++ b/library/HTMLPurifier/AttrDef/NumberSpan.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/library/HTMLPurifier/Definition.php b/library/HTMLPurifier/Definition.php index 60f48a36..b76b270c 100644 --- a/library/HTMLPurifier/Definition.php +++ b/library/HTMLPurifier/Definition.php @@ -9,6 +9,7 @@ require_once 'HTMLPurifier/AttrDef.php'; require_once 'HTMLPurifier/AttrDef/Pixels.php'; require_once 'HTMLPurifier/AttrDef/Length.php'; require_once 'HTMLPurifier/AttrDef/MultiLength.php'; + require_once 'HTMLPurifier/AttrDef/NumberSpan.php'; require_once 'HTMLPurifier/AttrTransform.php'; require_once 'HTMLPurifier/AttrTransform/Lang.php'; require_once 'HTMLPurifier/AttrTransform/TextAlign.php'; @@ -290,17 +291,26 @@ class HTMLPurifier_Definition $this->info['table']->attr['border'] = new HTMLPurifier_AttrDef_Pixels(); $e_Length = new HTMLPurifier_AttrDef_Length(); - $this->info['table']->attr['cellpadding'] = $e_Length; - $this->info['table']->attr['cellspacing'] = $e_Length; - $this->info['table']->attr['width'] = $e_Length; - $this->setAttrForTableElements('charoff', $e_Length); - $this->info['img']->attr['height'] = $e_Length; + $this->info['table']->attr['cellpadding'] = + $this->info['table']->attr['cellspacing'] = + $this->info['table']->attr['width'] = + $this->info['img']->attr['height'] = $this->info['img']->attr['width'] = $e_Length; + $this->setAttrForTableElements('charoff', $e_Length); $e_MultiLength = new HTMLPurifier_AttrDef_MultiLength(); - $this->info['col']->attr['width'] = $e_MultiLength; + $this->info['col']->attr['width'] = $this->info['colgroup']->attr['width'] = $e_MultiLength; + $e__NumberSpan = new HTMLPurifier_AttrDef_NumberSpan(); + $this->info['colgroup']->attr['span'] = + $this->info['col']->attr['span'] = + $this->info['td']->attr['rowspan'] = + $this->info['th']->attr['rowspan'] = + $this->info['td']->attr['colspan'] = + $this->info['th']->attr['colspan'] = $e__NumberSpan; + + ////////////////////////////////////////////////////////////////////// // UNIMP : info_tag_transform : transformations of tags diff --git a/tests/HTMLPurifier/AttrDef/NumberSpanTest.php b/tests/HTMLPurifier/AttrDef/NumberSpanTest.php new file mode 100644 index 00000000..bb9c3050 --- /dev/null +++ b/tests/HTMLPurifier/AttrDef/NumberSpanTest.php @@ -0,0 +1,28 @@ +def = new HTMLPurifier_AttrDef_NumberSpan(); + + // this one requires a little explanation. A colspan="1" shouldn't + // exist at all: it's just a dud, since the default value is already + // supplied + $this->assertDef('1', false); + + $this->assertDef('4'); + $this->assertDef('4.5', '4'); // round down (truncate) + $this->assertDef('0', false); + $this->assertDef('-4', false); + $this->assertDef('asdf', false); + + } + +} + +?> \ No newline at end of file diff --git a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php index d56152ef..51685754 100644 --- a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php +++ b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php @@ -80,6 +80,9 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends