Skip to content

Commit 804b596

Browse files
author
Benjamin Kniffler
authored
Fix test
1 parent 8ed347f commit 804b596

File tree

1 file changed

+3
-3
lines changed
  • libraries/load-themed-styles/src

1 file changed

+3
-3
lines changed

libraries/load-themed-styles/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ function initializeThemeState(): IThemeState {
164164
* @param {boolean} loadAsync When true, always load styles in async mode, irrespective of current sync mode.
165165
*/
166166
export function loadStyles(styles: string | ThemableArray, loadAsync: boolean = false): void {
167-
if (typeof document === 'undefined') {
168-
return;
169-
}
170167
measure(() => {
171168
const styleParts: ThemableArray = Array.isArray(styles) ? styles : splitStyles(styles);
172169
if (_injectStylesWithCssText === undefined) {
@@ -424,6 +421,9 @@ function registerStyles(styleArray: ThemableArray): void {
424421
* @param {IStyleRecord} styleRecord May specify a style Element to update.
425422
*/
426423
function registerStylesIE(styleArray: ThemableArray, styleRecord?: IStyleRecord): void {
424+
if (typeof document === 'undefined') {
425+
return;
426+
}
427427
const head: HTMLHeadElement = document.getElementsByTagName('head')[0];
428428
const registeredStyles: IStyleRecord[] = _themeState.registeredStyles;
429429
let lastStyleElement: IExtendedHtmlStyleElement = _themeState.lastStyleElement;

0 commit comments

Comments
 (0)