summaryrefslogtreecommitdiffstatshomepage
path: root/core/misc/autocomplete.js
diff options
context:
space:
mode:
authornod_ <nod_@598310.no-reply.drupal.org>2024-06-18 22:30:06 +0200
committernod_ <nod_@598310.no-reply.drupal.org>2024-06-18 22:30:06 +0200
commit0819b7aaf42190aa0aa241f7d3bcbf15c4483cf3 (patch)
treedf9628d1b893961adc936922baf5a15a18467434 /core/misc/autocomplete.js
parent9ad6e113cf6a247bb0566a926a1be0a4083ca6fa (diff)
downloaddrupal-0819b7aaf42190aa0aa241f7d3bcbf15c4483cf3.tar.gz
drupal-0819b7aaf42190aa0aa241f7d3bcbf15c4483cf3.zip
Issue #3454079 by Tom Konda, smustgrave: Prefer to use Array.prototype.includes() for some of Array.prototype.indexOf()
Diffstat (limited to 'core/misc/autocomplete.js')
-rw-r--r--core/misc/autocomplete.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index 2d40f23bfd6..590620e1b10 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -112,9 +112,8 @@
const tagged = autocomplete.splitValues(request.term);
const il = tagged.length;
for (let i = 0; i < il; i++) {
- const index = suggestions.indexOf(tagged[i]);
- if (index >= 0) {
- suggestions.splice(index, 1);
+ if (suggestions.includes(tagged[i])) {
+ suggestions.splice(suggestions.indexOf(tagged[i]), 1);
}
}
response(suggestions);