From 4a94bb9b345946a9efd51adaeedc0f907af4df49 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 9 Mar 2012 14:49:40 -0800 Subject: fix(startTag): fix tagname extraction the original code magically worked for ng:foo but for nothing else --- src/Angular.js | 2 +- test/AngularSpec.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 3f9938f1..7ab0e7f6 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -742,7 +742,7 @@ function startingTag(element) { // are not allowed to have children. So we just ignore it. element.html(''); } catch(e) {}; - return jqLite('
').append(element).html().replace(/\<\/[\w\:\-]+\>$/, ''); + return jqLite('
').append(element).html().match(/^(<[^>]+>)/)[1]; } diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 7e070761..92949b66 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -512,7 +512,8 @@ describe('angular', function() { describe('startingElementHtml', function(){ it('should show starting element tag only', function(){ - expect(startingTag('
text
')).toEqual(''); + expect(startingTag('
text
')). + toBeOneOf('', ''); }); }); -- cgit v1.2.3