Files
front-end-example/04-dom-events-async/06-bubbling-and-delegation
charlie f3bdaa4e88 feat: add TypeScript lessons and learning panel
- Introduced a new script to check TypeScript lesson files for errors.
- Created a main TypeScript file to render lessons and their details.
- Added lesson definitions with starter and answer codes.
- Implemented a user interface for navigating and running lessons.
- Styled the application with CSS for a better user experience.
- Updated README to reflect the new TypeScript section and usage instructions.
2026-03-19 10:06:11 +08:00
..

练习 6冒泡、委托和 stopPropagation

目标

理解事件会冒泡,并学会在列表里使用事件委托。

你要练什么

  • 事件冒泡
  • event.target
  • 事件委托
  • stopPropagation()

任务

  • 点击外层面板时输出一条日志
  • 点击列表项时,通过事件委托切换激活状态
  • 点击列表项里的删除按钮时,阻止冒泡并删除当前项

文件