This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 解释事件委托
事件委托是一种技术,涉及将事件监听器添加到父元素,而不是将事件监听器添加到子元素。 由于事件在DOM上冒泡,每当事件在后代元素上被触发时,监听器就会启动。 这种技术的好处是:
- 内存占用减少,因为父元素只需要一个单个处理程序,而不必附加每个后代的事件处理程序。
- 没有必要从已删除的元素中解绑处理器、将事件绑定到新元素。