]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
feat: filter elements with plugins from reflow method
authorDavid Krause <dkrause@magento.com>
Mon, 14 May 2018 20:56:06 +0000 (15:56 -0500)
committerDavid Krause <dkrause@magento.com>
Mon, 14 May 2018 20:56:06 +0000 (15:56 -0500)
Filter elements with plugins from reflow method:
- Add filter method to find to line 152 of foundation.core.js
- Remove warning from subsequest each method

js/foundation.core.js

index eb837dc10d07960a6680a1aac054d15c9817abdd..637961628101be75ecf65d85efdc592a44ec2829 100644 (file)
@@ -149,18 +149,15 @@ var Foundation = {
       var plugin = _this._plugins[name];
 
       // Localize the search to all elements inside elem, as well as elem itself, unless elem === document
-      var $elem = $(elem).find('[data-'+name+']').addBack('[data-'+name+']');
+      var $elem = $(elem).find('[data-'+name+']').addBack('[data-'+name+']').filter(function () {
+        return typeof $(this).data("zfPlugin") === "undefined";
+      });
 
       // For each plugin found, initialize it
       $elem.each(function() {
         var $el = $(this),
             opts = {};
-        // Don't double-dip on plugins
-        if ($el.data('zfPlugin')) {
-          console.warn("Tried to initialize "+name+" on an element that already has a Foundation plugin.");
-          return;
-        }
-
+            
         if($el.attr('data-options')){
           var thing = $el.attr('data-options').split(';').forEach(function(e, i){
             var opt = e.split(':').map(function(el){ return el.trim(); });