aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-10-16 15:01:59 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-10-16 15:01:59 -0400
commit1fdc0b7f7873885aebe279af9ffccb3900d804b2 (patch)
treece72a760092ee842402591ed5f55922db54523f5 /src/manipulation.js
parente83bc970f2dc11fc0fd545cb0ec756a0eab64eda (diff)
downloadjquery-1fdc0b7f7873885aebe279af9ffccb3900d804b2.tar.gz
jquery-1fdc0b7f7873885aebe279af9ffccb3900d804b2.zip
Replace unknown, mysterious html arg to replaceWith(fn...), with just the current node.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index aced4567b..5734b33d9 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -263,9 +263,12 @@ jQuery.fn.extend({
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
+ return this.each(function( index ) {
+ // HTML argument replaced by "this" element
+ // 1. There were no supporting tests
+ // 2. There was no internal code relying on this
+ // 3. There was no documentation of an html argument
+ jQuery( this ).replaceWith( value.call( this, index, this ) );
});
}