Skip to content

Commit 5c2d709

Browse files
committed
bug 6158; fixing replaceWith from throwing errors on empty elements
1 parent 2d0bc7c commit 5c2d709

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/manipulation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ jQuery.fn.extend({
261261
}
262262
});
263263
} else {
264+
if ( !this.length ) {
265+
return this;
266+
}
264267
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
265268
}
266269
},

0 commit comments

Comments
 (0)