Issue #3419763 by Tom Konda: Replace deprecated String.prototype.substr() with String.prototype.substring()

merge-requests/6540/head
nod_ 2024-02-10 16:00:02 +01:00
parent ffcce9c696
commit 378f477aa3
No known key found for this signature in database
GPG Key ID: 76624892606FA197
5 changed files with 5 additions and 5 deletions

View File

@ -295,7 +295,7 @@
} else { } else {
url = window.location; url = window.location;
} }
const hash = url.hash.substr(1); const hash = url.hash.substring(1);
if (hash) { if (hash) {
const $target = $(`#${hash}`); const $target = $(`#${hash}`);
$('body').trigger('formFragmentLinkClickOrHashChange', [$target]); $('body').trigger('formFragmentLinkClickOrHashChange', [$target]);

View File

@ -637,7 +637,7 @@
// Redirect on hash change when the original hash has an associated CKEditor 5. // Redirect on hash change when the original hash has an associated CKEditor 5.
function redirectTextareaFragmentToCKEditor5Instance() { function redirectTextareaFragmentToCKEditor5Instance() {
const hash = window.location.hash.substr(1); const hash = window.location.hash.substring(1);
const element = document.getElementById(hash); const element = document.getElementById(hash);
if (element) { if (element) {
const editorID = getElementId(element); const editorID = getElementId(element);

View File

@ -106,7 +106,7 @@
const chars = ['#', '?', '&']; const chars = ['#', '?', '&'];
for (let i = 0; i < chars.length; i++) { for (let i = 0; i < chars.length; i++) {
if (href.includes(chars[i])) { if (href.includes(chars[i])) {
href = href.substr(0, href.indexOf(chars[i])); href = href.substring(0, href.indexOf(chars[i]));
} }
} }
return href; return href;

View File

@ -194,7 +194,7 @@
$(once('views-ajax', '#views-tabset a')).on('click', function () { $(once('views-ajax', '#views-tabset a')).on('click', function () {
const href = $(this).attr('href'); const href = $(this).attr('href');
// Cut of #views-tabset. // Cut of #views-tabset.
const displayId = href.substr(11); const displayId = href.substring(11);
const viewsPreviewId = document.querySelector( const viewsPreviewId = document.querySelector(
'#views-live-preview #preview-display-id', '#views-live-preview #preview-display-id',
); );

View File

@ -221,7 +221,7 @@
this.target.each(function (i) { this.target.each(function (i) {
// Ensure that the maxlength is not exceeded by prepopulating the field. // Ensure that the maxlength is not exceeded by prepopulating the field.
const maxlength = $(this).attr('maxlength') - suffix.length; const maxlength = $(this).attr('maxlength') - suffix.length;
this.value = transliterated.substr(0, maxlength) + suffix; this.value = transliterated.substring(0, maxlength) + suffix;
}); });
}, },