Skip to content

Commit

Permalink
bugfix for will-change
Browse files Browse the repository at this point in the history
  • Loading branch information
Black Mirror committed Jun 26, 2018
1 parent 42e56f0 commit 8be62d7
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions scss/mixins/_will-change.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,11 @@
/// @author blackmirror1980
////

/// Checks if something is a will-change animateable list
///
/// @access public
/// @param {list} $wcl - the will-change list of animateable values (e.g. `left, top`)
/// @return {boolean}
@function is-will-change-animateable($wcl) {
@if is-array($wcal) {
$is-valid: true;

@each $will-change-animateable-prop in $wcal {
@if $is-valid {
$is-valid: array-contains($animateable-properties, $will-change-animateable-prop);
}
}

@return $is-valid;
}

@return false;
}

/// Will Change modes
///
/// @access private
/// @type list
$will-change-modes: array-concat((auto, scroll-position, contents, transform, opacity, unset), $css-default-modes);
$will-change-modes: array-concat((auto, scroll-position, contents, transform, opacity, unset), $animateable-properties, $css-default-modes);

/// Checks if something is a will-change value
///
Expand All @@ -40,11 +19,19 @@ $will-change-modes: array-concat((auto, scroll-position, contents, transform, op
/// @return {boolean}
@function is-will-change($wc) {
@if is-defined($wc) {
@if is-array($wc) {
@return is-will-change-animateable($wc);
@if list-separator($wc) != comma {
$wc: ($wc,);
}

$is-will-change-valid: true;

@each $will-change-value in $wc {
@if $is-will-change-valid {
$is-will-change-valid: array-contains($will-change-modes, $will-change-value);
}
}

@return array-contains($will-change-modes, $wc);
@return $is-will-change-valid;
}

@return false;
Expand Down Expand Up @@ -74,7 +61,7 @@ $will-change-modes: array-concat((auto, scroll-position, contents, transform, op
///
/// @access public
/// @param {string | array | list} $wc - the will-change value (e.g. `auto` or `left, top`)
@mixin will-change($wc) {
@mixin will-change($wc...) {
@if is-defined($wc) {
@if is-will-change($wc) {
will-change: $wc;
Expand Down

0 comments on commit 8be62d7

Please sign in to comment.