M
Matt Kruse
Is it possible to extend the HTMLCollection prototype in Firefox (>=2.0)?
It looks like I can do it, but it doesn't work:
HTMLCollection.prototype.funk = function() { alert(this.length); }
window.onload= function() {
var x = document.getElementsByTagName('div');
alert(HTMLCollection.prototype.funk); // function() { ... }
alert(x instanceof HTMLCollection); // true
alert(x.item===HTMLCollection.prototype.item); // false
x.funk(); // error: x.funk is not a function
}
Is there any other way to do it that will work right now?
It looks like I can do it, but it doesn't work:
HTMLCollection.prototype.funk = function() { alert(this.length); }
window.onload= function() {
var x = document.getElementsByTagName('div');
alert(HTMLCollection.prototype.funk); // function() { ... }
alert(x instanceof HTMLCollection); // true
alert(x.item===HTMLCollection.prototype.item); // false
x.funk(); // error: x.funk is not a function
}
Is there any other way to do it that will work right now?