| 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 ]; |