- Issue created by @Zigazou
- Status changed to Needs review
almost 2 years ago 7:20am 6 February 2023 - ๐ซ๐ทFrance Zigazou
Hi!
After applying the patch, the '$' variable is no more available and triggers the following message:
Uncaught TypeError: $ is undefined attach https://sandbox.local/modules/contrib/rules/js/autocomplete.js?rpnskb:115
- Status changed to Needs work
almost 2 years ago 11:16pm 6 February 2023 - ๐บ๐ธUnited States tr Cascadia
We use jquery.once in three different .js files:
- debug.js
- rules_ui.listing.js
- autocomplete.js
but it appears the above patch only modifies one of these (autocomplete.js).
According to the comments in autocomplete.js, Rules autocomplete.js was forked from core misc/autocomplete.js. I would have to do research to find out why it was forked, and what Rules is doing different, but if at all possible the Rules version should be changed the same way as the core version.
For reference, jQuery once was removed from core autocomplete in #3183149: Deprecate jquery.once and use the new once lib โ .
For this patch, I would also like to evaluate the dependencies for all of these .js files. For example, with autocomplete.js, right now we use:
rules.autocomplete: js: js/autocomplete.js: { weight: -1 } dependencies: - core/drupal - core/drupalSettings - core/drupal.ajax - core/jquery - core/jquery.once - core/jquery.ui.autocomplete
but I suspect that most of these are not needed and should be removed. Same with the other .js.
- ๐ซ๐ทFrance Zigazou
Hi!
Following comment #5 saying rules/autocomplete.js was forked, I did the same with Drupal 10 core/misc/autocomplete.js.
From what I saw, the custom autocomplete.js:
- immediately pop-up autocomplete suggestions when the field gets focus
- uses rules-* classes instead of form-* classes
- starts autocompletion with a minimum length of 0
I did not look at debug.js and rules_ui_listing.js.
Can someone please review the patch?
- ๐บ๐ธUnited States tr Cascadia
As you can see from the tests, your patch didn't fix any of the failures that are caused by using the (now removed) jquery-once library.
- ๐บ๐ธUnited States tr Cascadia
rules_ui.listing.js was fixed in ๐ [meta] Update rules_ui.listing.js Fixed
We still need to fix both debug.js and autocomplete.js
- Status changed to Needs review
over 1 year ago 2:07am 10 March 2023 - ๐บ๐ธUnited States tr Cascadia
Here's a re-roll with fixes to debug.js.
- ๐บ๐ธUnited States tr Cascadia
The remaining D10 error is not related to this patch.
Here's some more cleanup.Note - autocomplete.js and debug.js both require manual testing, because we don't have any test cases that use these. I could really use help manually testing these.
- ๐จ๐ณChina hongqing
I tested patch #10, it works well with PHP 8.1, MySql 5.7, and Drupal 10.0.9. Thanks.
- last update
over 1 year ago 414 pass - ๐บ๐ธUnited States tr Cascadia
Fixed two coding standards errors and added documentation comments to explain why autocomplete.js was forked, based on what @Zigazou said in #6.
- last update
over 1 year ago 408 pass, 3 fail - ๐ฎ๐ณIndia keshavv India
keshav.k โ made their first commit to this issueโs fork.
- Open on Drupal.org โCore: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - @keshavk opened merge request.
- last update
over 1 year ago 414 pass - Status changed to Fixed
over 1 year ago 11:13pm 17 May 2023 Automatically closed - issue fixed for 2 weeks with no activity.