diff --git a/library/HTMLPurifier/Lexer/DOMLex.php b/library/HTMLPurifier/Lexer/DOMLex.php
index 7d579837..de79aaae 100644
--- a/library/HTMLPurifier/Lexer/DOMLex.php
+++ b/library/HTMLPurifier/Lexer/DOMLex.php
@@ -52,14 +52,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
// attempt to armor stray angled brackets that cannot possibly
// form tags and thus are probably being used as emoticons
if ($config->get('Core.AggressivelyFixLt')) {
- $char = '[^a-z!\/]';
- $comment = "/|\z)/is";
- $html = preg_replace_callback($comment, array($this, 'callbackArmorCommentEntities'), $html);
- do {
- $old = $html;
- $html = preg_replace("/<($char)/i", '<\\1', $html);
- } while ($html !== $old);
- $html = preg_replace_callback($comment, array($this, 'callbackUndoCommentSubst'), $html); // fix comments
+ $html = $this->aggressivelyFixLt($html);
}
// preprocess html, essential for UTF-8
@@ -288,7 +281,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
*/
public function callbackUndoCommentSubst($matches)
{
- return '';
+
+ while (($startPos = strpos($html, $startTag, $offset)) !== false) {
+ $startPos += strlen($startTag); // Move past ` comment -->', $config, $context);
+
+ $this->assertIdentical($output, array(
+ new HTMLPurifier_Token_Comment(' Nested ')
+ ));
+ }
+
+}
+
+// vim: et sw=4 sts=4