]> source.dussan.org Git - jquery.git/commitdiff
fixing both #8403 and #8401: jQuery \"bulldozes\" other IE filters when setting opacity
authorlouisremi <louisremi@louisremi-laptop.(none)>
Mon, 28 Feb 2011 23:54:15 +0000 (00:54 +0100)
committerlouisremi <louisremi@louisremi-laptop.(none)>
Mon, 28 Feb 2011 23:54:15 +0000 (00:54 +0100)
src/css.js

index 8a982312f17a0c70263af45323c7028494c8b1c7..9fdba3b7b4aba6ffc06232a7047de17d3a10f651 100644 (file)
@@ -221,7 +221,8 @@ if ( !jQuery.support.opacity ) {
                },
 
                set: function( elem, value ) {
-                       var style = elem.style;
+                       var style = elem.style,
+                               currentStyle = elem.currentStyle;
 
                        // IE has trouble with opacity if it does not have layout
                        // Force it by setting the zoom level
@@ -231,11 +232,11 @@ if ( !jQuery.support.opacity ) {
                        var opacity = jQuery.isNaN(value) ?
                                "" :
                                "alpha(opacity=" + value * 100 + ")",
-                               filter = style.filter || "";
+                               filter = currentStyle && currentStyle.filter || style.filter || "";
 
                        style.filter = ralpha.test(filter) ?
                                filter.replace(ralpha, opacity) :
-                               style.filter + ' ' + opacity;
+                               filter + ' ' + opacity;
                }
        };
 }