Skip to content

Commit

Permalink
make setting for as a element work
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslyngsoe committed May 24, 2024
1 parent e159c43 commit dee0d8c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export class UUIFormValidationMessageElement extends LitElement {
return this._for;
}
public set for(value: HTMLElement | string | null) {
let queriedElement = null;
let element = null;
if (typeof value === 'string') {
const scope = this.getRootNode();
queriedElement = (scope as DocumentFragment)?.getElementById(value);
element = (scope as DocumentFragment)?.getElementById(value);
} else if (value instanceof HTMLElement) {
element = value;
}
const newScope = queriedElement || this;
const newScope = element ?? this;
const oldScope = this._for;

if (oldScope === newScope) {
Expand Down

0 comments on commit dee0d8c

Please sign in to comment.