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
This commit is contained in:
Rick Waldron 2011-11-14 12:24:58 -05:00 committed by timmywil
parent 8bc60bab5d
commit a8460d24e0
2 changed files with 14 additions and 24 deletions

View File

@ -355,12 +355,14 @@ 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 ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
// See #9699 for explanation of this approach (setting first, then removal)
@ -373,6 +375,7 @@ jQuery.extend({
}
}
}
}
},
attrHooks: {

View File

@ -481,20 +481,7 @@ test("removeAttr(String)", function() {
}
});
test("removeAttr, #", function() {
var div = jQuery("<div />");
ok( div.removeAttr( "" ), "empty string" );
ok( div.removeAttr(), "nothing" );
ok( div.removeAttr( false ), "false" );
ok( div.removeAttr( true ), "true" );
ok( div.removeAttr({ }), "object" );
ok( div.removeAttr( function(){} ), "function" );
});
test("removeAttr(Multi String)", function() {
test("removeAttr(Multi String, variable space width)", function() {
expect(8);
var div = jQuery("<div id='a' alt='b' title='c' rel='d'></div>"),