Skip to content

Commit

Permalink
bug #37077 [WebProfilerBundle] Move ajax clear event listener initial…
Browse files Browse the repository at this point in the history
…ization on loadToolbar (Bruno BOUTAREL)

This PR was merged into the 4.4 branch.

Discussion
----------

[WebProfilerBundle] Move ajax clear event listener initialization on loadToolbar

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37073
| License       | MIT

Fix ajax clear event listener stacking on each ajax request made.
Comment says if should be synced with `TwigBundle/Resources/views/base_js.html.twig`

If not applicable feel free to deny.

Commits
-------

cf4587b Move ajax clear event listener initialization on loadToolbar
  • Loading branch information
fabpot committed Jun 2, 2020
2 parents a2f4342 + cf4587b commit 950ff7e
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -131,13 +131,6 @@
removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
}
addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() {
requestStack = [];
renderAjaxRequests();
successStreak = 4;
document.querySelector('.sf-toolbar-ajax-request-list').innerHTML = '';
});
};
var startAjaxRequest = function(index) {
Expand Down Expand Up @@ -506,6 +499,12 @@
setPreference('toolbar/displayState', 'block');
});
renderAjaxRequests();
addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() {
requestStack = [];
renderAjaxRequests();
successStreak = 4;
document.querySelector('.sf-toolbar-ajax-request-list').innerHTML = '';
});
addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
elem.scrollTop = elem.scrollHeight;
Expand Down

0 comments on commit 950ff7e

Please sign in to comment.