Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

This module brings back the original jQuery.once() by RobLoach and with that jQuery to avoid all JS code that used the old dependencies and once syntax having to be rewritten.

This module overwrites core/jquery and core/jquery.once libraries, so you do not have to change a single line of code.

Features

  • Overwrites core/jquery library with a local copy of jQuery (currently 3.7.1)
  • Re-adds core/jquery.once library with a local copy of jQuery.once() (currently 2.2.3) that was used up until Drupal 9
  • Adds these two libraries also as seperate depencies for targeted use (jquery_once/jquery and jquery_once/jquery.once)

Benefits

  • You can use all modules that did not yet or won't switch to the new core/once library
  • If you simply like jQuery, you can use it regardless if Drupal core decides to drop its dependencies to it.
  • With a simple install of this module, you don't have to change a single line of code. Just continue using core/jquery and core/jquery.once like you did before.
  • Keep your site reliable, safe and especially maintainable for the future

Examples

You can keep using your old library definitions if you like. See below for an example of your_module.libraries.yml:

# You can keep using your core/jquery and core/jquery.once dependencies
my_js_logic:
  version: VERSION
  js:
    js/my_super_reliable_code.js: {}
  dependencies:
    - core/drupal
    - core/jquery
    - core/jquery.once

# You can also make new logic and specifically rely on the jQuery.once library
my_other_new_js_logic:
  version: VERSION
  js:
    js/some_new_file.js: {}
  dependencies:
    - core/drupal
    - jquery_once/jquery.once

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.1.0 Stable Jan 5, 2025