outer.addEventListener("click", () => console.log("outer bubble"));
button.addEventListener("click", () => console.log("button"));
outer.addEventListener("click", () => console.log("outer capture"), true);
outer capture, button, outer bubble
The answer is "outer capture, button, outer bubble". The order in which you register listeners does not matter across phases.
• First, the event goes down in the capture phase. The capturing listener on outer runs.
• Then it reaches the target, button.
• Then it bubbles back up to the normal listener on outer.
The tempting option "button, outer bubble, outer capture" is wrong because it follows the registration order. The capture phase always comes first.
Read more