0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-19 18:55:19 +00:00

Implement limited CSS property background, can only do colors (though this is desired behavior).

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@332 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-08-28 20:10:01 +00:00
parent 4e08389427
commit dd1b911183
4 changed files with 16 additions and 5 deletions

3
NEWS
View File

@ -6,8 +6,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Malformed UTF-8 and non-SGML character detection and cleaning implemented - Malformed UTF-8 and non-SGML character detection and cleaning implemented
- API documentation completed - API documentation completed
- Shorthand CSS properties implemented: font, border - Shorthand CSS properties implemented: font, border
- A limited version of CSS background implemented, only color is supported
- Basic color keywords translated into hexadecimal values - Basic color keywords translated into hexadecimal values
- Table CSS properties implementeds - Table CSS properties implemented
1.0.0beta, released 2006-08-16 1.0.0beta, released 2006-08-16
- First public release, most functionality implemented. Notable omissions are: - First public release, most functionality implemented. Notable omissions are:

8
TODO
View File

@ -6,12 +6,10 @@ Ongoing
- Plugins for major CMSes (very tricky issue) - Plugins for major CMSes (very tricky issue)
1.0 release 1.0 release
- Limited shorthand CSS attributes - Limited list-style shorthand CSS support
- background
- list-style
- Revise (HTML|CSS)Definition and Config relationship (groundwork for 2.0)
- Lossy alternate character encoding support (characters not in the encoding - Lossy alternate character encoding support (characters not in the encoding
will get silently dropped). will get silently dropped).
- Revise (HTML|CSS)Definition and Config relationship (groundwork for 2.0)
1.1 release 1.1 release
- Directive documentation generation - Directive documentation generation
@ -25,6 +23,8 @@ Ongoing
1.3 release 1.3 release
- Make URI validation routines tighter (especially mailto) - Make URI validation routines tighter (especially mailto)
- More extensive URI filtering schemes
- Allow for background-image and list-style-image (see above)
- Distinguish between different types of URIs, for instance, a mailto URI - Distinguish between different types of URIs, for instance, a mailto URI
in IMG SRC is nonsensical in IMG SRC is nonsensical

View File

@ -75,6 +75,15 @@ class HTMLPurifier_CSSDefinition
array('capitalize', 'uppercase', 'lowercase', 'none'), false); array('capitalize', 'uppercase', 'lowercase', 'none'), false);
$this->info['color'] = new HTMLPurifier_AttrDef_Color(); $this->info['color'] = new HTMLPurifier_AttrDef_Color();
// technically speaking, this one should get its own validator, but
// since we don't support background images, it effectively is
// equivalent to color. The only trouble is that if the author
// specifies an image and a color, they'll both end up getting dropped,
// even though we ought to implement it and just discard the image
// info. This will be fixed in a later version (see TODO) when
// better URI filtering is implemented.
$this->info['background'] =
$border_color = $border_color =
$this->info['border-top-color'] = $this->info['border-top-color'] =
$this->info['border-bottom-color'] = $this->info['border-bottom-color'] =

View File

@ -23,6 +23,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('text-transform:capitalize;'); $this->assertDef('text-transform:capitalize;');
$this->assertDef('background-color:rgb(0,0,255);'); $this->assertDef('background-color:rgb(0,0,255);');
$this->assertDef('background-color:transparent;'); $this->assertDef('background-color:transparent;');
$this->assertDef('background:#FF9;');
$this->assertDef('color:#F00;'); $this->assertDef('color:#F00;');
$this->assertDef('border-top-color:#F00;'); $this->assertDef('border-top-color:#F00;');
$this->assertDef('border-color:#F00 #FF0;'); $this->assertDef('border-color:#F00 #FF0;');