diff --git a/src/Tracy/Dumper/assets/dumper.js b/src/Tracy/Dumper/assets/dumper.js index 08f5075ff..a2a743237 100644 --- a/src/Tracy/Dumper/assets/dumper.js +++ b/src/Tracy/Dumper/assets/dumper.js @@ -27,22 +27,13 @@ class Dumper pre.classList.remove('tracy-collapsed'); }); - // lazy - (context || document).querySelectorAll('[data-tracy-snapshot]').forEach((pre) => { //
- let snapshot = JSON.parse(pre.getAttribute('data-tracy-snapshot'));
- pre.querySelectorAll('[data-tracy-dump]').forEach((toggler) => { //
- if (!toggler.nextSibling) {
- toggler.after(document.createTextNode('\n')); // enforce \n after toggler
- }
- toggler.nextSibling.after(buildStruct(JSON.parse(toggler.getAttribute('data-tracy-dump')), snapshot, toggler, true, []));
- toggler.removeAttribute('data-tracy-dump');
- });
- });
-
// snapshots
(context || document).querySelectorAll('meta[itemprop=tracy-snapshot]').forEach((meta) => {
let snapshot = JSON.parse(meta.getAttribute('content'));
meta.parentElement.querySelectorAll('[data-tracy-dump]').forEach((pre) => { //
+ if (pre.closest('[data-tracy-snapshot]')) { // ignore unrelated
+ return;
+ }
pre.appendChild(build(JSON.parse(pre.getAttribute('data-tracy-dump')), snapshot, pre.classList.contains('tracy-collapsed')));
pre.removeAttribute('data-tracy-dump');
pre.classList.remove('tracy-collapsed');
@@ -54,13 +45,25 @@ class Dumper
}
Dumper.inited = true;
- // enables & ctrl key
document.documentElement.addEventListener('click', (e) => {
let el;
+ // enables & ctrl key
if (e.ctrlKey && (el = e.target.closest('[data-tracy-href]'))) {
location.href = el.getAttribute('data-tracy-href');
return false;
}
+
+ // initializes lazy inside
+ if ((el = e.target.closest('[data-tracy-snapshot]'))) {
+ let snapshot = JSON.parse(el.getAttribute('data-tracy-snapshot'));
+ el.querySelectorAll('[data-tracy-dump]').forEach((toggler) => {
+ if (!toggler.nextSibling) {
+ toggler.after(document.createTextNode('\n')); // enforce \n after toggler
+ }
+ toggler.nextSibling.after(buildStruct(JSON.parse(toggler.getAttribute('data-tracy-dump')), snapshot, toggler, true, []));
+ toggler.removeAttribute('data-tracy-dump');
+ });
+ }
});
document.documentElement.addEventListener('tracy-toggle', (e) => {