Skip to content

Commit

Permalink
clone() nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
statianzo committed Aug 29, 2012
1 parent 8534a97 commit 73f4055
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/jquip.js
Expand Up @@ -431,6 +431,9 @@ window['$'] = window['jquip'] = (function(){
this[name] = setVal;
});
};
p['clone'] = function() {
return $(this.map(function() { return this.cloneNode(true); }));
};

$['Expr'] = {
'hidden': function(el){
Expand Down
14 changes: 14 additions & 0 deletions test/spec/wrap.js
Expand Up @@ -44,4 +44,18 @@
list.remove();
});
});
describe('jquip.clone', function() {

it('creates a copy', function() {
var els = jquip('<div><i>1</i><i>2</i></div>').find('i');
var clones = els.clone();
clones.html('x')

expect(els[0].innerText).toBe('1')
expect(els[1].innerText).toBe('2')

expect(clones[0].innerText).toBe('x')
expect(clones[1].innerText).toBe('x')
});
});
}());

0 comments on commit 73f4055

Please sign in to comment.