Skip to content

Commit ca6993f

Browse files
committed
Fix for Ticket #5986 - replaceWith mishandles strings
1 parent 4f2e209 commit ca6993f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/manipulation.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,11 @@ jQuery.fn.extend({
266266
// Make sure that the elements are removed from the DOM before they are inserted
267267
// this can help fix replacing a parent with child elements
268268
if ( !jQuery.isFunction( value ) ) {
269-
value = jQuery( value ).detach();
270-
269+
// API says a string is an HTML string, so evaling and
270+
// detaching will only cause problems
271+
if(typeof value !== 'string') {
272+
value = jQuery(value).detach();
273+
}
271274
} else {
272275
return this.each(function(i) {
273276
var self = jQuery(this), old = self.html();

0 commit comments

Comments
 (0)