Turn off legacy IE support in @keyframes.
This commit turns off $legacy-support-for-ie* for @content within the @keyframes mixin. If a project has legacy IE support turned on, certain mixins add property definitions which are not affected by $experimental-support-for-*. One such mixin is @opacity with will add a `filter:` property. Because IE 6, 7 and 8 do not support CSS animations and keyframes, we can safely turn off the support and restore to its previous values once we are done rendering the @keyframes @content.
This commit is contained in:
parent
17676c6a05
commit
cab02128a7
@ -46,19 +46,31 @@
|
||||
$experimental-support-for-khtml: $khtml;
|
||||
}
|
||||
|
||||
// Change the legacy-support-for-ie* settings in specific contexts.
|
||||
@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;
|
||||
}
|
||||
|
||||
// This mixin allows you to change the experimental support settings for
|
||||
// child (@content) styles.
|
||||
@mixin with-only-support-for($moz: false, $webkit: false, $ms: false, $o: false, $khtml: false) {
|
||||
@mixin with-only-support-for($moz: false, $webkit: false, $ms: false, $o: false, $khtml: false, $legacy-ie: false) {
|
||||
// Capture the current state
|
||||
$original-moz: $experimental-support-for-mozilla;
|
||||
$original-webkit: $experimental-support-for-webkit;
|
||||
$original-o: $experimental-support-for-opera;
|
||||
$original-ms: $experimental-support-for-microsoft;
|
||||
$original-khtml: $experimental-support-for-khtml;
|
||||
$original-ie6: $legacy-support-for-ie6;
|
||||
$original-ie7: $legacy-support-for-ie7;
|
||||
$original-ie8: $legacy-support-for-ie8;
|
||||
// Change support settings
|
||||
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
|
||||
@include set-legacy-ie-support($legacy-ie, $legacy-ie, $legacy-ie);
|
||||
// Apply styles
|
||||
@content;
|
||||
// Return to original support settings
|
||||
@include set-legacy-ie-support($original-ie6, $original-ie7, $original-ie8);
|
||||
@include set-experimental-support($original-moz, $original-webkit, $original-ms, $original-o, $original-khtml);
|
||||
}
|
||||
|
41
test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css
vendored
Normal file
41
test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
@-moz-keyframes test {
|
||||
0%, 100% {
|
||||
opacity: 1; }
|
||||
|
||||
50% {
|
||||
opacity: 0; } }
|
||||
|
||||
@-webkit-keyframes test {
|
||||
0%, 100% {
|
||||
opacity: 1; }
|
||||
|
||||
50% {
|
||||
opacity: 0; } }
|
||||
|
||||
@-o-keyframes test {
|
||||
0%, 100% {
|
||||
opacity: 1; }
|
||||
|
||||
50% {
|
||||
opacity: 0; } }
|
||||
|
||||
@-ms-keyframes test {
|
||||
0%, 100% {
|
||||
opacity: 1; }
|
||||
|
||||
50% {
|
||||
opacity: 0; } }
|
||||
|
||||
@keyframes test {
|
||||
0%, 100% {
|
||||
opacity: 1; }
|
||||
|
||||
50% {
|
||||
opacity: 0; } }
|
||||
|
||||
.animation {
|
||||
-webkit-animation: test;
|
||||
-moz-animation: test;
|
||||
-ms-animation: test;
|
||||
-o-animation: test;
|
||||
animation: test; }
|
19
test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss
vendored
Normal file
19
test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
@import "compass/css3/animation";
|
||||
@import "compass/css3/opacity";
|
||||
|
||||
$legacy-support-for-ie8: true;
|
||||
$legacy-support-for-ie7: true;
|
||||
$legacy-support-for-ie6: true;
|
||||
|
||||
@include keyframes(test) {
|
||||
0%, 100% {
|
||||
@include opacity(1);
|
||||
}
|
||||
50% {
|
||||
@include opacity(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animation {
|
||||
@include animation(test);
|
||||
}
|
Loading…
Reference in New Issue
Block a user