Added a fix for setting the style property in IE: .attr("style", "...") (bug #1170).
[jquery.git] / src / jquery / jquery.js
index 8e370f8..741b13b 100644 (file)
@@ -1171,9 +1171,14 @@ jQuery.fn = jQuery.prototype = {
                                obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
 
                        jQuery.each( a, function(){
-                               fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
+                               if ( jQuery.nodeName(this, "script") ) {
+                                       if ( this.src )
+                                               jQuery.ajax({ url: this.src, async: false, dataType: "script" });
+                                       else
+                                               (new Function( this.text || this.textContent || this.innerHTML || "" ))();
+                               } else
+                                       fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
                        });
-
                });
        }
 };
@@ -1466,6 +1471,9 @@ jQuery.extend({
                                    ret = c && c.getPropertyValue(prop) || "";
                                });
 
+                       if ( prop == "opacity" && ret == "" )
+                               ret = "1";
+
                } else if (elem.currentStyle) {
                        var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
                        ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
@@ -1559,13 +1567,14 @@ jQuery.extend({
                if ( fix[name] ) {
                        if ( value != undefined ) elem[fix[name]] = value;
                        return elem[fix[name]];
+               } else if ( jQuery.browser.msie && name == "style" )
+                       return jQuery.attr( elem.style, "cssText", value );
 
-               } else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
+               else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
                        return elem.getAttributeNode(name).nodeValue;
 
                // IE elem.getAttribute passes even for style
                else if ( elem.tagName ) {
-                       
 
                        if ( value != undefined ) elem.setAttribute( name, value );
                        if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) 
@@ -1607,7 +1616,7 @@ jQuery.extend({
         * @cat JavaScript
         */
        trim: function(t){
-               return t.replace(/^\s+|\s+$/g, "");
+               return (t||"").replace(/^\s+|\s+$/g, "");
        },
 
        makeArray: function( a ) {
@@ -1842,6 +1851,7 @@ new function() {
                selected: "selected",
                maxlength: "maxLength"
        };
+
 };
 
 /**