diff options
| author | paolo-delmundo | 2013-10-02 20:49:20 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-10-03 08:42:15 +0100 |
| commit | e66c23fe55f8571a014b0686c8dbca128e7a8240 (patch) | |
| tree | 6d0eae30b0180fb3999c9ec022728c63b56eabfa /test/ngSanitize/sanitizeSpec.js | |
| parent | e36e28ebd4a6c144e47d11fba8e211d8d5a9d03e (diff) | |
| download | angular.js-e66c23fe55f8571a014b0686c8dbca128e7a8240.tar.bz2 | |
fix($sanitize): sanitize DOCTYPE declarations correctly
HTML to be sanitized that contains a DOCTYPE declaration were causing
the HTML parser to throw an error. Now the parser correctly removes
the declarations when sanitizing HTML.
Closes #3931
Diffstat (limited to 'test/ngSanitize/sanitizeSpec.js')
| -rw-r--r-- | test/ngSanitize/sanitizeSpec.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/ngSanitize/sanitizeSpec.js b/test/ngSanitize/sanitizeSpec.js index ae1271f0..3d586830 100644 --- a/test/ngSanitize/sanitizeSpec.js +++ b/test/ngSanitize/sanitizeSpec.js @@ -24,7 +24,7 @@ describe('HTML', function() { attrs: attrs, unary: unary }; - // Since different browsers handle newlines differenttly we trim + // Since different browsers handle newlines differently we trim // so that it is easier to write tests. angular.forEach(attrs, function(value, key) { attrs[key] = value.replace(/^\s*/, '').replace(/\s*$/, '') @@ -112,6 +112,13 @@ describe('HTML', function() { expectHTML('a<SCRIPT>evil< / scrIpt >c.').toEqual('ac.'); }); + it('should remove DOCTYPE header', function() { + expectHTML('<!DOCTYPE html>').toEqual(''); + expectHTML('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n"http://www.w3.org/TR/html4/strict.dtd">').toEqual(''); + expectHTML('a<!DOCTYPE html>c.').toEqual('ac.'); + expectHTML('a<!DocTyPe html>c.').toEqual('ac.'); + }); + it('should remove nested script', function() { expectHTML('a< SCRIPT >A< SCRIPT >evil< / scrIpt >B< / scrIpt >c.').toEqual('ac.'); }); @@ -320,5 +327,6 @@ describe('HTML', function() { }); }); + }); }); |
