diff --git a/lib/api/manipulation.js b/lib/api/manipulation.js index dfd3237bc5..4ae89db05f 100644 --- a/lib/api/manipulation.js +++ b/lib/api/manipulation.js @@ -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 diff --git a/test/api.manipulation.js b/test/api.manipulation.js index 7d84b6444c..1e5cce9fc5 100644 --- a/test/api.manipulation.js +++ b/test/api.manipulation.js @@ -595,7 +595,11 @@ describe('$(...)', function() { return '