File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ function getOrder(prepend?: Prepend): AppendType {
4646 */
4747function findStyles ( container : ContainerType ) {
4848 return Array . from (
49- ( containerCache . get ( container ) || container ) . children ,
49+ ( containerCache . get ( container ) || container ) ? .children ?? [ ] ,
5050 ) . filter ( node => node . tagName === 'STYLE' ) as HTMLStyleElement [ ] ;
5151}
5252
@@ -66,7 +66,7 @@ export function injectCSS(css: string, option: Options = {}) {
6666 styleNode . innerHTML = css ;
6767
6868 const container = getContainer ( option ) ;
69- const { firstChild } = container ;
69+ const firstChild = container ?. firstChild ;
7070
7171 if ( prepend ) {
7272 // If is queue `prepend`, it will prepend first style and then append rest style
@@ -85,7 +85,9 @@ export function injectCSS(css: string, option: Options = {}) {
8585 }
8686
8787 // Use `insertBefore` as `prepend`
88- container . insertBefore ( styleNode , firstChild ) ;
88+ if ( firstChild ) {
89+ container . insertBefore ( styleNode , firstChild ) ;
90+ }
8991 } else {
9092 container . appendChild ( styleNode ) ;
9193 }
You can’t perform that action at this time.
0 commit comments