Skip to content
Permalink
Browse files

Update to fix for #1064 and tests

  • Loading branch information
brandonaaron committed Mar 22, 2007
1 parent 26034c4 commit 7ad613c5e9aaf79666c5de39ebfafad5c46e13b9
Showing with 9 additions and 7 deletions.
  1. +4 −4 src/jquery/coreTest.js
  2. +5 −3 src/jquery/jquery.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" );
@@ -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

0 comments on commit 7ad613c

Please sign in to comment.
You can’t perform that action at this time.