Problem/Motivation

Calling Drupal.attachBehaviors(); causes duplicate script lazysizes library tag includes.

Every time it is called, I end up with duplicated script tags for the main library and any plugins. In my case:

<script src="/libraries/lazysizes/lazysizes.min.js" async=""></script>
<script src="/libraries/lazysizes/plugins/unveilhooks/ls.unveilhooks.min.js" async=""></script>
<script src="/libraries/lazysizes/plugins/parent-fit/ls.parent-fit.min.js" async=""></script>
<script src="/libraries/lazysizes/plugins/object-fit/ls.object-fit.min.js" async=""></script>
<script src="/libraries/lazysizes/plugins/aspectratio/ls.aspectratio.min.js" async="">

Steps to reproduce

Call Drupal.attachBehaviors(); from any script within your theme

Issue fork lazy-3177430

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lindsay.wils created an issue. See original summary.

lindsay.wils’s picture

Issue summary: View changes

osman made their first commit to this issue’s fork.

osman’s picture

Version: 8.x-3.4 » 8.x-3.x-dev
Status: Active » Needs review
lindsay.wils’s picture

Thanks for looking into this. I have tested and confirm the changes have fixed the issue and can be merged.

osman’s picture

Status: Needs review » Fixed

Merged the solution to dev branch.

Status: Fixed » Closed (fixed)

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