From 8d18a1b70491c65f60ead0e08a26ecffac02d6f7 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Fri, 10 Dec 2010 18:10:05 -0600 Subject: [PATCH] added legacy support option for ie8, updated opacty and filter-gradient mixins to use legacy support settings --- .../compass/stylesheets/compass/_support.scss | 13 ++++++++----- .../stylesheets/compass/css3/_images.scss | 8 ++++++-- .../stylesheets/compass/css3/_opacity.scss | 17 ++++++----------- .../stylesheets/compass/css/gradients.css | 12 ++++++------ .../stylesheets/compass/css/opacity.css | 4 ++++ .../stylesheets/compass/sass/opacity.scss | 5 +++++ 6 files changed, 35 insertions(+), 24 deletions(-) create mode 100644 test/fixtures/stylesheets/compass/css/opacity.css create mode 100644 test/fixtures/stylesheets/compass/sass/opacity.scss diff --git a/frameworks/compass/stylesheets/compass/_support.scss b/frameworks/compass/stylesheets/compass/_support.scss index e3617ee9..b6cb2f19 100644 --- a/frameworks/compass/stylesheets/compass/_support.scss +++ b/frameworks/compass/stylesheets/compass/_support.scss @@ -1,17 +1,20 @@ // Usually compass hacks apply to both ie6 & 7 -- set this to false to disable support for both. $legacy-support-for-ie: true !default; -// Setting this to false will result in smaller output, but no support for ie6 +// Setting this to false will result in smaller output, but no support for ie6 hacks $legacy-support-for-ie6: $legacy-support-for-ie !default; -// Setting this to false will result in smaller output, but no support for ie7 +// Setting this to false will result in smaller output, but no support for ie7 hacks $legacy-support-for-ie7: $legacy-support-for-ie !default; +// Setting this to false will result in smaller output, but no support for legacy ie8 hacks +$legacy-support-for-ie8: $legacy-support-for-ie !default; + // @private -// The user can simply set $legacy-support-for-ie and 6 & 7 will be set accordingly, -// But in case the user set either of those explicitly, we need to sync the value of +// The user can simply set $legacy-support-for-ie and 6, 7, and 8 will be set accordingly, +// But in case the user set each of those explicitly, we need to sync the value of // this combined variable. -$legacy-support-for-ie: $legacy-support-for-ie6 or $legacy-support-for-ie7; +$legacy-support-for-ie: $legacy-support-for-ie6 or $legacy-support-for-ie7 or $legacy-support-for-ie8; // Support for mozilla in experimental css3 properties. $experimental-support-for-mozilla : true !default; diff --git a/frameworks/compass/stylesheets/compass/css3/_images.scss b/frameworks/compass/stylesheets/compass/css3/_images.scss index 8d52c56a..8ad01d43 100644 --- a/frameworks/compass/stylesheets/compass/css3/_images.scss +++ b/frameworks/compass/stylesheets/compass/css3/_images.scss @@ -54,8 +54,12 @@ @mixin filter-gradient($start-color, $end-color, $orientation: vertical) { @include has-layout; $gradient-type: if($orientation == vertical, 0, 1); - filter: progid:DXImageTransform.Microsoft.gradient(gradientType=#{$gradient-type}, startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}'); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=#{$gradient-type}, startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}')"; + @if $legacy-support-for-ie8 { + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=#{$gradient-type}, startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}')"; + } + @if $legacy-support-for-ie6 or $legacy-support-for-ie7 { + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=#{$gradient-type}, startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}'); + } } diff --git a/frameworks/compass/stylesheets/compass/css3/_opacity.scss b/frameworks/compass/stylesheets/compass/css3/_opacity.scss index 38093c6a..1cf0a538 100644 --- a/frameworks/compass/stylesheets/compass/css3/_opacity.scss +++ b/frameworks/compass/stylesheets/compass/css3/_opacity.scss @@ -6,18 +6,13 @@ // A number between 0 and 1, where 0 is transparent and 1 is opaque. @mixin opacity($opacity) { - opacity: $opacity; - @if $experimental-support-for-microsoft { - $value: unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{round($opacity * 100)})"); - @include experimental(filter, $value, - not -moz, - not -webkit, - not -o, - -ms, - not -khtml, - official // even though filter is not an official css3 property, IE 6/7 expect it. - ); + @if $legacy-support-for-ie8 { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=#{round($opacity * 100)})"; } + @if $legacy-support-for-ie6 or $legacy-support-for-ie7 { + filter: unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{round($opacity * 100)})"); + } + opacity: $opacity; } // Make an element completely transparent. diff --git a/test/fixtures/stylesheets/compass/css/gradients.css b/test/fixtures/stylesheets/compass/css/gradients.css index c495bee8..60f1cdba 100644 --- a/test/fixtures/stylesheets/compass/css/gradients.css +++ b/test/fixtures/stylesheets/compass/css/gradients.css @@ -338,15 +338,15 @@ .ie-horizontal-filter { *zoom: 1; - filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFFFFFFF', endColorstr='#FF000000'); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFFFFFFF', endColorstr='#FF000000')"; } + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFFFFFFF', endColorstr='#FF000000')"; + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFFFFFFF', endColorstr='#FF000000'); } .ie-vertical-filter { *zoom: 1; - filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#FF000000'); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#FF000000')"; } + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#FF000000')"; + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#FF000000'); } .ie-alpha-filter { *zoom: 1; - filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#00FFFFFF'); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#00FFFFFF')"; } + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#00FFFFFF')"; + filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#00FFFFFF'); } diff --git a/test/fixtures/stylesheets/compass/css/opacity.css b/test/fixtures/stylesheets/compass/css/opacity.css new file mode 100644 index 00000000..ea882d57 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/opacity.css @@ -0,0 +1,4 @@ +div { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=20); + opacity: 0.2; } diff --git a/test/fixtures/stylesheets/compass/sass/opacity.scss b/test/fixtures/stylesheets/compass/sass/opacity.scss new file mode 100644 index 00000000..b26dce7d --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/opacity.scss @@ -0,0 +1,5 @@ +@import "compass/css3/opacity"; + +div { + @include opacity(.2); +}