Skip to content

Commit

Permalink
Removed code that removed <code> tag
Browse files Browse the repository at this point in the history
fixes #60
  • Loading branch information
paquettg committed Apr 5, 2016
1 parent 01a9e2f commit 20bcd65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/PHPHtmlParser/Dom.php
Expand Up @@ -390,9 +390,6 @@ protected function clean($str)
$str = mb_eregi_replace("<\s*style\s*>(.*?)<\s*/\s*style\s*>", '', $str);
}

// strip out preformatted tags
$str = mb_eregi_replace("<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>", '', $str);

// strip out server side scripts
$str = mb_eregi_replace("(<\?)(.*?)(\?>)", '', $str);

Expand Down
7 changes: 7 additions & 0 deletions tests/DomTest.php
Expand Up @@ -302,4 +302,11 @@ public function testBeforeClosingTag()
$dom->load("<div class=\"stream-container \" > <div class=\"stream-item js-new-items-bar-container\"> </div> <div class=\"stream\">");
$this->assertEquals("<div class=\"stream-container \"> <div class=\"stream-item js-new-items-bar-container\"> </div> <div class=\"stream\"></div></div>", (string) $dom);
}

public function testCodeTag()
{
$dom = new Dom;
$dom->load('<strong>hello</strong><code class="language-php">$foo = "bar";</code>');
$this->assertEquals('<strong>hello</strong><code class="language-php">$foo = "bar";</code>', (string) $dom);
}
}

0 comments on commit 20bcd65

Please sign in to comment.