Skip to content

Commit 4a94bb9

Browse files
committed
fix(startTag): fix tagname extraction
the original code magically worked for ng:foo but for nothing else
1 parent 53aacb3 commit 4a94bb9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Angular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ function startingTag(element) {
742742
// are not allowed to have children. So we just ignore it.
743743
element.html('');
744744
} catch(e) {};
745-
return jqLite('<div>').append(element).html().replace(/\<\/[\w\:\-]+\>$/, '');
745+
return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1];
746746
}
747747

748748

test/AngularSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ describe('angular', function() {
512512

513513
describe('startingElementHtml', function(){
514514
it('should show starting element tag only', function(){
515-
expect(startingTag('<ng-abc x="2"><div>text</div></ng-abc>')).toEqual('<ng-abc x="2">');
515+
expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')).
516+
toBeOneOf('<ng-abc x="2A">', '<NG-ABC x="2A">');
516517
});
517518
});
518519

0 commit comments

Comments
 (0)