From 8be62d7eb23e2d4f1d6f3a482bbb257eb3b05cad Mon Sep 17 00:00:00 2001 From: Black Mirror Date: Tue, 26 Jun 2018 16:42:06 +0200 Subject: [PATCH] bugfix for will-change --- scss/mixins/_will-change.scss | 39 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/scss/mixins/_will-change.scss b/scss/mixins/_will-change.scss index 5cc8e56..ab6e716 100644 --- a/scss/mixins/_will-change.scss +++ b/scss/mixins/_will-change.scss @@ -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 /// @@ -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; @@ -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;