MDN states the following:
some/many
error
events do not triggerwindow.onerror
, you have to listen for them specifically
That's great, but which ones do not invoke onerror
?
MDN states the following:
some/many
error
events do not triggerwindow.onerror
, you have to listen for them specifically
That's great, but which ones do not invoke onerror
?
-
2
If a program cannot be parsed, then you get a
SyntaxError
before theonerror
assignment can even be evaluated. – pimvdb Commented Dec 14, 2012 at 21:27 -
Let's assume that the first script loaded only has
window.onerror=function(){console.log(arguments);};
and nothing more. – Francisc Commented Dec 14, 2012 at 21:28 -
1
I assume that bit in the MDN docs refers to loading
error
events for Ajax, images, etc. – apsillers Commented Dec 14, 2012 at 21:32
1 Answer
Reset to default 5It looks like quirksmode has a good detail of what errors it will and will not catch: http://www.quirksmode/dom/events/error.html
If it helps, any error that you specifically throw
will be caught.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744854518a4597328.html
评论列表(0条)