fix(startTag): fix tagname extraction

the original code magically worked for ng:foo but for nothing else
This commit is contained in:
Igor Minar 2012-03-09 14:49:40 -08:00
parent 53aacb35fa
commit 4a94bb9b34
2 changed files with 3 additions and 2 deletions

View file

@ -742,7 +742,7 @@ function startingTag(element) {
// are not allowed to have children. So we just ignore it.
element.html('');
} catch(e) {};
return jqLite('<div>').append(element).html().replace(/\<\/[\w\:\-]+\>$/, '');
return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1];
}

View file

@ -512,7 +512,8 @@ describe('angular', function() {
describe('startingElementHtml', function(){
it('should show starting element tag only', function(){
expect(startingTag('<ng-abc x="2"><div>text</div></ng-abc>')).toEqual('<ng-abc x="2">');
expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')).
toBeOneOf('<ng-abc x="2A">', '<NG-ABC x="2A">');
});
});