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

Commit

Permalink
fix(Angular): properly get node name for svg element wrapper
Browse files Browse the repository at this point in the history
Fixes #10078
  • Loading branch information
pkozlowski-opensource committed Nov 22, 2014
1 parent 5c43b94 commit 8e37729
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Angular.js
Expand Up @@ -625,7 +625,7 @@ function makeMap(str) {


function nodeName_(element) {
return lowercase(element.nodeName || element[0].nodeName);
return lowercase(element.nodeName || (element[0] && element[0].nodeName));
}

function includes(array, obj) {
Expand Down
5 changes: 5 additions & 0 deletions test/AngularSpec.js
Expand Up @@ -1009,6 +1009,11 @@ describe('angular', function() {
expect(nodeName_(div.childNodes[0])).toBe('ngtest:foo');
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');
});

it('should return undefined for elements without the .nodeName property', function() {
//some elements, like SVGElementInstance don't have .nodeName property
expect(nodeName_({})).toBeUndefined();
});
});


Expand Down

0 comments on commit 8e37729

Please sign in to comment.