Skip to content

Instantly share code, notes, and snippets.

@js2me
Created October 11, 2017 08:31
If you write only on VanillaJS and you dont use jQuery, that gist for you! He include features, which help to you work with DOM elements
Element.prototype.remove = function () {
this.parentElement.removeChild(this);
};
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
for (var i = this.length - 1; i >= 0; i--) {
if (this[i] && this[i].parentElement) {
this[i].parentElement.removeChild(this[i]);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment