"./var/hasOwn",
"./var/fnToString",
"./var/ObjectFunctionString",
- "./var/trim",
"./var/support",
"./var/isWindow",
"./core/DOMEval",
"./core/toType"
], function( arr, getProto, slice, concat, push, indexOf,
class2type, toString, hasOwn, fnToString, ObjectFunctionString,
- trim, support, isWindow, DOMEval, toType ) {
+ support, isWindow, DOMEval, toType ) {
"use strict";
return ret;
},
- trim: function( text ) {
- return text == null ? "" : trim.call( text );
- },
// results is for internal usage only
makeArray: function( arr, results ) {
define( [
"./core",
"./var/slice",
-
+ "./var/trim",
"./event/alias"
-], function( jQuery, slice ) {
+], function( jQuery, trim, slice ) {
"use strict";
jQuery.ready( true );
}
};
+
+jQuery.trim = function( text ) {
+ return text == null ? "" : trim.call( text );
+};
} );
}
QUnit.test( "core", function( assert ) {
- assert.expect( 18 );
+ assert.expect( 17 );
var elem = jQuery( "<div></div><span></span>" );
assert.strictEqual( elem.length, 2, "Correct number of elements" );
- assert.strictEqual( jQuery.trim( " hello " ), "hello", "jQuery.trim" );
assert.ok( jQuery.isPlainObject( { "a": 2 } ), "jQuery.isPlainObject(object)" );
assert.ok( !jQuery.isPlainObject( "foo" ), "jQuery.isPlainObject(String)" );
window[ "jQuery" ] = jQuery = $$;
} );
-QUnit.test( "trim", function( assert ) {
- assert.expect( 13 );
-
- var nbsp = String.fromCharCode( 160 );
-
- assert.equal( jQuery.trim( "hello " ), "hello", "trailing space" );
- assert.equal( jQuery.trim( " hello" ), "hello", "leading space" );
- assert.equal( jQuery.trim( " hello " ), "hello", "space on both sides" );
- assert.equal( jQuery.trim( " " + nbsp + "hello " + nbsp + " " ), "hello", " " );
-
- assert.equal( jQuery.trim(), "", "Nothing in." );
- assert.equal( jQuery.trim( undefined ), "", "Undefined" );
- assert.equal( jQuery.trim( null ), "", "Null" );
- assert.equal( jQuery.trim( 5 ), "5", "Number" );
- assert.equal( jQuery.trim( false ), "false", "Boolean" );
-
- assert.equal( jQuery.trim( " " ), "", "space should be trimmed" );
- assert.equal( jQuery.trim( "ipad\xA0" ), "ipad", "nbsp should be trimmed" );
- assert.equal( jQuery.trim( "\uFEFF" ), "", "zwsp should be trimmed" );
- assert.equal( jQuery.trim( "\uFEFF \xA0! | \uFEFF" ), "! |", "leading/trailing should be trimmed" );
-} );
-
QUnit.test( "isPlainObject", function( assert ) {
var done = assert.async();
cb = jQuery.proxy( fn, null, "arg1", "arg2" );
cb.call( thisObject, "arg3" );
} );
+
+QUnit.test( "trim", function( assert ) {
+ assert.expect( 13 );
+
+ var nbsp = String.fromCharCode( 160 );
+
+ assert.equal( jQuery.trim( "hello " ), "hello", "trailing space" );
+ assert.equal( jQuery.trim( " hello" ), "hello", "leading space" );
+ assert.equal( jQuery.trim( " hello " ), "hello", "space on both sides" );
+ assert.equal( jQuery.trim( " " + nbsp + "hello " + nbsp + " " ), "hello", " " );
+
+ assert.equal( jQuery.trim(), "", "Nothing in." );
+ assert.equal( jQuery.trim( undefined ), "", "Undefined" );
+ assert.equal( jQuery.trim( null ), "", "Null" );
+ assert.equal( jQuery.trim( 5 ), "5", "Number" );
+ assert.equal( jQuery.trim( false ), "false", "Boolean" );
+
+ assert.equal( jQuery.trim( " " ), "", "space should be trimmed" );
+ assert.equal( jQuery.trim( "ipad\xA0" ), "ipad", "nbsp should be trimmed" );
+ assert.equal( jQuery.trim( "\uFEFF" ), "", "zwsp should be trimmed" );
+ assert.equal( jQuery.trim( "\uFEFF \xA0! | \uFEFF" ), "! |", "leading/trailing should be trimmed" );
+} );