Another irritating Mac IE shortcoming... and a fix!
It doesn't support the
So I rewrote the bastard.
[Update (Aug 16): found and fixed a bug.]
[Update (Aug 17): ok, so I thought I was all slick with that part that ensures that we're not overwriting an existing property. Little did I know that there's yet another bug in IE that makes the delete operator not work correctly. So I'll just have to make do assuming that there's no property called "$temp_daz$apply_hack$unlikely_name$". :) ]
function.apply() method.So I rewrote the bastard.
if (!Function.prototype.apply)
Function.prototype.apply = function(obj,args)
{
/* Stash the list of arguments in a string. */
var arglist = "";
if (args)
for (var i = 0; i < args.length; i++)
arglist += (i?",":"")+"args["+i+"]";
/* Define the function as a method of the object,
invoke it, delete it, and return the result. */
var p = "$temp_daz$apply_hack$unlikely_name$";
obj[p] = this;
var r = eval("obj[p]("+arglist+");");
delete obj[p];
return r;
};
[Update (Aug 16): found and fixed a bug.]
[Update (Aug 17): ok, so I thought I was all slick with that part that ensures that we're not overwriting an existing property. Little did I know that there's yet another bug in IE that makes the delete operator not work correctly. So I'll just have to make do assuming that there's no property called "$temp_daz$apply_hack$unlikely_name$". :) ]
