diff --git a/TODO.txt b/TODO.txt index da98e6f6..b6d4c7eb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,15 +1,13 @@ Todo List -Primary: - - (In Progress) Implement attribute validation - - Implement HTMLPurifier (trivial) - Code issues: - - Rename AbstractTest to Harness - (?) Create a TokenFactory to prevent really long lines - Massive profiling - Fix IPv6 issues - - Make URI validation routines tighter + - Make URI validation routines tighter (especially mailto) + - Distinguish between different types of URIs, for instance, a mailto URI + in IMG SRC is nonsensical + - Factor out Host validation to its own AttrDef Enhancements: - Do fixes for Firefox's inability to handle COL alignment props (Bug 915) diff --git a/docs/progress.html b/docs/progress.html index ccca4487..06913f68 100644 --- a/docs/progress.html +++ b/docs/progress.html @@ -71,7 +71,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;} scopeTD, THW3C only: No browser implementation - + URI citeBLOCKQUOTE, Q- DEL, INS- @@ -103,6 +103,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;} noshadeHRBoolean, style 'border-style:solid;' nowrapTD, THBoolean, style 'white-space:nowrap;' (not compat with IE5) sizeHRNear-equiv 'width', needs px suffix if original was pixels +srcIMGRequired, insert blank or default img if not set startOLPoorly supported 'counter-reset', transform may not be desirable typeLIEquivalent style 'list-style-type', different allowed values though. (needs testing) OL diff --git a/library/HTMLPurifier/Definition.php b/library/HTMLPurifier/Definition.php index b76b270c..418f04c7 100644 --- a/library/HTMLPurifier/Definition.php +++ b/library/HTMLPurifier/Definition.php @@ -10,6 +10,7 @@ require_once 'HTMLPurifier/AttrDef.php'; require_once 'HTMLPurifier/AttrDef/Length.php'; require_once 'HTMLPurifier/AttrDef/MultiLength.php'; require_once 'HTMLPurifier/AttrDef/NumberSpan.php'; + require_once 'HTMLPurifier/AttrDef/URI.php'; require_once 'HTMLPurifier/AttrTransform.php'; require_once 'HTMLPurifier/AttrTransform/Lang.php'; require_once 'HTMLPurifier/AttrTransform/TextAlign.php'; @@ -310,6 +311,14 @@ class HTMLPurifier_Definition $this->info['td']->attr['colspan'] = $this->info['th']->attr['colspan'] = $e__NumberSpan; + $e_URI = new HTMLPurifier_AttrDef_URI(); + $this->info['a']->attr['href'] = + $this->info['img']->attr['longdesc'] = + $this->info['img']->attr['src'] = + $this->info['del']->attr['cite'] = + $this->info['ins']->attr['cite'] = + $this->info['blockquote']->attr['cite'] = + $this->info['q']->attr['cite'] = $e_URI; ////////////////////////////////////////////////////////////////////// // UNIMP : info_tag_transform : transformations of tags diff --git a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php index 69873e30..ff1488f4 100644 --- a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php +++ b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php @@ -87,6 +87,14 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends HTML; $expect[13] = $inputs[13]; + // test URI + $inputs[14] = 'Google'; + $expect[14] = $inputs[14]; + + // test invalid URI + $inputs[15] = 'Google'; + $expect[15] = 'Google'; + $this->assertStrategyWorks($strategy, $inputs, $expect, $config); }