Bug 1383886 - Remove redundant element.closest() call since one call to closest() can do the work that was previously done by two calls to closest() and a property check. r?gijs draft
authorJared Wein <jwein@mozilla.com>
Mon, 24 Jul 2017 16:27:10 -0400
changeset 614579 e1858db64a60b915694b7a47006c42afc2b2c205
parent 614574 ea50d69c93a67718a47f7953e5141be6db4bdc8c
child 614761 83695d4b601f9d175804c64ebc7c8611065350cc
push id70065
push userbmo:jaws@mozilla.com
push dateMon, 24 Jul 2017 20:27:30 +0000
reviewersgijs
bugs1383886
milestone56.0a1
Bug 1383886 - Remove redundant element.closest() call since one call to closest() can do the work that was previously done by two calls to closest() and a property check. r?gijs MozReview-Commit-ID: L6weawO4qB0
browser/extensions/pocket/content/main.js
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -92,18 +92,17 @@ var pktUI = (function() {
         getPanelFrame().setAttribute("src", "about:blank");
 
         if (_lastAddSucceeded) {
             var libraryButton = document.getElementById("library-button");
             if (!Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled") ||
                 !libraryButton ||
                 libraryButton.getAttribute("cui-areatype") == "menu-panel" ||
                 libraryButton.getAttribute("overflowedItem") == "true" ||
-                !libraryButton.closest("toolbar") ||
-                libraryButton.closest("toolbar").id != "nav-bar") {
+                !libraryButton.closest("#nav-bar")) {
                 return;
             }
             libraryButton.removeAttribute("fade");
             libraryButton.setAttribute("animate", "pocket");
             libraryButton.addEventListener("animationend", onLibraryButtonAnimationEnd);
         }
     }