- From: Dan Clark <notifications@github.com>
- Date: Tue, 19 May 2026 15:26:16 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 19 May 2026 22:26:20 UTC
dandclark left a comment (WICG/webcomponents#1114)
I don't have strong feelings on this either way, but a piece of precedent that I think points in the direction of returning null for invalid reference targets is that the getters already do the validation that the attr-associated element is a descendant of any of the element's shadow-including ancestors:
```html
<button popoverTarget="myPopover">Open popover</button>
<my-popover id="myPopover">
<template shadowRootMode="open">
<div popover>The real popover target</div>
</template>
</my-popover>
<script>
const button = document.querySelector("button");
const div = document.querySelector("my-popover").shadowRoot.querySelector("div[popover]");
button.popoverTargetElement = div; // Won't be a real association; div is not a descendant of any of button's shadow-including ancestors
button.popoverTargetElement; // logs null
</script>
```
Following the reference target to see if it's valid seems similar to me.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1114#issuecomment-4492577321
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/1114/4492577321@github.com>
Received on Tuesday, 19 May 2026 22:26:20 UTC