Make WordPress Core

Opened 3 months ago

Last modified 4 days ago

#59991 new defect (bug)

Included imagesLoaded libary broken

Reported by: physalis's profile physalis Owned by:
Milestone: 6.6 Priority: normal
Severity: normal Version: 6.4
Component: External Libraries Keywords: needs-patch dev-feedback
Focuses: javascript Cc:

Description

On the current WordPress release version, the included imagesLoaded javascript file is broken. The minified file appears to include two minified versions of the actual script and breaks functionality. To reproduce, see wp-includes/js/imagesloaded.min.js.

Change History (7)

#1 @adamsilverstein
3 months ago

Hi @physalis - thanks for the bug report.

Looking at the file, it does appear to have some duplication although the code blocks are not the same. This is a built file, so we need to look into the build process to see if there is an issue.

the included imagesLoaded javascript file is broken

How can you tell this is broken, what issue does this cause? are you seeing console errors/failed functionality?

Can you please provide steps to reproduce any issue you see?

#2 follow-up: @adamsilverstein
3 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.5
  • Version changed from trunk to 6.4

#3 @physalis
3 months ago

  • Keywords needs-patch removed
  • Version changed from 6.4 to trunk

Hi @adamsilverstein , lovely to meet you.

I believe you should be able to reproduce the error. Just create a simple masonry layout and include imagesLoaded as a condition, like described here. It's producing the usual xyz-is-not-a-function error when a required script hasn't loaded. You can compare functionality by including your own imagesLoaded instead.

I hope this helps!

#4 in reply to: ↑ 2 @physalis
3 months ago

Replying to adamsilverstein:

Looks like this was changed in https://core.trac.wordpress.org/changeset/56393, see https://core.trac.wordpress.org/ticket/56731#comment:21

imagesLoaded had been updated to 5.0, but obviously included in a way that breaks the script, hence my report :) .

#5 follow-up: @adamsilverstein
3 months ago

  • Keywords needs-patch added
  • Version changed from trunk to 6.4

Hey @physalis - thanks for the details about reproducing.

Reviewing the NPM library upstream the built file we bundle looks correct: https://unpkg.com/imagesloaded@5.0.0/imagesloaded.pkgd.min.js

So the issue may not actually be with the built file but rather with how we are using it or some breaking change in the library.

I believe you should be able to reproduce the error. Just create a simple masonry layout and include imagesLoaded as a condition

Ok, that sounds like a bit of a challenge! Do you have a live site or demo plugin that reproduces the issue?

#6 in reply to: ↑ 5 @physalis
3 months ago

Replying to adamsilverstein:

Ah, you're right, I could have sworn the packaged file was different from the version I then downloaded from the creator of the script. Just by switching to the file (from the link you posted above) in my theme made my script work again. Before 6.4.x it was working fine.

Ok, that sounds like a bit of a challenge! Do you have a live site or demo plugin that reproduces the issue?

Well, it's a live site, so if you could just ping me when you could identify the issue, I'd love to revert it back to a functioning version :) . Just see here. If you replace the URL for imagesLoaded to https://www.zukunft-des-engagements.de/wp-content/themes/nes/js/imagesloaded.pkgd.min.js, the masonry block is working again.
Just for explanation: It's a custom block that uses imagesloaded and masonry, loading both scripts through the viewScript line in block.json:

"viewScript": [  "nes-accordion", "imagesloaded", "masonry", "nes-eventfeedback" ]

#7 @swissspidy
4 days ago

  • Keywords dev-feedback added
  • Milestone changed from 6.5 to 6.6
Note: See TracTickets for help on using tickets.