-
Notifications
You must be signed in to change notification settings - Fork 5
/
jquery-1.6.2-vsdoc.js
9134 lines (7422 loc) · 330 KB
/
jquery-1.6.2-vsdoc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only
* intended to be used only for design-time IntelliSense. Please use the
* standard jQuery library for all production use.
*
* Comment version: 1.6.2
*/
/*!
* Note: While Microsoft is not the author of this script file, Microsoft
* grants you the right to use this file for the sole purpose of either:
* (i) interacting through your browser with the Microsoft website, subject
* to the website's terms of use; or (ii) using the files as included with a
* Microsoft product subject to the Microsoft Software License Terms for that
* Microsoft product. Microsoft reserves all other rights to the files not
* expressly granted by Microsoft, whether by implication, estoppel or
* otherwise. The notices and licenses below are for informational purposes
* only.
*
* Provided for Informational Purposes Only
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* jQuery JavaScript Library v1.6.2
* http://jquery.com/
*
* Copyright 2010, John Resig
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
*
*/
(function (window, undefined) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document;
var jQuery = (function () {
// Define a local copy of jQuery
var jQuery = function (selector, context) {
/// <summary>
/// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements.
/// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML.
/// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s).
/// 4: $(callback) - A shorthand for $(document).ready().
/// 5: $() - As of jQuery 1.4, if you pass no arguments in to the jQuery() method, an empty jQuery set will be returned.
/// </summary>
/// <param name="selector" type="String">
/// 1: expression - An expression to search with.
/// 2: html - A string of HTML to create on the fly.
/// 3: elements - DOM element(s) to be encapsulated by a jQuery object.
/// 4: callback - The function to execute when the DOM is ready.
/// </param>
/// <param name="context" type="jQuery">
/// 1: context - A DOM Element, Document or jQuery to use as context.
/// </param>
/// <returns type="jQuery" />
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init(selector, context);
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
rwhite = /\s/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for non-word characters
rnonword = /\W/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// Has the ready events already been bound?
readyBound = false,
// The functions to execute on DOM ready
readyList = [],
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
init: function (selector, context) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if (!selector) {
return this;
}
// Handle $(DOMElement)
if (selector.nodeType) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if (selector === "body" && !context && document.body) {
this.context = document;
this[0] = document.body;
this.selector = "body";
this.length = 1;
return this;
}
// Handle HTML strings
if (typeof selector === "string") {
// Are we dealing with HTML string or an ID?
match = quickExpr.exec(selector);
// Verify a match, and that no context was specified for #id
if (match && (match[1] || !context)) {
// HANDLE: $(html) -> $(array)
if (match[1]) {
doc = (context ? context.ownerDocument || context : document);
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec(selector);
if (ret) {
if (jQuery.isPlainObject(context)) {
selector = [document.createElement(ret[1])];
jQuery.fn.attr.call(selector, context, true);
} else {
selector = [doc.createElement(ret[1])];
}
} else {
ret = jQuery.buildFragment([match[1]], [doc]);
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
}
return jQuery.merge(this, selector);
// HANDLE: $("#id")
} else {
elem = document.getElementById(match[2]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if (elem && elem.parentNode) {
// Handle the case where IE and Opera return items
// by name instead of ID
if (elem.id !== match[2]) {
return rootjQuery.find(selector);
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $("TAG")
} else if (!context && !rnonword.test(selector)) {
this.selector = selector;
this.context = document;
selector = document.getElementsByTagName(selector);
return jQuery.merge(this, selector);
// HANDLE: $(expr, $(...))
} else if (!context || context.jquery) {
return (context || rootjQuery).find(selector);
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return jQuery(context).find(selector);
}
// HANDLE: $(function)
// Shortcut for document ready
} else if (jQuery.isFunction(selector)) {
return rootjQuery.ready(selector);
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray(selector, this);
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.4.4",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function () {
/// <summary>
/// The number of elements currently matched.
/// Part of Core
/// </summary>
/// <returns type="Number" />
return this.length;
},
toArray: function () {
/// <summary>
/// Retrieve all the DOM elements contained in the jQuery set, as an array.
/// </summary>
/// <returns type="Array" />
return slice.call(this, 0);
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function (num) {
/// <summary>
/// Access a single matched element. num is used to access the
/// Nth element matched.
/// Part of Core
/// </summary>
/// <returns type="Element" />
/// <param name="num" type="Number">
/// Access the element in the Nth position.
/// </param>
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
(num < 0 ? this.slice(num)[0] : this[num]);
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function (elems, name, selector) {
/// <summary>
/// Set the jQuery object to an array of elements, while maintaining
/// the stack.
/// Part of Core
/// </summary>
/// <returns type="jQuery" />
/// <param name="elems" type="Elements">
/// An array of elements
/// </param>
// Build a new jQuery matched element set
var ret = jQuery();
if (jQuery.isArray(elems)) {
push.apply(ret, elems);
} else {
jQuery.merge(ret, elems);
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if (name === "find") {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if (name) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function (callback, args) {
/// <summary>
/// Execute a function within the context of every matched element.
/// This means that every time the passed-in function is executed
/// (which is once for every element matched) the 'this' keyword
/// points to the specific element.
/// Additionally, the function, when executed, is passed a single
/// argument representing the position of the element in the matched
/// set.
/// Part of Core
/// </summary>
/// <returns type="jQuery" />
/// <param name="callback" type="Function">
/// A function to execute
/// </param>
return jQuery.each(this, callback, args);
},
ready: function (fn) {
/// <summary>
/// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.
/// </summary>
/// <param name="fn" type="Function">The function to be executed when the DOM is ready.</param>
// Attach the listeners
jQuery.bindReady();
// If the DOM is already ready
if (jQuery.isReady) {
// Execute the function immediately
fn.call(document, jQuery);
// Otherwise, remember the function for later
} else if (readyList) {
// Add the function to the wait list
readyList.push(fn);
}
return this;
},
eq: function (i) {
/// <summary>
/// Reduce the set of matched elements to a single element.
/// The position of the element in the set of matched elements
/// starts at 0 and goes to length - 1.
/// Part of Core
/// </summary>
/// <returns type="jQuery" />
/// <param name="num" type="Number">
/// pos The index of the element that you wish to limit to.
/// </param>
return i === -1 ?
this.slice(i) :
this.slice(i, +i + 1);
},
first: function () {
/// <summary>
/// Reduce the set of matched elements to the first in the set.
/// </summary>
/// <returns type="jQuery" />
return this.eq(0);
},
last: function () {
/// <summary>
/// Reduce the set of matched elements to the final one in the set.
/// </summary>
/// <returns type="jQuery" />
return this.eq(-1);
},
slice: function () {
/// <summary>
/// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method.
/// </summary>
/// <param name="start" type="Number" integer="true">Where to start the subset (0-based).</param>
/// <param name="end" optional="true" type="Number" integer="true">Where to end the subset (not including the end element itself).
/// If omitted, ends at the end of the selection</param>
/// <returns type="jQuery">The sliced elements</returns>
return this.pushStack(slice.apply(this, arguments),
"slice", slice.call(arguments).join(","));
},
map: function (callback) {
/// <summary>
/// This member is internal.
/// </summary>
/// <private />
/// <returns type="jQuery" />
return this.pushStack(jQuery.map(this, function (elem, i) {
return callback.call(elem, i, elem);
}));
},
end: function () {
/// <summary>
/// End the most recent 'destructive' operation, reverting the list of matched elements
/// back to its previous state. After an end operation, the list of matched elements will
/// revert to the last state of matched elements.
/// If there was no destructive operation before, an empty set is returned.
/// Part of DOM/Traversing
/// </summary>
/// <returns type="jQuery" />
return this.prevObject || jQuery(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function () {
/// <summary>
/// Extend one object with one or more others, returning the original,
/// modified, object. This is a great utility for simple inheritance.
/// jQuery.extend(settings, options);
/// var settings = jQuery.extend({}, defaults, options);
/// Part of JavaScript
/// </summary>
/// <param name="target" type="Object">
/// The object to extend
/// </param>
/// <param name="prop1" type="Object">
/// The object that will be merged into the first.
/// </param>
/// <param name="propN" type="Object" optional="true" parameterArray="true">
/// (optional) More objects to merge into the first
/// </param>
/// <returns type="Object" />
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if (typeof target === "boolean") {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== "object" && !jQuery.isFunction(target)) {
target = {};
}
// extend jQuery itself if only one argument is passed
if (length === i) {
target = this;
--i;
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = jQuery.extend(deep, clone, copy);
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function (deep) {
/// <summary>
/// Run this function to give control of the $ variable back
/// to whichever library first implemented it. This helps to make
/// sure that jQuery doesn't conflict with the $ object
/// of other libraries.
/// By using this function, you will only be able to access jQuery
/// using the 'jQuery' variable. For example, where you used to do
/// $("div p"), you now must do jQuery("div p").
/// Part of Core
/// </summary>
/// <returns type="undefined" />
window.$ = _$;
if (deep) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Handle when the DOM is ready
ready: function (wait) {
/// <summary>
/// This method is internal.
/// </summary>
/// <private />
// A third-party is pushing the ready event forwards
if (wait === true) {
jQuery.readyWait--;
}
// Make sure that the DOM is not already loaded
if (!jQuery.readyWait || (wait !== true && !jQuery.isReady)) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if (!document.body) {
return setTimeout(jQuery.ready, 1);
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if (wait !== true && --jQuery.readyWait > 0) {
return;
}
// If there are functions bound, to execute
if (readyList) {
// Execute all of them
var fn,
i = 0,
ready = readyList;
// Reset the list of functions
readyList = null;
while ((fn = ready[i++])) {
fn.call(document, jQuery);
}
// Trigger any bound ready events
if (jQuery.fn.trigger) {
jQuery(document).trigger("ready").unbind("ready");
}
}
}
},
bindReady: function () {
if (readyBound) {
return;
}
readyBound = true;
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if (document.readyState === "complete") {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout(jQuery.ready, 1);
}
// Mozilla, Opera and webkit nightlies currently support this event
if (document.addEventListener) {
// Use the handy event callback
document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
// A fallback to window.onload, that will always work
window.addEventListener("load", jQuery.ready, false);
// If IE event model is used
} else if (document.attachEvent) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", DOMContentLoaded);
// A fallback to window.onload, that will always work
window.attachEvent("onload", jQuery.ready);
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch (e) { }
if (document.documentElement.doScroll && toplevel) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function (obj) {
/// <summary>
/// Determines if the parameter passed is a function.
/// </summary>
/// <param name="obj" type="Object">The object to check</param>
/// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function (obj) {
/// <summary>
/// Determine if the parameter passed is an array.
/// </summary>
/// <param name="obj" type="Object">Object to test whether or not it is an array.</param>
/// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function (obj) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNaN: function (obj) {
return obj == null || !rdigit.test(obj) || isNaN(obj);
},
type: function (obj) {
return obj == null ?
String(obj) :
class2type[toString.call(obj)] || "object";
},
isPlainObject: function (obj) {
/// <summary>
/// Check to see if an object is a plain object (created using "{}" or "new Object").
/// </summary>
/// <param name="obj" type="Object">
/// The object that will be checked to see if it's a plain object.
/// </param>
/// <returns type="Boolean" />
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
return false;
}
// Not own constructor property must be Object
if (obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for (key in obj) { }
return key === undefined || hasOwn.call(obj, key);
},
isEmptyObject: function (obj) {
/// <summary>
/// Check to see if an object is empty (contains no properties).
/// </summary>
/// <param name="obj" type="Object">
/// The object that will be checked to see if it's empty.
/// </param>
/// <returns type="Boolean" />
for (var name in obj) {
return false;
}
return true;
},
error: function (msg) {
throw msg;
},
parseJSON: function (data) {
if (typeof data !== "string" || !data) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim(data);
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if (rvalidchars.test(data.replace(rvalidescape, "@")
.replace(rvalidtokens, "]")
.replace(rvalidbraces, ""))) {
// Try to use the native JSON parser first
return window.JSON && window.JSON.parse ?
window.JSON.parse(data) :
(new Function("return " + data))();
} else {
jQuery.error("Invalid JSON: " + data);
}
},
noop: function () {
/// <summary>
/// An empty function.
/// </summary>
/// <returns type="Function" />
},
// Evalulates a script in a global context
globalEval: function (data) {
/// <summary>
/// Internally evaluates a script in a global context.
/// </summary>
/// <private />
if (data && rnotwhite.test(data)) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement,
script = document.createElement("script");
script.type = "text/javascript";
if (jQuery.support.scriptEval) {
script.appendChild(document.createTextNode(data));
} else {
script.text = data;
}
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709).
head.insertBefore(script, head.firstChild);
head.removeChild(script);
}
},
nodeName: function (elem, name) {
/// <summary>
/// Checks whether the specified element has the specified DOM node name.
/// </summary>
/// <param name="elem" type="Element">The element to examine</param>
/// <param name="name" type="String">The node name to check</param>
/// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns>
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function (object, callback, args) {
/// <summary>
/// A generic iterator function, which can be used to seemlessly
/// iterate over both objects and arrays. This function is not the same
/// as $().each() - which is used to iterate, exclusively, over a jQuery
/// object. This function can be used to iterate over anything.
/// The callback has two arguments:the key (objects) or index (arrays) as first
/// the first, and the value as the second.
/// Part of JavaScript
/// </summary>
/// <param name="obj" type="Object">
/// The object, or array, to iterate over.
/// </param>
/// <param name="fn" type="Function">
/// The function that will be executed on every object.
/// </param>
/// <returns type="Object" />
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction(object);
if (args) {
if (isObj) {
for (name in object) {
if (callback.apply(object[name], args) === false) {
break;
}
}
} else {
for (; i < length; ) {
if (callback.apply(object[i++], args) === false) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if (isObj) {
for (name in object) {
if (callback.call(object[name], name, object[name]) === false) {
break;
}
}
} else {
for (var value = object[0];
i < length && callback.call(value, i, value) !== false; value = object[++i]) { }
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function (text) {
return text == null ?
"" :
trim.call(text);
} :
// Otherwise use our own trimming functionality
function (text) {
return text == null ?
"" :
text.toString().replace(trimLeft, "").replace(trimRight, "");
},
// results is for internal usage only
makeArray: function (array, results) {
/// <summary>
/// Turns anything into a true array. This is an internal method.
/// </summary>
/// <param name="array" type="Object">Anything to turn into an actual Array</param>
/// <returns type="Array" />
/// <private />
var ret = results || [];
if (array != null) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type(array);
if (array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow(array)) {
push.call(ret, array);
} else {
jQuery.merge(ret, array);
}
}
return ret;
},
inArray: function (elem, array) {
if (array.indexOf) {
return array.indexOf(elem);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === elem) {
return i;
}
}
return -1;
},
merge: function (first, second) {
/// <summary>
/// Merge two arrays together, removing all duplicates.
/// The new array is: All the results from the first array, followed
/// by the unique results from the second array.
/// Part of JavaScript
/// </summary>
/// <returns type="Array" />
/// <param name="first" type="Array">
/// The first array to merge.
/// </param>
/// <param name="second" type="Array">
/// The second array to merge.
/// </param>
var i = first.length,
j = 0;
if (typeof second.length === "number") {
for (var l = second.length; j < l; j++) {
first[i++] = second[j];
}
} else {
while (second[j] !== undefined) {
first[i++] = second[j++];
}
}
first.length = i;
return first;
},
grep: function (elems, callback, inv) {
/// <summary>
/// Filter items out of an array, by using a filter function.
/// The specified function will be passed two arguments: The
/// current array item and the index of the item in the array. The
/// function must return 'true' to keep the item in the array,
/// false to remove it.
/// });
/// Part of JavaScript
/// </summary>