From 5c95b8cccc0d72f7ca3afb1162b9528c1222eb3c Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 8 Jun 2012 11:53:17 -0700 Subject: fix(startingTag): make tag name always lowercase some browsers (IE) always provide the nodeName as upper-case --- src/Angular.js | 4 +++- test/AngularSpec.js | 4 ++-- test/ng/compileSpec.js | 14 ++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 20f2e722..c3b57c10 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -755,7 +755,9 @@ function startingTag(element) { // are not allowed to have children. So we just ignore it. element.html(''); } catch(e) {} - return jqLite('
').append(element).html().match(/^(<[^>]+>)/)[1]; + return jqLite('
').append(element).html(). + match(/^(<[^>]+>)/)[1]. + replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); } diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 70f41d33..1c0f5f78 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -101,7 +101,7 @@ describe('angular', function() { describe('elementHTML', function() { it('should dump element', function() { - expect(lowercase(startingTag('
something
'))). + expect(startingTag('
something
')). toEqual('
'); }); }); @@ -541,7 +541,7 @@ describe('angular', function() { describe('startingElementHtml', function(){ it('should show starting element tag only', function(){ expect(startingTag('
text
')). - toBeOneOf('', ''); + toBe(''); }); }); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 655d48cc..d2b0360c 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -824,8 +824,8 @@ describe('$compile', function() { inject(function($compile){ expect(function() { $compile('
'); - }).toThrow('Multiple directives [sync, async] asking for template on: <'+ - (msie <= 8 ? 'DIV' : 'div') + ' class="sync async">'); + }).toThrow('Multiple directives [sync, async] asking for template on: '+ + '
'); }); }); @@ -1212,8 +1212,7 @@ describe('$compile', function() { expect(function(){ $compile('
'); }).toThrow('Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' + - '<' + (msie < 9 ? 'DIV' : 'div') + - ' class="iscope-a; scope-b ng-isolate-scope ng-scope">'); + '
'); }) ); @@ -1223,8 +1222,7 @@ describe('$compile', function() { expect(function(){ $compile('
'); }).toThrow('Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' + - '<' + (msie < 9 ? 'DIV' : 'div') + - ' class="iscope-a; iscope-b ng-isolate-scope ng-scope">'); + '
'); }) ); @@ -1978,8 +1976,8 @@ describe('$compile', function() { inject(function($compile) { expect(function() { $compile('
'); - }).toThrow('Multiple directives [first, second] asking for transclusion on: <' + - (msie <= 8 ? 'DIV' : 'div') + ' class="first second ng-isolate-scope ng-scope">'); + }).toThrow('Multiple directives [first, second] asking for transclusion on: ' + + '
'); }); }); -- cgit v1.2.3