From e8d897120e248c5ec3e7a40d76fad73e12a12fbe Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 20 Nov 2022 20:23:37 -0500 Subject: [PATCH] Menubar - Fix buggy, slow loader --- js/crm.menubar.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/crm.menubar.js b/js/crm.menubar.js index 8360557f05da..710b0c8b5deb 100644 --- a/js/crm.menubar.js +++ b/js/crm.menubar.js @@ -28,18 +28,14 @@ // Wait for crm-container present on the page as it's faster than document.ready function insert(markup) { - if ($('#crm-container').length) { + if (document.getElementById('crm-container')) { render(markup); } else { new MutationObserver(function(mutations, observer) { - _.each(mutations, function(mutant) { - _.each(mutant.addedNodes, function(node) { - if ($(node).is('#crm-container')) { - render(markup); - observer.disconnect(); - } - }); - }); + if (document.getElementById('crm-container')) { + render(markup); + observer.disconnect(); + } }).observe(document, {childList: true, subtree: true}); } }