Skip to content

Commit

Permalink
Merge pull request #12972 from alexander-schranz/patch-1
Browse files Browse the repository at this point in the history
Internal (utils): Changes `global` variable name to avoid syntax error. Closes #12971.

Thanks to @alexander-schranz!
  • Loading branch information
arkflpc authored Dec 29, 2022
2 parents 71ee186 + c3e9b14 commit 05e80c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/ckeditor5-utils/src/dom/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export interface GlobalType {
* console.log( global.window.innerWidth );
* ```
*/
let global: GlobalType;
let globalVar: GlobalType; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971

// In some environments window and document API might not be available.
try {
global = { window, document };
globalVar = { window, document };
} catch ( e ) {
// It's not possible to mock a window object to simulate lack of a window object without writing extremely convoluted code.
/* istanbul ignore next */
Expand All @@ -47,7 +47,7 @@ try {
// We only handle this so loading editor in environments without window and document doesn't fail.
// For better DX we shouldn't introduce mixed types and require developers to check the type manually.
// This module should not be used on purpose in any environment outside browser.
global = { window: {} as any, document: {} as any };
globalVar = { window: {} as any, document: {} as any };
}

export default global;
export default globalVar;

0 comments on commit 05e80c0

Please sign in to comment.