ErrorEvent + onerror, order check
Result: Chrome fires them in the order they are attached by the user. (In this case, good, but bad in others.)
by James Greene
JavaScript
if (typeof window.ErrorEvent !== "undefined") {
window.addEventListener("error", function() {
document.body.innerHTML += "<div>ErrorEvent</div>";
});
}
else {
document.body.innerHTML += "<div>ErrorEvent not available in this browser</div>";
}
window.onerror = function() {
document.body.innerHTML += "<div>onerror</div>";
}
throw new Error("WAT");