From: SassNinja Date: Fri, 19 Oct 2018 07:16:28 +0000 (+0200) Subject: fix: reset queries in MediaQuery _init method & adjust naming X-Git-Tag: v6.6.0~3^2~82^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11543%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: reset queries in MediaQuery _init method & adjust naming This is necessary because using _reInit would populate the queries with duplicates again otherwise. --- diff --git a/js/foundation.util.mediaQuery.js b/js/foundation.util.mediaQuery.js index 69abbc645..970d711e4 100644 --- a/js/foundation.util.mediaQuery.js +++ b/js/foundation.util.mediaQuery.js @@ -81,7 +81,7 @@ var MediaQuery = { */ _init() { - // make sure the initialization is only done once to avoid overhead when calling _init() several times + // make sure the initialization is only done once when calling _init() several times if (this.isInitialized === true) { return; } else { @@ -99,6 +99,8 @@ var MediaQuery = { namedQueries = parseStyleToObject(extractedStyles); + self.queries = []; // reset + for (var key in namedQueries) { if(namedQueries.hasOwnProperty(key)) { self.queries.push({ @@ -114,11 +116,12 @@ var MediaQuery = { }, /** - * Reinitializes the media query helper what might be necessary if your CSS is not (completely) loaded while _init() is executed. + * Reinitializes the media query helper. + * Useful if your CSS breakpoint configuration has just been loaded or has changed since the initialization. * @function * @private */ - _reinit() { + _reInit() { this.isInitialized = false; this._init(); },