Added a fix for setting the style property in IE: .attr("style", "...") (bug #1170).

This commit is contained in:
John Resig 2007-07-21 00:12:18 +00:00
parent 97a6bdbaba
commit 3740716480

View File

@ -1567,14 +1567,15 @@ jQuery.extend({
if ( fix[name] ) { if ( fix[name] ) {
if ( value != undefined ) elem[fix[name]] = value; if ( value != undefined ) elem[fix[name]] = value;
return elem[fix[name]]; 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; return elem.getAttributeNode(name).nodeValue;
// IE elem.getAttribute passes even for style // IE elem.getAttribute passes even for style
else if ( elem.tagName ) { else if ( elem.tagName ) {
if ( value != undefined ) elem.setAttribute( name, value ); if ( value != undefined ) elem.setAttribute( name, value );
if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
return elem.getAttribute( name, 2 ); return elem.getAttribute( name, 2 );
@ -1850,6 +1851,7 @@ new function() {
selected: "selected", selected: "selected",
maxlength: "maxLength" maxlength: "maxLength"
}; };
}; };
/** /**