mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(jqLite): support append on document fragment
previously jquery didn't support append on this node type, now it does (since 1.8.x) so I'm adding this to jqlite as well.
This commit is contained in:
parent
b9a9f91fbf
commit
96ed9ff59a
2 changed files with 8 additions and 2 deletions
|
|
@ -659,8 +659,9 @@ forEach({
|
|||
|
||||
append: function(element, node) {
|
||||
forEach(new JQLite(node), function(child){
|
||||
if (element.nodeType === 1)
|
||||
if (element.nodeType === 1 || element.nodeType === 11) {
|
||||
element.appendChild(child);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -955,9 +955,14 @@ 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() {
|
||||
it('should append to document fragment', function() {
|
||||
var root = jqLite(document.createDocumentFragment());
|
||||
expect(root.append('<p>foo</p>')).toBe(root);
|
||||
expect(root.children().length).toBe(1);
|
||||
});
|
||||
it('should not append anything if parent node is not of type element or docfrag', function() {
|
||||
var root = jqLite('<p>some text node</p>').contents();
|
||||
expect(root.append('<p>foo</p>')).toBe(root);
|
||||
expect(root.children().length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue