@ckeditor/ckeditor5-utils
Version:
Miscellaneous utilities used by CKEditor 5.
23 lines (22 loc) • 698 B
JavaScript
/**
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module utils/dom/iswindow
*/
/**
* Checks if the object is a native DOM Window.
*/
export function isWindow(obj) {
const stringifiedObject = Object.prototype.toString.apply(obj);
// Returns `true` for the `window` object in browser environments.
if (stringifiedObject == '[object Window]') {
return true;
}
// Returns `true` for the `window` object in the Electron environment.
if (stringifiedObject == '[object global]') {
return true;
}
return false;
}