Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 09a9832

Browse files
fix(Angular): properly get node name for svg element wrapper
Fixes #10078 Closes #10172
1 parent bf6a79c commit 09a9832

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Angular.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ function makeMap(str) {
625625

626626

627627
function nodeName_(element) {
628-
return lowercase(element.nodeName || element[0].nodeName);
628+
return lowercase(element.nodeName || (element[0] && element[0].nodeName));
629629
}
630630

631631
function includes(array, obj) {

test/AngularSpec.js

+5
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,11 @@ describe('angular', function() {
10091009
expect(nodeName_(div.childNodes[0])).toBe('ngtest:foo');
10101010
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');
10111011
});
1012+
1013+
it('should return undefined for elements without the .nodeName property', function() {
1014+
//some elements, like SVGElementInstance don't have .nodeName property
1015+
expect(nodeName_({})).toBeUndefined();
1016+
});
10121017
});
10131018

10141019

0 commit comments

Comments
 (0)