Allow specification of base for selector

This commit is contained in:
Tony Garnock-Jones 2023-12-02 19:35:47 +01:00
parent ae2c113325
commit 24a75e935a
1 changed files with 6 additions and 6 deletions

View File

@ -94,14 +94,14 @@ export class Widget implements EventTarget {
}
set parent(p: string | ParentNode | null) {
if (typeof p === 'string') {
p = document.querySelector(p);
}
this._parent.value = p;
this.setParent(p);
}
setParent(p: string | ParentNode | null): this {
this.parent = p;
setParent(p: string | ParentNode | null, wrt: ParentNode = document): this {
if (typeof p === 'string') {
p = wrt.querySelector(p);
}
this._parent.value = p;
return this;
}