jquery once no longer works in Drupal 10

Created on 17 April 2023, about 1 year ago
Updated 6 March 2024, 4 months ago

Problem/Motivation

drupal.js?v=10.0.7:64 Uncaught TypeError: $(...).find(...).once is not a function
at Object.attach (paragraphs-sorting.js?rt9b3g:10:10)
at drupal.js?v=10.0.7:166:24

Steps to reproduce

Proposed resolution

https://www.drupal.org/project/drupal/issues/3207782 β†’

use jquery.once.bc

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States oknate Greater New York City Area

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.

  • πŸ‡ΊπŸ‡ΎUruguay jjose.quevedo

    jjose.quevedo β†’ made their first commit to this issue’s fork.

  • @jjosequevedo opened merge request.
  • @jjosequevedo opened merge request.
  • πŸ‡΅πŸ‡­Philippines ambot112

    Here is a working for my project.

  • πŸ‡΅πŸ‡­Philippines ambot112

    Sorry, I uploaded wrong file. Here is the correct one.

  • πŸ‡΅πŸ‡­Philippines ambot112

    Removed the console log for debugging

  • Status changed to Needs review 10 months ago
  • πŸ‡¦πŸ‡·Argentina dagmar Argentina

    Once more once required in js/form-toggle-description.js

  • πŸ‡¦πŸ‡·Argentina dagmar Argentina

    Ok, one more round, this patch is bigger than #10 because I went over all the occurrences of once.

  • πŸ‡¦πŸ‡·Argentina dagmar Argentina

    One more fix. Before, clicking form descriptions was re-sending any form.

  • πŸ‡©πŸ‡ͺGermany skrug Bamberg

    Patch #12 prevents the Sort-Button from appearing in node edit forms.

    Patch thunder_admin-3354603-13.patch works for me then.

  • πŸ‡³πŸ‡±Netherlands SpadXIII

    I've updated the patch in #13

    a couple missing .once-calls and changed the way it was used in paragraphs.js

    can't seem to generate an interdiff due to 'interdiff: Whitespace damage detected in input' ?

  • Status changed to Needs work 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States wstocker

    Patch 14 and D10.2 gives me this error where paragraph fields are used.

    drupal.js?v=10.2.4:64 Uncaught TypeError: The element must be an instance of Element
        at u (once.js:122:11)
        at i (once.js:156:25)
        at a (once.js:280:5)
        at Object.attach (paragraphs.js?s9xsr0:16:7)
        at drupal.js?v=10.2.4:166:24

    I don't think this is properly handling elements returned by once.

  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States wstocker

    Refactored thunder_admin-3354603-14.patch addressing error where a jQuery object was incorrectly passed to the Drupal once utility, which expects raw DOM elements.

Production build 0.69.0 2024