Make sure that the correct context is being passed in for replaceWith(fn). Fixes #5798.
This commit is contained in:
parent
9f17e70ae9
commit
0b3165fd23
2 changed files with 16 additions and 0 deletions
|
@ -233,6 +233,12 @@ jQuery.fn.extend({
|
|||
// this can help fix replacing a parent with child elements
|
||||
if ( !jQuery.isFunction( value ) ) {
|
||||
value = jQuery( value ).detach();
|
||||
|
||||
} else {
|
||||
return this.each(function(i) {
|
||||
var self = jQuery(this), old = self.html();
|
||||
self.replaceWith( value.call( this, i, old ) );
|
||||
});
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue