mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Replace deprecated String.prototype.substr() (#8988)
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
@@ -54,7 +54,7 @@ export function rendererPhotos(context) {
|
||||
// validate the date
|
||||
var date = val && new Date(val);
|
||||
if (date && !isNaN(date)) {
|
||||
val = date.toISOString().substr(0, 10);
|
||||
val = date.toISOString().slice(0, 10);
|
||||
} else {
|
||||
val = null;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ export function uiFieldCombo(field, context) {
|
||||
var v = tags[k];
|
||||
if (!v || (typeof v === 'string' && v.toLowerCase() === 'no')) continue;
|
||||
|
||||
var suffix = field.key ? k.substr(field.key.length) : k;
|
||||
var suffix = field.key ? k.slice(field.key.length) : k;
|
||||
_multiData.push({
|
||||
key: k,
|
||||
value: displayValue(suffix),
|
||||
|
||||
@@ -71,7 +71,7 @@ export function uiSuccess(context) {
|
||||
}
|
||||
|
||||
const parsed = new Date(raw);
|
||||
return new Date(parsed.toUTCString().substr(0, 25)); // convert to local timezone
|
||||
return new Date(parsed.toUTCString().slice(0, 25)); // convert to local timezone
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ export function utilPrefixDOMProperty(property) {
|
||||
|
||||
if (property in s) return property;
|
||||
|
||||
property = property.substr(0, 1).toUpperCase() + property.substr(1);
|
||||
property = property.slice(0, 1).toUpperCase() + property.slice(1);
|
||||
|
||||
while (++i < n) {
|
||||
if (prefixes[i] + property in s) {
|
||||
|
||||
Reference in New Issue
Block a user