fason 的 apply & call for IE5

fason 的 apply & call for IE5

 

if ( typeof (Function.prototype.apply) != " function " )
{
  Function.prototype.apply 
=   function (obj, argu)
  {
    
var  s;
    
if (obj)
    {
      obj.constructor.prototype._caller
= this ;
      s 
=   " obj._caller " ;
    }
    
else  s  =   " this " ;
    
var  a = [];
    
for ( var  i = 0 ; i < argu.length; i ++ )
      a[i] 
=   " argu[ " +  i  + " ] " ;
    
return  eval(s  + " ( " +  a.join( " , " + " ); " );
  };
  Function.prototype.call  
=   function (obj)
  {
    
var  a = [];
    
for ( var  i = 1 ; i < arguments.length; i ++ )
      a[i
- 1 ] = arguments[i];
    
return   this .apply(obj, a);
  }; 

你可能感兴趣的:(fason 的 apply & call for IE5)