Skip to content

Commit

Permalink
fix: fixed function findIframeByWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey28 committed Jul 11, 2022
1 parent 250ff0b commit 25c1349
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/client/core/utils/dom.js
Expand Up @@ -390,8 +390,16 @@ export function isTopWindow (win) {
}
}

export function findIframeByWindow (iframeWindow, iframeDestinationWindow) {
const iframes = (iframeDestinationWindow || window).document.getElementsByTagName('iframe');
export function findIframeByWindow (iframeWindow) {
const iframes = [];

document.querySelectorAll('*').forEach(elem => {
if (elem.tagName === 'IFRAME')
iframes.push(elem);

if (elem.shadowRoot)
elem.shadowRoot.querySelectorAll('iframe').forEach(iframe => iframes.push(iframe));
});

for (let i = 0; i < iframes.length; i++) {
if (nativeMethods.contentWindowGetter.call(iframes[i]) === iframeWindow)
Expand Down

0 comments on commit 25c1349

Please sign in to comment.