mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 11:11:05 +00:00
fix(startingTag): make tag name always lowercase
some browsers (IE) always provide the nodeName as upper-case
This commit is contained in:
parent
9be82d942f
commit
5c95b8cccc
3 changed files with 11 additions and 11 deletions
|
|
@ -755,7 +755,9 @@ function startingTag(element) {
|
||||||
// are not allowed to have children. So we just ignore it.
|
// are not allowed to have children. So we just ignore it.
|
||||||
element.html('');
|
element.html('');
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1];
|
return jqLite('<div>').append(element).html().
|
||||||
|
match(/^(<[^>]+>)/)[1].
|
||||||
|
replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ describe('angular', function() {
|
||||||
|
|
||||||
describe('elementHTML', function() {
|
describe('elementHTML', function() {
|
||||||
it('should dump element', function() {
|
it('should dump element', function() {
|
||||||
expect(lowercase(startingTag('<div attr="123">something<span></span></div>'))).
|
expect(startingTag('<div attr="123">something<span></span></div>')).
|
||||||
toEqual('<div attr="123">');
|
toEqual('<div attr="123">');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -541,7 +541,7 @@ describe('angular', function() {
|
||||||
describe('startingElementHtml', function(){
|
describe('startingElementHtml', function(){
|
||||||
it('should show starting element tag only', function(){
|
it('should show starting element tag only', function(){
|
||||||
expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')).
|
expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')).
|
||||||
toBeOneOf('<ng-abc x="2A">', '<NG-ABC x="2A">');
|
toBe('<ng-abc x="2A">');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -824,8 +824,8 @@ describe('$compile', function() {
|
||||||
inject(function($compile){
|
inject(function($compile){
|
||||||
expect(function() {
|
expect(function() {
|
||||||
$compile('<div><div class="sync async"></div></div>');
|
$compile('<div><div class="sync async"></div></div>');
|
||||||
}).toThrow('Multiple directives [sync, async] asking for template on: <'+
|
}).toThrow('Multiple directives [sync, async] asking for template on: '+
|
||||||
(msie <= 8 ? 'DIV' : 'div') + ' class="sync async">');
|
'<div class="sync async">');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1212,8 +1212,7 @@ describe('$compile', function() {
|
||||||
expect(function(){
|
expect(function(){
|
||||||
$compile('<div class="iscope-a; scope-b"></div>');
|
$compile('<div class="iscope-a; scope-b"></div>');
|
||||||
}).toThrow('Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' +
|
}).toThrow('Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' +
|
||||||
'<' + (msie < 9 ? 'DIV' : 'div') +
|
'<div class="iscope-a; scope-b ng-isolate-scope ng-scope">');
|
||||||
' class="iscope-a; scope-b ng-isolate-scope ng-scope">');
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1223,8 +1222,7 @@ describe('$compile', function() {
|
||||||
expect(function(){
|
expect(function(){
|
||||||
$compile('<div class="iscope-a; iscope-b"></div>');
|
$compile('<div class="iscope-a; iscope-b"></div>');
|
||||||
}).toThrow('Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
|
}).toThrow('Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
|
||||||
'<' + (msie < 9 ? 'DIV' : 'div') +
|
'<div class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
|
||||||
' class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1978,8 +1976,8 @@ describe('$compile', function() {
|
||||||
inject(function($compile) {
|
inject(function($compile) {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
$compile('<div class="first second"></div>');
|
$compile('<div class="first second"></div>');
|
||||||
}).toThrow('Multiple directives [first, second] asking for transclusion on: <' +
|
}).toThrow('Multiple directives [first, second] asking for transclusion on: ' +
|
||||||
(msie <= 8 ? 'DIV' : 'div') + ' class="first second ng-isolate-scope ng-scope">');
|
'<div class="first second ng-isolate-scope ng-scope">');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue