I am using this solution: (from: Remove element by id)
Element.prototype.remove = function() {
this.parentElement.removeChild(this);
}
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
for(var i = 0, len = this.length; i < len; i++) {
if(this[i] && this[i].parentElement) {
this[i].parentElement.removeChild(this[i]);
}
}
}
I am getting the following warning in closure compiler:
externs.zip//w3c_dom2.js:793: WARNING - mismatch of the remove property type and the type of the property it overrides from superclass Element
original: function (this:Element): undefined
override: function (this:HTMLSelectElement, number): undefined
HTMLSelectElement.prototype.remove = function(index) {};
How can I clear this warning? Or should I use another approach for element.remove?