Don't parent the popup frame to elements which cause unload (#488)
This commit is contained in:
parent
401fe9f8d0
commit
8a368aaddc
@ -281,7 +281,7 @@ class Popup {
|
||||
}
|
||||
|
||||
_onFullscreenChanged() {
|
||||
const parent = (DOM.getFullscreenElement() || document.body || null);
|
||||
const parent = this._getFrameParentElement();
|
||||
if (parent !== null && this._container.parentNode !== parent) {
|
||||
parent.appendChild(this._container);
|
||||
}
|
||||
@ -375,6 +375,22 @@ class Popup {
|
||||
contentWindow.postMessage({action, params, token}, this._targetOrigin);
|
||||
}
|
||||
|
||||
_getFrameParentElement() {
|
||||
const defaultParent = document.body;
|
||||
const fullscreenElement = DOM.getFullscreenElement();
|
||||
if (fullscreenElement === null || fullscreenElement.shadowRoot) {
|
||||
return defaultParent;
|
||||
}
|
||||
|
||||
switch (fullscreenElement.nodeName.toUpperCase()) {
|
||||
case 'IFRAME':
|
||||
case 'FRAME':
|
||||
return defaultParent;
|
||||
}
|
||||
|
||||
return fullscreenElement;
|
||||
}
|
||||
|
||||
static _getPositionForHorizontalText(elementRect, width, height, viewport, offsetScale, optionsGeneral) {
|
||||
const preferBelow = (optionsGeneral.popupHorizontalTextPosition === 'below');
|
||||
const horizontalOffset = optionsGeneral.popupHorizontalOffset * offsetScale;
|
||||
|
Loading…
Reference in New Issue
Block a user