Update dom.js

This commit is contained in:
Harvey Zack committed 2024-12-16 14:51:02 +08:00
1 parent ad0395fa37
commit 38ef03d31f
1 file changed
+11 -7
+11 -7
View File
@@ -97,15 +97,19 @@ export function getIcon(key = '', html = '') {
}
export function setStyleText(id, style) {
const $style = document.getElementById(id);
if ($style) {
$style.textContent = style;
} else {
const $style = createElement('style');
let $style = document.getElementById(id);
if (!$style) {
$style = document.createElement('style');
$style.id = id;
$style.textContent = style;
document.head.appendChild($style);
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
document.head.appendChild($style);
});
} else {
(document.head || document.documentElement).appendChild($style);
}
}
$style.textContent = style;
}
export function supportsFlex() {