\r
$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {\r
$('#foo').css({opacity: n});\r
- ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );\r
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );\r
$('#foo').css({opacity: parseFloat(n)});\r
- ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );\r
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );\r
}); \r
$('#foo').css({opacity: ''});\r
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );\r
\r
$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {\r
$('#foo').css('opacity', n);\r
- ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );\r
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );\r
$('#foo').css('opacity', parseFloat(n));\r
- ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );\r
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );\r
});\r
$('#foo').css('opacity', '');\r
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );\r
curCSS: function(elem, prop, force) {
var ret;
- if (prop == "opacity" && jQuery.browser.msie)
- return jQuery.attr(elem.style, "opacity");
+ if (prop == "opacity" && jQuery.browser.msie) {
+ ret = jQuery.attr(elem.style, "opacity");
+ return ret == "" ? "1" : ret;
+ }
if (prop == "float" || prop == "cssFloat")
prop = jQuery.browser.msie ? "styleFloat" : "cssFloat";
}
return elem.filter ?
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "1";
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
}
// Certain attributes only work when accessed via the old DOM 0 way