我正在开发用于Web框架的JS,并经常与其他开发人员(通常容易出错)的jQuery代码混合使用.不幸的是,他们的jQuery(文档).ready块中的错误阻止了我的执行.采取以下简单示例:
<script type="text/javascript">
jQuery(document).ready(function() {
nosuchobject.fakemethod(); //intentionally cause major error
});
</script>
<script type="text/javascript">
jQuery(document).ready(function() {
alert("Hello!"); //never executed
});
</script>
Run Code Online (Sandbox Code Playgroud)
不管先前发生了什么,第二个就绪块不应该执行吗?是否有一种"安全"的方式来运行jQuery(document).ready即使出现以前的错误也会运行?
编辑:由于它们是由其他作者编写并且是任意混合的,因此我无法控制/查看容易出错的块.
在过去的24小时内,我们有大量的TubePress用户报告来自YouTube的错误消息:
Serving Limit Exceeded
Run Code Online (Sandbox Code Playgroud)
我们的大多数用户都拥有自己的Google API密钥,而我们的云托管TubePress安装并不能达到每日配额.我找不到有关此特定错误消息的任何文档,也无法理解为什么它会突然出现在这么多具有不同密钥的网站上.
谁能解释一下发生了什么?
在Internet Explorer 8中查看时,似乎简单的YouTube iframe嵌入会抛出JavaScript错误.希望有人能找到我做错的内容 - 除非这是一个新错误?
如何重现:
错误:
SCRIPT5007: Unable to get value of the property 'getActivated': object is null or undefined
ie8-youtube.html, line 28 character 128
SCRIPT5020: Expected ')' in regular expression
html5player-vflR_cX32.js, line 675 character 708
SCRIPT438: Object doesn't support property or method 'SetReturnValue'
www-embed-vflqDUnF8.js, line 66 character 56
SCRIPT438: Object doesn't support property or method 'SetReturnValue'
uVlr4eYkNjY, line 1 character 1
Run Code Online (Sandbox Code Playgroud)
有人对此有任何见解吗?