事件捕获
const parent = document.getElementById('parent');
const child = document.getElementById('child');
parent.addEventListener('click', function() {
console.log('父元素在捕获阶段被点击');
}, true); // 设置为捕获阶段
child.addEventListener('click', function() {
console.log('子元素被点击');
});Last updated