Skip to content

Commit 2687c26

Browse files
committed
fix($compile): detect <a> elements inside <svg>
1 parent f2fa1ed commit 2687c26

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/ng/compile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
765765
}
766766
}
767767

768-
nodeName = nodeName_(this.$$element);
768+
// SVG elements' `nodeName` can be lowercase
769+
nodeName = nodeName_(this.$$element).toUpperCase();
769770

770771
// sanitize a[href] and img[src] values
771772
if ((nodeName === 'A' && (key === 'href' || key === 'xlinkHref')) ||

test/ng/compileSpec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4804,6 +4804,8 @@ describe('$compile', function() {
48044804
});
48054805

48064806
it('should use $$sanitizeUri when working with svg and xlink:href', function() {
4807+
if (!window.SVGElement) return;
4808+
48074809
var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri');
48084810
module(function($provide) {
48094811
$provide.value('$$sanitizeUri', $$sanitizeUri);

0 commit comments

Comments
 (0)