Skip to content

Commit

Permalink
Didn't actually need the hooks anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Apr 3, 2011
1 parent 4baa213 commit 00abeae
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/attributes.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ jQuery.extend({
offset: true offset: true
}, },


attrFix: {},

attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {


// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
Expand All @@ -285,11 +287,14 @@ jQuery.extend({
if ( pass && name in jQuery.attrFn ) { if ( pass && name in jQuery.attrFn ) {
return jQuery(elem)[name](value); return jQuery(elem)[name](value);
} }

var ret, var ret,
notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
hooks; hooks;


// Normalize the name if needed
name = notxml && jQuery.attrFix[ name ] || name;

hooks = jQuery.attrHooks[ name ]; hooks = jQuery.attrHooks[ name ];


if ( value !== undefined ) { if ( value !== undefined ) {
Expand Down Expand Up @@ -472,8 +477,8 @@ if ( !jQuery.support.optSelected ) {
// IE6/7 do not support getting/setting some attributes with get/setAttribute // IE6/7 do not support getting/setting some attributes with get/setAttribute


if ( jQuery.support.attrFix ) { if ( jQuery.support.attrFix ) {
var attrFix = { jQuery.extend(jQuery.attrFix, {
"for": "htmlFor", "for": "htmlFor",
"class": "className", "class": "className",
readonly: "readOnly", readonly: "readOnly",
maxlength: "maxLength", maxlength: "maxLength",
Expand All @@ -483,17 +488,5 @@ if ( jQuery.support.attrFix ) {
tabindex: "tabIndex", tabindex: "tabIndex",
usemap: "useMap", usemap: "useMap",
frameborder: "frameBorder" frameborder: "frameBorder"
}; });

jQuery.each(attrFix, function( key, name ) {
jQuery.attrHooks[ key ] = jQuery.extend( jQuery.attrHooks[ key ], {
get: function( elem ) {
return elem.getAttribute( name );
},
set: function( elem, value ) {
elem.setAttribute( name, value );
return value;
}
});
});
} }

0 comments on commit 00abeae

Please sign in to comment.