From: Chris Thronebury Date: Sun, 26 Jun 2016 04:31:09 +0000 (-0400) Subject: Fix ghetto for loop X-Git-Tag: v6.2.4-rc1~57^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e52cc36a4a7044955b5641da4a5ee755048df419;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Fix ghetto for loop --- diff --git a/scss/util/_breakpoint.scss b/scss/util/_breakpoint.scss index 15707b992..ddcf80aa0 100644 --- a/scss/util/_breakpoint.scss +++ b/scss/util/_breakpoint.scss @@ -176,19 +176,10 @@ $breakpoint-classes: (small medium large) !default; /// @returns {Mixed} The value for the key after `$key`, if `$key` was found. If `$key` was not found, or `$key` was the last value in the map, returns `null`. @function -zf-map-next($map, $key) { // Store the values of the map as a list, so we can access them with nth - $values: map-values($map); - - // Ghetto for loop - $i: 1; - $found: false; - @each $val in map-keys($map) { - @if $found == false { - @if ($key == $val) { - $found: true; - } - $i: $i + 1; - } - } + $values: map-keys($map); + + // Get the index of the key within the map and add 1 to it for the next breakpoint in the map + $i: index($values, $key) + 1; // If the key doesn't exist, or it's the last key in the map, return null @if $i > length($map) { @@ -196,7 +187,8 @@ $breakpoint-classes: (small medium large) !default; } // Otherwise, return the value @else { - @return nth($values, $i); + @return map-get($map, nth($values, $i)); + } }