Skip to content

Instantly share code, notes, and snippets.

@dariocravero
Last active January 13, 2016 10:48
Show Gist options
  • Save dariocravero/feff0146bb1bcb9dfa7f to your computer and use it in GitHub Desktop.
Save dariocravero/feff0146bb1bcb9dfa7f to your computer and use it in GitHub Desktop.
iframe.contentWindow.addEventListener('beforeunload',() => this.middlewareCleanupWrapper() );
if (this.observer) {
this.observer.disconnect();
}
this.observer = new MutationObserver(mutations => {
iframe.parentElement.style.height = iframe.contentDocument.documentElement.offsetHeight + 'px';
});
this.observer.observe(iframe.contentDocument.body, {
attributes: true,
attributesFilter: ['style'],
subtree: true
});
iframe.parentElement.style.height = iframe.contentDocument.documentElement.offsetHeight + 'px';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment