相关疑难解决方法(0)

哪些浏览器支持bind()?

我必须在下面的方法中使用bind().我只想支持IE10及以上版本.任何人都可以验证IE10何时或是否支持bind()?

    // Verify console exists
    ...    
    if (window.console) {
        logger = window.console.log.bind(window.console);
        // bind needed for Safari but not FF, possible IE issue?
    } else {
        return false; // window.console not available, silent fail
    }
    ...
Run Code Online (Sandbox Code Playgroud)

javascript

11
推荐指数
1
解决办法
6211
查看次数

Function.prototype.bind在IE中不起作用,即使在它应该受支持的版本中也是如此

以下脚本在IE 9,IE 10,IE 11中不起作用

var a = location;
var b = 'toString'
var c = a[b].bind(a);
c(); // "Invalid calling object in IE"
Run Code Online (Sandbox Code Playgroud)

有没有解决方法呢?

编辑 - 链接问题中提供的MDN垫片不起作用!! 它们适用于IE 8!我对IE> 8的问题,其中Function.bind是"支持的".

javascript internet-explorer cross-browser

5
推荐指数
1
解决办法
1129
查看次数