diff options
author | timmywil <timmywillisn@gmail.com> | 2011-11-14 12:31:28 -0500 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-11-14 12:31:28 -0500 |
commit | 20cbf1b123c9d54029b7d5f6fef2343793f274c2 (patch) | |
tree | 3ff69d9080404636e5196aff2d7f57f17b56c842 /src | |
parent | a8460d24e0fd9cae3c9091bd9adef645804dc935 (diff) | |
download | jquery-20cbf1b123c9d54029b7d5f6fef2343793f274c2.tar.gz jquery-20cbf1b123c9d54029b7d5f6fef2343793f274c2.zip |
Microoptimization in jQuery.attr and remove the redundancy of return undefined
Diffstat (limited to 'src')
-rw-r--r-- | src/attributes.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/attributes.js b/src/attributes.js index 193abf007..5aa5273cd 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -177,7 +177,7 @@ jQuery.fn.extend({ ret == null ? "" : ret; } - return undefined; + return; } isFunction = jQuery.isFunction( value ); @@ -302,7 +302,7 @@ 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 ) { @@ -310,7 +310,7 @@ jQuery.extend({ } // Fallback to prop when attributes are not supported - if ( !("getAttribute" in elem) ) { + if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } @@ -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; @@ -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 ); |