24 lines
787 B
JavaScript
24 lines
787 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getDocument = void 0;
|
|
var canUseDOM_1 = require("./canUseDOM");
|
|
/**
|
|
* 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
|