| @@ 6927-6973 (lines=47) @@ | ||
| 6924 | }); |
|
| 6925 | ||
| 6926 | jQuery.extend({ |
|
| 6927 | attr: function( elem, name, value ) { |
|
| 6928 | var hooks, ret, |
|
| 6929 | nType = elem.nodeType; |
|
| 6930 | ||
| 6931 | // don't get/set attributes on text, comment and attribute nodes |
|
| 6932 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
|
| 6933 | return; |
|
| 6934 | } |
|
| 6935 | ||
| 6936 | // Fallback to prop when attributes are not supported |
|
| 6937 | if ( typeof elem.getAttribute === strundefined ) { |
|
| 6938 | return jQuery.prop( elem, name, value ); |
|
| 6939 | } |
|
| 6940 | ||
| 6941 | // All attributes are lowercase |
|
| 6942 | // Grab necessary hook if one is defined |
|
| 6943 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
| 6944 | name = name.toLowerCase(); |
|
| 6945 | hooks = jQuery.attrHooks[ name ] || |
|
| 6946 | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); |
|
| 6947 | } |
|
| 6948 | ||
| 6949 | if ( value !== undefined ) { |
|
| 6950 | ||
| 6951 | if ( value === null ) { |
|
| 6952 | jQuery.removeAttr( elem, name ); |
|
| 6953 | ||
| 6954 | } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
|
| 6955 | return ret; |
|
| 6956 | ||
| 6957 | } else { |
|
| 6958 | elem.setAttribute( name, value + "" ); |
|
| 6959 | return value; |
|
| 6960 | } |
|
| 6961 | ||
| 6962 | } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
|
| 6963 | return ret; |
|
| 6964 | ||
| 6965 | } else { |
|
| 6966 | ret = jQuery.find.attr( elem, name ); |
|
| 6967 | ||
| 6968 | // Non-existent attributes return null, we normalize to undefined |
|
| 6969 | return ret == null ? |
|
| 6970 | undefined : |
|
| 6971 | ret; |
|
| 6972 | } |
|
| 6973 | }, |
|
| 6974 | ||
| 6975 | removeAttr: function( elem, value ) { |
|
| 6976 | var name, propName, |
|
| @@ 8404-8449 (lines=46) @@ | ||
| 8401 | } ); |
|
| 8402 | ||
| 8403 | jQuery.extend( { |
|
| 8404 | attr: function( elem, name, value ) { |
|
| 8405 | var ret, hooks, |
|
| 8406 | nType = elem.nodeType; |
|
| 8407 | ||
| 8408 | // Don't get/set attributes on text, comment and attribute nodes |
|
| 8409 | if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
| 8410 | return; |
|
| 8411 | } |
|
| 8412 | ||
| 8413 | // Fallback to prop when attributes are not supported |
|
| 8414 | if ( typeof elem.getAttribute === "undefined" ) { |
|
| 8415 | return jQuery.prop( elem, name, value ); |
|
| 8416 | } |
|
| 8417 | ||
| 8418 | // All attributes are lowercase |
|
| 8419 | // Grab necessary hook if one is defined |
|
| 8420 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
| 8421 | name = name.toLowerCase(); |
|
| 8422 | hooks = jQuery.attrHooks[ name ] || |
|
| 8423 | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); |
|
| 8424 | } |
|
| 8425 | ||
| 8426 | if ( value !== undefined ) { |
|
| 8427 | if ( value === null ) { |
|
| 8428 | jQuery.removeAttr( elem, name ); |
|
| 8429 | return; |
|
| 8430 | } |
|
| 8431 | ||
| 8432 | if ( hooks && "set" in hooks && |
|
| 8433 | ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
| 8434 | return ret; |
|
| 8435 | } |
|
| 8436 | ||
| 8437 | elem.setAttribute( name, value + "" ); |
|
| 8438 | return value; |
|
| 8439 | } |
|
| 8440 | ||
| 8441 | if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
| 8442 | return ret; |
|
| 8443 | } |
|
| 8444 | ||
| 8445 | ret = jQuery.find.attr( elem, name ); |
|
| 8446 | ||
| 8447 | // Non-existent attributes return null, we normalize to undefined |
|
| 8448 | return ret == null ? undefined : ret; |
|
| 8449 | }, |
|
| 8450 | ||
| 8451 | attrHooks: { |
|
| 8452 | type: { |
|
| @@ 7134-7179 (lines=46) @@ | ||
| 7131 | } ); |
|
| 7132 | ||
| 7133 | jQuery.extend( { |
|
| 7134 | attr: function( elem, name, value ) { |
|
| 7135 | var ret, hooks, |
|
| 7136 | nType = elem.nodeType; |
|
| 7137 | ||
| 7138 | // Don't get/set attributes on text, comment and attribute nodes |
|
| 7139 | if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
| 7140 | return; |
|
| 7141 | } |
|
| 7142 | ||
| 7143 | // Fallback to prop when attributes are not supported |
|
| 7144 | if ( typeof elem.getAttribute === "undefined" ) { |
|
| 7145 | return jQuery.prop( elem, name, value ); |
|
| 7146 | } |
|
| 7147 | ||
| 7148 | // All attributes are lowercase |
|
| 7149 | // Grab necessary hook if one is defined |
|
| 7150 | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
| 7151 | name = name.toLowerCase(); |
|
| 7152 | hooks = jQuery.attrHooks[ name ] || |
|
| 7153 | ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); |
|
| 7154 | } |
|
| 7155 | ||
| 7156 | if ( value !== undefined ) { |
|
| 7157 | if ( value === null ) { |
|
| 7158 | jQuery.removeAttr( elem, name ); |
|
| 7159 | return; |
|
| 7160 | } |
|
| 7161 | ||
| 7162 | if ( hooks && "set" in hooks && |
|
| 7163 | ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
| 7164 | return ret; |
|
| 7165 | } |
|
| 7166 | ||
| 7167 | elem.setAttribute( name, value + "" ); |
|
| 7168 | return value; |
|
| 7169 | } |
|
| 7170 | ||
| 7171 | if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
| 7172 | return ret; |
|
| 7173 | } |
|
| 7174 | ||
| 7175 | ret = jQuery.find.attr( elem, name ); |
|
| 7176 | ||
| 7177 | // Non-existent attributes return null, we normalize to undefined |
|
| 7178 | return ret == null ? undefined : ret; |
|
| 7179 | }, |
|
| 7180 | ||
| 7181 | attrHooks: { |
|
| 7182 | type: { |
|