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
This file contains 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
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