Event Capturing and Bubbling in JavaScript

Get a deeper look at how events work by understanding bubbling, capturing, stopping propagation, and more!
This is a companion discussion topic for the original entry at http://www.kirupa.com/html5/event_capturing_bubbling_javascript.htm

Hello, great article and clear explanation of event propagation!

One question: in the article you say that events start at the root of the document and the diagrams shows the window object as the starting point.

Isn’t the html element the root element of the document?

Where exactly does capturing start and bubbling end?

Is there really any need for the Propagation to be called within the clickHandler function ? It has already been interrupted already.

Technically the ‘root’ is at the top of the tree so it starts and end there but I have seen other stuff online that is little misleading stating it is the HTML but to be honest I don’t think it really matters in the grand scheme of things. I think the confusion comes because technically the window isn’t part of the DOM but one shouldn’t lose sleep over this.

1 Like