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 2448cfa5b..dc8796159 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 +# Bubbling og capturing -Let's start with an example. +Lad os starte med et eksempel. -This handler is assigned to `
`, but also runs if you click any nested tag like `` or ``: +Denne handler er tilknyttet `
`, men kører også, hvis du klikker på en hvilken som helst indlejret tag som `` eller ``: ```html autorun height=60
- If you click on EM, the handler on DIV runs. + Hvis du klikker på EM, vil den handler der er på DIV blive kørt.
``` -Isn't it a bit strange? Why does the handler on `
` run if the actual click was on ``? +Er det ikke lidt mærkeligt? Hvorfor kører handleren på `
` hvis det faktiske klik var på ``? ## Bubbling -The bubbling principle is simple. +Princippet bag bubbling er simpelt. -**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.** +**Når en event finder sted på et element, kører den først de handlers, der er tilknyttet elementet, derefter på dets forældre og så videre op til andre forældre.** -Let's say we have 3 nested elements `FORM > DIV > P` with a handler on each of them: +Lad os sige, at vi har 3 indlejrede elementer `FORM > DIV > P` med en handler på hvert af dem: ```html run autorun 123Most deeply nested element \ No newline at end of file + + + + + + + + + + + + + + 1 + + + 2 + + + 3 + + + dybeste + + indlejrede element + + + + + \ No newline at end of file diff --git a/2-ui/2-events/02-bubbling-and-capturing/eventflow.svg b/2-ui/2-events/02-bubbling-and-capturing/eventflow.svg index 566064cd6..23b338f1e 100644 --- a/2-ui/2-events/02-bubbling-and-capturing/eventflow.svg +++ b/2-ui/2-events/02-bubbling-and-capturing/eventflow.svg @@ -1 +1,287 @@ -WindowDocument<html><body><table><tbody><tr><tr><td>Shady Grove<td>Aeolian<td>Over the River,Charlie<td>DorianTargetPhase(2)CapturePhase(1)BubblingPhase(3) \ No newline at end of file + + + + + + + + + + + + + Window + + + + + + Document + + + + + + <html> + + + + + + <body> + + + + + + <table> + + + + + + <tbody> + + + + + + <tr> + + + + + + <tr> + + + + + + <td> + + + + + + Shady Grove + + + + + + <td> + + + + + + Aeolian + + + + + + <td> + + + + + + + Over the River, + + + Charlie + + + + + + + <td> + + + + + + Dorian + + + + + + + + + + + + + + + + + + + + + + + + Target + + + fasen + + + (2) + + + + + + Capture + + + fasen + + + (1) + + + + + + + + + + + + + + + + + + + + Bubbling + + + fasen + + + (3) + + + + + + + + + + + + + + + + + \ No newline at end of file