Starter 要做什麼
先看見缺口,再完成一個小修改。
本主題檔案:files/main.js
定位:先確認 click 是否 bubbles 到 container。
Starter · code-edit
先看見缺口,再完成一個小修改。
先看見缺口,再完成一個小修改。
本主題檔案:files/main.js
定位:先確認 click 是否 bubbles 到 container。
頁面不會替你修改檔案;請在實作檔完成後重新整理確認。
container 有兩個按鈕但沒有 child listener。
listenerCount=1、handledCount=2、lastTarget 為第二個按鈕。
container.addEventListener('click', e => e.target.closest('button'))。只在本階段資料夾內操作,避免改到其他章節。
index.htmlstyle.cssmain.jsservices.html證據:listenerCount=1、handledCount=2、currentTarget=container
前往 Checkpoint →