25 lines
926 B
JavaScript
25 lines
926 B
JavaScript
|
define(["require", "exports", "./canUseDOM"], function (require, exports, canUseDOM_1) {
|
||
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.getDocument = void 0;
|
||
|
/**
|
||
|
* Helper to get the document object. Note that in popup window cases, document
|
||
|
* might be the wrong document, which is why we look at ownerDocument for the
|
||
|
* truth.
|
||
|
*
|
||
|
* @public
|
||
|
*/
|
||
|
function getDocument(rootElement) {
|
||
|
// eslint-disable-next-line no-restricted-globals
|
||
|
if (!(0, canUseDOM_1.canUseDOM)() || typeof document === 'undefined') {
|
||
|
return undefined;
|
||
|
}
|
||
|
else {
|
||
|
var el = rootElement;
|
||
|
// eslint-disable-next-line no-restricted-globals
|
||
|
return el && el.ownerDocument ? el.ownerDocument : document;
|
||
|
}
|
||
|
}
|
||
|
exports.getDocument = getDocument;
|
||
|
});
|
||
|
//# sourceMappingURL=getDocument.js.map
|