[whatwg/dom] Should event.stopPropagation() during capturing prevent the bubbling phase? (#916)

Originally https://github.com/jsdom/jsdom/issues/3070.

Example code ([live version](http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=8659)):

```js
const element = document.createElement("div");

element.addEventListener("click", () => {
  console.log("capture listener");
  event.stopPropagation();
}, { capture: true });

element.addEventListener("click", () => {
  console.log("bubble listener");
});

element.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
```

In Safari, and per the spec (and in jsdom): logs only "capture listener".

In Firefox and Chrome: logs "capture listener" and then "bubble listener"

Which should it be?

@alexreardon also notes that the domintro for stopPropagation, which reads

> When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. 

implies to him it should be the Firefox and Chrome behavior.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/916

Received on Thursday, 5 November 2020 19:23:33 UTC