Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit ba5d15f

Browse files
authored
Merge pull request #49 from mnakalay/master
Fixes Script tags that contain closing HTML tags
2 parents 7d3a3a6 + c809f96 commit ba5d15f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DeferParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ protected function setOrRemoveAttribute($node, $attr, $value)
683683
protected function script_encode($html)
684684
{
685685
return preg_replace_callback('/(<script[^>]*>)(.*?)(<\/script>)/si', function ($matches) {
686-
if (!preg_match('/type=/i', $matches[1]) || strpos($matches[1], 'text/javascript') !== false) {
686+
if (!preg_match('/<\/[^>]*>/i', $matches[2]) && (!preg_match('/type=/i', $matches[1]) || strpos($matches[1], 'text/javascript') !== false)) {
687687
return $matches[0];
688688
}
689689

0 commit comments

Comments
 (0)