X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=9ae399b49514222f84047d61a4b444340fd7ccbd;hb=fac6a87dcf2cb731692ea5baa647293435cdde01;hp=12b342cb8979b9eef9df0138b0f6e034054df908;hpb=7b2c84ddbe004ed4ab2ee3982af40b7275d7dfde;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 12b342c..9ae399b 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -98,7 +98,7 @@ if ( typeof $ != "undefined" ) * @desc Creates a div element (and all of its contents) dynamically, * and appends it to the element with the ID of body. Internally, an * element is created and it's innerHTML property set to the given markup. - * It is therefore both quite flexible and limited. + * It is therefore both quite flexible and limited. * * @name $ * @param String expr An expression to search with, or a string of HTML to create on the fly. @@ -1451,14 +1451,16 @@ jQuery.extend({ }); return p == "height" ? oHeight : oWidth; - } else if ( p == "opacity" && jQuery.browser.msie ) - return parseFloat( jQuery.curCSS(e,"filter").replace(/[^0-9.]/,"") ) || 1; + } return jQuery.curCSS( e, p ); }, curCSS: function(elem, prop, force) { var ret; + + if (prop == 'opacity' && jQuery.browser.msie) + return jQuery.attr(elem.style, 'opacity'); if (!force && elem.style[prop]) { @@ -1829,6 +1831,22 @@ jQuery.extend({ disabled: "disabled", checked: "checked" }; + + // IE actually uses filters for opacity ... elem is actually elem.style + if (name == "opacity" && jQuery.browser.msie && value != undefined) { + // IE has trouble with opacity if it does not have layout + // Would prefer to check element.hasLayout first but don't have access to the element here + elem['zoom'] = 1; + if (value == 1) // Remove filter to avoid more IE weirdness + return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,""); + else + return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"") + "alpha(opacity=" + value * 100 + ")"; + } else if (name == "opacity" && jQuery.browser.msie) { + return elem["filter"] ? parseFloat( elem["filter"].match(/alpha\(opacity=(.*)\)/)[1] )/100 : 1; + } + + // Mozilla doesn't play well with opacity 1 + if (name == "opacity" && jQuery.browser.mozilla && value == 1) value = 0.9999; if ( fix[name] ) { if ( value != undefined ) elem[fix[name]] = value;