Bug Tracker

Ticket #2959: attr-form.diff

File attr-form.diff, 2.5 kB (added by flesler, 8 months ago)
  • core.js

     
    10511051        // IE elem.getAttribute passes even for style 
    10521052        if ( elem.tagName ) { 
    10531053 
    1054             // These attributes require special treatment 
    1055             var special = /href|src|style/.test( name ); 
    1056  
    1057             // Safari mis-reports the default selected property of a hidden option 
    1058             // Accessing the parent's selectedIndex property fixes it 
    1059             if ( name == "selected" && jQuery.browser.safari ) 
    1060                 elem.parentNode.selectedIndex; 
    1061  
    1062             // If applicable, access the attribute via the DOM 0 way 
    1063             if ( name in elem && notxml && !special ) { 
    1064                 if ( set ){ 
    1065                     // We can't allow the type property to be changed (since it causes problems in IE) 
    1066                     if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) 
    1067                         throw "type property can't be changed"; 
    1068  
    1069                     elem[ name ] = value; 
     1054            if( notxml ){ 
     1055                     
     1056                // Safari mis-reports the default selected property of a hidden option 
     1057                // Accessing the parent's selectedIndex property fixes it 
     1058                if ( name == "selected" && jQuery.browser.safari ) 
     1059                    elem.parentNode.selectedIndex; 
     1060     
     1061                // browsers index elements by id/name on forms, give priority to attributes. 
     1062                if( jQuery.nodeName( elem, 'form' ) && elem.getAttributeNode(name) ){ 
     1063                    elem = elem.getAttributeNode(name); 
     1064                    name = 'nodeValue'; 
     1065                }else 
     1066                    // These attributes require special treatment 
     1067                    var special = /href|src|style/.test( name ); 
     1068                     
     1069                // If applicable, access the attribute via the DOM 0 way 
     1070                if ( name in elem && !special ) { 
     1071                    if ( set ){ 
     1072                        // We can't allow the type property to be changed (since it causes problems in IE) 
     1073                        if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) 
     1074                            throw "type property can't be changed"; 
     1075     
     1076                        elem[ name ] = value; 
     1077                    } 
     1078     
     1079                    return elem[ name ]; 
    10701080                } 
    1071  
    1072                 // browsers index elements by id/name on forms, give priority to attributes. 
    1073                 if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) 
    1074                     return elem.getAttributeNode( name ).nodeValue; 
    1075  
    1076                 return elem[ name ]; 
     1081     
     1082                if ( msie && name == "style" ) 
     1083                    return jQuery.attr( elem.style, "cssText", value ); 
    10771084            } 
    10781085 
    1079             if ( msie && notxml &&  name == "style" ) 
    1080                 return jQuery.attr( elem.style, "cssText", value ); 
    1081  
    10821086            if ( set ) 
    10831087                // convert the value to a string (all browsers do this but IE) see #1070 
    10841088                elem.setAttribute( name, "" + value );