mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-19 08:00:23 +00:00
fix(startTag): fix tagname extraction
the original code magically worked for ng:foo but for nothing else
This commit is contained in:
parent
53aacb35fa
commit
4a94bb9b34
2 changed files with 3 additions and 2 deletions
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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">');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue