corrade-http-templates – Blame information for rev 61

Subversion Repositories:
Rev:
Rev Author Line No. Line
61 office 1 define( [
2 "./core",
3 "./core/nodeName",
4 "./core/camelCase",
5 "./core/toType",
6 "./var/isFunction",
7 "./var/isWindow",
8 "./var/slice",
9  
10 "./event/alias"
11 ], function( jQuery, nodeName, camelCase, toType, isFunction, isWindow, slice ) {
12  
13 "use strict";
14  
15 jQuery.fn.extend( {
16  
17 bind: function( types, data, fn ) {
18 return this.on( types, null, data, fn );
19 },
20 unbind: function( types, fn ) {
21 return this.off( types, null, fn );
22 },
23  
24 delegate: function( selector, types, data, fn ) {
25 return this.on( types, selector, data, fn );
26 },
27 undelegate: function( selector, types, fn ) {
28  
29 // ( namespace ) or ( selector, types [, fn] )
30 return arguments.length === 1 ?
31 this.off( selector, "**" ) :
32 this.off( types, selector || "**", fn );
33 }
34 } );
35  
36 // Bind a function to a context, optionally partially applying any
37 // arguments.
38 // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
39 // However, it is not slated for removal any time soon
40 jQuery.proxy = function( fn, context ) {
41 var tmp, args, proxy;
42  
43 if ( typeof context === "string" ) {
44 tmp = fn[ context ];
45 context = fn;
46 fn = tmp;
47 }
48  
49 // Quick check to determine if target is callable, in the spec
50 // this throws a TypeError, but we will just return undefined.
51 if ( !isFunction( fn ) ) {
52 return undefined;
53 }
54  
55 // Simulated bind
56 args = slice.call( arguments, 2 );
57 proxy = function() {
58 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
59 };
60  
61 // Set the guid of unique handler to the same of original handler, so it can be removed
62 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
63  
64 return proxy;
65 };
66  
67 jQuery.holdReady = function( hold ) {
68 if ( hold ) {
69 jQuery.readyWait++;
70 } else {
71 jQuery.ready( true );
72 }
73 };
74 jQuery.isArray = Array.isArray;
75 jQuery.parseJSON = JSON.parse;
76 jQuery.nodeName = nodeName;
77 jQuery.isFunction = isFunction;
78 jQuery.isWindow = isWindow;
79 jQuery.camelCase = camelCase;
80 jQuery.type = toType;
81  
82 jQuery.now = Date.now;
83  
84 jQuery.isNumeric = function( obj ) {
85  
86 // As of jQuery 3.0, isNumeric is limited to
87 // strings and numbers (primitives or objects)
88 // that can be coerced to finite numbers (gh-2662)
89 var type = jQuery.type( obj );
90 return ( type === "number" || type === "string" ) &&
91  
92 // parseFloat NaNs numeric-cast false positives ("")
93 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
94 // subtraction forces infinities to NaN
95 !isNaN( obj - parseFloat( obj ) );
96 };
97  
98 } );