Problem/Motivation
The eslint rules used in #3239134: Refactor (if feasible) uses of the jQuery val function to use VanillaJS is not catching all usage of .val() it is still used in the following files:
core/misc/states.es6.js
return this.val() === '';
return this.filter(':checked').val() || false;
return this.val();
return this.filter(':checked').val() || false;
return this.val();
core/modules/ckeditor/js/models/Model.es6.js
this.get('$textarea').val(
core/modules/color/preview.es6.js
form.find('.color-palette input[name="palette[base]"]').val(),
form.find('.color-palette input[name="palette[text]"]').val(),
form.find('.color-palette input[name="palette[link]"]').val(),
.val(),
.val(),
core/modules/filter/filter.filter_html.admin.es6.js
this.$allowedHTMLFormItem.val(
this.$allowedHTMLFormItem.val(this._generateSetting(this.userTags));
// This one is a legitimate use
core/modules/quickedit/js/views/EditorView.es6.js
.val(value);
core/themes/claro/js/vertical-tabs.es6.js
.val(this.details.attr('id'));
We should also open an issue in the upstream project.
Steps to reproduce
Proposed resolution
Update states.js
Do not change jquery.form.js because it is excluded from eslint
Remaining tasks
Open an issue in the upstream project.
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3259381-nr-bot.txt | 1.35 KB | needs-review-queue-bot |
Issue fork drupal-3259381
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
Comment #2
nod_Comment #5
kmonahan commentedOpened https://git.drupalcode.org/project/drupal/-/merge_requests/2250 with updates to the occurrences of val() listed in the issue description.
Comment #6
kmonahan commentedSome failing tests to look at.
Comment #7
nod_Comment #9
thebumik commentedComment #11
thebumik commentedReplaced jQuery val() methods with VanillaJS. Updated the fork with the latest HEAD and PR is created against 11. x.
Please review!
Comment #12
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. 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.
Comment #13
nod_few comments on the MR, thanks for picking it up!
Comment #14
nod_I think you reverted a bit too much code in jquery.form.js, we still need to remove the calls to .val() maybe I wasn't clear, sorry.
Comment #15
nod_Had a closer look. Couple of things:
filter.filter_html.admin.js: The whole thing is deprecated and will be removed in D11. #2567801: Deprecate core/modules/editor/js/editor.admin.js JS APIs in Drupal 10, for removal in Drupal 11jquery.form.jsis excluded from eslint, let's remove changes to this one as well. It's a temporary fork until we get rid of it and this one require jQuery to work at all so no sense in removing the dependency on it.Sorry for making you add/remove changes to specific files, I changed my mind after spending a bit more time with the code.
Comment #18
utkarsh_33 commentedThe test are fixed now.In response to
commit removes the whole file but as far as i understood from the comment is that we just wanted to revert the changes from that file.It would be helpful if @nod_ can verify the change.
Marking it needs review as rest everything is addressed apart from the changes in 06c9630b commit.
Comment #20
smustgrave commentedStill not a huge fan of [0]. personally but it was used in the previous commit so would assume fine here.
Comment #21
quietone commentedI read the IS, the comments and the MR. I have updated the title to reflect what is being fixed here and why.
This still needs a followup per the issue summary.
Comment #22
nod_I'd like to have a function to avoid duplicating the code in two places here. The function can be local to this file, no need to add something to the global
Drupalobject