IE8- bind() 函数兼容

来源:互联网 发布:20 linux xen 编辑:程序博客网 时间:2024/06/04 18:51
if(!Function.prototype.bind){    Function.prototype.bind = function(){        if(typeof this !== 'function'){      throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');    }        var _this = this;        var obj = arguments[0];        var ags = Array.prototype.slice.call(arguments,1);        return function(){            _this.apply(obj,ags);        };    };}
0 0