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

Commit 030a42e

Browse files
committed
fix(sanitize): handle newline characters inside <script> for IE
Tweak the regex used match characters inside <script> and <style> to a IE compatible regex.
1 parent 898714d commit 030a42e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ngSanitize/sanitize.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ function htmlParser(html, handler) {
336336
}
337337

338338
} else {
339-
html = html.replace(new RegExp("([^]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
339+
// IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\W\w].
340+
html = html.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
340341
function(all, text) {
341342
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
342343

0 commit comments

Comments
 (0)