Skip to content

Commit

Permalink
Microoptimization in jQuery.attr and remove the redundancy of return …
Browse files Browse the repository at this point in the history
…undefined
  • Loading branch information
timmywil committed Nov 14, 2011
1 parent a8460d2 commit 20cbf1b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/attributes.js
Expand Up @@ -177,7 +177,7 @@ jQuery.fn.extend({
ret == null ? "" : ret;
}

return undefined;
return;
}

isFunction = jQuery.isFunction( value );
Expand Down Expand Up @@ -302,15 +302,15 @@ jQuery.extend({

// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
return;
}

if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}

// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}

Expand All @@ -327,7 +327,7 @@ jQuery.extend({

if ( value === null ) {
jQuery.removeAttr( elem, name );
return undefined;
return;

} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
Expand Down Expand Up @@ -439,7 +439,7 @@ jQuery.extend({

// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
return;
}

notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
Expand Down

0 comments on commit 20cbf1b

Please sign in to comment.