]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
refactor: remove empty expressions 11830/head
authorDaniel Ruf <mac1@daniel-ruf.de>
Sat, 5 Oct 2019 15:42:21 +0000 (17:42 +0200)
committerDaniel Ruf <mac1@daniel-ruf.de>
Sat, 5 Oct 2019 15:42:21 +0000 (17:42 +0200)
js/foundation.abide.js
js/foundation.accordion.js
js/foundation.dropdown.js
js/foundation.responsiveAccordionTabs.js
js/foundation.util.box.js

index 7fbd9df8d94cb20df82de3ccc04a7addb6877b9d..949c09877f6b0c14906e80493083a27c2c25e93a 100644 (file)
@@ -293,7 +293,7 @@ class Abide extends Plugin {
       if (typeof errorId === 'undefined') {
         errorId = GetYoDigits(6, 'abide-error');
         $error.attr('id', errorId);
-      };
+      }
 
       $el.attr('aria-describedby', errorId);
     }
@@ -304,7 +304,7 @@ class Abide extends Plugin {
       if (typeof elemId === 'undefined') {
         elemId = GetYoDigits(6, 'abide-input');
         $el.attr('id', elemId);
-      };
+      }
 
       // For each label targeting $el, set [for] if it is not set.
       $labels.each((i, label) => {
@@ -608,7 +608,7 @@ class Abide extends Plugin {
           valid = true;
         }
       });
-    };
+    }
 
     return valid;
   }
@@ -648,7 +648,7 @@ class Abide extends Plugin {
       if (checked >= minRequired) {
         valid = true;
       }
-    };
+    }
 
     // Skip validation if more than 1 checkbox have to be checked AND if the form hasn't got submitted yet (otherwise it will already show an error during the first fill in)
     if (this.initialized !== true && minRequired > 1) {
index e2f9116f068412a23a6da2b2aba28aef955a1dd4..962c531a9cfbce210cc60e4a733cc0d98bfd06ed 100644 (file)
@@ -91,7 +91,7 @@ class Accordion extends Plugin {
         if ($anchor && $link && $link.length) {
           if (!$link.parent('[data-accordion-item]').hasClass('is-active')) {
             this._openSingleTab($anchor);
-          };
+          }
         }
         // Otherwise, close everything
         else {
index 560fc2933d7a7c57c9e4ffc8a0685e696e4a345d..294f1ae85a627a2d222a9eea5f32bfaaaf3b8009 100644 (file)
@@ -73,7 +73,7 @@ class Dropdown extends Positionable {
       // Get the anchor ID or create one
       if (typeof this.$currentAnchor.attr('id') === 'undefined') {
         this.$currentAnchor.attr('id', GetYoDigits(6, 'dd-anchor'));
-      };
+      }
 
       this.$element.attr('aria-labelledby', this.$currentAnchor.attr('id'));
     }
@@ -153,12 +153,13 @@ class Dropdown extends Positionable {
       .on('click.zf.trigger', function(e) {
         _this._setCurrentAnchor(this);
 
-        if (_this.options.forceFollow === false) {
+        if (
           // if forceFollow false, always prevent default action
-          e.preventDefault();
-        } else if (hasTouch && _this.options.hover && _this.$element.hasClass('is-open') === false) {
+          (_this.options.forceFollow === false) ||
           // if forceFollow true and hover option true, only prevent default action on 1st click
           // on 2nd click (dropown opened) the default action (e.g. follow a href) gets executed
+          (hasTouch && _this.options.hover && _this.$element.hasClass('is-open') === false)
+        ) {
           e.preventDefault();
         }
     });
index 8d73237b6fe727de11811a386a4dd0b962dd0655..e6477ff6ef742e1953bee9f6ad073b954566f833 100644 (file)
@@ -55,7 +55,7 @@ class ResponsiveAccordionTabs extends Plugin{
     this.className = 'ResponsiveAccordionTabs'; // ie9 back compat
     if (!this.$element.attr('id')) {
       this.$element.attr('id',GetYoDigits(6, 'responsiveaccordiontabs'));
-    };
+    }
 
     this._init();
     this._events();
@@ -178,7 +178,7 @@ class ResponsiveAccordionTabs extends Plugin{
     if ($panels.length) fromString = 'tabs';
     if (fromString === toSet) {
       return;
-    };
+    }
 
     var tabsTitle = _this.allOptions.linkClass?_this.allOptions.linkClass:'tabs-title';
     var tabsPanel = _this.allOptions.panelClass?_this.allOptions.panelClass:'tabs-panel';
@@ -192,7 +192,7 @@ class ResponsiveAccordionTabs extends Plugin{
       $panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected');
     }else{
       $panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content');
-    };
+    }
 
     $panels.css({display:'',visibility:''});
     $liHeads.css({display:'',visibility:''});
@@ -211,7 +211,7 @@ class ResponsiveAccordionTabs extends Plugin{
         $placeholder.remove();
       }else{
         $tabsContent = $('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content',_this.$element.attr('id'));
-      };
+      }
       $panels.each(function(key,value){
         var tempValue = $(value).appendTo($tabsContent).addClass(tabsPanel);
         var hash = $liHeadsA.get(key).hash.slice(1);
@@ -223,12 +223,12 @@ class ResponsiveAccordionTabs extends Plugin{
             hash = id;
             $(value).attr('id',hash);
             $($liHeadsA.get(key)).attr('href',$($liHeadsA.get(key)).attr('href').replace('#','')+'#'+hash);
-          };
-        };
+          }
+        }
         var isActive = $($liHeads.get(key)).hasClass('is-active');
         if (isActive) {
           tempValue.addClass('is-active');
-        };
+        }
       });
       $liHeads.addClass(tabsTitle);
     };
index 11688c35861b4c22203a1c7d7c6ae419e7b30dc0..74ec8985822315cce18c062d1632a6abce9201a0 100644 (file)
@@ -22,7 +22,7 @@ var Box = {
  */
 function ImNotTouchingYou(element, parent, lrOnly, tbOnly, ignoreBottom) {
   return OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) === 0;
-};
+}
 
 function OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) {
   var eleDims = GetDimensions(element),