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

Commit 5c95b8c

Browse files
committed
fix(startingTag): make tag name always lowercase
some browsers (IE) always provide the nodeName as upper-case
1 parent 9be82d9 commit 5c95b8c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Angular.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ function startingTag(element) {
755755
// are not allowed to have children. So we just ignore it.
756756
element.html('');
757757
} catch(e) {}
758-
return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1];
758+
return jqLite('<div>').append(element).html().
759+
match(/^(<[^>]+>)/)[1].
760+
replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
759761
}
760762

761763

test/AngularSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('angular', function() {
101101

102102
describe('elementHTML', function() {
103103
it('should dump element', function() {
104-
expect(lowercase(startingTag('<div attr="123">something<span></span></div>'))).
104+
expect(startingTag('<div attr="123">something<span></span></div>')).
105105
toEqual('<div attr="123">');
106106
});
107107
});
@@ -541,7 +541,7 @@ describe('angular', function() {
541541
describe('startingElementHtml', function(){
542542
it('should show starting element tag only', function(){
543543
expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')).
544-
toBeOneOf('<ng-abc x="2A">', '<NG-ABC x="2A">');
544+
toBe('<ng-abc x="2A">');
545545
});
546546
});
547547

test/ng/compileSpec.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,8 @@ describe('$compile', function() {
824824
inject(function($compile){
825825
expect(function() {
826826
$compile('<div><div class="sync async"></div></div>');
827-
}).toThrow('Multiple directives [sync, async] asking for template on: <'+
828-
(msie <= 8 ? 'DIV' : 'div') + ' class="sync async">');
827+
}).toThrow('Multiple directives [sync, async] asking for template on: '+
828+
'<div class="sync async">');
829829
});
830830
});
831831

@@ -1212,8 +1212,7 @@ describe('$compile', function() {
12121212
expect(function(){
12131213
$compile('<div class="iscope-a; scope-b"></div>');
12141214
}).toThrow('Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' +
1215-
'<' + (msie < 9 ? 'DIV' : 'div') +
1216-
' class="iscope-a; scope-b ng-isolate-scope ng-scope">');
1215+
'<div class="iscope-a; scope-b ng-isolate-scope ng-scope">');
12171216
})
12181217
);
12191218

@@ -1223,8 +1222,7 @@ describe('$compile', function() {
12231222
expect(function(){
12241223
$compile('<div class="iscope-a; iscope-b"></div>');
12251224
}).toThrow('Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
1226-
'<' + (msie < 9 ? 'DIV' : 'div') +
1227-
' class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
1225+
'<div class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
12281226
})
12291227
);
12301228

@@ -1978,8 +1976,8 @@ describe('$compile', function() {
19781976
inject(function($compile) {
19791977
expect(function() {
19801978
$compile('<div class="first second"></div>');
1981-
}).toThrow('Multiple directives [first, second] asking for transclusion on: <' +
1982-
(msie <= 8 ? 'DIV' : 'div') + ' class="first second ng-isolate-scope ng-scope">');
1979+
}).toThrow('Multiple directives [first, second] asking for transclusion on: ' +
1980+
'<div class="first second ng-isolate-scope ng-scope">');
19831981
});
19841982
});
19851983

0 commit comments

Comments
 (0)