File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,12 @@ export const addStyle = (styleContainerNode: any, cmpMeta: d.ComponentRuntimeMet
120120 */
121121 const stylesheet = new CSSStyleSheet ( ) ;
122122 stylesheet . replaceSync ( style ) ;
123- styleContainerNode . adoptedStyleSheets = [ stylesheet , ...styleContainerNode . adoptedStyleSheets ] ;
123+
124+ /**
125+ * > If the array needs to be modified, use in-place mutations like push().
126+ * https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets
127+ */
128+ styleContainerNode . adoptedStyleSheets . unshift ( stylesheet ) ;
124129 } else {
125130 /**
126131 * If a scoped component is used within a shadow root and constructable stylesheets are
@@ -162,7 +167,11 @@ export const addStyle = (styleContainerNode: any, cmpMeta: d.ComponentRuntimeMet
162167 }
163168 }
164169 } else if ( BUILD . constructableCSS && ! styleContainerNode . adoptedStyleSheets . includes ( style ) ) {
165- styleContainerNode . adoptedStyleSheets = [ ...styleContainerNode . adoptedStyleSheets , style ] ;
170+ /**
171+ * > If the array needs to be modified, use in-place mutations like push().
172+ * https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets
173+ */
174+ styleContainerNode . adoptedStyleSheets . push ( style ) ;
166175 }
167176 }
168177 return scopeId ;
You can’t perform that action at this time.
0 commit comments