From: jk Date: Tue, 11 Apr 2017 18:25:57 +0000 (+0200) Subject: fixes mutateme.zf.trigger fires as often as many submenu you got because it's in... X-Git-Tag: v6.4.0-rc1~77^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1786b2b21f0f76a3b5d59d04c88ec0455514d87;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fixes mutateme.zf.trigger fires as often as many submenu you got because it's in the _events($elem) function, and this gets bound as manu times you got submenues. i'got a menu with 92 submenu's and wondered why the performance is so weak on clicking on the responsiveToggle, so i started searching an found that the mutateme event gets fired as many times as there are submenus, and on the drilldown then 92 times the _getMaxDims was executedthis calcs the heights and so on and is very performant, so i debugged it an moved it to the _registerEvents function big performance improvement --- diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index 3e5f72da4..2f9800a70 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -153,7 +153,6 @@ class Drilldown { }); } }); - this.$element.on('mutateme.zf.trigger', this._resize.bind(this)); } /** @@ -166,6 +165,7 @@ class Drilldown { this._bindHandler = this._scrollTop.bind(this); this.$element.on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown',this._bindHandler); } + this.$element.on('mutateme.zf.trigger', this._resize.bind(this)); } /**