diff options
author | Mark Raddatz <mraddatz@gmail.com> | 2013-02-08 05:43:25 +0800 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2013-02-08 09:49:14 -0500 |
commit | 6a0ee2d9ed34b81d4ad0662423bf815a3110990f (patch) | |
tree | 493fe864323d556814b4e1fa4c8daf8037fa5cec /src | |
parent | dc9b009c1325e05344fa2216fac71fac3a0a0590 (diff) | |
download | jquery-6a0ee2d9ed34b81d4ad0662423bf815a3110990f.tar.gz jquery-6a0ee2d9ed34b81d4ad0662423bf815a3110990f.zip |
Fix #13401: replaceWith(""). Close gh-1163.
Diffstat (limited to 'src')
-rw-r--r-- | src/manipulation.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index d50ebddf7..a5a1a3975 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -241,15 +241,17 @@ jQuery.fn.extend({ value = jQuery( value ).not( this ).detach(); } - return this.domManip( [ value ], true, function( elem ) { - var next = this.nextSibling, - parent = this.parentNode; - - if ( parent ) { - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - }); + return value !== "" ? + this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent ) { + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + }) : + this.remove(); }, detach: function( selector ) { |