# 事件

## 设计动机

利用合成事件：可以先看一下[W3C标准](https://www.w3.org/TR/DOM-Level-3-Events/)

W3C 标准约定了一个事件的传播过程要经过以下 3 个阶段：

1. 事件捕获阶段
2. 目标阶段
3. 事件冒泡阶段

DOM 事件流下的性能优化思路：事件委托

`e.target` 这个属性，它指的是触发事件的具体目标，它记录着**事件的源头**。所以说，不管咱们的监听函数在哪一层执行，只要我拿到这个 `e.target`，就相当于拿到了真正触发事件的那个元素。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jonathan-zhang.gitbook.io/react-steppitguide/orgin-code/shi-jian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
