Commit 430d9e0b authored by jeresig's avatar jeresig

Merge branch 'fix_8403' of https://github.com/lrbabe/jquery into lrbabe-fix_8403

parents 7bfb6a7d 581fa824
...@@ -231,7 +231,8 @@ if ( !jQuery.support.opacity ) { ...@@ -231,7 +231,8 @@ if ( !jQuery.support.opacity ) {
}, },
set: function( elem, value ) { 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 // IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level // Force it by setting the zoom level
...@@ -241,11 +242,11 @@ if ( !jQuery.support.opacity ) { ...@@ -241,11 +242,11 @@ if ( !jQuery.support.opacity ) {
var opacity = jQuery.isNaN(value) ? var opacity = jQuery.isNaN(value) ?
"" : "" :
"alpha(opacity=" + value * 100 + ")", "alpha(opacity=" + value * 100 + ")",
filter = style.filter || ""; filter = currentStyle && currentStyle.filter || style.filter || "";
style.filter = ralpha.test(filter) ? style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) : filter.replace(ralpha, opacity) :
style.filter + ' ' + opacity; filter + " " + opacity;
} }
}; };
} }
......
/* for testing opacity set in styles in IE */ /* for testing opacity set in styles in IE */
ol#empty { opacity: 0; filter:Alpha(opacity=0); } ol#empty { opacity: 0; filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff'); }
div#fx-tests h4 { div#fx-tests h4 {
background: red; background: red;
......
module("css", { teardown: moduleTeardown }); module("css", { teardown: moduleTeardown });
test("css(String|Hash)", function() { test("css(String|Hash)", function() {
expect(41); expect( 42 );
equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"'); equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"');
...@@ -58,6 +58,9 @@ test("css(String|Hash)", function() { ...@@ -58,6 +58,9 @@ test("css(String|Hash)", function() {
equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" ); equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" );
jQuery('#empty').css({ opacity: '1' }); jQuery('#empty').css({ opacity: '1' });
equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
jQuery.support.opacity ?
ok(true, "Requires the same number of tests"):
ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" );
var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild'); var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment