From: Colin Snover Date: Thu, 30 Sep 2010 18:24:59 +0000 (-0700) Subject: Make sure setting opacity does not clobber other inline filters. Fixes #7101. X-Git-Tag: 1.4.3rc1~26 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=06c505d85194890f8bacabc66895a6167b61728a;p=jquery.git Make sure setting opacity does not clobber other inline filters. Fixes #7101. --- diff --git a/src/css.js b/src/css.js index 79ae00e37..4bf818e5a 100644 --- a/src/css.js +++ b/src/css.js @@ -204,7 +204,7 @@ if ( !jQuery.support.opacity ) { style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : - opacity; + style.filter + ' ' + opacity; } }; } diff --git a/test/unit/css.js b/test/unit/css.js index 8802fc00a..468f76386 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -114,11 +114,14 @@ if(jQuery.browser.msie) { var filterVal = "progid:DXImageTransform.Microsoft.Alpha(opacity=30) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; var filterVal2 = "progid:DXImageTransform.Microsoft.alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; + var filterVal3 = "progid:DXImageTransform.Microsoft.Blur(pixelradius=5)"; jQuery('#foo').css("filter", filterVal); equals( jQuery('#foo').css("filter"), filterVal, "css('filter', val) works" ); - jQuery('#foo').css("opacity", 1) - equals( jQuery('#foo').css("filter"), filterVal2, "Setting opacity in IE doesn't clobber other filters" ); - equals( jQuery('#foo').css("opacity"), 1, "Setting opacity in IE with other filters works" ) + jQuery('#foo').css("opacity", 1); + equals( jQuery('#foo').css("filter"), filterVal2, "Setting opacity in IE doesn't duplicate opacity filter" ); + equals( jQuery('#foo').css("opacity"), 1, "Setting opacity in IE with other filters works" ); + jQuery('#foo').css("filter", filterVal3).css("opacity", 1); + ok( jQuery('#foo').css("filter").indexOf(filterVal3) !== -1, "Setting opacity in IE doesn't clobber other filters" ); }); }