jQuery.once deprecated in D10

Created on 27 April 2023, over 1 year ago
Updated 5 April 2024, 7 months ago

Problem/Motivation

On Drupal 10 with the HTML Field Formatter having the Responsive-option enabled a javascript error is produced on the frontend:

Uncaught TypeError: $(...).once is not a function
    at Object.attach (responsive.js?rtrnac:17:10)
    at drupal.js?v=10.0.8:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=10.0.8:162:34)
    at drupal.init.js?v=10.0.8:32:12
    at HTMLDocument.listener (drupal.init.js?v=10.0.8:20:7)

Steps to reproduce

On a Drupal 10 installation:

  1. Install and enable Media: Embeddable -module
  2. Configure Embeddable media type default display mode to show the field HTML Embed and enable the Responsive-option on it
  3. Create a new Embeddable media entity with an iframe content and visit the media item full view page
  4. Check the inspector console for js errors

Proposed resolution

Fix the issue as recommended in Remove jQuery dependency from the once feature .

Remaining tasks

  • Does not fit into 1.1.* core compatibility (^8.8 || ^9 || ^10) as vanilla once.js has only been available since Drupal 9.2.0. So maybe we need a new major version for this fix?
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇫🇮Finland tohesi

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024