Problem/Motivation

Under latest Drupal 9 versions the component splide.colorbox.js breaks because Drupal core implemented once in vanilla js.

Error on console

Proposed resolution

Replace line 116 of splide.colorbox.js, and removed support to Drupal 8.

Current line

$('.splide.is-colorbox', context).once('splide-colorbox').each(doSplideColorbox);

Possible solution

$(once('splide-colorbox', '.splide.is-colorbox', context)).each(doSplideColorbox);

Comments

MaxMendez created an issue. See original summary.

maxmendez’s picture

Here a first approach

gausarts’s picture

Category: Bug report » Task
Status: Active » Needs work

Thank you.

An obvious miss. Most are already converted to use dBlazy.once, except few like this one.

Once.js is only available since Drupal 9.3.

Blazy ecosystem still supports Drupal 8 and provides a D8-D11+ compat method named dBlazy.once.

The best route is to use once compat aka dBlazy.once as seen everywhere else at the Blazy ecosystem till we drop supporting Drupal 9.2 below, likely when D8 is no longer reported in use, or less than 15%.

Feel free to update and checkout the module splide scripts for dBlazy.once samples.

  • gausarts committed 0032f8ab on 1.0.x
    Issue #3320523 by MaxMendez: splide.colorbox and once implementation
    
gausarts’s picture

Status: Needs work » Fixed

Committed with a bonus. Thank you for contribution.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.