Skip to content

Commit 181da11

Browse files
committed
Replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
1 parent 0d3c0a7 commit 181da11

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
331331
332332
/* prevent logging AJAX calls to static and inline files, like templates */
333333
var path = url;
334-
if (url.substr(0, 1) === '/') {
334+
if (url.slice(0, 1) === '/') {
335335
if (0 === url.indexOf('{{ request.basePath|e('js') }}')) {
336-
path = url.substr({{ request.basePath|length }});
336+
path = url.slice({{ request.basePath|length }});
337337
}
338338
}
339339
else if (0 === url.indexOf('{{ (request.schemeAndHttpHost ~ request.basePath)|e('js') }}')) {
340-
path = url.substr({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
340+
path = url.slice({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
341341
}
342342
343343
if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {

src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function xpathHasClass(className) {
371371
if (/\bsf-dump-toggle\b/.test(a.className)) {
372372
e.preventDefault();
373373
if (!toggle(a, isCtrlKey(e))) {
374-
var r = doc.getElementById(a.getAttribute('href').substr(1)),
374+
var r = doc.getElementById(a.getAttribute('href').slice(1)),
375375
s = r.previousSibling,
376376
f = r.parentNode,
377377
t = a.parentNode;
@@ -438,7 +438,7 @@ function xpathHasClass(className) {
438438
toggle(a);
439439
}
440440
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
441-
a = a.substr(1);
441+
a = a.slice(1);
442442
elt.className += ' '+a;
443443
444444
if (/[\[{]$/.test(elt.previousSibling.nodeValue)) {

0 commit comments

Comments
 (0)