diff options
author | Jordan Boesch <jboesch26@gmail.com> | 2011-03-05 09:46:12 -0600 |
---|---|---|
committer | Jordan Boesch <jboesch26@gmail.com> | 2011-03-05 09:46:12 -0600 |
commit | c9ef09c800ba7b6510d9e3a68f053ae29409f621 (patch) | |
tree | b58bf511662c0b0dff3a61e499661b5c6f43fae2 /src/manipulation.js | |
parent | 5c2d70979c15bbda5c90e1634abe11d8c350abcb (diff) | |
download | jquery-c9ef09c800ba7b6510d9e3a68f053ae29409f621.tar.gz jquery-c9ef09c800ba7b6510d9e3a68f053ae29409f621.zip |
bug 6158; fixing replaceWith from throwing errors on non existant elements
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index a4a81de44..613faabb9 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -261,10 +261,9 @@ jQuery.fn.extend({ } }); } else { - if ( !this.length ) { - return this; - } - return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); + return ( this.length ) ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; } }, |