davidjbradshaw/iframe-resizer

initCallback won't be called

shotasenga opened this issue · 3 comments

It seems like some times the throttle() (sizeIFrameThrottled()) prevents init event.

When the init event was fired, the sizeIFrameThrottled() postpone the event firing process. During the waiting time, if some other event occurred, the initial init event was skipped. As a consequence, initCallback won't be called.

Steps

  1. load frame from the main page
  2. load iframreResizer.contentWindow.js in the frame
  3. modify content as soon as possible (In the test case below, I just put style tag on the bottom of the document.)
  4. the main page receives iFrameResizer0:136:300:mutationObserver event instead of init

I made a quick test case to reproduce the bag. http://shared.senta.me.s3-website-us-east-1.amazonaws.com/iframe-resizer-000/

My environment

  • OS :: macOS High Sierra 10.13.2
  • Browser :: Chrome 63.0.3239.132 (Official Build) (64-bit)

Thanks,

Not seem that before. I guess init should not be throttled. Would welcome a PR if you have the time to fix this.

I think I have the time to fix it later today (or weekend) I'll send a PR then.

Fixed in v3.6.0