Skip to content

Commit

Permalink
use "typeof ... === 'boolean'"
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored Aug 1, 2024
1 parent 9aba15e commit 82510da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web_src/js/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export function createElementFromAttrs(tagName, attrs) {
const el = document.createElement(tagName);
for (const [key, value] of Object.entries(attrs)) {
if (value === undefined || value === null) continue;
if (value === true || value === false) {
if (typeof value === 'boolean') {
el.toggleAttribute(key, value);
} else {
el.setAttribute(key, String(value));
Expand Down

0 comments on commit 82510da

Please sign in to comment.