Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript-Apply()破坏IE 9_Javascript_Jquery_Internet Explorer_Internet Explorer 9 - Fatal编程技术网

Javascript-Apply()破坏IE 9

Javascript-Apply()破坏IE 9,javascript,jquery,internet-explorer,internet-explorer-9,Javascript,Jquery,Internet Explorer,Internet Explorer 9,我有一个目标: var _intervals = { intervals: {}, _add: function (fun, interval) { var newInterval = setInterval.apply( window, [fun, interval].concat([].slice.call(arguments, 2)) ); this.intervals[ ne

我有一个目标:

var _intervals = {
    intervals: {},
    _add: function (fun, interval) {
        var newInterval = setInterval.apply(
            window,
            [fun, interval].concat([].slice.call(arguments, 2))
        );

        this.intervals[ newInterval ] = true;
        return newInterval;
    },
    _delete: function (id) {
        return clearInterval(this.intervals[id]);
    },
    _deleteAll: function () {
        var all = Object.keys(this.intervals), len = all.length;
        while (len-- > 0) {
            clearInterval(all.shift());
        }
    }
};
由于一些奇怪的原因,当我从
\u add
属性中删除
apply()
函数时,如果我将IE9保留在那里,IE9将停止工作,但属性
\u add
需要
apply()
才能正常工作

我研究了IE9中的
apply()
问题,但找不到任何相关内容

有什么帮助吗


非常感谢

IE9不支持通过
setInterval
的参数向回调传递参数

所以这不是
apply
的问题,而是
setInterval
的问题

您可以使用此选项:

var args = [].slice.call(arguments, 2), newInterval = setInterval(function(){
    fun.apply(window, args);
}, interval);