Skip to content

Commit

Permalink
Fix for Ticket #5986 - replaceWith mishandles strings
Browse files Browse the repository at this point in the history
  • Loading branch information
iamnoah committed Jan 29, 2010
1 parent 4f2e209 commit ca6993f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/manipulation.js
Expand Up @@ -266,8 +266,11 @@ 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 ) ) {
value = jQuery( value ).detach();

// API says a string is an HTML string, so evaling and
// detaching will only cause problems
if(typeof value !== 'string') {
value = jQuery(value).detach();
}
} else {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
Expand Down

0 comments on commit ca6993f

Please sign in to comment.