diff options
| author | Igor Minar | 2012-03-09 14:49:40 -0800 | 
|---|---|---|
| committer | Igor Minar | 2012-03-09 16:27:12 -0800 | 
| commit | 4a94bb9b345946a9efd51adaeedc0f907af4df49 (patch) | |
| tree | dc6e46df05005bf5cb6b3470d819c6b8b2c4584e | |
| parent | 53aacb35fa469496c88a04a70ffab875e8b35d86 (diff) | |
| download | angular.js-4a94bb9b345946a9efd51adaeedc0f907af4df49.tar.bz2 | |
fix(startTag): fix tagname extraction
the original code magically worked for ng:foo but for nothing else
| -rw-r--r-- | src/Angular.js | 2 | ||||
| -rw-r--r-- | 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('<div>').append(element).html().replace(/\<\/[\w\:\-]+\>$/, ''); +  return jqLite('<div>').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('<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">');      });    }); | 
