From 2c603b755835b5997e517ccf7446bdc0ec94cc62 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Sat, 29 Mar 2014 02:18:44 +0900 Subject: [PATCH] Don't do forEach loop twice --- modules/browserUIShowHideObserver.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/browserUIShowHideObserver.js b/modules/browserUIShowHideObserver.js index 3ba3cdb3..ab75017d 100644 --- a/modules/browserUIShowHideObserver.js +++ b/modules/browserUIShowHideObserver.js @@ -73,7 +73,7 @@ BrowserUIShowHideObserver.prototype = { return; case 'attributes': - this.onAttributeModified(this.box, aMutations, aObserver); + this.onAttributeModified(this.box, aMutation, aObserver); return; } }, this); @@ -99,13 +99,15 @@ BrowserUIShowHideObserver.prototype = { var self = this; observer = new this.MutationObserver(function(aMutations, aObserver) { - self.onAttributeModified(aChild, aMutations, aObserver); + aMutations.forEach(function(aMutation) { + self.onAttributeModified(aChild, aMutation, aObserver); + }); }); observer.observe(aChild, { attributes : true }); aChild.__treestyletab__attributeObserver = observer; }, this) }, - onAttributeModified : function BrowserUIShowHideObserver_onAttributeModified(aTargetElement, aMutations, aObserver) + onAttributeModified : function BrowserUIShowHideObserver_onAttributeModified(aTargetElement, aMutation, aObserver) { var TST = this.owner.browser.treeStyleTab; if ( @@ -121,16 +123,12 @@ BrowserUIShowHideObserver.prototype = { ) return; - aMutations.forEach(function(aMutation) { - if (aMutation.type != 'attributes') - return; if (aMutation.attributeName == 'hidden' || aMutation.attributeName == 'collapsed' || aMutation.attributeName == 'moz-collapsed' || // Used in full screen mode aMutation.attributeName == 'disablechrome') { TST.updateFloatingTabbar(TreeStyleTabConstants.kTABBAR_UPDATE_BY_WINDOW_RESIZE); } - }, this); }, destroyChildrenObserver : function BrowserUIShowHideObserver_destroyChildrenObserver(aParent)