diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2007-03-22 01:37:28 +0000 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2007-03-22 01:37:28 +0000 |
commit | 7ad613c5e9aaf79666c5de39ebfafad5c46e13b9 (patch) | |
tree | a10798ae42f46751b0b189b537bf457301ece3a6 /src | |
parent | 26034c4a2985c18c6c702f1c609001f859e33654 (diff) | |
download | jquery-7ad613c5e9aaf79666c5de39ebfafad5c46e13b9.tar.gz jquery-7ad613c5e9aaf79666c5de39ebfafad5c46e13b9.zip |
Update to fix for #1064 and tests
Diffstat (limited to 'src')
-rw-r--r-- | src/jquery/coreTest.js | 8 | ||||
-rw-r--r-- | src/jquery/jquery.js | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 4370e9da8..896130011 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -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" );
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 30396cacc..84a159433 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -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 |