WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#27510 closed defect (bug) (fixed)

Masonry 3 compatibility issues

Reported by: kovshenin Owned by:
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: External Libraries Keywords:
Focuses: javascript Cc:

Description

I've been digging into some of the things in Masonry 3 lately and it seems like the upgrade can break quite a few existing themes.

  1. A quick search in the .org themes repo revealed that some themes register their own Masonry v2 under the masonry handle, which means they will automatically be bumped to core's standalone v3 without the shim and the jQuery dependency. I'm not sure how to address this.
  1. Masonry v3 removes two classes: masonry-brick and masonry. Not many themes used these classes and most of them bundle their own copy of Masonry, but there's probably at least a handful that use core's jquery-masonry and used these classes in CSS. I sent a patch upstream for this.
  1. Themes that used infinite scroll used .masonry( 'reload' ); to layout new appended items. This method no longer exists in v3 and the proper way is to .masonry( 'reloadItems' ).masonry( 'layout' );. I also opened a pull request upstream for this.

Change History (9)

#1 @nacin
4 years ago

I'm not sure about point 1, masonry. We could go with wp-masonry, I guess, but that would probably imply we're going to instantiate our own wp.Masonry — which we could indeed do.

Looks like 2 and 3 are handled (https://github.com/desandro/masonry/pull/532 remains pending) in an upstream version of the shim.

#2 follow-up: @eightface
4 years ago

Not sure if it's related to your issues, but they also integrated the corner-stamp technique (http://desandro.github.io/masonry/demos/corner-stamp.html) into Masonry as the stamp method (http://masonry.desandro.com/methods.html#stamp). That gave me an error/conflict on a site earlier today and made the rest of the scripts bail.

#3 @nacin
4 years ago

In 27779:

Update Masonry v2/v3 shim from upstream.

props kovshenin.
see #27510.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


4 years ago

#5 in reply to: ↑ 2 @kovshenin
4 years ago

Replying to eightface: Can you provide a link to the theme or site that broke?

#6 @nacin
4 years ago

In 27780:

Update minified jQuery Masonry shim. see [27779], see #27510.

#7 @nacin
4 years ago

In 27781:

Preserve comments in Masonry shim. see [27780], see #27510.

#8 @kovshenin
4 years ago

I looked through the list of themes that use the masonry handle on .org, basically only Magazine will break because it appends its Masonry init code right into the bundled library file which won't get loaded in 3.9. I e-mailed Han about it, so point 1 is not that big of an issue.

Points 2 and 3 are fixed upstream. Before closing this ticket let's wait a few more days to see if anything pops up with folks who used jquery-masonry. I believe there's more than just .reload().

#9 @nacin
4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

http://make.wordpress.org/core/2014/03/27/masonry-in-wordpress-3-9/

Closing out. We can re-open if we discover more breakage or if another bug report comes in.

Note: See TracTickets for help on using tickets.