Re: [WICG/webcomponents] Reference Target: Should the `form` and `list` JavaScript attributes return the host element? (Issue #1072)

This is really thorny since some previous invariant cannot be satisfied. Either `.form` returns null in a case that this is unexpected (the button does submit the form), or it returns the wrong type and any code that depends on this being an `HTMLFormElement` could break.

**Option 3:** Return the actual reference target element. This does not seem acceptable because it breaks encapsulation. I'm suggesting this as an option because the downside should be balanced against the downsides of the other options.

**Option 4:** Return a proxy of the reference target element that appears as if it has no `parentNode`, etc, and cannot otherwise gain access to its containing shadowRoot.

In the absence of these more exotic options being possible, I think just **Option 1** returning `null` feels safest. Failing to find a `form` isn't great but returning an unexpected thing seems more likely to generate an exception..






-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1072#issuecomment-2584306393
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1072/2584306393@github.com>

Received on Friday, 10 January 2025 21:33:11 UTC