diff options
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/core.js b/src/core.js index 3ef92d48f..5a5c7469e 100644 --- a/src/core.js +++ b/src/core.js @@ -15,14 +15,14 @@ define( [ "./var/hasOwn", "./var/fnToString", "./var/ObjectFunctionString", + "./var/trim", "./var/support", - "./var/isFunction", "./var/isWindow", "./core/DOMEval", "./core/toType" ], function( arr, document, getProto, slice, concat, push, indexOf, class2type, toString, hasOwn, fnToString, ObjectFunctionString, - support, isFunction, isWindow, DOMEval, toType ) { + trim, support, isWindow, DOMEval, toType ) { "use strict"; @@ -35,11 +35,7 @@ var // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); - }, - - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; + }; jQuery.fn = jQuery.prototype = { @@ -139,7 +135,7 @@ jQuery.extend = jQuery.fn.extend = function() { } // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { + if ( typeof target !== "object" && typeof target !== "function" ) { target = {}; } @@ -264,11 +260,8 @@ jQuery.extend( { return obj; }, - // Support: Android <=4.0 only trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); + return text == null ? "" : trim.call( text ); }, // results is for internal usage only @@ -293,8 +286,6 @@ jQuery.extend( { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit merge: function( first, second ) { var len = +second.length, j = 0, @@ -380,14 +371,10 @@ function( i, name ) { function isArrayLike( obj ) { - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, + var length = !!obj && obj.length, type = toType( obj ); - if ( isFunction( obj ) || isWindow( obj ) ) { + if ( typeof obj === "function" || isWindow( obj ) ) { return false; } |