]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: options parsing in Interchange
authorNicolas Coden <nicolas@ncoden.fr>
Thu, 25 Jan 2018 23:15:40 +0000 (00:15 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Thu, 25 Jan 2018 23:15:40 +0000 (00:15 +0100)
js/foundation.interchange.js

index 3a838992fe3358cde4859b3e55c1bca605603087..d29ef32c27e57f4b25a9921eb16c6457d7b84938 100644 (file)
@@ -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';
     }