Skip to content

Commit cf47e8b

Browse files
committed
Merge pull request #3 from grassator/master
Fixed issue with parsing multiline style and script tags
2 parents c46c36c + c1bac0e commit cf47e8b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

htmlparser.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@
109109
}
110110

111111
} else {
112-
html = html.replace(new RegExp("(.*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
113-
text = text.replace(/<!--(.*?)-->/g, "$1")
114-
.replace(/<!\[CDATA\[(.*?)]]>/g, "$1");
115-
112+
html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
113+
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2");
116114
if (handler.chars)
117115
handler.chars(text);
118116

0 commit comments

Comments
 (0)