Skip to content

Commit

Permalink
deprecation fix: use new SCSS syntax
Browse files Browse the repository at this point in the history
Fixes deprecation warning with SASS and Compass#2052

```
DEPRECATION WARNING on line 92 of /Users/mattheworiordan/.rvm/gems/ruby-2.2.2/gems/compass-core-1.0.3/stylesheets/compass/css3/_deprecated-support.scss: #{} interpolation near operators will be simplified
in a future version of Sass. To preserve the current behavior, use quotes:

  unquote('"$ie6-"#{$legacy-support-for-ie6} "$ie7-"#{$legacy-support-for-ie7} "$ie8-"#{$legacy-support-for-ie8}')
```
  • Loading branch information
mattheworiordan committed Jun 8, 2016
1 parent d5df161 commit b58e1ee
Showing 1 changed file with 66 additions and 148 deletions.
214 changes: 66 additions & 148 deletions core/stylesheets/compass/css3/_deprecated-support.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,97 +17,86 @@ $legacy-support-for-webkit: true !default;
// their corresponding experimental CSS2 properties when
// the implementations are identical except for the property
// prefix.
@mixin experimental($property, $value,
$moz : $experimental-support-for-mozilla,
$webkit : $experimental-support-for-webkit,
$o : $experimental-support-for-opera,
$ms : $experimental-support-for-microsoft,
$khtml : $experimental-support-for-khtml,
$official : true
) {
@if $webkit and $experimental-support-for-webkit { -webkit-#{$property} : $value; }
@if $khtml and $experimental-support-for-khtml { -khtml-#{$property} : $value; }
@if $moz and $experimental-support-for-mozilla { -moz-#{$property} : $value; }
@if $ms and $experimental-support-for-microsoft { -ms-#{$property} : $value; }
@if $o and $experimental-support-for-opera { -o-#{$property} : $value; }
@if $official { #{$property} : $value; }
@mixin experimental($property, $value, $moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml, $official: true) {
@if $webkit and $experimental-support-for-webkit {
-webkit-#{$property}: $value;
}
@if $khtml and $experimental-support-for-khtml {
-khtml-#{$property}: $value;
}
@if $moz and $experimental-support-for-mozilla {
-moz-#{$property}: $value;
}
@if $ms and $experimental-support-for-microsoft {
-ms-#{$property}: $value;
}
@if $o and $experimental-support-for-opera {
-o-#{$property}: $value;
}
@if $official {
#{$property}: $value;
}
}

// This mixin is a shortcut for applying only a single experimental value
@mixin experimental-only-for($property, $value,
$moz : false,
$webkit : false,
$o : false,
$ms : false,
$khtml : false,
$official : false
) {
@mixin experimental-only-for($property, $value, $moz: false, $webkit: false, $o: false, $ms: false, $khtml: false, $official: false) {
@include experimental($property, $value, $moz, $webkit, $o, $ms, $khtml, $official);
}

// Same as experimental(), but for cases when the property is the same and the value is vendorized
@mixin experimental-value($property, $value,
$moz : $experimental-support-for-mozilla,
$webkit : $experimental-support-for-webkit,
$o : $experimental-support-for-opera,
$ms : $experimental-support-for-microsoft,
$khtml : $experimental-support-for-khtml,
$official : true
) {
@if $webkit and $experimental-support-for-webkit { #{$property} : -webkit-#{$value}; }
@if $khtml and $experimental-support-for-khtml { #{$property} : -khtml-#{$value}; }
@if $moz and $experimental-support-for-mozilla { #{$property} : -moz-#{$value}; }
@if $ms and $experimental-support-for-microsoft { #{$property} : -ms-#{$value}; }
@if $o and $experimental-support-for-opera { #{$property} : -o-#{$value}; }
@if $official { #{$property} : #{$value}; }
@mixin experimental-value($property, $value, $moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml, $official: true) {
@if $webkit and $experimental-support-for-webkit {
#{$property}: -webkit-#{$value};
}
@if $khtml and $experimental-support-for-khtml {
#{$property}: -khtml-#{$value};
}
@if $moz and $experimental-support-for-mozilla {
#{$property}: -moz-#{$value};
}
@if $ms and $experimental-support-for-microsoft {
#{$property}: -ms-#{$value};
}
@if $o and $experimental-support-for-opera {
#{$property}: -o-#{$value};
}
@if $official {
#{$property}: #{$value};
}
}

// @private
// Check a given support list for support of a particular browser
@function supported(
$prefix,
$support-list
) {
@function supported($prefix, $support-list) {
$keys: moz, webkit, o, ms, khtml, official;
$index: index($keys, $prefix);

@if $index {
@if $index == 6 and length($support-list) == 5 {
@return official;
} @else {
}
@else {
@return nth($support-list, $index);
}
} @else {
@warn 'Please pass a valid browser for $prefix: moz, webkit, o, ms, khtml, or official.';
}
@else {
@warn "Please pass a valid browser for $prefix: moz, webkit, o, ms, khtml, or official.";
}
}

// A debug tool for checking browser support
@mixin debug-support-matrix($experimental: true, $ie: true) {
@debug #{'$moz-'}$experimental-support-for-mozilla
#{'$webkit-'}$experimental-support-for-webkit
#{'$opera-'}$experimental-support-for-opera
#{'$microsoft-'}$experimental-support-for-microsoft
#{'$khtml-'}$experimental-support-for-khtml;
@debug #{'$ie6-'}$legacy-support-for-ie6
#{'$ie7-'}$legacy-support-for-ie7
#{'$ie8-'}$legacy-support-for-ie8;
@debug #{"$moz-"}$experimental-support-for-mozilla #{"$webkit-"}$experimental-support-for-webkit #{"$opera-"}$experimental-support-for-opera #{"$microsoft-"}$experimental-support-for-microsoft #{"$khtml-"}$experimental-support-for-khtml;
@debug #{"$ie6-"}$legacy-support-for-ie6 #{"$ie7-"}$legacy-support-for-ie7 #{"$ie8-"}$legacy-support-for-ie8;
}

// Capture the current exerimental support settings
@function capture-experimental-matrix() {
@return $experimental-support-for-mozilla
$experimental-support-for-webkit
$experimental-support-for-opera
$experimental-support-for-microsoft
$experimental-support-for-khtml;
@return $experimental-support-for-mozilla $experimental-support-for-webkit $experimental-support-for-opera $experimental-support-for-microsoft $experimental-support-for-khtml;
}

// Capture the current legacy-ie support settings
@function capture-legacy-ie-matrix() {
@return $legacy-support-for-ie6
$legacy-support-for-ie7
$legacy-support-for-ie8;
@return $legacy-support-for-ie6 $legacy-support-for-ie7 $legacy-support-for-ie8;
}

// Capture and store support
Expand All @@ -128,144 +117,73 @@ $legacy-ie-matrix: capture-legacy-ie-matrix();
}

// Change the experimental-support settings in specific contexts.
@mixin set-experimental-support(
$moz : false,
$webkit : false,
$o : false,
$ms : false,
$khtml : false
) {
$experimental-support-for-mozilla : $moz;
$experimental-support-for-webkit : $webkit;
$experimental-support-for-opera : $o;
$experimental-support-for-microsoft : $ms;
$experimental-support-for-khtml : $khtml;
@mixin set-experimental-support($moz: false, $webkit: false, $o: false, $ms: false, $khtml: false) {
$experimental-support-for-mozilla: $moz;
$experimental-support-for-webkit: $webkit;
$experimental-support-for-opera: $o;
$experimental-support-for-microsoft: $ms;
$experimental-support-for-khtml: $khtml;
}

@mixin capture-and-set-experimental(
$moz : false,
$webkit : false,
$o : false,
$ms : false,
$khtml : false
) {
@mixin capture-and-set-experimental($moz: false, $webkit: false, $o: false, $ms: false, $khtml: false) {
@include capture-experimental-matrix;
@include set-experimental-support($moz, $webkit, $o, $ms, $khtml);
}

@mixin capture-and-adjust-experimental(
$moz : $experimental-support-for-mozilla,
$webkit : $experimental-support-for-webkit,
$o : $experimental-support-for-opera,
$ms : $experimental-support-for-microsoft,
$khtml : $experimental-support-for-khtml
) {
@mixin capture-and-adjust-experimental($moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml) {
@include capture-experimental-matrix;
@include set-experimental-support($moz, $webkit, $o, $ms, $khtml);
}

// Change the legacy-support-for-ie* settings in specific contexts.
@mixin set-legacy-ie-support(
$ie6: false,
$ie7: false,
$ie8: false
) {
@mixin set-legacy-ie-support($ie6: false, $ie7: false, $ie8: false) {
$legacy-support-for-ie6: $ie6;
$legacy-support-for-ie7: $ie7;
$legacy-support-for-ie8: $ie8;
}

@mixin capture-and-set-legacy-ie(
$ie6: false,
$ie7: false,
$ie8: false
) {
@mixin capture-and-set-legacy-ie($ie6: false, $ie7: false, $ie8: false) {
@include capture-legacy-ie-matrix;
@include set-legacy-ie-support($ie6, $ie7, $ie8);
}

@mixin capture-and-adjust-legacy-ie(
$ie6: $legacy-support-for-ie6,
$ie7: $legacy-support-for-ie7,
$ie8: $legacy-support-for-ie8
) {
@mixin capture-and-adjust-legacy-ie($ie6: $legacy-support-for-ie6, $ie7: $legacy-support-for-ie7, $ie8: $legacy-support-for-ie8) {
@include capture-and-set-legacy-ie($ie6, $ie7, $ie8);
}

// Capture current browser support matrix, and set a new matrix of support.
@mixin capture-and-set-support(
$moz : false,
$webkit : false,
$o : false,
$ms : false,
$khtml : false,
$ie6 : false,
$ie7 : false,
$ie8 : false
) {
@mixin capture-and-set-support($moz: false, $webkit: false, $o: false, $ms: false, $khtml: false, $ie6: false, $ie7: false, $ie8: false) {
// Capture the current state
@include capture-support-matrix;

// Change support settings
@include set-experimental-support($moz, $webkit, $o, $ms, $khtml);
@include set-legacy-ie-support($ie6, $ie7, $ie8);
}

// Capture current browser support matrix, and set a new matrix of support.
@mixin capture-and-adjust-support(
$moz : $experimental-support-for-mozilla,
$webkit : $experimental-support-for-webkit,
$o : $experimental-support-for-opera,
$ms : $experimental-support-for-microsoft,
$khtml : $experimental-support-for-khtml,
$ie6 : $legacy-support-for-ie6,
$ie7 : $legacy-support-for-ie7,
$ie8 : $legacy-support-for-ie8
) {
@mixin capture-and-adjust-support($moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml, $ie6: $legacy-support-for-ie6, $ie7: $legacy-support-for-ie7, $ie8: $legacy-support-for-ie8) {
@include capture-and-set-support($moz, $webkit, $o, $ms, $khtml, $ie6, $ie7, $ie8);
}


// This mixin allows you to change the experimental support settings for
// child (@content) styles.
@mixin with-only-support-for(
$moz : false,
$webkit : false,
$o : false,
$ms : false,
$khtml : false,
$ie6 : false,
$ie7 : false,
$ie8 : false
) {
@mixin with-only-support-for($moz: false, $webkit: false, $o: false, $ms: false, $khtml: false, $ie6: false, $ie7: false, $ie8: false) {
// Capture current state
$wo-experimental-matrix : capture-experimental-matrix();
$wo-legacy-ie-matrix : capture-legacy-ie-matrix();

$wo-experimental-matrix: capture-experimental-matrix();
$wo-legacy-ie-matrix: capture-legacy-ie-matrix();
// Set new states
@include set-experimental-support($moz, $webkit, $o, $ms, $khtml);
@include set-legacy-ie-support($ie6, $ie7, $ie8);

// Apply styles
@content;

// Return to original support settings
@include set-experimental-support($wo-experimental-matrix...);
@include set-legacy-ie-support($wo-legacy-ie-matrix...);
}

// This mixin is a shortcut for making slight adjustments to browser support
// for child (@content) styles
@mixin adjust-support-for(
$moz : $experimental-support-for-mozilla,
$webkit : $experimental-support-for-webkit,
$o : $experimental-support-for-opera,
$ms : $experimental-support-for-microsoft,
$khtml : $experimental-support-for-khtml,
$ie6 : $legacy-support-for-ie6,
$ie7 : $legacy-support-for-ie7,
$ie8 : $legacy-support-for-ie8
) {
@mixin adjust-support-for($moz: $experimental-support-for-mozilla, $webkit: $experimental-support-for-webkit, $o: $experimental-support-for-opera, $ms: $experimental-support-for-microsoft, $khtml: $experimental-support-for-khtml, $ie6: $legacy-support-for-ie6, $ie7: $legacy-support-for-ie7, $ie8: $legacy-support-for-ie8) {
@include with-only-support-for($moz, $webkit, $o, $ms, $khtml, $ie6, $ie7, $ie8) {
@content;
}
Expand Down

0 comments on commit b58e1ee

Please sign in to comment.