Re: [whatwg/dom] Dispatching events section may not match browsers (#746)

How do you detect shadow trees without this change? I used the following html to try to see the difference but I got the same result for each element.

```html
<div id=closedparent>
  <div id=closedhost></div>
</div>

<div id=openparent>
  <div id=openhost></div>
</div>

<div id=div></div>

<script>
const closedroot = closedhost.attachShadow({mode: 'closed'});
const closedrootchild = document.createElement('div');
closedroot.appendChild(closedrootchild);

const openroot = openhost.attachShadow({mode: 'open'});
const openrootchild = document.createElement('div');
openroot.appendChild(openrootchild);

console.log('closedparent:');
test(closedparent);

console.log('closedhost:');
test(closedhost);

console.log('closedrootchild:');
test(closedrootchild);

console.log('openparent:');
test(openparent);

console.log('openhost:');
test(openhost);

console.log('openrootchild:');
test(openrootchild);

console.log('div:');
test(div);

function test(element) {
  element.addEventListener('click', () => {
    console.log('[bubble ] 1');
  }, {once: true});
  element.addEventListener('click', () => {
    console.log('[capture] 2');
  }, {capture: true, once: true});
  element.addEventListener('click', () => {
    console.log('[bubble ] 3');
  }, {once: true});
  element.addEventListener('click', () => {
    console.log('[capture] 4');
  }, {capture: true, once: true});

  element.click();
}
</script>
```

-- 
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/746#issuecomment-742780309

Received on Thursday, 10 December 2020 20:32:03 UTC