aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2011-11-14 12:24:58 -0500
committertimmywil <timmywillisn@gmail.com>2011-11-14 12:24:58 -0500
commita8460d24e0fd9cae3c9091bd9adef645804dc935 (patch)
tree57790d9ad1d388b009eabc928f122d91880e3689 /src
parent8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0 (diff)
downloadjquery-a8460d24e0fd9cae3c9091bd9adef645804dc935.tar.gz
jquery-a8460d24e0fd9cae3c9091bd9adef645804dc935.zip
Landing pull request 600. Remove jQuery.trim() to restore perf. Supplements #10773.
More Details: - https://github.com/jquery/jquery/pull/600 - http://bugs.jquery.com/ticket/10773
Diffstat (limited to 'src')
-rw-r--r--src/attributes.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 08bec5847..193abf007 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -355,21 +355,24 @@ jQuery.extend({
var propName, attrNames, name, l,
i = 0;
- if ( value && typeof value === "string" && elem.nodeType === 1 ) {
- attrNames = jQuery.trim( value ).toLowerCase().split( " " );
+ if ( value && elem.nodeType === 1 ) {
+ attrNames = value.toLowerCase().split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ];
- propName = jQuery.propFix[ name ] || name;
- // See #9699 for explanation of this approach (setting first, then removal)
- jQuery.attr( elem, name, "" );
- elem.removeAttribute( getSetAttribute ? name : propName );
+ if ( name ) {
+ propName = jQuery.propFix[ name ] || name;
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && propName in elem ) {
- elem[ propName ] = false;
+ // See #9699 for explanation of this approach (setting first, then removal)
+ jQuery.attr( elem, name, "" );
+ elem.removeAttribute( getSetAttribute ? name : propName );
+
+ // Set corresponding property to false for boolean attributes
+ if ( rboolean.test( name ) && propName in elem ) {
+ elem[ propName ] = false;
+ }
}
}
}