jQuery可以从我的事件处理程序中抛出错误吗?

我在使用jQuery设置的特定事件处理程序中发生错误,代码只是在没有显示任何错误的情况下中断。 当我以前在YUI编写类似的东西时,我会设置YAHOO.util.Event.throwErrors = true; 在我的开发中。 版本,这告诉YUI的事件处理程序抛出错误。 我找不到任何类似的东西,只是我失明而没有看到它吗?

谢谢!

这是一个例子……

  jQuery Events    google.load('jquery', '1.3.2');   

click me

$(document).ready(function() { $("p").click(function() { console.log('How to display an error here similar to the native onclick ?'); qaz; console.log('this line is not executed because of the error, but the error is not reported. Is there a way to have jQuery report those errors ?'); }); });

我很确定jQuery不会为你吞下错误,所以你绝对应该看到你未定义的qaz的错误。

运行更新的页面,我仍然看到console.log和Firebug中未定义的qaz上的错误。 打开正常的浏览器错误控制台,我也看到qaz is not defined (...temp.html - Line: 15)消息。 在IE中,我当然得到"console" is undefined ,但这只是表明错误也在那里(因为没有控制台)。 假设你正在运行那个完全相同的html / js,显然还有一些其他的变量正在给你带来问题。

你在运行什么版本的Firebug? 调试javascript之类的1.4版本有各种各样的随机问题,但1.5.0似乎更加一致和稳定。