Make sure setting opacity does not clobber other inline filters. Fixes #7101.

This commit is contained in:
Colin Snover 2010-09-30 11:24:59 -07:00 committed by John Resig
parent cb811c04b0
commit 06c505d851
2 changed files with 7 additions and 4 deletions

View file

@ -204,7 +204,7 @@ if ( !jQuery.support.opacity ) {
style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) :
opacity;
style.filter + ' ' + opacity;
}
};
}

View file

@ -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" );
});
}