@@ -111,10 +111,7 @@ var boolAttrs = {
111
111
this . parentNode . replaceChild ( frag , this )
112
112
} ,
113
113
get sheet ( ) {
114
- if ( this . tagName === "STYLE" || this . tagName === "LINK" && this . rel === "stylesheet" && this . href ) return new CSSStyleSheet ( {
115
- href : this . href ,
116
- ownerNode : this
117
- } , this . tagName === "STYLE" && this . textContent )
114
+ return makeSheet ( this )
118
115
} ,
119
116
get style ( ) {
120
117
return this . _style || ( this . _style = CSSStyleDeclaration ( this . getAttribute ( "style" ) || "" ) )
@@ -187,7 +184,7 @@ var boolAttrs = {
187
184
} ,
188
185
toString ( min ) {
189
186
return rawTextElements [ this . tagName ] ? (
190
- this . tagName === "STYLE" && ( min === true || min && min . css ) ? "\n" + this . sheet . toString ( min . css || true ) + "\n" :
187
+ this . tagName === "STYLE" && ( min === true || min && min . css ) ? "\n" + makeSheet ( this , min . css || true ) + "\n" :
191
188
this . textContent
192
189
) : this . childNodes . map ( node => node . toString ( min ) ) . join ( "" )
193
190
}
@@ -491,6 +488,14 @@ function getSibling(node, step, type) {
491
488
return type > 0 ? getElement ( silbings , index + step , step , type ) : silbings && silbings [ index + step ] || null
492
489
}
493
490
491
+ function makeSheet ( el , min ) {
492
+ if ( el . tagName === "STYLE" || el . tagName === "LINK" && el . rel === "stylesheet" && el . href ) return new CSSStyleSheet ( {
493
+ href : el . href ,
494
+ ownerNode : el ,
495
+ min
496
+ } , el . tagName === "STYLE" && el . textContent )
497
+ }
498
+
494
499
function mergeAttributes ( source , target ) {
495
500
if ( source && target && source . attributes ) {
496
501
source . attributes . names ( ) . forEach ( attr => target . setAttribute ( attr , source . getAttribute ( attr ) ) )
0 commit comments