File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,12 @@ export class VueElement extends BaseClass {
312
312
}
313
313
314
314
// apply CSS
315
+ if ( __DEV__ && styles && def . shadowRoot === false ) {
316
+ warn (
317
+ 'Custom element style injection is not supported when using ' +
318
+ 'shadowRoot: false' ,
319
+ )
320
+ }
315
321
this . _applyStyles ( styles )
316
322
317
323
// initial render
@@ -481,11 +487,13 @@ export class VueElement extends BaseClass {
481
487
}
482
488
483
489
private _applyStyles ( styles : string [ ] | undefined ) {
490
+ const root = this . shadowRoot
491
+ if ( ! root ) return
484
492
if ( styles ) {
485
493
styles . forEach ( css => {
486
494
const s = document . createElement ( 'style' )
487
495
s . textContent = css
488
- this . _root . appendChild ( s )
496
+ root . appendChild ( s )
489
497
// record for HMR
490
498
if ( __DEV__ ) {
491
499
; ( this . _styles || ( this . _styles = [ ] ) ) . push ( s )
You can’t perform that action at this time.
0 commit comments