diff --git a/library/HTMLPurifier/Injector.php b/library/HTMLPurifier/Injector.php
index bc093b80..5922f813 100644
--- a/library/HTMLPurifier/Injector.php
+++ b/library/HTMLPurifier/Injector.php
@@ -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;
}
diff --git a/tests/HTMLPurifier/Injector/LinkifyTest.php b/tests/HTMLPurifier/Injector/LinkifyTest.php
index e66f0eb9..1a1542d5 100644
--- a/tests/HTMLPurifier/Injector/LinkifyTest.php
+++ b/tests/HTMLPurifier/Injector/LinkifyTest.php
@@ -41,6 +41,10 @@ class HTMLPurifier_Injector_LinkifyTest extends HTMLPurifier_InjectorHarness
$this->assertResult('http://example.com/');
}
+ function testExcludes() {
+ $this->assertResult('http://example.com');
+ }
+
}
// vim: et sw=4 sts=4