question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Twitter/MutationObserver issue

See original GitHub issue

Hi,

If I embed a tweet in an iframe, there seems to be a resizing issue. I tracked it into here: https://github.com/davidjbradshaw/iframe-resizer/blob/master/src/iframeResizer.contentWindow.js#L608-L613

What seems to happen, is that the iframe gets a mutation event. The mutation event is about the removal of this Twitter’s <blockquote> element. But when the event happens, the blockquote is still in the html structure. So, the size of the iframe ends up larger than it should be.

Another issue is, that the iframe will gradually be resized into the correct size when you click on the wrongly-sized iframe. This is quite distracting/seems wrong. I could make a video if this isn’t apparent.

Two test html files attached. test1.zip

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davidjbradshawcommented, Jul 24, 2016

The latest version has the option to pass in your own custom sizing method.

https://github.com/davidjbradshaw/iframe-resizer#heightcalculationmethod--widthcalculationmethod

0reactions
ilecommented, Jul 23, 2016

Yes, but I didn’t find a one that would work. However, this would work: getMaxElement('bottom',getAllElements()) but I needed to change the source code to do that only.

Not sure if that would be a good fix overall, but it would work in this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javan Makhmali on Twitter: "The changes to Turbolinks ...
Dynamically inserted s break MutationObserver · Issue #12939 · electron/electron. Electron Version: 2.0.0 Operating System: macOS 10.13.4 Last known working ...
Read more >
customize Twitter timeline with JQuery and CSS on Load more ...
On load of the new tweets? MutationObserver will watch the dom so any changes resulting from clicking the Load New Tweets button will...
Read more >
MutationObserver - Web APIs | MDN
The MutationObserver interface provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for...
Read more >
Getting To Know The MutationObserver API
Without it, your observers will run infinitely and you can end up with memory problems. I had a Mutation Observer running on an...
Read more >
JavaScript Mutation Observer - W3docs
The Mutation Observer Syntax · childList: modifications in the direct children of the node. · subtree: inside all the node descendants. · attributes:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found