You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/2-events/02-bubbling-and-capturing/article.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,11 @@ Bukan kah itu sedikit aneh? kenapa penangan (_handler_) pada `<div>` berjalan pa
14
14
15
15
## Menggelembung (_bubbling_)
16
16
17
-
The bubbling principle is simple.
17
+
Prinsip menggelembung (_bubbling_) itu sederhana.
18
18
19
-
**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.**
19
+
**Pada saat sebuah peristiwa terjadi ke sebuah elemen, peristiwa itu akan menjalankan penangan (_handler_) yang ada pada elemen itu, kemudian pada elemen orang tua (_parent_), dan seterusnya hingga sampai ke elemen yang paling atas (_ancestors_).**
20
20
21
-
Let's say we have 3 nested elements `FORM > DIV > P`with a handler on each of them:
21
+
Bayangkan kita memiliki tiga elemen bersarang `FORM > DIV > P`dengan penagan (_handler_) pada setiap elemen:
22
22
23
23
```html run autorun
24
24
<style>
@@ -34,16 +34,15 @@ Let's say we have 3 nested elements `FORM > DIV > P` with a handler on each of t
34
34
</div>
35
35
</form>
36
36
```
37
-
38
-
A click on the inner `<p>` first runs `onclick`:
39
-
1. On that `<p>`.
40
-
2. Then on the outer `<div>`.
41
-
3. Then on the outer `<form>`.
42
-
4. And so on upwards till the `document` object.
37
+
Sebuah klik pada bagian dalam `<p>` akan menjalankan `onclick`:
38
+
1. Yang ada pada `<p>`.
39
+
2. Kemudian pada `<div>`.
40
+
3. Kemudian pada `<form>`.
41
+
4. Dan seterusnya hingga sampai ke objek `document`.
43
42
44
43

45
44
46
-
So if we click on`<p>`, then we'll see 3 alerts: `p` -> `div` -> `form`.
45
+
Jadi jika kita klik pada`<p>`, kemudia kita akan melihat 3 buah peringatan (_alerts_): `p` -> `div` -> `form`.
47
46
48
47
The process is called "bubbling", because events "bubble" from the inner element up through parents like a bubble in the water.
0 commit comments