Refactor (if feasible) uses of the jQuery parent function to use vanillaJS

Created on 23 September 2021, about 3 years ago
Updated 3 September 2024, 26 days ago

Problem/Motivation

As mentioned in the parent issue #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint โ†’ , we are working towards reducing our jQuery footprint. One of the ways to accomplish this is to reduce the number of jQuery features used in Drupal core. We have added eslint rules that identify specific features and fail tests when those features are in use.

There are (or will be) individual issues for each jQuery-use eslint rule. This one is specific to jquery/no-parent, which targets the jQuery parent function.

Steps to reproduce

Proposed resolution

Remaining tasks

  • If it's determined to be feasible, refactor those uses of jQuery parent() to use Vanilla (native) JavaScript instead.

Review

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Javascriptย  โ†’

Last updated about 5 hours ago

  • Maintained by
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @justafish
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance @nod_
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States hooroomoo

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • last update about 1 year ago
    Custom Commands Failed
  • First commit to issue fork.
  • Pipeline finished with Failed
    9 months ago
    Total: 186s
    #65712
  • Pipeline finished with Failed
    9 months ago
    Total: 826s
    #65722
  • Pipeline finished with Failed
    9 months ago
    Total: 202s
    #65850
  • Pipeline finished with Failed
    9 months ago
    Total: 504s
    #65853
  • Pipeline finished with Success
    9 months ago
    Total: 538s
    #65869
  • Status changed to Needs review 9 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd

    Made remaining changes and Fixed tests for MR 4337.

  • Status changed to Needs work 9 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    few things

  • Pipeline finished with Success
    9 months ago
    Total: 617s
    #69451
  • Pipeline finished with Success
    9 months ago
    Total: 562s
    #69459
  • Pipeline finished with Canceled
    9 months ago
    Total: 36s
    #70413
  • Pipeline finished with Failed
    9 months ago
    Total: 173s
    #70414
  • Pipeline finished with Failed
    9 months ago
    Total: 599s
    #70415
  • Pipeline finished with Success
    9 months ago
    Total: 638s
    #70421
  • Status changed to Needs review 9 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd

    Made all the changes. Please Review.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    smustgrave โ†’ changed the visibility of the branch 3238867-refactor-if-feasible to hidden.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe feedback has been addressed but would like if it could get the thumbs up from @nod_

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    some feedback in the MR

  • First commit to issue fork.
  • Pipeline finished with Canceled
    7 months ago
    Total: 43s
    #107601
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk
  • Pipeline finished with Success
    7 months ago
    Total: 486s
    #107602
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Will leave for sub-maintainer but personally I find addition of [0] for selecting makes the UX go down.

  • Status changed to Needs work 5 months ago
  • The Needs Review Queue Bot โ†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd
  • Status changed to Needs work 5 months ago
  • The Needs Review Queue Bot โ†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Pipeline finished with Canceled
    5 months ago
    Total: 767s
    #150257
  • Pipeline finished with Failed
    5 months ago
    Total: 1021s
    #150272
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shubh511

    shubh_ โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    5 months ago
    Total: 986s
    #150887
  • First commit to issue fork.
  • Pipeline finished with Failed
    3 months ago
    Total: 165s
    #208398
  • Pipeline finished with Failed
    3 months ago
    Total: 616s
    #209225
  • Pipeline finished with Success
    3 months ago
    Total: 744s
    #209263
  • Status changed to Needs review 3 months ago
  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe all feedback has been addressed on this one.

  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    we don't need to replace the customevent dispatch with jquery trigger, it's on purpose that it's a dom event now.

  • Pipeline finished with Success
    3 months ago
    Total: 646s
    #210325
  • Status changed to Needs review 3 months ago
  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Feedback appears to have been addressed.

  • Pipeline finished with Success
    3 months ago
    Total: 478s
    #213495
  • Status changed to Needs work 2 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Thanks for sticking with it, found a way to simplify a number of selectors thanks to :has()

  • Pipeline finished with Failed
    2 months ago
    Total: 157s
    #226571
  • Pipeline finished with Failed
    2 months ago
    Total: 464s
    #226574
  • Pipeline finished with Success
    2 months ago
    Total: 647s
    #226596
  • Status changed to Needs review 2 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Thanks, I realized that 6 months ago I found the CSS only solution but browser support was not there yet, now it's been a while and all the supported browsers caught up.

  • Status changed to RTBC 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Appears all feedback has been addressed

  • Status changed to Needs work 2 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Sorry, a few more things.

  • First commit to issue fork.
  • Pipeline finished with Failed
    29 days ago
    Total: 412s
    #269255
  • Status changed to Needs review 29 days ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone
  • Status changed to RTBC 28 days ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Seems latest round of feedback has been addressed.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    saving credit

  • Status changed to Needs work 27 days ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Doing a last check, there are instances of .parent() left that are not detected by the jquery rule:

            drupal
                core/misc  (4 usages found)
                    tabledrag.js  (1 usage found)
                        337 columnIndex = cell.parent().find('> td').index(cell.get(0)) + 1;
                    vertical-tabs.js  (2 usages found)
                        237 .parent()
                        263 .parent()
                core/misc/dialog  (1 usage found)
                    dialog.position.js  (1 usage found)
                        99 Math.round(event.data.$element.parent().outerHeight()) <
                core/modules/views_ui/js  (2 usages found)
                    views-admin.js  (2 usages found)
                        392 .parent()
                        1220 this.$parent = this.$button.parent('div.views-expose, div.views-grouped');
    
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    For some reason I added an ignore to one of the instances identified in #39. I have removed that one. Unfortunately, I don't know how to change any of the remaining instances to vanillaJS.

    If the rule is not detecting some instances how will future usages be avoided?

Production build 0.71.5 2024