1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Implement %HTML.Attr.Name.UseCDATA which relaxes name validation rules.

Sponsored-by: Ian Cook <thinkspill@gmail.com>
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2009-03-20 19:34:38 -04:00
parent 84e2e141fc
commit 398a02039e
6 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
<?php
class HTMLPurifier_HTMLModule_NameTest extends HTMLPurifier_HTMLModuleHarness
{
function setUp() {
parent::setUp();
}
function testBasicUse() {
$this->config->set('Attr.EnableID', true);
$this->assertResult(
'<a name="foo">bar</a>'
);
}
function testCDATA() {
$this->config->set('HTML.Attr.Name.UseCDATA', true);
$this->assertResult(
'<a name="2">Baz</a><a name="2">Bar</a>'
);
}
function testCDATAWithHeavyTidy() {
$this->config->set('HTML.Attr.Name.UseCDATA', true);
$this->config->set('HTML.TidyLevel', 'heavy');
$this->assertResult('<a name="2">Baz</a>');
}
}