Created
October 19, 2009 04:44
-
-
Save cheeaun/213078 to your computer and use it in GitHub Desktop.
Element.disposeSelf and Element.destroySelf - removes an element without removing its content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var moveContent = function(element){ | |
var nodes = $A(element.childNodes); | |
var parent = element.parentNode; | |
for (var i=0, l=nodes.length; i<l; i++){ | |
parent.insertBefore(nodes[i], element); | |
} | |
}; | |
Element.implement({ | |
disposeSelf: function(){ | |
moveContent(this); | |
return this.dispose(); | |
}, | |
destroySelf: function(){ | |
moveContent(this); | |
return this.destroy(); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment