mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
Update dom.js
This commit is contained in:
1 parent
ad0395fa37
commit
38ef03d31f
1 file changed
+11
-7
@@ -97,15 +97,19 @@ export function getIcon(key = '', html = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function setStyleText(id, style) {
|
export function setStyleText(id, style) {
|
||||||
const $style = document.getElementById(id);
|
let $style = document.getElementById(id);
|
||||||
if ($style) {
|
if (!$style) {
|
||||||
$style.textContent = style;
|
$style = document.createElement('style');
|
||||||
} else {
|
|
||||||
const $style = createElement('style');
|
|
||||||
$style.id = id;
|
$style.id = id;
|
||||||
$style.textContent = style;
|
if (document.readyState === 'loading') {
|
||||||
document.head.appendChild($style);
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.head.appendChild($style);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
(document.head || document.documentElement).appendChild($style);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$style.textContent = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function supportsFlex() {
|
export function supportsFlex() {
|
||||||
|
|||||||
Reference in new issue
Block a user