From 0f1cc5ae319608aaae7a24819950f4a6fada31e2 Mon Sep 17 00:00:00 2001
From: nod_ <nod_@598310.no-reply.drupal.org>
Date: Sat, 10 Feb 2024 16:00:02 +0100
Subject: [PATCH] Issue #3419763 by Tom Konda: Replace deprecated
 String.prototype.substr() with String.prototype.substring()

(cherry picked from commit 378f477aa3fc4de9043800fb9a825c621b1d7434)
---
 core/misc/form.js                       | 2 +-
 core/modules/ckeditor5/js/ckeditor5.js  | 2 +-
 core/modules/views/js/base.js           | 2 +-
 core/modules/views_ui/js/ajax.js        | 2 +-
 core/modules/views_ui/js/views-admin.js | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/misc/form.js b/core/misc/form.js
index 606f74dfa905..e293b9d87e2b 100644
--- a/core/misc/form.js
+++ b/core/misc/form.js
@@ -293,7 +293,7 @@
     } else {
       url = window.location;
     }
-    const hash = url.hash.substr(1);
+    const hash = url.hash.substring(1);
     if (hash) {
       const $target = $(`#${hash}`);
       $('body').trigger('formFragmentLinkClickOrHashChange', [$target]);
diff --git a/core/modules/ckeditor5/js/ckeditor5.js b/core/modules/ckeditor5/js/ckeditor5.js
index e204023d7a4c..1d81ad30bfba 100644
--- a/core/modules/ckeditor5/js/ckeditor5.js
+++ b/core/modules/ckeditor5/js/ckeditor5.js
@@ -637,7 +637,7 @@
 
   // Redirect on hash change when the original hash has an associated CKEditor 5.
   function redirectTextareaFragmentToCKEditor5Instance() {
-    const hash = window.location.hash.substr(1);
+    const hash = window.location.hash.substring(1);
     const element = document.getElementById(hash);
     if (element) {
       const editorID = getElementId(element);
diff --git a/core/modules/views/js/base.js b/core/modules/views/js/base.js
index 31a0147c4c0f..f844ddb9366f 100644
--- a/core/modules/views/js/base.js
+++ b/core/modules/views/js/base.js
@@ -106,7 +106,7 @@
     const chars = ['#', '?', '&'];
     for (let i = 0; i < chars.length; i++) {
       if (href.includes(chars[i])) {
-        href = href.substr(0, href.indexOf(chars[i]));
+        href = href.substring(0, href.indexOf(chars[i]));
       }
     }
     return href;
diff --git a/core/modules/views_ui/js/ajax.js b/core/modules/views_ui/js/ajax.js
index 5cbd583e3c63..f534cd6ff939 100644
--- a/core/modules/views_ui/js/ajax.js
+++ b/core/modules/views_ui/js/ajax.js
@@ -194,7 +194,7 @@
       $(once('views-ajax', '#views-tabset a')).on('click', function () {
         const href = $(this).attr('href');
         // Cut of #views-tabset.
-        const displayId = href.substr(11);
+        const displayId = href.substring(11);
         const viewsPreviewId = document.querySelector(
           '#views-live-preview #preview-display-id',
         );
diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js
index 34edf52d533f..4cadec6186b9 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -221,7 +221,7 @@
         this.target.each(function (i) {
           // Ensure that the maxlength is not exceeded by prepopulating the field.
           const maxlength = $(this).attr('maxlength') - suffix.length;
-          this.value = transliterated.substr(0, maxlength) + suffix;
+          this.value = transliterated.substring(0, maxlength) + suffix;
         });
       },
 
-- 
GitLab