deprecated.js (2406B)
1 define( [ 2 "./core", 3 "./core/nodeName", 4 "./core/camelCase", 5 "./core/toType", 6 "./var/isFunction", 7 "./var/isWindow", 8 "./var/slice", 9 10 "./deprecated/ajax-event-alias", 11 "./deprecated/event" 12 ], function( jQuery, nodeName, camelCase, toType, isFunction, isWindow, slice ) { 13 14 "use strict"; 15 16 // Support: Android <=4.0 only 17 // Make sure we trim BOM and NBSP 18 // Require that the "whitespace run" starts from a non-whitespace 19 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 20 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 21 22 // Bind a function to a context, optionally partially applying any 23 // arguments. 24 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) 25 // However, it is not slated for removal any time soon 26 jQuery.proxy = function( fn, context ) { 27 var tmp, args, proxy; 28 29 if ( typeof context === "string" ) { 30 tmp = fn[ context ]; 31 context = fn; 32 fn = tmp; 33 } 34 35 // Quick check to determine if target is callable, in the spec 36 // this throws a TypeError, but we will just return undefined. 37 if ( !isFunction( fn ) ) { 38 return undefined; 39 } 40 41 // Simulated bind 42 args = slice.call( arguments, 2 ); 43 proxy = function() { 44 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 45 }; 46 47 // Set the guid of unique handler to the same of original handler, so it can be removed 48 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 49 50 return proxy; 51 }; 52 53 jQuery.holdReady = function( hold ) { 54 if ( hold ) { 55 jQuery.readyWait++; 56 } else { 57 jQuery.ready( true ); 58 } 59 }; 60 jQuery.isArray = Array.isArray; 61 jQuery.parseJSON = JSON.parse; 62 jQuery.nodeName = nodeName; 63 jQuery.isFunction = isFunction; 64 jQuery.isWindow = isWindow; 65 jQuery.camelCase = camelCase; 66 jQuery.type = toType; 67 68 jQuery.now = Date.now; 69 70 jQuery.isNumeric = function( obj ) { 71 72 // As of jQuery 3.0, isNumeric is limited to 73 // strings and numbers (primitives or objects) 74 // that can be coerced to finite numbers (gh-2662) 75 var type = jQuery.type( obj ); 76 return ( type === "number" || type === "string" ) && 77 78 // parseFloat NaNs numeric-cast false positives ("") 79 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 80 // subtraction forces infinities to NaN 81 !isNaN( obj - parseFloat( obj ) ); 82 }; 83 84 jQuery.trim = function( text ) { 85 return text == null ? 86 "" : 87 ( text + "" ).replace( rtrim, "$1" ); 88 }; 89 } );