Skip to content

Commit

Permalink
Consider the right context when checking if iframe is removed
Browse files Browse the repository at this point in the history
This patch fixes #62.
  • Loading branch information
lpellegr committed Oct 14, 2020
1 parent da8df79 commit 0a492ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parent/monitorIframeRemoval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CHECK_IFRAME_IN_DOC_INTERVAL = 60000;
export default (iframe: HTMLIFrameElement, destructor: Destructor) => {
const { destroy, onDestroy } = destructor;
const checkIframeInDocIntervalId = setInterval(() => {
if (!document.contains(iframe)) {
if (!iframe.isConnected) {
clearInterval(checkIframeInDocIntervalId);
destroy();
}
Expand Down

0 comments on commit 0a492ab

Please sign in to comment.