From a807951f84ea89e92e7d2c6a2ed39ec29ab2a03b Mon Sep 17 00:00:00 2001 From: Stanislav Dolgachov Date: Sat, 18 May 2019 17:27:55 +0300 Subject: [PATCH 01/15] 02-bubbling-and-capturing: Translate the first part --- .../02-bubbling-and-capturing/article.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 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 bae476f7ef..17b0070a63 100644 --- a/2-ui/2-events/02-bubbling-and-capturing/article.md +++ b/2-ui/2-events/02-bubbling-and-capturing/article.md @@ -1,24 +1,24 @@ -# 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 -
- If you click on EM, the handler on DIV runs. +
+ Если вы кликните на EM, сработает обработчик на DIV
``` -Isn't it a bit strange? Why does the handler on `
` run 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