As I understand it event bubbling isn’t event propagation, but it is one of the ways of event propagation. Event propagation consists of capturing and bubbling, you can choose one of them in eventHandler, default one is bubbling.
@TheCodeCreative
4 жыл бұрын
That's right. Event bubbling is the third phase of event propagation. Capturing is the first, target is the second.
@miw879
2 жыл бұрын
the way you area explaining it I get a immediate relief that I'm gonna nail this topic today. Love the way you teach bro 100% earned my subscribe.
@AllThingsJavaScript
2 жыл бұрын
I appreciate that!
@ericf5323
7 жыл бұрын
Great quick tutorial!
@salohiddintalabjonov4021
2 жыл бұрын
Thanks my bro!
@cheatman05
6 жыл бұрын
Well this method gets the job done in most of the situations, but when you want to assign an event listener to an element, and there are children elements of that, the event.target will refer to the one you clicked on, so the handler will not be called. You have to make a loop that "bubbles" up from the target, till the target.parentNode is not the one we were looking for (also until we don't reach the parent element). For examle: Title Content etc etc ... in this case, if we click on the span, the event.target will be the that span, instead of the "li"
@AllThingsJavaScript
6 жыл бұрын
Thanks for including that!
@prvs8
2 жыл бұрын
thank you
@gladstonross12
5 жыл бұрын
so what if the tag had a element inside it but u wanted to target the tag given that the element inherits the width and height of the li.
@AllThingsJavaScript
5 жыл бұрын
If I'm understanding the question correctly, you would attach the event listener to the li tag. Is that what you are after?
Пікірлер: 18