Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel: Uncaught TypeError: Cannot read property 'split' of undefined in jetpack-carousel.js below 768px #8033

Closed
galbaras opened this issue Oct 23, 2017 · 10 comments
Labels
[Feature] Carousel A fullscreen modal appearing when clicking on an image in a gallery or tiled gallery. [Pri] Low [Type] Bug When a feature is broken and / or not performing as intended

Comments

@galbaras
Copy link

Steps to reproduce the issue

Visit https://www.ronitbaras.com/family-matters/parenting-family/hush-little-baby-good-sleeping-habits-for-kids/ (or any other post) with the Chrome code inspector open and viewport width less than 768px.

This can be done either by manually changing the viewport size or by turning on responsive mode and choosing a narrow device.

What I expected

No console errors.

What happened instead

Chrome console shows this:

Uncaught TypeError: Cannot read property 'split' of undefined jetpack-carousel.js?ver=20170209:456
at HTMLImageElement. (jetpack-carousel.js?ver=20170209:456)
at Function.each (jquery.js?ver=1.12.4:2)
at a.fn.init.each (jquery.js?ver=1.12.4:2)
at processSingleImageGallery (jetpack-carousel.js?ver=20170209:440)
at HTMLDocument. (jetpack-carousel.js?ver=20170209:1462)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)

@jeherve jeherve changed the title Uncaught TypeError: Cannot read property 'split' of undefined in jetpack-carousel.js below 768px Carousel: Uncaught TypeError: Cannot read property 'split' of undefined in jetpack-carousel.js below 768px Oct 24, 2017
@jeherve jeherve added [Feature] Carousel A fullscreen modal appearing when clicking on an image in a gallery or tiled gallery. [Type] Bug When a feature is broken and / or not performing as intended labels Oct 24, 2017
@jeherve
Copy link
Member

jeherve commented Oct 24, 2017

Related: #6638

Does this still happen when you deactivate WP Fastest Cache?

Could you also let me know how you inserted the images into the posts? Did you use a specific plugin / builder tool to create that post?

Thanks!

@jeherve jeherve added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Oct 24, 2017
@galbaras
Copy link
Author

Disabling WP Fastest Cache (+ Premium) and even activating Cloudflare's Development Mode makes no difference :(

I insert images using Add Media, although I have EWWW Image Optimizer, Media File Renamer and Regenerate Thumbnails installed and EWWW injects code for serving WEBP images conditionally in the front end.

@jeherve
Copy link
Member

jeherve commented Oct 24, 2017

Thanks for the extra details!

EWWW injects code for serving WEBP images conditionally in the front end.

Could you let me know if the error remains when you turn this off?

@galbaras
Copy link
Author

No, it goes away.

Alas, I need this for serving WEBP images through Cloudflare, because using .htaccess redirect rules doesn't work with a CDN :(

Not being a front-end person, this brings us to the edge of my skills, but I suspect that Jetpack is referring to an image as it was defined in the HTML, and that image is replaced in the meantime.

@jeherve
Copy link
Member

jeherve commented Oct 25, 2017

No, it goes away.

Excellent, that means that the markup generated by EWWW trips the Carousel.

<p><noscript data-img="https://www.ronitbaras.com/wp-content/uploads/2008/06/clip-image00217.jpg" data-webp="https://www.ronitbaras.com/wp-content/uploads/2008/06/clip-image00217.jpg.webp" data-alt="Sleeping baby" data-height="278" data-width="409" data-class="alignleft" data-style="border-width: 0px;" class="">&lt;img class="alignleft" style="border-width: 0px;" src="https://www.ronitbaras.com/wp-content/uploads/2008/06/clip-image00217.jpg" alt="Sleeping baby" width="409" height="278" border="0"&gt;</noscript><img src="https://www.ronitbaras.com/wp-content/uploads/2008/06/clip-image00217.jpg.webp" alt="Sleeping baby" height="278" width="409" class="alignleft" style="border-width: 0px;"></p>

Alas, I need this for serving WEBP images through Cloudflare, because using .htaccess redirect rules doesn't work with a CDN :(

Until this is solved, you could enable Jetpack's Photon feature, and let it serve WebP images for you in browsers that support it. :)
https://jetpack.com/2015/12/04/webp-support/

@jeherve jeherve added [Pri] Low and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Oct 25, 2017
@galbaras
Copy link
Author

Seems like the EWWW code is causing other issues, so I've asked the developer to take a look. Should get back to me in a day. Any insights on this should help, though.

@galbaras
Copy link
Author

galbaras commented Nov 2, 2017

Looks like this issue only happens when I'm logged in, so no big deal. The EWWW author has made some nice progress and removed some attribute conflicts, so this issue can be put on a back burner for now.

@jeherve
Copy link
Member

jeherve commented Nov 2, 2017

Excellent, thanks for the update.

@jeherve jeherve closed this as completed Nov 2, 2017
@nosilver4u
Copy link

Apparently my fix for Jetpack way back when was horribly incomplete, not sure what I was thinking. I've now made sure EWWW IO properly handles the data-orig-file, data-large-file, and data-medium-file attributes.

@jeherve
Copy link
Member

jeherve commented Nov 3, 2017

@nosilver4u Thank you, and thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Carousel A fullscreen modal appearing when clicking on an image in a gallery or tiled gallery. [Pri] Low [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

3 participants