Cannot use 'in' operator to search for 'container' in 'drupalSettings.photoswipe'

Created on 22 April 2018, over 7 years ago
Updated 22 March 2023, over 2 years ago

Scenario:
After upgrading to drupal 8.5 and higher the blazy photoswipe plugin generates an error when opening the image to the photoswipe lightbox

Error message:
TypeError: cannot use 'in' operator to search for 'container' in 'drupalSettings.photoswipe'.

Code in blazy.photoswipe.min.js:
Drupal.behaviors.blazyPhotoSwipe = {
attach: function (context) {
var pswpElm = document.querySelector('.pswp');

// If body has no container for PhotoSwipe gallery, append it.
if ('container' in drupalSettings.photoswipe && pswpElm === null) {
// https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
document.body.insertAdjacentHTML('beforeend', drupalSettings.photoswipe.container);
}

💬 Support request
Status

Closed: duplicate

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024