Skip to content

Commit

Permalink
fix setting muted attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Oct 8, 2024
1 parent 71524d6 commit 15efbd9
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions datex-bindings/dom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,20 @@ export class DOMUtils {
}


// special attributes--------------

// update checkbox checked property (bug?)
if (element instanceof HTMLInputElement && attr == "checked") {
element.checked = val as boolean;
}

// update muted property
else if (element instanceof HTMLMediaElement && attr == "muted") {
element.muted = val as boolean;
}

// --------------------------------

// display context event handler function
if (attr.endsWith(":frontend")) {
if (typeof val !== "function") throw new Error(`Invalid value for attribute "${attr}" - must be a function`)
Expand Down Expand Up @@ -578,16 +592,6 @@ export class DOMUtils {
}
}

// update checkbox checked property (bug?)
else if (element instanceof HTMLInputElement && attr == "checked") {
element.checked = val as boolean;
}

// update muted property
else if (element instanceof HTMLMediaElement && attr == "muted") {
element.muted = val as boolean;
}

// set datex-update
else if (attr == "datex-update") {
(<DOMUtils.elWithUIXAttributes><unknown>element)[DOMUtils.DATEX_UPDATE_TYPE] = val as string;
Expand Down

0 comments on commit 15efbd9

Please sign in to comment.