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:
30
tests/HTMLPurifier/HTMLModule/NameTest.php
Normal file
30
tests/HTMLPurifier/HTMLModule/NameTest.php
Normal 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>');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user