Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e63f55

Browse filesBrowse files
minor symfony#46091 [VarDumper][WebProfilerBundle] Replace deprecated String.prototype.substr() (CommanderRoot)
This PR was merged into the 4.4 branch. Discussion ---------- [VarDumper][WebProfilerBundle] Replace deprecated String.prototype.substr() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | | License | MIT | Doc PR | [String.prototype.substr()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) is deprecated so we replace it with [String.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) which works similarily but isn't deprecated. .substr() probably isn't going away anytime soon but the change is trivial so it doesn't hurt to do it. Commits ------- 181da11 Replace deprecated String.prototype.substr()
2 parents 01a8e72 + 181da11 commit 4e63f55
Copy full SHA for 4e63f55

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
+2-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.