onerror + ErrorEvent, order check
Result: Chrome fires them in the order they are attached by the user.
by James Greene
JavaScript
window.onerror = function() {
document.body.innerHTML += "<div>onerror</div>";
}
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>";
}
throw new Error("WAT");