Skip to content

Commit

Permalink
is-length with zero value bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Black Mirror committed Mar 5, 2018
1 parent 15fc474 commit 7341f36
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions scss/types/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ $css-default-modes: (initial, inherit);
@return is-defined($cd) and array-contains($css-default-modes, $cd);
}

@function is-not-unitless-or-zero($v) {
@return not(unitless($v)) or (unitless($v) and $v==0);
}

@function is-calc-length($cl) {
@return is-defined($cl) and string-starts-with($cl + '', 'calc(') and string-ends-with($cl + '', ')');
}
Expand All @@ -25,13 +21,13 @@ $length-modes: array-concat((auto), $css-default-modes);
$relative-length-units: (em, ex, ch, rem, vw, vh, vmin, vmax);

@function is-relative-length($l) {
@return is-number($l) and is-not-unitless-or-zero($l) and (array-contains($relative-length-units, unit($l)) or is-percentage($l));
@return is-number($l) and ($l==0 or (not(unitless($l) and (array-contains($relative-length-units, unit($l)) or is-percentage($l)))));
}

$absolute-length-units: (cm, mm, in, px, pt, pc);

@function is-absolute-length($l) {
@return is-number($l) and is-not-unitless-or-zero($l) and array-contains($absolute-length-units, unit($l));
@return is-number($l) and ($l==0 or (not(unitless($l) and (array-contains($absolute-length-units, unit($l))))));
}

/// Checks is a value is a valid CSS length
Expand Down

0 comments on commit 7341f36

Please sign in to comment.