なので TextNode などではイベントを発生させられないと思っていたのですが
document.body.innerHTML = `
<div></div>
`
window.onclick = console.log
document.body.firstChild.dispatchEvent(new Event("click", { bubbles: true }))
// Event {isTrusted: false, type: "click", target: text, currentTarget: Window, eventPhase: 3, …}
TextNode でも dispatchEvent があり発生元にできました
firstChild は改行とスペースの TextNode です
出力も 「target: text」 になってます
同じように CommentNode でも dispatch 可能です
document.body.innerHTML = `<!-- comment -->`
window.onclick = console.log
document.body.firstChild.dispatchEvent(new Event("click", { bubbles: true }))
// Event {isTrusted: false, type: "click", target: comment, currentTarget: Window, eventPhase: 3, …}