mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -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) {
|
||||
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() {
|
||||
|
||||
Reference in new issue
Block a user