mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +00:00
Fix allowsElement() bug manifesting in LinkifyTest.
Thanks frank farmer for reporting. Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
parent
e8abd5953c
commit
733a5ce5c3
@ -137,6 +137,12 @@ abstract class HTMLPurifier_Injector
|
||||
if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
|
||||
return false;
|
||||
}
|
||||
// check for exclusion
|
||||
for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
|
||||
$node = $this->currentNesting[$i];
|
||||
$def = $this->htmlDefinition->info[$node->name];
|
||||
if (isset($def->excludes[$name])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@ class HTMLPurifier_Injector_LinkifyTest extends HTMLPurifier_InjectorHarness
|
||||
$this->assertResult('http://example.com/');
|
||||
}
|
||||
|
||||
function testExcludes() {
|
||||
$this->assertResult('<a><span>http://example.com</span></a>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
Loading…
Reference in New Issue
Block a user