Skip to content

Commit 8aa9338

Browse files
authored
fix: IE not support prepend (#219)
1 parent eaf8893 commit 8aa9338

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Dom/dynamicCSS.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ export function injectCSS(css: string, option: Options = {}) {
2727
styleNode.innerHTML = css;
2828

2929
const container = getContainer(option);
30+
const { firstChild } = container;
3031

31-
if (option.prepend) {
32-
container.prepend(styleNode);
32+
if (option.prepend && firstChild) {
33+
container.insertBefore(styleNode, firstChild);
3334
} else {
34-
container.append(styleNode);
35+
container.appendChild(styleNode);
3536
}
3637

3738
return styleNode;

0 commit comments

Comments
 (0)