Closed aolin480 closed 6 years ago
Thanks for this contribution and for detailing your situation.
As with #259, I feel these checks are for too small of an edge case. I'd rather rely on dependency semantic versioning over feature checks in code.
I appreciate your effort here, but I'll have to pass on this one.
Error from 3rd Party script using imagesLoaded:
We are trying to improve our pageload times due to render-blocking jQuery, and this error just came up for us from an external script that is using imagesLoaded.
In our implementation we are defining our own jQuery global in the header of our document to catch all inline jQuery commands in the body, and then towards the footer, after the actual jQuery library is loaded (which is async/deferred too) we are processing those catches. Since we're only catching a few common jQuery objects used on our platform (ready, on, bind, click), we are not including
$.fn
or$.Deferred
so imagesLoaded is actually looking at our jQuery global and errors out because it cannot find those functions.I know this is a rare case of using jQuery, but our platform is full of clients with some inline javascript in areas we just cannot bulk update and change in a snap. I believe there should be a check if
$.fn
and$.Deferred
exists before using them. If, in a different world, jQuery removes these functions, imagesLoaded would break, so I think checking before using would be ideal.