小编ste*_*fan的帖子

Chrome中的"未捕获的TypeError:非法调用"

当我用requestAnimationFrame以下代码做一些原生支持的动画时:

var support = {
    animationFrame: window.requestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame
};

support.animationFrame(function() {}); //error

support.animationFrame.call(window, function() {}); //right
Run Code Online (Sandbox Code Playgroud)

直接打电话给support.animationFrame意志......

未捕获的TypeError:非法调用

在Chrome中.为什么?

javascript html5 google-chrome typeerror

128
推荐指数
3
解决办法
13万
查看次数

jQuery不支持postmessage事件?

当我使用jQuery事件监听器来处理消息事件时,如下所示:

$(window).on('message', function(e) {
    var data = e.data; // data = undefined
});
Run Code Online (Sandbox Code Playgroud)

数据未定义!我确定我已将数据传递到当前窗口.因为如果我使用"addEventListener",一切顺利!

所以有什么问题?

jquery html5 postmessage

62
推荐指数
2
解决办法
2万
查看次数