Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix close release destroyObserver #1229

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/iframeResizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
onScroll: function () {
return true
}
})
}),
destroyObserver
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this up into the alphabetical order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


function getMutationObserver() {
return (
Expand Down Expand Up @@ -729,6 +730,8 @@
chkEvent(iframeId, 'onClosed', iframeId)
log(iframeId, '--')
removeIframeListeners(iframe)
destroyObserver && destroyObserver.disconnect()
destroyObserver = null
}

function getPagePosition(iframeId) {
Expand Down Expand Up @@ -1146,11 +1149,12 @@
destroyObserver.observe(iframe.parentNode, {
childList: true
})
return destroyObserver
}

var MutationObserver = getMutationObserver()
if (MutationObserver) {
createDestroyObserver(MutationObserver)
destroyObserver = createDestroyObserver(MutationObserver)
}

addEventListener(iframe, 'load', iFrameLoaded)
Expand Down