mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 05:37:49 +02:00
[1.7.0] Implement addElement: the advanced API is complete!
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1165 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -57,10 +57,8 @@ class HTMLPurifier_HTMLDefinitionTest extends UnitTestCase
|
||||
$config = HTMLPurifier_Config::create(array(
|
||||
'HTML.DefinitionID' => 'HTMLPurifier_HTMLDefinitionTest->test_addAttribute'
|
||||
));
|
||||
$config->revision = 9;
|
||||
$def =& $config->getHTMLDefinition(true);
|
||||
$def->addAttribute('span', 'custom', 'Enum#attribute');
|
||||
$def = $config->getHTMLDefinition();
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$input = '<span custom="attribute">Custom!</span>';
|
||||
@@ -69,6 +67,21 @@ class HTMLPurifier_HTMLDefinitionTest extends UnitTestCase
|
||||
|
||||
}
|
||||
|
||||
function test_addElement() {
|
||||
|
||||
$config = HTMLPurifier_Config::create(array(
|
||||
'HTML.DefinitionID' => 'HTMLPurifier_HTMLDefinitionTest->test_addElement'
|
||||
));
|
||||
$def =& $config->getHTMLDefinition(true);
|
||||
$def->addElement('marquee', 'Inline', 'Inline', 'Common', array('width' => 'Length'));
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$input = '<span><marquee width="50">Foobar</marquee></span>';
|
||||
$output = $purifier->purify($input);
|
||||
$this->assertIdentical($input, $output);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user