I'm trying to override the native HTMLElement.addEventListener in
firefox so that I can do some extra things. I know it's possible to
add methods to the HTMLElement prototype and for them to be present on
instances of that element, but modifying native methods doesn't seem
to stick ie:
HTMLElement.prototype.addEventListener = function()
{
alert('overridden');
};
HTMLElement.prototype.anotherMethod= function()
{
alert('anothermethod');
};
var div = document.createElement('div');
alert(div.anotherMethod.toString()); // alerts function ()
{ alert('anotherMethod'); }
alert(div.addEventListener.toString()); // alerts function() { [native
code ]};
Does anyone know if its possible to override a native method in
forefox ?
Marc