allow Element as the anchor - now with correct typings

pull/1188/head
Christophe Eymard 2023-02-10 21:56:57 +01:00
rodzic 8493131db5
commit 737b55d78d
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -38,7 +38,7 @@ import type { CSSResultGroup } from 'lit';
export default class SlPopup extends ShoelaceElement {
static styles: CSSResultGroup = styles;
private anchorEl: HTMLElement | null;
private anchorEl: Element | null;
private cleanup: ReturnType<typeof autoUpdate> | undefined;
/** A reference to the internal popup container. Useful for animating and styling the popup with JavaScript. */
@ -223,7 +223,7 @@ export default class SlPopup extends ShoelaceElement {
// Locate the anchor by id
const root = this.getRootNode() as Document | ShadowRoot;
this.anchorEl = root.getElementById(this.anchor);
} else if (this.anchor instanceof HTMLElement) {
} else if (this.anchor instanceof Element) {
// Use the anchor's reference
this.anchorEl = this.anchor;
} else {