Skip to content

Commit 7975a26

Browse files
SimeonCSimeonC
SimeonC
authored and
SimeonC
committed
fix(sanitize): Port script/style fix over from main repo.
Fixes #533
1 parent da43539 commit 7975a26

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

dist/textAngular-sanitize.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/textAngular-sanitize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ function htmlParser(html, handler) {
341341
}
342342

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

test/textAngularSanitize/sanitize.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('HTML', function() {
137137
});
138138

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

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

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

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

0 commit comments

Comments
 (0)