Re: [whatwg/dom] event.composedPath() may return different results if DOM is modified between two calls (#525)

Yeah, that makes sense. Thank you!

One more thing I have noticed:
> if tuple's item has slot-in-closed-tree, decrease hiddenSubtreeLevel by 1.

I think this could set hiddenSubtreeLevel to a negative value in some cases. I guess that is unintentional.

For example, suppose an event is fired on C, and the current target is D, in the following DOM trees:
```
A
└──/shadowRoot1 (open)
    └── B
        ├──/shadowRoot2 (closed)
        │   └── D
        │       └── slot
        └── C
```

| item  | root-of-closed-tree | slot-in-closed-tree | hasSeenCurrentTarget | hiddenSubtreeLevel | reversedComposedPath |
| ----  | --                  | --                  | --                   |                 -- | --                   |
| C     |                     |                     | true                 |                 -1 | A,sr1,B,sr2,D,slot   |
| slot  |                     | true                | true                 |                  0  -> -1 | A,sr1,B,sr2,D,slot   |
| D     |                     |                     | true                 |                  0 | A,sr1,B,sr2,D        |
| sr2   | true                |                     | false                |                  0 | A,sr1,B,sr2          |
| B     |                     |                     | false                |                  0 | A,sr1,B              |
| sr1   |                     |                     | false                |                  0 | A,sr1                |
| A     |                     |                     | false                |                  0 | A                    |

composedPath() should be [A,sr1,B,sr2,D,slot,C] in this case, but C is not added because hiddenSubtreeLevel became -1 in the slot.

Can we fix this as follows?

> if tuple's item has slot-in-closed-tree and hiddenSubtreLevel is positive, decrease hiddenSubtreeLevel by 1.



-- 
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/525#issuecomment-343038580

Received on Thursday, 9 November 2017 03:42:38 UTC