diff options
| author | Igor Minar | 2011-03-31 01:19:07 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-03-31 01:19:07 -0700 |
| commit | a2c42711281d6ec61b73190b47743f79143c5bb1 (patch) | |
| tree | dd1e463c9208b4d76a175141d684574d4bde144b | |
| parent | 56c00800c78d3d896fa6cb97ab97b974805152c4 (diff) | |
| download | angular.js-a2c42711281d6ec61b73190b47743f79143c5bb1.tar.bz2 | |
ignore jqLite#append for doc fragment
this is needed to be compatible with jqQuery 1.5.1
| -rw-r--r-- | src/jqLite.js | 3 | ||||
| -rw-r--r-- | test/jqLiteSpec.js | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index d16ce19e..6539aaab 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -342,7 +342,8 @@ forEach({ append: function(element, node) { forEach(new JQLite(node), function(child){ - element.appendChild(child); + if (element.nodeType === 1) + element.appendChild(child); }); }, diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 2fc670ce..e566b1fe 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -299,6 +299,11 @@ describe('jqLite', function(){ expect(root.append('text')).toEqual(root); expect(root.html()).toEqual('text'); }); + it('should not append anything if parent node is not of type element', function() { + var root = jqLite(document.createDocumentFragment()); + expect(root.append('<p>foo</p>')).toBe(root); + expect(root.children().length).toBe(0); + }); }); describe('remove', function(){ it('should remove', function(){ |
