diff --git a/src/ngSanitize/sanitize.js b/src/ngSanitize/sanitize.js index a23fc1b12e3f..81302e3ffca4 100644 --- a/src/ngSanitize/sanitize.js +++ b/src/ngSanitize/sanitize.js @@ -236,16 +236,18 @@ var svgAttrs = makeMap('accent-height,accumulate,additive,alphabetic,arabic-form 'underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,' + 'viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,' + 'xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,' + - 'zoomAndPan'); + 'zoomAndPan', true); var validAttrs = angular.extend({}, uriAttrs, svgAttrs, htmlAttrs); -function makeMap(str) { +function makeMap(str, lowercaseKeys) { var obj = {}, items = str.split(','), i; - for (i = 0; i < items.length; i++) obj[items[i]] = true; + for (i = 0; i < items.length; i++) { + obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true; + } return obj; } diff --git a/test/ngSanitize/sanitizeSpec.js b/test/ngSanitize/sanitizeSpec.js index e9617e10b8c1..121d3284736f 100644 --- a/test/ngSanitize/sanitizeSpec.js +++ b/test/ngSanitize/sanitizeSpec.js @@ -251,6 +251,12 @@ describe('HTML', function() { .toEqual(''); }); + it('should not ignore white-listed svg camelCased attributes', function() { + expectHTML('') + .toEqual(''); + + }); + it('should sanitize SVG xlink:href attribute values', function() { expectHTML('') .toEqual('');