From: Nicolas Coden Date: Thu, 25 Jan 2018 23:15:40 +0000 (+0100) Subject: fix: options parsing in Interchange X-Git-Tag: v6.6.0~3^2~117^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=956e06a438eeb3c87fd1956112ede4b48d5cef2b;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: options parsing in Interchange --- diff --git a/js/foundation.interchange.js b/js/foundation.interchange.js index 3a838992f..d29ef32c2 100644 --- a/js/foundation.interchange.js +++ b/js/foundation.interchange.js @@ -23,7 +23,7 @@ class Interchange extends Plugin { */ _setup(element, options) { this.$element = element; - this.options = $.extend({}, Interchange.defaults, options); + this.options = $.extend({}, Interchange.defaults, this.$element.data(), options); this.rules = []; this.currentPath = ''; this.className = 'Interchange'; // ie9 back compat @@ -91,11 +91,10 @@ class Interchange extends Plugin { * @private */ _parseOptions() { - // [data-interchange-type] var types = ['auto', 'src', 'background', 'html']; if (typeof this.options.type === undefined) this.options.type = 'auto'; - else if (types.indexOf(this.options.type) !== -1) { + else if (types.indexOf(this.options.type) === -1) { console.log(`Warning: invalid value "${this.options.type}" for Interchange option "type"`); this.options.type = 'auto'; }