dispatchEvent 会触发“默认”处理程序吗?

Does dispatchEvent trigger `default` handler?

我创建了这个简短的片段来测试是否可以在 JavaScript 事件中触发 default 处理程序。

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script></script>
document.addEventListener('mousedown', function (e){
    console.log('mousedown', e);
    if (e.target === document.getElementById('target')) {
        if (!e.__redispatched) {
            e.preventDefault();
            e.stopPropagation();
            e.stopImmediatePropagation();
            var ne = new MouseEvent('mousedown', e);
            ne.__redispatched = true;
            setTimeout(function (){
                e.target.focus();
                e.target.dispatchEvent(ne);
            }, 1000);
        }
    }
}, true);
    </head>
    <body>
        <input type="text" id="target"/>
        <input type="text"/>
    </body>
</html>

我预计 target 输入会接收事件并正常处理它,从而将插入符号移动到正确的位置(就像它通常在 mousedown 上所做的那样)。但是没有任何反应。

我的问题:
我是在使用 dispatchEvent 做错了什么,还是浏览器在处理合成事件时忽略了默认处理程序?有什么 material/proof 吗?

不幸的是,浏览器会忽略 不受信任 事件的默认事件处理程序。

3.4 Trusted events in the W3C UI Events Specification

Events that are generated by the user agent, either as a result of user interaction, or as a direct result of changes to the DOM, are trusted by the user agent with privileges that are not afforded to events generated by script through the DocumentEvent.createEvent("Event") method, modified using the Event.initEvent() method, or dispatched via the EventTarget.dispatchEvent() method. The isTrusted attribute of trusted events has a value of true, while untrusted events have a isTrusted attribute value of false.

Most untrusted events should not trigger default actions, with the exception of the click event. This event always triggers the default action, even if the isTrusted attribute is false (this behavior is retained for backward-compatibility). All other untrusted events must behave as if the Event.preventDefault() method had been called on that event.