Re: [whatwg/dom] Allow custom "get the parent" algorithms for EventTargets (#583)

What about enabling `parentNode` to just work instead of adding more config? It should be fairly easy to investigate if this would be web compatible, but since bubbling is opt-in, I suspect it could be since there's no point in dispatching events that bubble on non-DOM nodes today.

For objects that use another property to point to the parent object (e.g. `parent`), all this needs is

```js
get parentNode() {
 return this.parent;
}
```

Benefits:
- Predictable and discoverable
- Consistent across DOM and non-DOM objects

Drawbacks:
- Potential compat issue (needs research)
- Less flexibility around object schema and `parentNode` is not a great name

Note that there is ample precedent around special property or method names doing special things rather than specifying properties in some init object, especally in Custom Elements.

That said, if this is entirely out of the question, it should definitely be an init object instead of a positional argument, see TAG principle [6.4 Accept optional and/or primitive arguments through dictionaries](https://www.w3.org/TR/design-principles/#prefer-dictionaries)

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

Message ID: <whatwg/dom/issues/583/1753370258@github.com>

Received on Monday, 9 October 2023 17:08:46 UTC