]> source.dussan.org Git - jquery.git/commitdiff
bug 6158; fixing replaceWith from throwing errors on empty elements
authorJordan Boesch <jboesch26@gmail.com>
Sat, 5 Mar 2011 15:30:29 +0000 (09:30 -0600)
committerJordan Boesch <jboesch26@gmail.com>
Sat, 5 Mar 2011 15:30:29 +0000 (09:30 -0600)
src/manipulation.js

index ba316971553dafdf33307bb14cac87bd5f6f678e..a4a81de4474ed3b2270ef3f6a1d00f2a90dfdf57 100644 (file)
@@ -261,6 +261,9 @@ jQuery.fn.extend({
                                }
                        });
                } else {
+            if ( !this.length ) {
+                return this;
+            }
                        return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
                }
        },