Side navigation
Ticket #3749: preservechildren.patch
File preservechildren.patch, 0.7 KB (added by kkaefer, December 25, 2008 07:41PM UTC)
alternative patch that extends the .remove() function instead of adding another function
Index: core.js
===================================================================
--- core.js (revision 5998)
+++ core.js (working copy)
@@ -1284,8 +1284,13 @@
jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
},
- remove: function( selector ) {
+ remove: function( selector, preserveChildren ) {
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
+ if ( this.parentNode && preserveChildren ) {
+ while ( this.firstChild ) {
+ this.parentNode.insertBefore( this.firstChild, this );
+ }
+ }
// Prevent memory leaks
jQuery( "*", this ).add([this]).each(function(){
jQuery.event.remove(this);
Download in other formats:
Original Format
File preservechildren.patch, 0.7 KB (added by kkaefer, December 25, 2008 07:41PM UTC)
alternative patch that extends the .remove() function instead of adding another function
Index: core.js
===================================================================
--- core.js (revision 5998)
+++ core.js (working copy)
@@ -1284,8 +1284,13 @@
jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
},
- remove: function( selector ) {
+ remove: function( selector, preserveChildren ) {
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
+ if ( this.parentNode && preserveChildren ) {
+ while ( this.firstChild ) {
+ this.parentNode.insertBefore( this.firstChild, this );
+ }
+ }
// Prevent memory leaks
jQuery( "*", this ).add([this]).each(function(){
jQuery.event.remove(this);