Skip to content

Commit

Permalink
Merge pull request #410 from jugglinmike/replacewith-args
Browse files Browse the repository at this point in the history
Correct arguments for 'replaceWith' callback
  • Loading branch information
davidchambers committed Mar 6, 2014
2 parents aa0cc40 + 380663e commit 6ce5473
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/api/manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var replaceWith = exports.replaceWith = function(content) {
index;

if (_.isFunction(content)) {
dom = makeDomArray(content.call(el, i));
dom = makeDomArray(content.call(el, i, el));
}

// In the case that `dom` contains nodes that already exist in other
Expand Down
6 changes: 5 additions & 1 deletion test/api.manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ describe('$(...)', function() {
return '<li class="first">';
});

expect(args).to.eql([[0], [1], [2]]);
expect(args).to.eql([
[0, origChildren[0]],
[1, origChildren[1]],
[2, origChildren[2]]
]);
expect(thisValues).to.eql([
origChildren[0],
origChildren[1],
Expand Down

0 comments on commit 6ce5473

Please sign in to comment.