Permalink
Browse files

Merge branch 'deprecate-webkit-gradient'

  • Loading branch information...
Phil LaPier
Phil LaPier committed Jun 25, 2013
2 parents 5bdaa07 + 5d77433 commit 775fbccb4b711014ba4c9ace45404c661f1baf10
@@ -1,5 +1,4 @@
// Custom Helpers
-@import "helpers/deprecated-webkit-gradient";
@import "helpers/gradient-positions-parser";
@import "helpers/linear-positions-parser";
@import "helpers/radial-arg-parser";
@@ -8,7 +7,6 @@
@import "helpers/shape-size-stripper";
// Custom Functions
-@import "functions/compact";
@import "functions/flex-grid";
@import "functions/grid-width";
@import "functions/golden-ratio";
@@ -4,18 +4,18 @@
//************************************************************************//
@mixin background(
- $background-1 , $background-2: false,
- $background-3: false, $background-4: false,
- $background-5: false, $background-6: false,
- $background-7: false, $background-8: false,
- $background-9: false, $background-10: false,
- $fallback: false
+ $background-1 , $background-2: null,
+ $background-3: null, $background-4: null,
+ $background-5: null, $background-6: null,
+ $background-7: null, $background-8: null,
+ $background-9: null, $background-10: null,
+ $fallback: null
) {
- $backgrounds: compact($background-1, $background-2,
+ $backgrounds: $background-1, $background-2,
$background-3, $background-4,
$background-5, $background-6,
$background-7, $background-8,
- $background-9, $background-10);
+ $background-9, $background-10;
$fallback-color: false;
@if (type-of($fallback) == color) or ($fallback == "transparent") {
@@ -1,11 +1,9 @@
-@mixin linear-gradient($pos, $G1, $G2: false,
- $G3: false, $G4: false,
- $G5: false, $G6: false,
- $G7: false, $G8: false,
- $G9: false, $G10: false,
- $deprecated-pos1: left top,
- $deprecated-pos2: left bottom,
- $fallback: false) {
+@mixin linear-gradient($pos, $G1, $G2: null,
+ $G3: null, $G4: null,
+ $G5: null, $G6: null,
+ $G7: null, $G8: null,
+ $G9: null, $G10: null,
+ $fallback: null) {
// Detect what type of value exists in $pos
$pos-type: type-of(nth($pos, 1));
$pos-spec: null;
@@ -24,7 +22,7 @@
$pos-spec: nth($positions, 2);
}
- $full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
+ $full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Set $G1 as the default fallback color
$fallback-color: nth($G1, 1);
@@ -35,7 +33,6 @@
}
background-color: $fallback-color;
- background-image: _deprecated-webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $full); // Safari <= 5.0
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})");
}
@@ -1,24 +1,20 @@
// Requires Sass 3.1+
@mixin radial-gradient($G1, $G2,
- $G3: false, $G4: false,
- $G5: false, $G6: false,
- $G7: false, $G8: false,
- $G9: false, $G10: false,
+ $G3: null, $G4: null,
+ $G5: null, $G6: null,
+ $G7: null, $G8: null,
+ $G9: null, $G10: null,
$pos: null,
$shape-size: null,
- $deprecated-pos1: center center,
- $deprecated-pos2: center center,
- $deprecated-radius1: 0,
- $deprecated-radius2: 460,
- $fallback: false) {
+ $fallback: null) {
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
$G1: nth($data, 1);
$G2: nth($data, 2);
$pos: nth($data, 3);
$shape-size: nth($data, 4);
- $full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
+ $full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Strip deprecated cover/contain for spec
$shape-size-spec: _shape-size-stripper($shape-size);
@@ -38,7 +34,6 @@
$shape-size-spec: if(($shape-size-spec != ' ') and ($pos == null), '#{$shape-size-spec}, ', '#{$shape-size-spec} ');
background-color: $fallback-color;
- background-image: _deprecated-webkit-gradient(radial, $deprecated-pos1, $deprecated-pos2, $full, $deprecated-radius1, $deprecated-radius2); // Safari <= 5.0 && IOS 4
background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full}));
background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})");
}
@@ -1,11 +0,0 @@
-// Remove `false` values from a list
-
-@function compact($vars...) {
- $list: ();
- @each $var in $vars {
- @if $var {
- $list: append($list, $var, comma);
- }
- }
- @return $list;
-}
@@ -1,11 +1,11 @@
// This function is required and used by the background-image mixin.
@function radial-gradient($G1, $G2,
- $G3: false, $G4: false,
- $G5: false, $G6: false,
- $G7: false, $G8: false,
- $G9: false, $G10: false,
- $pos: null,
- $shape-size: null) {
+ $G3: null, $G4: null,
+ $G5: null, $G6: null,
+ $G7: null, $G8: null,
+ $G9: null, $G10: null,
+ $pos: null,
+ $shape-size: null) {
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
$G1: nth($data, 1);
@@ -14,7 +14,7 @@
$shape-size: nth($data, 4);
$type: radial;
- $gradient: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
+ $gradient: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
$type-gradient: $type, $shape-size $pos, $gradient;
@return $type-gradient;
@@ -1,39 +0,0 @@
-// Render Deprecated Webkit Gradient - Linear || Radial
-//************************************************************************//
-@function _deprecated-webkit-gradient($type,
- $deprecated-pos1, $deprecated-pos2,
- $full,
- $deprecated-radius1: false, $deprecated-radius2: false) {
- $gradient-list: ();
- $gradient: false;
- $full-length: length($full);
- $percentage: false;
- $gradient-type: $type;
-
- @for $i from 1 through $full-length {
- $gradient: nth($full, $i);
-
- @if length($gradient) == 2 {
- $color-stop: color-stop(nth($gradient, 2), nth($gradient, 1));
- $gradient-list: join($gradient-list, $color-stop, comma);
- }
- @else if $gradient != null {
- @if $i == $full-length {
- $percentage: 100%;
- }
- @else {
- $percentage: ($i - 1) * (100 / ($full-length - 1)) + "%";
- }
- $color-stop: color-stop(unquote($percentage), $gradient);
- $gradient-list: join($gradient-list, $color-stop, comma);
- }
- }
-
- @if $type == radial {
- $gradient: -webkit-gradient(radial, $deprecated-pos1, $deprecated-radius1, $deprecated-pos2, $deprecated-radius2, $gradient-list);
- }
- @else if $type == linear {
- $gradient: -webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $gradient-list);
- }
- @return $gradient;
-}
@@ -22,7 +22,7 @@
$pos: $pos nth($value, $i);
}
}
- $G1: false;
+ $G1: null;
}
// If not spec calculate correct values
@@ -38,7 +38,7 @@
$pos: $value;
@if $pos == $G1 {
- $G1: false;
+ $G1: null;
}
}
@@ -55,11 +55,11 @@
$shape-size: $value;
@if $value == $G1 {
- $G1: false;
+ $G1: null;
}
@else if $value == $G2 {
- $G2: false;
+ $G2: null;
}
}
}

0 comments on commit 775fbcc

Please sign in to comment.