Skip to content

Commit

Permalink
fix(sanitize): Port script/style fix over from main repo.
Browse files Browse the repository at this point in the history
Fixes #533
  • Loading branch information
SimeonC authored and SimeonC committed Feb 3, 2015
1 parent da43539 commit 7975a26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/textAngular-sanitize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/textAngular-sanitize.js
Expand Up @@ -341,7 +341,7 @@ function htmlParser(html, handler) {
}

} else {
html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
html = html.replace(new RegExp("([^]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
function(all, text) {
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");

Expand Down
4 changes: 2 additions & 2 deletions test/textAngularSanitize/sanitize.spec.js
Expand Up @@ -137,7 +137,7 @@ describe('HTML', function() {
});

it('should remove script', function() {
expectHTML('a<SCRIPT>evil< / scrIpt >c.').toEqual('ac.');
expectHTML('a<SCRIPT>\n\revil\n\r< / scrIpt >c.').toEqual('ac.');
});

it('should remove DOCTYPE header', function() {
Expand All @@ -157,7 +157,7 @@ describe('HTML', function() {
});

it('should remove style', function() {
expectHTML('a<STyle>evil</stYle>c.').toEqual('ac.');
expectHTML('a<STyle>\n\revil\n\r</stYle>c.').toEqual('ac.');
});

it('should remove script and style', function() {
Expand Down

0 comments on commit 7975a26

Please sign in to comment.