Update to fix for #1064 and tests

This commit is contained in:
Brandon Aaron 2007-03-22 01:37:28 +00:00
parent 26034c4a29
commit 7ad613c5e9
2 changed files with 9 additions and 7 deletions

View file

@ -261,9 +261,9 @@ test("css(String|Hash)", function() {
$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
$('#foo').css({opacity: n});
ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );
ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
$('#foo').css({opacity: parseFloat(n)});
ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );
ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
});
$('#foo').css({opacity: ''});
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
@ -288,9 +288,9 @@ test("css(String, Object)", function() {
$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
$('#foo').css('opacity', n);
ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a String" );
ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
$('#foo').css('opacity', parseFloat(n));
ok( $('#foo').css('opacity') == n, "Assert opacity is " + n + " as a Number" );
ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
});
$('#foo').css('opacity', '');
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );

View file

@ -1403,8 +1403,10 @@ jQuery.extend({
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";
@ -1537,7 +1539,7 @@ jQuery.extend({
}
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