From 2783a468869e5960ab954ade6b575176bbc91a49 Mon Sep 17 00:00:00 2001 From: Starrier <1342878298@qq.com> Date: Thu, 19 Jul 2018 10:37:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02-bubbling-and-capturing/article.md | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/2-ui/2-events/02-bubbling-and-capturing/article.md b/2-ui/2-events/02-bubbling-and-capturing/article.md index bc5d70dc1b..41366e50f7 100644 --- a/2-ui/2-events/02-bubbling-and-capturing/article.md +++ b/2-ui/2-events/02-bubbling-and-capturing/article.md @@ -1,8 +1,8 @@ -# Bubbling and capturing +# 冒泡和捕获 -Let's start with an example. +我们先看一个示例。 -This handler is assigned to `
`, but also runs if you click any nested tag like `` or ``: +这个处理器被分配给 `
`,但是如果你单击像 `` 或者 `` 这样的嵌套标签也是可以运行的: ```html autorun height=60
@@ -10,15 +10,15 @@ This handler is assigned to `
`, but also runs if you click any nested tag l
``` -Isn't it a bit strange? Why the handler on `
` runs if the actual click was on ``? +这很奇怪不是么?为什么实际上是单击 ``,而 `
` 上的处理器会运行? -## Bubbling +## 冒泡 -The bubbling principle is simple. +冒泡原理很简单。 -**When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.** +**当事件发生元素上时,它首先会本身上运行处理器,然后会在父元素行运行,然后是其他的祖先**。 -Let's say, we have 3 nested elements `FORM > DIV > P` with a handler on each of them: +比如我们有 3 层嵌套 `FORM > DIV > P`,它们都各自拥有一个处理器: ```html run autorun