Skip to content

Commit 06c505d

Browse files
Colin Snoverjeresig
authored andcommitted
Make sure setting opacity does not clobber other inline filters. Fixes #7101.
1 parent cb811c0 commit 06c505d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ if ( !jQuery.support.opacity ) {
204204

205205
style.filter = ralpha.test(filter) ?
206206
filter.replace(ralpha, opacity) :
207-
opacity;
207+
style.filter + ' ' + opacity;
208208
}
209209
};
210210
}

test/unit/css.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ if(jQuery.browser.msie) {
114114

115115
var filterVal = "progid:DXImageTransform.Microsoft.Alpha(opacity=30) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
116116
var filterVal2 = "progid:DXImageTransform.Microsoft.alpha(opacity=100) progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
117+
var filterVal3 = "progid:DXImageTransform.Microsoft.Blur(pixelradius=5)";
117118
jQuery('#foo').css("filter", filterVal);
118119
equals( jQuery('#foo').css("filter"), filterVal, "css('filter', val) works" );
119-
jQuery('#foo').css("opacity", 1)
120-
equals( jQuery('#foo').css("filter"), filterVal2, "Setting opacity in IE doesn't clobber other filters" );
121-
equals( jQuery('#foo').css("opacity"), 1, "Setting opacity in IE with other filters works" )
120+
jQuery('#foo').css("opacity", 1);
121+
equals( jQuery('#foo').css("filter"), filterVal2, "Setting opacity in IE doesn't duplicate opacity filter" );
122+
equals( jQuery('#foo').css("opacity"), 1, "Setting opacity in IE with other filters works" );
123+
jQuery('#foo').css("filter", filterVal3).css("opacity", 1);
124+
ok( jQuery('#foo').css("filter").indexOf(filterVal3) !== -1, "Setting opacity in IE doesn't clobber other filters" );
122125
});
123126
}
124127

0 commit comments

Comments
 (0)