8000 [Profiler][VarDumper] Add a search feature to the HtmlDumper by ogizanagi · Pull Request #21109 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Profiler][VarDumper] Add a search feature to the HtmlDumper #21109

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

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Factorize showing current node
  • Loading branch information
ogizanagi committed Jan 3, 2017
commit d8bc70c09720cd9ad2fa8b3ffa36fff7d98c449e
27 changes: 13 additions & 14 deletions src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,16 @@ function xpathString(str) {
},
};

function showCurrent(state)
{
var currentNode = state.current();
if (currentNode) {
reveal(currentNode);
highlight(root, currentNode, state.nodes);
}
counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' on ' + state.count();
}

var search = doc.createElement('div');
search.className = 'sf-dump-search-wrapper sf-dump-search-hidden';
search.innerHTML = '
Expand Down Expand Up @@ -503,13 +513,8 @@ function xpathString(str) {
var xpathResult = doc.evaluate('//pre[@id="' + root.id + '"]//span[@class="sf-dump-str" or @class="sf-dump-key" or @class="sf-dump-public" or @class="sf-dump-protected" or @class="sf-dump-private"][contains(child::text(), ' + xpathString(searchQuery) + ')]', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);

while (node = xpathResult.iterateNext()) state.nodes.push(node);
var currentNode = state.current();
if (currentNode) {
reveal(currentNode);
highlight(root, currentNode, state.nodes);
}

counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' on ' + state.count();

showCurrent(state);
}, 400);
});

Expand All @@ -520,13 +525,7 @@ function xpathString(str) {
'next' === direction ? state.next() : state.previous();
searchInput.focus();
collapseAll(root);
var currentNode = state.current();
if (currentNode) {
reveal(currentNode);
highlight(root, currentNode, state.nodes);
}

counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' on ' + state.count();
showCurrent(state);
})
});

Expand Down
0