davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.

Home Page:https://iframe-resizer.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flawed jQuery check causes script to not work

gabrielgrant opened this issue · comments

Describe the bug
PR #613 introduced a flawed check for jQuery:

('jQuery' in window) && ('iFrameResize' in window.jQuery.prototype)

see https://github.com/davidjbradshaw/iframe-resizer/pull/613/files

if jQuery is set to undefined this check will result in an error:

image

To Reproduce
Steps to reproduce the behavior:

  1. Open dev console on a page that doesn't use jQuery
  2. check that jQuery isn't present: 'jQuery' in window
  3. set window.jQuery = undefined
  4. confirm 'jQuery' in window
  5. run the check: 'jQuery' in window && 'iFrameResize' in window.jQuery.prototype
  6. See error

Expected behavior
The check should return false

Desktop:

  • OS: Windows
  • Browser chrome
  • Version 106

Additional context
This seems to occur when including a mailchimp form in an iFrame

related: #1094

how this manifests in my actual use of the script:

image

image