Skip to content

Commit 28ed990

Browse files
authored
[5.1] Replace deprecated substr() with substring() (#42726)
1 parent 3994cc5 commit 28ed990

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/media_source/system/js/fields/calendar-locales/date/gregorian/date-helper.es5.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
case "%b":
277277
case "%B":
278278
for (j = 0; j < 12; ++j) {
279-
if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) {
279+
if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) {
280280
m = j;
281281
break;
282282
}
@@ -319,7 +319,7 @@
319319
if (a[i].search(/[a-zA-Z]+/) != -1) {
320320
var t = -1;
321321
for (j = 0; j < 12; ++j) {
322-
if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) {
322+
if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) {
323323
t = j;
324324
break;
325325
}
@@ -402,7 +402,7 @@
402402
s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
403403
// FIXME: %x : preferred date representation for the current locale without the time
404404
// FIXME: %X : preferred time representation for the current locale without the date
405-
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
405+
s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99)
406406
s["%Y"] = y; // year with the century
407407
s["%%"] = "%"; // a literal '%' character
408408

build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Date.prototype.print = function (str, dateType, translate, localStrings) {
356356
s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
357357
// FIXME: %x : preferred date representation for the current locale without the time
358358
// FIXME: %X : preferred time representation for the current locale without the date
359-
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
359+
s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99)
360360
s["%Y"] = y; // year with the century
361361
s["%%"] = "%"; // a literal '%' character
362362

@@ -405,7 +405,7 @@ Date.parseFieldDate = function(str, fmt, dateType, localStrings) {
405405
case "%b":
406406
case "%B":
407407
for (j = 0; j < 12; ++j) {
408-
if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; }
408+
if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; }
409409
}
410410
break;
411411

@@ -444,7 +444,7 @@ Date.parseFieldDate = function(str, fmt, dateType, localStrings) {
444444
if (a[i].search(/[a-zA-Z]+/) != -1) {
445445
var t = -1;
446446
for (j = 0; j < 12; ++j) {
447-
if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; }
447+
if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; }
448448
}
449449
if (t != -1) {
450450
if (m != -1) {

build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
this.icon.setAttribute('class', clss);
265265
}
266266

267-
const uniqueId = `simple-color-${Math.random().toString(36).substr(2, 10)}`;
267+
const uniqueId = `simple-color-${Math.random().toString(36).substring(2, 12)}`;
268268
this.icon.setAttribute('type', 'button');
269269
this.icon.setAttribute('tabindex', '0');
270270
this.icon.style.backgroundColor = color;

build/media_source/system/js/inlinehelp.es6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Joomla.toggleInlineHelp = (toggleClass) => {
1616
// The ID of the description whose visibility is toggled.
1717
const myId = elDiv.id;
1818
// The ID of the control described by this node (same ID, minus the '-desc' suffix).
19-
const controlId = myId ? myId.substr(0, myId.length - 5) : null;
19+
const controlId = myId ? myId.substring(0, myId.length - 5) : null;
2020
// Get the control described by this node.
2121
const elControl = controlId ? document.getElementById(controlId) : null;
2222
// Is this node hidden?

0 commit comments

Comments
 (0)