8000 [VarDumper] Strengthen dumped JS by nicolas-grekas · Pull Request #23983 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[VarDumper] Strengthen dumped JS #23983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[VarDumper] Strengthen dumped JS
  • Loading branch information
nicolas-grekas committed Aug 25, 2017
commit 5e05fc958f9d17a23f58b9dba2856b8a7a8a5350
13 changes: 6 additions & 7 deletions src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
8000
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function toggle(a, recursive) {
function collapse(a, recursive) {
var s = a.nextSibling || {}, oldClass = s.className;

if ('sf-dump-expanded' == oldClass) {
if (/\bsf-dump-expanded\b/.test(oldClass)) {
toggle(a, recursive);

return true;
Expand All @@ -199,7 +199,7 @@ function collapse(a, recursive) {
function expand(a, recursive) {
var s = a.nextSibling || {}, oldClass = s.className;

if ('sf-dump-compact' == oldClass) {
if (/\bsf-dump-compact\b/.test(oldClass)) {
toggle(a, recursive);

return true;
Expand Down Expand Up @@ -254,8 +254,8 @@ function highlight(root, activeNode, nodes) {

function resetHighlightedNodes(root) {
Array.from(root.querySelectorAll('.sf-dump-str, .sf-dump-key, .sf-dump-public, .sf-dump-protected, .sf-dump-private')).forEach(function (strNode) {
strNode.className = strNode.className.replace(/\b sf-dump-highlight\b/, '');
strNode.className = strNode.className.replace(/\b sf-dump-highlight-active\b/, '');
strNode.className = strNode.className.replace(/\bsf-dump-highlight\b/, '');
strNode.className = strNode.className.replace(/\bsf-dump-highlight-active\b/, '');
});
}

Expand Down Expand Up @@ -352,7 +352,7 @@ function xpathString(str) {
} else if (/\bsf-dump-str-toggle\b/.test(a.className)) {
e.preventDefault();
e = a.parentNode.parentNode;
e.className = e.className.replace(/sf-dump-str-(expand|collapse)/, a.parentNode.className);
e.className = e.className.replace(/\bsf-dump-str-(expand|collapse)\b/, a.parentNode.className);
}
});

Expand Down Expand Up @@ -518,8 +518,7 @@ function showCurrent(state)
Array.from(search.querySelectorAll('.sf-dump-search-input-next, .sf-dump-search-input-previous')).forEach(function (btn) {
addEventListener(btn, 'click', function (e) {
e.preventDefault();
var direction = -1 !== e.target.className.indexOf('next') ? 'next' : 'previous';
'next' === direction ? state.next() : state.previous();
-1 !== e.target.className.indexOf('next') ? state.next() : state.previous();
searchInput.focus();
collapseAll(root);
showCurrent(state);
Expand Down
0