JSFiddle - React, Tailwind, and code Playground

document 和 document.body 都绑定了 error 事件 但只有 document 被触发了这个事件

HTML

<html>
    <body>
        <a id="someElem"></a>
    </body>
</html>

JavaScript

$(function(){
    $(document).bind('error', function(evt){
        console.log('Catched event by document', evt);
    });
    
    $(document.body).bind('error', function(evt){
        console.log('Catched event by body', evt);
    });

    $('#someElem').trigger('error.custom');
});