Skip to content

Commit

Permalink
fix(sanitize): handle newline characters inside <script> for IE
Browse files Browse the repository at this point in the history
Tweak the regex used match characters inside <script> and <style> to a IE
compatible regex.
  • Loading branch information
lgalfaso committed Feb 7, 2015
1 parent 69ee593 commit ce49d4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ngSanitize/sanitize.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ function htmlParser(html, handler) {
}

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

Expand Down

0 comments on commit ce49d4d

Please sign in to comment.