1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 22:26:31 +02:00

[1.3.0] New directives %HTML.AllowedElements and %HTML.AllowedAttributes to let users narrow the set of allowed tags

. Added HTMLPurifier->info_parent_def, parent child processing made special

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@565 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-11-23 13:51:19 +00:00
parent 94db380271
commit 925a07b828
4 changed files with 97 additions and 3 deletions

View File

@@ -36,6 +36,23 @@ class HTMLPurifier_Test extends UnitTestCase
}
function testDifferentAllowedElements() {
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML', 'AllowedElements', array('b', 'i', 'p', 'a'));
$config->set('HTML', 'AllowedAttributes', array('a.href', '*.id'));
$this->purifier = new HTMLPurifier($config);
$this->assertPurification(
'<p>Par.</p><p>Para<a href="http://google.com/">gr</a>aph</p>Text<b>Bol<i>d</i></b>'
);
$this->assertPurification(
'<span>Not allowed</span><a class="mef" id="foobar">Foobar</a>',
'Not allowed<a>Foobar</a>' // no ID!!!
);
}
}
?>