jquery-source 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.4.2
2
+ * jQuery JavaScript Library v1.4.3
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Copyright 2010, John Resig
@@ -11,10 +11,14 @@
11
11
  * Copyright 2010, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date: Sat Feb 13 22:33:48 2010 -0500
14
+ * Date: Thu Oct 14 23:10:06 2010 -0400
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
18
+ // Use the correct document accordingly with window argument (sandbox)
19
+ var document = window.document;
20
+ var jQuery = (function() {
21
+
18
22
  // Define a local copy of jQuery
19
23
  var jQuery = function( selector, context ) {
20
24
  // The jQuery object is actually just the init constructor 'enhanced'
@@ -27,28 +31,45 @@ var jQuery = function( selector, context ) {
27
31
  // Map over the $ in case of overwrite
28
32
  _$ = window.$,
29
33
 
30
- // Use the correct document accordingly with window argument (sandbox)
31
- document = window.document,
32
-
33
34
  // A central reference to the root jQuery(document)
34
35
  rootjQuery,
35
36
 
36
37
  // A simple way to check for HTML strings or ID strings
37
38
  // (both of which we optimize for)
38
- quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
39
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
39
40
 
40
41
  // Is it a simple selector
41
42
  isSimple = /^.[^:#\[\.,]*$/,
42
43
 
43
44
  // Check if a string has a non-whitespace character in it
44
45
  rnotwhite = /\S/,
46
+ rwhite = /\s/,
45
47
 
46
48
  // Used for trimming whitespace
47
- rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
49
+ trimLeft = /^\s+/,
50
+ trimRight = /\s+$/,
51
+
52
+ // Check for non-word characters
53
+ rnonword = /\W/,
54
+
55
+ // Check for digits
56
+ rdigit = /\d/,
48
57
 
49
58
  // Match a standalone tag
50
59
  rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
51
60
 
61
+ // JSON RegExp
62
+ rvalidchars = /^[\],:{}\s]*$/,
63
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
64
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
65
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
66
+
67
+ // Useragent RegExp
68
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
69
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
70
+ rmsie = /(msie) ([\w.]+)/,
71
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
72
+
52
73
  // Keep a UserAgent string for use with jQuery.browser
53
74
  userAgent = navigator.userAgent,
54
75
 
@@ -66,10 +87,14 @@ var jQuery = function( selector, context ) {
66
87
 
67
88
  // Save a reference to some core methods
68
89
  toString = Object.prototype.toString,
69
- hasOwnProperty = Object.prototype.hasOwnProperty,
90
+ hasOwn = Object.prototype.hasOwnProperty,
70
91
  push = Array.prototype.push,
71
92
  slice = Array.prototype.slice,
72
- indexOf = Array.prototype.indexOf;
93
+ trim = String.prototype.trim,
94
+ indexOf = Array.prototype.indexOf,
95
+
96
+ // [[Class]] -> type pairs
97
+ class2type = {};
73
98
 
74
99
  jQuery.fn = jQuery.prototype = {
75
100
  init: function( selector, context ) {
@@ -88,7 +113,7 @@ jQuery.fn = jQuery.prototype = {
88
113
  }
89
114
 
90
115
  // The body element only exists once, optimize finding it
91
- if ( selector === "body" && !context ) {
116
+ if ( selector === "body" && !context && document.body ) {
92
117
  this.context = document;
93
118
  this[0] = document.body;
94
119
  this.selector = "body";
@@ -122,7 +147,7 @@ jQuery.fn = jQuery.prototype = {
122
147
  }
123
148
 
124
149
  } else {
125
- ret = buildFragment( [ match[1] ], [ doc ] );
150
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
126
151
  selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
127
152
  }
128
153
 
@@ -132,7 +157,9 @@ jQuery.fn = jQuery.prototype = {
132
157
  } else {
133
158
  elem = document.getElementById( match[2] );
134
159
 
135
- if ( elem ) {
160
+ // Check parentNode to catch when Blackberry 4.6 returns
161
+ // nodes that are no longer in the document #6963
162
+ if ( elem && elem.parentNode ) {
136
163
  // Handle the case where IE and Opera return items
137
164
  // by name instead of ID
138
165
  if ( elem.id !== match[2] ) {
@@ -150,7 +177,7 @@ jQuery.fn = jQuery.prototype = {
150
177
  }
151
178
 
152
179
  // HANDLE: $("TAG")
153
- } else if ( !context && /^\w+$/.test( selector ) ) {
180
+ } else if ( !context && !rnonword.test( selector ) ) {
154
181
  this.selector = selector;
155
182
  this.context = document;
156
183
  selector = document.getElementsByTagName( selector );
@@ -184,7 +211,7 @@ jQuery.fn = jQuery.prototype = {
184
211
  selector: "",
185
212
 
186
213
  // The current version of jQuery being used
187
- jquery: "1.4.2",
214
+ jquery: "1.4.3",
188
215
 
189
216
  // The default length of a jQuery object is 0
190
217
  length: 0,
@@ -304,7 +331,7 @@ jQuery.fn.init.prototype = jQuery.fn;
304
331
 
305
332
  jQuery.extend = jQuery.fn.extend = function() {
306
333
  // copy reference to target object
307
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
334
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray;
308
335
 
309
336
  // Handle a deep copy situation
310
337
  if ( typeof target === "boolean" ) {
@@ -338,10 +365,15 @@ jQuery.extend = jQuery.fn.extend = function() {
338
365
  continue;
339
366
  }
340
367
 
341
- // Recurse if we're merging object literal values or arrays
342
- if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
343
- var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
344
- : jQuery.isArray(copy) ? [] : {};
368
+ // Recurse if we're merging plain objects or arrays
369
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
370
+ if ( copyIsArray ) {
371
+ copyIsArray = false;
372
+ clone = src && jQuery.isArray(src) ? src : [];
373
+
374
+ } else {
375
+ clone = src && jQuery.isPlainObject(src) ? src : {};
376
+ }
345
377
 
346
378
  // Never move original objects, clone them
347
379
  target[ name ] = jQuery.extend( deep, clone, copy );
@@ -371,19 +403,33 @@ jQuery.extend({
371
403
 
372
404
  // Is the DOM ready to be used? Set to true once it occurs.
373
405
  isReady: false,
406
+
407
+ // A counter to track how many items to wait for before
408
+ // the ready event fires. See #6781
409
+ readyWait: 1,
374
410
 
375
411
  // Handle when the DOM is ready
376
- ready: function() {
412
+ ready: function( wait ) {
413
+ // A third-party is pushing the ready event forwards
414
+ if ( wait === true ) {
415
+ jQuery.readyWait--;
416
+ }
417
+
377
418
  // Make sure that the DOM is not already loaded
378
- if ( !jQuery.isReady ) {
419
+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
379
420
  // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
380
421
  if ( !document.body ) {
381
- return setTimeout( jQuery.ready, 13 );
422
+ return setTimeout( jQuery.ready, 1 );
382
423
  }
383
424
 
384
425
  // Remember that the DOM is ready
385
426
  jQuery.isReady = true;
386
427
 
428
+ // If a normal DOM Ready event fired, decrement, and wait if need be
429
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
430
+ return;
431
+ }
432
+
387
433
  // If there are functions bound, to execute
388
434
  if ( readyList ) {
389
435
  // Execute all of them
@@ -413,7 +459,8 @@ jQuery.extend({
413
459
  // Catch cases where $(document).ready() is called after the
414
460
  // browser event has already occurred.
415
461
  if ( document.readyState === "complete" ) {
416
- return jQuery.ready();
462
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
463
+ return setTimeout( jQuery.ready, 1 );
417
464
  }
418
465
 
419
466
  // Mozilla, Opera and webkit nightlies currently support this event
@@ -451,25 +498,40 @@ jQuery.extend({
451
498
  // Since version 1.3, DOM methods and functions like alert
452
499
  // aren't supported. They return false on IE (#2968).
453
500
  isFunction: function( obj ) {
454
- return toString.call(obj) === "[object Function]";
501
+ return jQuery.type(obj) === "function";
502
+ },
503
+
504
+ isArray: Array.isArray || function( obj ) {
505
+ return jQuery.type(obj) === "array";
506
+ },
507
+
508
+ // A crude way of determining if an object is a window
509
+ isWindow: function( obj ) {
510
+ return obj && typeof obj === "object" && "setInterval" in obj;
511
+ },
512
+
513
+ isNaN: function( obj ) {
514
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
455
515
  },
456
516
 
457
- isArray: function( obj ) {
458
- return toString.call(obj) === "[object Array]";
517
+ type: function( obj ) {
518
+ return obj == null ?
519
+ String( obj ) :
520
+ class2type[ toString.call(obj) ] || "object";
459
521
  },
460
522
 
461
523
  isPlainObject: function( obj ) {
462
524
  // Must be an Object.
463
525
  // Because of IE, we also have to check the presence of the constructor property.
464
526
  // Make sure that DOM nodes and window objects don't pass through, as well
465
- if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
527
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
466
528
  return false;
467
529
  }
468
530
 
469
531
  // Not own constructor property must be Object
470
- if ( obj.constructor
471
- && !hasOwnProperty.call(obj, "constructor")
472
- && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
532
+ if ( obj.constructor &&
533
+ !hasOwn.call(obj, "constructor") &&
534
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
473
535
  return false;
474
536
  }
475
537
 
@@ -479,7 +541,7 @@ jQuery.extend({
479
541
  var key;
480
542
  for ( key in obj ) {}
481
543
 
482
- return key === undefined || hasOwnProperty.call( obj, key );
544
+ return key === undefined || hasOwn.call( obj, key );
483
545
  },
484
546
 
485
547
  isEmptyObject: function( obj ) {
@@ -503,9 +565,9 @@ jQuery.extend({
503
565
 
504
566
  // Make sure the incoming data is actual JSON
505
567
  // Logic borrowed from http://json.org/json2.js
506
- if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
507
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
508
- .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
568
+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
569
+ .replace(rvalidtokens, "]")
570
+ .replace(rvalidbraces, "")) ) {
509
571
 
510
572
  // Try to use the native JSON parser first
511
573
  return window.JSON && window.JSON.parse ?
@@ -584,9 +646,20 @@ jQuery.extend({
584
646
  return object;
585
647
  },
586
648
 
587
- trim: function( text ) {
588
- return (text || "").replace( rtrim, "" );
589
- },
649
+ // Use native String.trim function wherever possible
650
+ trim: trim ?
651
+ function( text ) {
652
+ return text == null ?
653
+ "" :
654
+ trim.call( text );
655
+ } :
656
+
657
+ // Otherwise use our own trimming functionality
658
+ function( text ) {
659
+ return text == null ?
660
+ "" :
661
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
662
+ },
590
663
 
591
664
  // results is for internal usage only
592
665
  makeArray: function( array, results ) {
@@ -596,7 +669,10 @@ jQuery.extend({
596
669
  // The window, strings (and functions) also have 'length'
597
670
  // The extra typeof function check is to prevent crashes
598
671
  // in Safari 2 (See: #3039)
599
- if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
672
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
673
+ var type = jQuery.type(array);
674
+
675
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
600
676
  push.call( ret, array );
601
677
  } else {
602
678
  jQuery.merge( ret, array );
@@ -640,12 +716,14 @@ jQuery.extend({
640
716
  },
641
717
 
642
718
  grep: function( elems, callback, inv ) {
643
- var ret = [];
719
+ var ret = [], retVal;
720
+ inv = !!inv;
644
721
 
645
722
  // Go through the array, only saving the items
646
723
  // that pass the validator function
647
724
  for ( var i = 0, length = elems.length; i < length; i++ ) {
648
- if ( !inv !== !callback( elems[ i ], i ) ) {
725
+ retVal = !!callback( elems[ i ], i );
726
+ if ( inv !== retVal ) {
649
727
  ret.push( elems[ i ] );
650
728
  }
651
729
  }
@@ -701,16 +779,49 @@ jQuery.extend({
701
779
  return proxy;
702
780
  },
703
781
 
782
+ // Mutifunctional method to get and set values to a collection
783
+ // The value/s can be optionally by executed if its a function
784
+ access: function( elems, key, value, exec, fn, pass ) {
785
+ var length = elems.length;
786
+
787
+ // Setting many attributes
788
+ if ( typeof key === "object" ) {
789
+ for ( var k in key ) {
790
+ jQuery.access( elems, k, key[k], exec, fn, value );
791
+ }
792
+ return elems;
793
+ }
794
+
795
+ // Setting one attribute
796
+ if ( value !== undefined ) {
797
+ // Optionally, function values get executed if exec is true
798
+ exec = !pass && exec && jQuery.isFunction(value);
799
+
800
+ for ( var i = 0; i < length; i++ ) {
801
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
802
+ }
803
+
804
+ return elems;
805
+ }
806
+
807
+ // Getting an attribute
808
+ return length ? fn( elems[0], key ) : undefined;
809
+ },
810
+
811
+ now: function() {
812
+ return (new Date()).getTime();
813
+ },
814
+
704
815
  // Use of jQuery.browser is frowned upon.
705
816
  // More details: http://docs.jquery.com/Utilities/jQuery.browser
706
817
  uaMatch: function( ua ) {
707
818
  ua = ua.toLowerCase();
708
819
 
709
- var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
710
- /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
711
- /(msie) ([\w.]+)/.exec( ua ) ||
712
- !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
713
- [];
820
+ var match = rwebkit.exec( ua ) ||
821
+ ropera.exec( ua ) ||
822
+ rmsie.exec( ua ) ||
823
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
824
+ [];
714
825
 
715
826
  return { browser: match[1] || "", version: match[2] || "0" };
716
827
  },
@@ -718,6 +829,11 @@ jQuery.extend({
718
829
  browser: {}
719
830
  });
720
831
 
832
+ // Populate the class2type map
833
+ jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
834
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
835
+ });
836
+
721
837
  browserMatch = jQuery.uaMatch( userAgent );
722
838
  if ( browserMatch.browser ) {
723
839
  jQuery.browser[ browserMatch.browser ] = true;
@@ -735,6 +851,13 @@ if ( indexOf ) {
735
851
  };
736
852
  }
737
853
 
854
+ // Verify that \s matches non-breaking spaces
855
+ // (IE fails on this test)
856
+ if ( !rwhite.test( "\xA0" ) ) {
857
+ trimLeft = /^[\s\xA0]+/;
858
+ trimRight = /[\s\xA0]+$/;
859
+ }
860
+
738
861
  // All jQuery objects should point back to these
739
862
  rootjQuery = jQuery(document);
740
863
 
@@ -765,7 +888,7 @@ function doScrollCheck() {
765
888
  // If IE is used, use the trick by Diego Perini
766
889
  // http://javascript.nwbox.com/IEContentLoaded/
767
890
  document.documentElement.doScroll("left");
768
- } catch( error ) {
891
+ } catch(e) {
769
892
  setTimeout( doScrollCheck, 1 );
770
893
  return;
771
894
  }
@@ -774,54 +897,12 @@ function doScrollCheck() {
774
897
  jQuery.ready();
775
898
  }
776
899
 
777
- function evalScript( i, elem ) {
778
- if ( elem.src ) {
779
- jQuery.ajax({
780
- url: elem.src,
781
- async: false,
782
- dataType: "script"
783
- });
784
- } else {
785
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
786
- }
900
+ // Expose jQuery to the global object
901
+ return (window.jQuery = window.$ = jQuery);
787
902
 
788
- if ( elem.parentNode ) {
789
- elem.parentNode.removeChild( elem );
790
- }
791
- }
903
+ })();
792
904
 
793
- // Mutifunctional method to get and set values to a collection
794
- // The value/s can be optionally by executed if its a function
795
- function access( elems, key, value, exec, fn, pass ) {
796
- var length = elems.length;
797
-
798
- // Setting many attributes
799
- if ( typeof key === "object" ) {
800
- for ( var k in key ) {
801
- access( elems, k, key[k], exec, fn, value );
802
- }
803
- return elems;
804
- }
805
-
806
- // Setting one attribute
807
- if ( value !== undefined ) {
808
- // Optionally, function values get executed if exec is true
809
- exec = !pass && exec && jQuery.isFunction(value);
810
-
811
- for ( var i = 0; i < length; i++ ) {
812
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
813
- }
814
-
815
- return elems;
816
- }
817
-
818
- // Getting an attribute
819
- return length ? fn( elems[0], key ) : undefined;
820
- }
821
905
 
822
- function now() {
823
- return (new Date).getTime();
824
- }
825
906
  (function() {
826
907
 
827
908
  jQuery.support = {};
@@ -829,13 +910,15 @@ function now() {
829
910
  var root = document.documentElement,
830
911
  script = document.createElement("script"),
831
912
  div = document.createElement("div"),
832
- id = "script" + now();
913
+ id = "script" + jQuery.now();
833
914
 
834
915
  div.style.display = "none";
835
916
  div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
836
917
 
837
918
  var all = div.getElementsByTagName("*"),
838
- a = div.getElementsByTagName("a")[0];
919
+ a = div.getElementsByTagName("a")[0],
920
+ select = document.createElement("select"),
921
+ opt = select.appendChild( document.createElement("option") );
839
922
 
840
923
  // Can't get basic test support
841
924
  if ( !all || !all.length || !a ) {
@@ -878,18 +961,24 @@ function now() {
878
961
 
879
962
  // Make sure that a selected-by-default option has a working selected property.
880
963
  // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
881
- optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
882
-
883
- parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
964
+ optSelected: opt.selected,
884
965
 
885
966
  // Will be defined later
886
- deleteExpando: true,
967
+ optDisabled: false,
887
968
  checkClone: false,
888
969
  scriptEval: false,
889
970
  noCloneEvent: true,
890
- boxModel: null
971
+ boxModel: null,
972
+ inlineBlockNeedsLayout: false,
973
+ shrinkWrapBlocks: false,
974
+ reliableHiddenOffsets: true
891
975
  };
892
976
 
977
+ // Make sure that the options inside disabled selects aren't marked as disabled
978
+ // (WebKit marks them as diabled)
979
+ select.disabled = true;
980
+ jQuery.support.optDisabled = !opt.disabled;
981
+
893
982
  script.type = "text/javascript";
894
983
  try {
895
984
  script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
@@ -905,15 +994,6 @@ function now() {
905
994
  delete window[ id ];
906
995
  }
907
996
 
908
- // Test to see if it's possible to delete an expando from an element
909
- // Fails in Internet Explorer
910
- try {
911
- delete script.test;
912
-
913
- } catch(e) {
914
- jQuery.support.deleteExpando = false;
915
- }
916
-
917
997
  root.removeChild( script );
918
998
 
919
999
  if ( div.attachEvent && div.fireEvent ) {
@@ -943,27 +1023,63 @@ function now() {
943
1023
 
944
1024
  document.body.appendChild( div );
945
1025
  jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
946
- document.body.removeChild( div ).style.display = 'none';
947
1026
 
948
- div = null;
1027
+ if ( "zoom" in div.style ) {
1028
+ // Check if natively block-level elements act like inline-block
1029
+ // elements when setting their display to 'inline' and giving
1030
+ // them layout
1031
+ // (IE < 8 does this)
1032
+ div.style.display = "inline";
1033
+ div.style.zoom = 1;
1034
+ jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
1035
+
1036
+ // Check if elements with layout shrink-wrap their children
1037
+ // (IE 6 does this)
1038
+ div.style.display = "";
1039
+ div.innerHTML = "<div style='width:4px;'></div>";
1040
+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1041
+ }
1042
+
1043
+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
1044
+ var tds = div.getElementsByTagName("td");
1045
+
1046
+ // Check if table cells still have offsetWidth/Height when they are set
1047
+ // to display:none and there are still other visible table cells in a
1048
+ // table row; if so, offsetWidth/Height are not reliable for use when
1049
+ // determining if an element has been hidden directly using
1050
+ // display:none (it is still safe to use offsets if a parent element is
1051
+ // hidden; don safety goggles and see bug #4512 for more information).
1052
+ // (only IE 8 fails this test)
1053
+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
1054
+
1055
+ tds[0].style.display = "";
1056
+ tds[1].style.display = "none";
1057
+
1058
+ // Check if empty table cells still have offsetWidth/Height
1059
+ // (IE < 8 fail this test)
1060
+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1061
+ div.innerHTML = "";
1062
+
1063
+ document.body.removeChild( div ).style.display = "none";
1064
+ div = tds = null;
949
1065
  });
950
1066
 
951
1067
  // Technique from Juriy Zaytsev
952
1068
  // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
953
- var eventSupported = function( eventName ) {
954
- var el = document.createElement("div");
955
- eventName = "on" + eventName;
956
-
957
- var isSupported = (eventName in el);
958
- if ( !isSupported ) {
959
- el.setAttribute(eventName, "return;");
960
- isSupported = typeof el[eventName] === "function";
961
- }
962
- el = null;
963
-
964
- return isSupported;
1069
+ var eventSupported = function( eventName ) {
1070
+ var el = document.createElement("div");
1071
+ eventName = "on" + eventName;
1072
+
1073
+ var isSupported = (eventName in el);
1074
+ if ( !isSupported ) {
1075
+ el.setAttribute(eventName, "return;");
1076
+ isSupported = typeof el[eventName] === "function";
1077
+ }
1078
+ el = null;
1079
+
1080
+ return isSupported;
965
1081
  };
966
-
1082
+
967
1083
  jQuery.support.submitBubbles = eventSupported("submit");
968
1084
  jQuery.support.changeBubbles = eventSupported("change");
969
1085
 
@@ -983,23 +1099,33 @@ jQuery.props = {
983
1099
  usemap: "useMap",
984
1100
  frameborder: "frameBorder"
985
1101
  };
986
- var expando = "jQuery" + now(), uuid = 0, windowData = {};
1102
+
1103
+
1104
+
1105
+
1106
+ var windowData = {},
1107
+ rbrace = /^(?:\{.*\}|\[.*\])$/;
987
1108
 
988
1109
  jQuery.extend({
989
1110
  cache: {},
990
-
991
- expando:expando,
1111
+
1112
+ // Please use with caution
1113
+ uuid: 0,
1114
+
1115
+ // Unique for each copy of jQuery on the page
1116
+ expando: "jQuery" + jQuery.now(),
992
1117
 
993
1118
  // The following elements throw uncatchable exceptions if you
994
1119
  // attempt to add expando properties to them.
995
1120
  noData: {
996
1121
  "embed": true,
997
- "object": true,
1122
+ // Ban all objects except for Flash (which handle expandos)
1123
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
998
1124
  "applet": true
999
1125
  },
1000
1126
 
1001
1127
  data: function( elem, name, data ) {
1002
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
1128
+ if ( !jQuery.acceptData( elem ) ) {
1003
1129
  return;
1004
1130
  }
1005
1131
 
@@ -1007,29 +1133,38 @@ jQuery.extend({
1007
1133
  windowData :
1008
1134
  elem;
1009
1135
 
1010
- var id = elem[ expando ], cache = jQuery.cache, thisCache;
1136
+ var isNode = elem.nodeType,
1137
+ id = isNode ? elem[ jQuery.expando ] : null,
1138
+ cache = jQuery.cache, thisCache;
1011
1139
 
1012
- if ( !id && typeof name === "string" && data === undefined ) {
1013
- return null;
1140
+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
1141
+ return;
1014
1142
  }
1015
1143
 
1144
+ // Get the data from the object directly
1145
+ if ( !isNode ) {
1146
+ cache = elem;
1147
+
1016
1148
  // Compute a unique ID for the element
1017
- if ( !id ) {
1018
- id = ++uuid;
1149
+ } else if ( !id ) {
1150
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
1019
1151
  }
1020
1152
 
1021
1153
  // Avoid generating a new cache unless none exists and we
1022
1154
  // want to manipulate it.
1023
1155
  if ( typeof name === "object" ) {
1024
- elem[ expando ] = id;
1025
- thisCache = cache[ id ] = jQuery.extend(true, {}, name);
1156
+ if ( isNode ) {
1157
+ cache[ id ] = jQuery.extend(cache[ id ], name);
1158
+
1159
+ } else {
1160
+ jQuery.extend( cache, name );
1161
+ }
1026
1162
 
1027
- } else if ( !cache[ id ] ) {
1028
- elem[ expando ] = id;
1163
+ } else if ( isNode && !cache[ id ] ) {
1029
1164
  cache[ id ] = {};
1030
1165
  }
1031
1166
 
1032
- thisCache = cache[ id ];
1167
+ thisCache = isNode ? cache[ id ] : cache;
1033
1168
 
1034
1169
  // Prevent overriding the named cache with undefined values
1035
1170
  if ( data !== undefined ) {
@@ -1040,7 +1175,7 @@ jQuery.extend({
1040
1175
  },
1041
1176
 
1042
1177
  removeData: function( elem, name ) {
1043
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
1178
+ if ( !jQuery.acceptData( elem ) ) {
1044
1179
  return;
1045
1180
  }
1046
1181
 
@@ -1048,7 +1183,10 @@ jQuery.extend({
1048
1183
  windowData :
1049
1184
  elem;
1050
1185
 
1051
- var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
1186
+ var isNode = elem.nodeType,
1187
+ id = isNode ? elem[ jQuery.expando ] : elem,
1188
+ cache = jQuery.cache,
1189
+ thisCache = isNode ? cache[ id ] : id;
1052
1190
 
1053
1191
  // If we want to remove a specific section of the element's data
1054
1192
  if ( name ) {
@@ -1057,30 +1195,50 @@ jQuery.extend({
1057
1195
  delete thisCache[ name ];
1058
1196
 
1059
1197
  // If we've removed all the data, remove the element's cache
1060
- if ( jQuery.isEmptyObject(thisCache) ) {
1198
+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
1061
1199
  jQuery.removeData( elem );
1062
1200
  }
1063
1201
  }
1064
1202
 
1065
1203
  // Otherwise, we want to remove all of the element's data
1066
1204
  } else {
1067
- if ( jQuery.support.deleteExpando ) {
1205
+ if ( isNode && jQuery.support.deleteExpando ) {
1068
1206
  delete elem[ jQuery.expando ];
1069
1207
 
1070
1208
  } else if ( elem.removeAttribute ) {
1071
1209
  elem.removeAttribute( jQuery.expando );
1072
- }
1073
1210
 
1074
1211
  // Completely remove the data cache
1075
- delete cache[ id ];
1212
+ } else if ( isNode ) {
1213
+ delete cache[ id ];
1214
+
1215
+ // Remove all fields from the object
1216
+ } else {
1217
+ for ( var n in elem ) {
1218
+ delete elem[ n ];
1219
+ }
1220
+ }
1076
1221
  }
1222
+ },
1223
+
1224
+ // A method for determining if a DOM node can handle the data expando
1225
+ acceptData: function( elem ) {
1226
+ if ( elem.nodeName ) {
1227
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
1228
+
1229
+ if ( match ) {
1230
+ return !(match === true || elem.getAttribute("classid") !== match);
1231
+ }
1232
+ }
1233
+
1234
+ return true;
1077
1235
  }
1078
1236
  });
1079
1237
 
1080
1238
  jQuery.fn.extend({
1081
1239
  data: function( key, value ) {
1082
- if ( typeof key === "undefined" && this.length ) {
1083
- return jQuery.data( this[0] );
1240
+ if ( typeof key === "undefined" ) {
1241
+ return this.length ? jQuery.data( this[0] ) : null;
1084
1242
 
1085
1243
  } else if ( typeof key === "object" ) {
1086
1244
  return this.each(function() {
@@ -1094,15 +1252,42 @@ jQuery.fn.extend({
1094
1252
  if ( value === undefined ) {
1095
1253
  var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1096
1254
 
1255
+ // Try to fetch any internally stored data first
1097
1256
  if ( data === undefined && this.length ) {
1098
1257
  data = jQuery.data( this[0], key );
1258
+
1259
+ // If nothing was found internally, try to fetch any
1260
+ // data from the HTML5 data-* attribute
1261
+ if ( data === undefined && this[0].nodeType === 1 ) {
1262
+ data = this[0].getAttribute( "data-" + key );
1263
+
1264
+ if ( typeof data === "string" ) {
1265
+ try {
1266
+ data = data === "true" ? true :
1267
+ data === "false" ? false :
1268
+ data === "null" ? null :
1269
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
1270
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
1271
+ data;
1272
+ } catch( e ) {}
1273
+
1274
+ } else {
1275
+ data = undefined;
1276
+ }
1277
+ }
1099
1278
  }
1279
+
1100
1280
  return data === undefined && parts[1] ?
1101
1281
  this.data( parts[0] ) :
1102
1282
  data;
1283
+
1103
1284
  } else {
1104
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
1285
+ return this.each(function() {
1286
+ var $this = jQuery( this ), args = [ parts[0], value ];
1287
+
1288
+ $this.triggerHandler( "setData" + parts[1] + "!", args );
1105
1289
  jQuery.data( this, key, value );
1290
+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
1106
1291
  });
1107
1292
  }
1108
1293
  },
@@ -1113,6 +1298,10 @@ jQuery.fn.extend({
1113
1298
  });
1114
1299
  }
1115
1300
  });
1301
+
1302
+
1303
+
1304
+
1116
1305
  jQuery.extend({
1117
1306
  queue: function( elem, type, data ) {
1118
1307
  if ( !elem ) {
@@ -1171,7 +1360,7 @@ jQuery.fn.extend({
1171
1360
  if ( data === undefined ) {
1172
1361
  return jQuery.queue( this[0], type );
1173
1362
  }
1174
- return this.each(function( i, elem ) {
1363
+ return this.each(function( i ) {
1175
1364
  var queue = jQuery.queue( this, type, data );
1176
1365
 
1177
1366
  if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -1203,18 +1392,22 @@ jQuery.fn.extend({
1203
1392
  return this.queue( type || "fx", [] );
1204
1393
  }
1205
1394
  });
1395
+
1396
+
1397
+
1398
+
1206
1399
  var rclass = /[\n\t]/g,
1207
- rspace = /\s+/,
1400
+ rspaces = /\s+/,
1208
1401
  rreturn = /\r/g,
1209
- rspecialurl = /href|src|style/,
1210
- rtype = /(button|input)/i,
1211
- rfocusable = /(button|input|object|select|textarea)/i,
1212
- rclickable = /^(a|area)$/i,
1213
- rradiocheck = /radio|checkbox/;
1402
+ rspecialurl = /^(?:href|src|style)$/,
1403
+ rtype = /^(?:button|input)$/i,
1404
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
1405
+ rclickable = /^a(?:rea)?$/i,
1406
+ rradiocheck = /^(?:radio|checkbox)$/i;
1214
1407
 
1215
1408
  jQuery.fn.extend({
1216
1409
  attr: function( name, value ) {
1217
- return access( this, name, value, true, jQuery.attr );
1410
+ return jQuery.access( this, name, value, true, jQuery.attr );
1218
1411
  },
1219
1412
 
1220
1413
  removeAttr: function( name, fn ) {
@@ -1235,7 +1428,7 @@ jQuery.fn.extend({
1235
1428
  }
1236
1429
 
1237
1430
  if ( value && typeof value === "string" ) {
1238
- var classNames = (value || "").split( rspace );
1431
+ var classNames = (value || "").split( rspaces );
1239
1432
 
1240
1433
  for ( var i = 0, l = this.length; i < l; i++ ) {
1241
1434
  var elem = this[i];
@@ -1269,7 +1462,7 @@ jQuery.fn.extend({
1269
1462
  }
1270
1463
 
1271
1464
  if ( (value && typeof value === "string") || value === undefined ) {
1272
- var classNames = (value || "").split(rspace);
1465
+ var classNames = (value || "").split( rspaces );
1273
1466
 
1274
1467
  for ( var i = 0, l = this.length; i < l; i++ ) {
1275
1468
  var elem = this[i];
@@ -1307,7 +1500,7 @@ jQuery.fn.extend({
1307
1500
  // toggle individual class names
1308
1501
  var className, i = 0, self = jQuery(this),
1309
1502
  state = stateVal,
1310
- classNames = value.split( rspace );
1503
+ classNames = value.split( rspaces );
1311
1504
 
1312
1505
  while ( (className = classNames[ i++ ]) ) {
1313
1506
  // check each className given, space seperated list
@@ -1339,12 +1532,15 @@ jQuery.fn.extend({
1339
1532
  },
1340
1533
 
1341
1534
  val: function( value ) {
1342
- if ( value === undefined ) {
1535
+ if ( !arguments.length ) {
1343
1536
  var elem = this[0];
1344
1537
 
1345
1538
  if ( elem ) {
1346
1539
  if ( jQuery.nodeName( elem, "option" ) ) {
1347
- return (elem.attributes.value || {}).specified ? elem.value : elem.text;
1540
+ // attributes.value is undefined in Blackberry 4.7 but
1541
+ // uses .value. See #6932
1542
+ var val = elem.attributes.value;
1543
+ return !val || val.specified ? elem.value : elem.text;
1348
1544
  }
1349
1545
 
1350
1546
  // We need to handle select boxes special
@@ -1363,8 +1559,11 @@ jQuery.fn.extend({
1363
1559
  for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
1364
1560
  var option = options[ i ];
1365
1561
 
1366
- if ( option.selected ) {
1367
- // Get the specifc value for the option
1562
+ // Don't return options that are disabled or in a disabled optgroup
1563
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1564
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1565
+
1566
+ // Get the specific value for the option
1368
1567
  value = jQuery(option).val();
1369
1568
 
1370
1569
  // We don't need an array for one selects
@@ -1407,10 +1606,15 @@ jQuery.fn.extend({
1407
1606
  val = value.call(this, i, self.val());
1408
1607
  }
1409
1608
 
1410
- // Typecast each time if the value is a Function and the appended
1411
- // value is therefore different each time.
1412
- if ( typeof val === "number" ) {
1609
+ // Treat null/undefined as ""; convert numbers to string
1610
+ if ( val == null ) {
1611
+ val = "";
1612
+ } else if ( typeof val === "number" ) {
1413
1613
  val += "";
1614
+ } else if ( jQuery.isArray(val) ) {
1615
+ val = jQuery.map(val, function (value) {
1616
+ return value == null ? "" : value + "";
1617
+ });
1414
1618
  }
1415
1619
 
1416
1620
  if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
@@ -1483,14 +1687,22 @@ jQuery.extend({
1483
1687
  }
1484
1688
 
1485
1689
  // If applicable, access the attribute via the DOM 0 way
1486
- if ( name in elem && notxml && !special ) {
1690
+ // 'in' checks fail in Blackberry 4.7 #6931
1691
+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
1487
1692
  if ( set ) {
1488
1693
  // We can't allow the type property to be changed (since it causes problems in IE)
1489
1694
  if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1490
1695
  jQuery.error( "type property can't be changed" );
1491
1696
  }
1492
1697
 
1493
- elem[ name ] = value;
1698
+ if ( value === null ) {
1699
+ if ( elem.nodeType === 1 ) {
1700
+ elem.removeAttribute( name );
1701
+ }
1702
+
1703
+ } else {
1704
+ elem[ name ] = value;
1705
+ }
1494
1706
  }
1495
1707
 
1496
1708
  // browsers index elements by id/name on forms, give priority to attributes.
@@ -1526,6 +1738,12 @@ jQuery.extend({
1526
1738
  elem.setAttribute( name, "" + value );
1527
1739
  }
1528
1740
 
1741
+ // Ensure that missing attributes return undefined
1742
+ // Blackberry 4.7 returns "" from getAttribute #6938
1743
+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
1744
+ return undefined;
1745
+ }
1746
+
1529
1747
  var attr = !jQuery.support.hrefNormalized && notxml && special ?
1530
1748
  // Some attributes require a special call on IE
1531
1749
  elem.getAttribute( name, 2 ) :
@@ -1534,18 +1752,21 @@ jQuery.extend({
1534
1752
  // Non-existent attributes return null, we normalize to undefined
1535
1753
  return attr === null ? undefined : attr;
1536
1754
  }
1537
-
1538
- // elem is actually elem.style ... set the style
1539
- // Using attr for specific style information is now deprecated. Use style instead.
1540
- return jQuery.style( elem, name, value );
1541
1755
  }
1542
1756
  });
1757
+
1758
+
1759
+
1760
+
1543
1761
  var rnamespaces = /\.(.*)$/,
1762
+ rformElems = /^(?:textarea|input|select)$/i,
1763
+ rperiod = /\./g,
1764
+ rspace = / /g,
1765
+ rescape = /[^\w\s.|`]/g,
1544
1766
  fcleanup = function( nm ) {
1545
- return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
1546
- return "\\" + ch;
1547
- });
1548
- };
1767
+ return nm.replace(rescape, "\\$&");
1768
+ },
1769
+ focusCounts = { focusin: 0, focusout: 0 };
1549
1770
 
1550
1771
  /*
1551
1772
  * A number of helper functions used for managing events.
@@ -1563,10 +1784,14 @@ jQuery.event = {
1563
1784
 
1564
1785
  // For whatever reason, IE has trouble passing the window object
1565
1786
  // around, causing it to be cloned in the process
1566
- if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
1787
+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
1567
1788
  elem = window;
1568
1789
  }
1569
1790
 
1791
+ if ( handler === false ) {
1792
+ handler = returnFalse;
1793
+ }
1794
+
1570
1795
  var handleObjIn, handleObj;
1571
1796
 
1572
1797
  if ( handler.handler ) {
@@ -1588,8 +1813,28 @@ jQuery.event = {
1588
1813
  return;
1589
1814
  }
1590
1815
 
1591
- var events = elemData.events = elemData.events || {},
1592
- eventHandle = elemData.handle, eventHandle;
1816
+ // Use a key less likely to result in collisions for plain JS objects.
1817
+ // Fixes bug #7150.
1818
+ var eventKey = elem.nodeType ? "events" : "__events__",
1819
+ events = elemData[ eventKey ],
1820
+ eventHandle = elemData.handle;
1821
+
1822
+ if ( typeof events === "function" ) {
1823
+ // On plain objects events is a fn that holds the the data
1824
+ // which prevents this data from being JSON serialized
1825
+ // the function does not need to be called, it just contains the data
1826
+ eventHandle = events.handle;
1827
+ events = events.events;
1828
+
1829
+ } else if ( !events ) {
1830
+ if ( !elem.nodeType ) {
1831
+ // On plain objects, create a fn that acts as the holder
1832
+ // of the values to avoid JSON serialization of event data
1833
+ elemData[ eventKey ] = elemData = function(){};
1834
+ }
1835
+
1836
+ elemData.events = events = {};
1837
+ }
1593
1838
 
1594
1839
  if ( !eventHandle ) {
1595
1840
  elemData.handle = eventHandle = function() {
@@ -1628,7 +1873,9 @@ jQuery.event = {
1628
1873
  }
1629
1874
 
1630
1875
  handleObj.type = type;
1631
- handleObj.guid = handler.guid;
1876
+ if ( !handleObj.guid ) {
1877
+ handleObj.guid = handler.guid;
1878
+ }
1632
1879
 
1633
1880
  // Get the current list of functions bound to this event
1634
1881
  var handlers = events[ type ],
@@ -1680,13 +1927,23 @@ jQuery.event = {
1680
1927
  return;
1681
1928
  }
1682
1929
 
1683
- var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
1930
+ if ( handler === false ) {
1931
+ handler = returnFalse;
1932
+ }
1933
+
1934
+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
1935
+ eventKey = elem.nodeType ? "events" : "__events__",
1684
1936
  elemData = jQuery.data( elem ),
1685
- events = elemData && elemData.events;
1937
+ events = elemData && elemData[ eventKey ];
1686
1938
 
1687
1939
  if ( !elemData || !events ) {
1688
1940
  return;
1689
1941
  }
1942
+
1943
+ if ( typeof events === "function" ) {
1944
+ elemData = events;
1945
+ events = events.events;
1946
+ }
1690
1947
 
1691
1948
  // types is actually an event object here
1692
1949
  if ( types && types.type ) {
@@ -1721,7 +1978,7 @@ jQuery.event = {
1721
1978
  type = namespaces.shift();
1722
1979
 
1723
1980
  namespace = new RegExp("(^|\\.)" +
1724
- jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
1981
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
1725
1982
  }
1726
1983
 
1727
1984
  eventType = events[ type ];
@@ -1731,7 +1988,7 @@ jQuery.event = {
1731
1988
  }
1732
1989
 
1733
1990
  if ( !handler ) {
1734
- for ( var j = 0; j < eventType.length; j++ ) {
1991
+ for ( j = 0; j < eventType.length; j++ ) {
1735
1992
  handleObj = eventType[ j ];
1736
1993
 
1737
1994
  if ( all || namespace.test( handleObj.namespace ) ) {
@@ -1745,7 +2002,7 @@ jQuery.event = {
1745
2002
 
1746
2003
  special = jQuery.event.special[ type ] || {};
1747
2004
 
1748
- for ( var j = pos || 0; j < eventType.length; j++ ) {
2005
+ for ( j = pos || 0; j < eventType.length; j++ ) {
1749
2006
  handleObj = eventType[ j ];
1750
2007
 
1751
2008
  if ( handler.guid === handleObj.guid ) {
@@ -1769,7 +2026,7 @@ jQuery.event = {
1769
2026
  // remove generic event handler if no more handlers exist
1770
2027
  if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
1771
2028
  if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
1772
- removeEvent( elem, type, elemData.handle );
2029
+ jQuery.removeEvent( elem, type, elemData.handle );
1773
2030
  }
1774
2031
 
1775
2032
  ret = null;
@@ -1787,7 +2044,10 @@ jQuery.event = {
1787
2044
  delete elemData.events;
1788
2045
  delete elemData.handle;
1789
2046
 
1790
- if ( jQuery.isEmptyObject( elemData ) ) {
2047
+ if ( typeof elemData === "function" ) {
2048
+ jQuery.removeData( elem, eventKey );
2049
+
2050
+ } else if ( jQuery.isEmptyObject( elemData ) ) {
1791
2051
  jQuery.removeData( elem );
1792
2052
  }
1793
2053
  }
@@ -1802,7 +2062,7 @@ jQuery.event = {
1802
2062
  if ( !bubbling ) {
1803
2063
  event = typeof event === "object" ?
1804
2064
  // jQuery.Event object
1805
- event[expando] ? event :
2065
+ event[ jQuery.expando ] ? event :
1806
2066
  // Object literal
1807
2067
  jQuery.extend( jQuery.Event(type), event ) :
1808
2068
  // Just the event type (string)
@@ -1847,7 +2107,10 @@ jQuery.event = {
1847
2107
  event.currentTarget = elem;
1848
2108
 
1849
2109
  // Trigger the event, it is assumed that "handle" is a function
1850
- var handle = jQuery.data( elem, "handle" );
2110
+ var handle = elem.nodeType ?
2111
+ jQuery.data( elem, "handle" ) :
2112
+ (jQuery.data( elem, "__events__" ) || {}).handle;
2113
+
1851
2114
  if ( handle ) {
1852
2115
  handle.apply( elem, data );
1853
2116
  }
@@ -1859,41 +2122,42 @@ jQuery.event = {
1859
2122
  if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
1860
2123
  if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
1861
2124
  event.result = false;
2125
+ event.preventDefault();
1862
2126
  }
1863
2127
  }
1864
2128
 
1865
2129
  // prevent IE from throwing an error for some elements with some event types, see #3533
1866
- } catch (e) {}
2130
+ } catch (inlineError) {}
1867
2131
 
1868
2132
  if ( !event.isPropagationStopped() && parent ) {
1869
2133
  jQuery.event.trigger( event, data, parent, true );
1870
2134
 
1871
2135
  } else if ( !event.isDefaultPrevented() ) {
1872
- var target = event.target, old,
1873
- isClick = jQuery.nodeName(target, "a") && type === "click",
1874
- special = jQuery.event.special[ type ] || {};
2136
+ var target = event.target, old, targetType = type.replace(rnamespaces, ""),
2137
+ isClick = jQuery.nodeName(target, "a") && targetType === "click",
2138
+ special = jQuery.event.special[ targetType ] || {};
1875
2139
 
1876
2140
  if ( (!special._default || special._default.call( elem, event ) === false) &&
1877
2141
  !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
1878
2142
 
1879
2143
  try {
1880
- if ( target[ type ] ) {
2144
+ if ( target[ targetType ] ) {
1881
2145
  // Make sure that we don't accidentally re-trigger the onFOO events
1882
- old = target[ "on" + type ];
2146
+ old = target[ "on" + targetType ];
1883
2147
 
1884
2148
  if ( old ) {
1885
- target[ "on" + type ] = null;
2149
+ target[ "on" + targetType ] = null;
1886
2150
  }
1887
2151
 
1888
2152
  jQuery.event.triggered = true;
1889
- target[ type ]();
2153
+ target[ targetType ]();
1890
2154
  }
1891
2155
 
1892
2156
  // prevent IE from throwing an error for some elements with some event types, see #3533
1893
- } catch (e) {}
2157
+ } catch (triggerError) {}
1894
2158
 
1895
2159
  if ( old ) {
1896
- target[ "on" + type ] = old;
2160
+ target[ "on" + targetType ] = old;
1897
2161
  }
1898
2162
 
1899
2163
  jQuery.event.triggered = false;
@@ -1902,9 +2166,9 @@ jQuery.event = {
1902
2166
  },
1903
2167
 
1904
2168
  handle: function( event ) {
1905
- var all, handlers, namespaces, namespace, events;
2169
+ var all, handlers, namespaces, namespace_sort = [], namespace_re, events, args = jQuery.makeArray( arguments );
1906
2170
 
1907
- event = arguments[0] = jQuery.event.fix( event || window.event );
2171
+ event = args[0] = jQuery.event.fix( event || window.event );
1908
2172
  event.currentTarget = this;
1909
2173
 
1910
2174
  // Namespaced event handlers
@@ -1913,10 +2177,19 @@ jQuery.event = {
1913
2177
  if ( !all ) {
1914
2178
  namespaces = event.type.split(".");
1915
2179
  event.type = namespaces.shift();
1916
- namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
2180
+ namespace_sort = namespaces.slice(0).sort();
2181
+ namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
2182
+ }
2183
+
2184
+ event.namespace = event.namespace || namespace_sort.join(".");
2185
+
2186
+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
2187
+
2188
+ if ( typeof events === "function" ) {
2189
+ events = events.events;
1917
2190
  }
1918
2191
 
1919
- var events = jQuery.data(this, "events"), handlers = events[ event.type ];
2192
+ handlers = (events || {})[ event.type ];
1920
2193
 
1921
2194
  if ( events && handlers ) {
1922
2195
  // Clone the handlers to prevent manipulation
@@ -1926,14 +2199,14 @@ jQuery.event = {
1926
2199
  var handleObj = handlers[ j ];
1927
2200
 
1928
2201
  // Filter the functions by class
1929
- if ( all || namespace.test( handleObj.namespace ) ) {
2202
+ if ( all || namespace_re.test( handleObj.namespace ) ) {
1930
2203
  // Pass in a reference to the handler function itself
1931
2204
  // So that we can later remove it
1932
2205
  event.handler = handleObj.handler;
1933
2206
  event.data = handleObj.data;
1934
2207
  event.handleObj = handleObj;
1935
2208
 
1936
- var ret = handleObj.handler.apply( this, arguments );
2209
+ var ret = handleObj.handler.apply( this, args );
1937
2210
 
1938
2211
  if ( ret !== undefined ) {
1939
2212
  event.result = ret;
@@ -1953,10 +2226,10 @@ jQuery.event = {
1953
2226
  return event.result;
1954
2227
  },
1955
2228
 
1956
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
2229
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
1957
2230
 
1958
2231
  fix: function( event ) {
1959
- if ( event[ expando ] ) {
2232
+ if ( event[ jQuery.expando ] ) {
1960
2233
  return event;
1961
2234
  }
1962
2235
 
@@ -1993,8 +2266,8 @@ jQuery.event = {
1993
2266
  }
1994
2267
 
1995
2268
  // Add which for key events
1996
- if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
1997
- event.which = event.charCode || event.keyCode;
2269
+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
2270
+ event.which = event.charCode != null ? event.charCode : event.keyCode;
1998
2271
  }
1999
2272
 
2000
2273
  // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
@@ -2026,36 +2299,24 @@ jQuery.event = {
2026
2299
 
2027
2300
  live: {
2028
2301
  add: function( handleObj ) {
2029
- jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) );
2302
+ jQuery.event.add( this,
2303
+ liveConvert( handleObj.origType, handleObj.selector ),
2304
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
2030
2305
  },
2031
2306
 
2032
2307
  remove: function( handleObj ) {
2033
- var remove = true,
2034
- type = handleObj.origType.replace(rnamespaces, "");
2035
-
2036
- jQuery.each( jQuery.data(this, "events").live || [], function() {
2037
- if ( type === this.origType.replace(rnamespaces, "") ) {
2038
- remove = false;
2039
- return false;
2040
- }
2041
- });
2042
-
2043
- if ( remove ) {
2044
- jQuery.event.remove( this, handleObj.origType, liveHandler );
2045
- }
2308
+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
2046
2309
  }
2047
-
2048
2310
  },
2049
2311
 
2050
2312
  beforeunload: {
2051
2313
  setup: function( data, namespaces, eventHandle ) {
2052
2314
  // We only want to do this special case on windows
2053
- if ( this.setInterval ) {
2315
+ if ( jQuery.isWindow( this ) ) {
2054
2316
  this.onbeforeunload = eventHandle;
2055
2317
  }
2056
-
2057
- return false;
2058
2318
  },
2319
+
2059
2320
  teardown: function( namespaces, eventHandle ) {
2060
2321
  if ( this.onbeforeunload === eventHandle ) {
2061
2322
  this.onbeforeunload = null;
@@ -2065,12 +2326,16 @@ jQuery.event = {
2065
2326
  }
2066
2327
  };
2067
2328
 
2068
- var removeEvent = document.removeEventListener ?
2329
+ jQuery.removeEvent = document.removeEventListener ?
2069
2330
  function( elem, type, handle ) {
2070
- elem.removeEventListener( type, handle, false );
2331
+ if ( elem.removeEventListener ) {
2332
+ elem.removeEventListener( type, handle, false );
2333
+ }
2071
2334
  } :
2072
2335
  function( elem, type, handle ) {
2073
- elem.detachEvent( "on" + type, handle );
2336
+ if ( elem.detachEvent ) {
2337
+ elem.detachEvent( "on" + type, handle );
2338
+ }
2074
2339
  };
2075
2340
 
2076
2341
  jQuery.Event = function( src ) {
@@ -2090,10 +2355,10 @@ jQuery.Event = function( src ) {
2090
2355
 
2091
2356
  // timeStamp is buggy for some events on Firefox(#3843)
2092
2357
  // So we won't rely on the native value
2093
- this.timeStamp = now();
2358
+ this.timeStamp = jQuery.now();
2094
2359
 
2095
2360
  // Mark it as fixed
2096
- this[ expando ] = true;
2361
+ this[ jQuery.expando ] = true;
2097
2362
  };
2098
2363
 
2099
2364
  function returnFalse() {
@@ -2117,9 +2382,11 @@ jQuery.Event.prototype = {
2117
2382
  // if preventDefault exists run it on the original event
2118
2383
  if ( e.preventDefault ) {
2119
2384
  e.preventDefault();
2120
- }
2385
+
2121
2386
  // otherwise set the returnValue property of the original event to false (IE)
2122
- e.returnValue = false;
2387
+ } else {
2388
+ e.returnValue = false;
2389
+ }
2123
2390
  },
2124
2391
  stopPropagation: function() {
2125
2392
  this.isPropagationStopped = returnTrue;
@@ -2202,6 +2469,7 @@ if ( !jQuery.support.submitBubbles ) {
2202
2469
  var elem = e.target, type = elem.type;
2203
2470
 
2204
2471
  if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
2472
+ e.liveFired = undefined;
2205
2473
  return trigger( "submit", this, arguments );
2206
2474
  }
2207
2475
  });
@@ -2210,6 +2478,7 @@ if ( !jQuery.support.submitBubbles ) {
2210
2478
  var elem = e.target, type = elem.type;
2211
2479
 
2212
2480
  if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
2481
+ e.liveFired = undefined;
2213
2482
  return trigger( "submit", this, arguments );
2214
2483
  }
2215
2484
  });
@@ -2229,9 +2498,7 @@ if ( !jQuery.support.submitBubbles ) {
2229
2498
  // change delegation, happens here so we have bind.
2230
2499
  if ( !jQuery.support.changeBubbles ) {
2231
2500
 
2232
- var formElems = /textarea|input|select/i,
2233
-
2234
- changeFilters,
2501
+ var changeFilters,
2235
2502
 
2236
2503
  getVal = function( elem ) {
2237
2504
  var type = elem.type, val = elem.value;
@@ -2256,7 +2523,7 @@ if ( !jQuery.support.changeBubbles ) {
2256
2523
  testChange = function testChange( e ) {
2257
2524
  var elem = e.target, data, val;
2258
2525
 
2259
- if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
2526
+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
2260
2527
  return;
2261
2528
  }
2262
2529
 
@@ -2274,6 +2541,7 @@ if ( !jQuery.support.changeBubbles ) {
2274
2541
 
2275
2542
  if ( data != null || val ) {
2276
2543
  e.type = "change";
2544
+ e.liveFired = undefined;
2277
2545
  return jQuery.event.trigger( e, arguments[1], elem );
2278
2546
  }
2279
2547
  };
@@ -2282,6 +2550,8 @@ if ( !jQuery.support.changeBubbles ) {
2282
2550
  filters: {
2283
2551
  focusout: testChange,
2284
2552
 
2553
+ beforedeactivate: testChange,
2554
+
2285
2555
  click: function( e ) {
2286
2556
  var elem = e.target, type = elem.type;
2287
2557
 
@@ -2304,7 +2574,7 @@ if ( !jQuery.support.changeBubbles ) {
2304
2574
 
2305
2575
  // Beforeactivate happens also before the previous element is blurred
2306
2576
  // with this event you can't trigger a change event, but you can store
2307
- // information/focus[in] is not needed anymore
2577
+ // information
2308
2578
  beforeactivate: function( e ) {
2309
2579
  var elem = e.target;
2310
2580
  jQuery.data( elem, "_change_data", getVal(elem) );
@@ -2320,17 +2590,20 @@ if ( !jQuery.support.changeBubbles ) {
2320
2590
  jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
2321
2591
  }
2322
2592
 
2323
- return formElems.test( this.nodeName );
2593
+ return rformElems.test( this.nodeName );
2324
2594
  },
2325
2595
 
2326
2596
  teardown: function( namespaces ) {
2327
2597
  jQuery.event.remove( this, ".specialChange" );
2328
2598
 
2329
- return formElems.test( this.nodeName );
2599
+ return rformElems.test( this.nodeName );
2330
2600
  }
2331
2601
  };
2332
2602
 
2333
2603
  changeFilters = jQuery.event.special.change.filters;
2604
+
2605
+ // Handle when the input is .focus()'d
2606
+ changeFilters.focus = changeFilters.beforeactivate;
2334
2607
  }
2335
2608
 
2336
2609
  function trigger( type, elem, args ) {
@@ -2343,17 +2616,21 @@ if ( document.addEventListener ) {
2343
2616
  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2344
2617
  jQuery.event.special[ fix ] = {
2345
2618
  setup: function() {
2346
- this.addEventListener( orig, handler, true );
2619
+ if ( focusCounts[fix]++ === 0 ) {
2620
+ document.addEventListener( orig, handler, true );
2621
+ }
2347
2622
  },
2348
2623
  teardown: function() {
2349
- this.removeEventListener( orig, handler, true );
2624
+ if ( --focusCounts[fix] === 0 ) {
2625
+ document.removeEventListener( orig, handler, true );
2626
+ }
2350
2627
  }
2351
2628
  };
2352
2629
 
2353
2630
  function handler( e ) {
2354
2631
  e = jQuery.event.fix( e );
2355
2632
  e.type = fix;
2356
- return jQuery.event.handle.call( this, e );
2633
+ return jQuery.event.trigger( e, null, e.target );
2357
2634
  }
2358
2635
  });
2359
2636
  }
@@ -2368,7 +2645,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
2368
2645
  return this;
2369
2646
  }
2370
2647
 
2371
- if ( jQuery.isFunction( data ) ) {
2648
+ if ( jQuery.isFunction( data ) || data === false ) {
2372
2649
  fn = data;
2373
2650
  data = undefined;
2374
2651
  }
@@ -2476,6 +2753,14 @@ jQuery.each(["live", "die"], function( i, name ) {
2476
2753
  var type, i = 0, match, namespaces, preType,
2477
2754
  selector = origSelector || this.selector,
2478
2755
  context = origSelector ? this : jQuery( this.context );
2756
+
2757
+ if ( typeof types === "object" && !types.preventDefault ) {
2758
+ for ( var key in types ) {
2759
+ context[ name ]( key, data, types[key], selector );
2760
+ }
2761
+
2762
+ return this;
2763
+ }
2479
2764
 
2480
2765
  if ( jQuery.isFunction( data ) ) {
2481
2766
  fn = data;
@@ -2510,31 +2795,39 @@ jQuery.each(["live", "die"], function( i, name ) {
2510
2795
 
2511
2796
  if ( name === "live" ) {
2512
2797
  // bind live handler
2513
- context.each(function(){
2514
- jQuery.event.add( this, liveConvert( type, selector ),
2798
+ for ( var j = 0, l = context.length; j < l; j++ ) {
2799
+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
2515
2800
  { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
2516
- });
2801
+ }
2517
2802
 
2518
2803
  } else {
2519
2804
  // unbind live handler
2520
- context.unbind( liveConvert( type, selector ), fn );
2805
+ context.unbind( "live." + liveConvert( type, selector ), fn );
2521
2806
  }
2522
2807
  }
2523
2808
 
2524
2809
  return this;
2525
- }
2810
+ };
2526
2811
  });
2527
2812
 
2528
2813
  function liveHandler( event ) {
2529
- var stop, elems = [], selectors = [], args = arguments,
2530
- related, match, handleObj, elem, j, i, l, data,
2531
- events = jQuery.data( this, "events" );
2814
+ var stop, maxLevel, elems = [], selectors = [],
2815
+ related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
2816
+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
2817
+
2818
+ if ( typeof events === "function" ) {
2819
+ events = events.events;
2820
+ }
2532
2821
 
2533
2822
  // Make sure we avoid non-left-click bubbling in Firefox (#3861)
2534
2823
  if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
2535
2824
  return;
2536
2825
  }
2537
2826
 
2827
+ if ( event.namespace ) {
2828
+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
2829
+ }
2830
+
2538
2831
  event.liveFired = this;
2539
2832
 
2540
2833
  var live = events.live.slice(0);
@@ -2553,20 +2846,23 @@ function liveHandler( event ) {
2553
2846
  match = jQuery( event.target ).closest( selectors, event.currentTarget );
2554
2847
 
2555
2848
  for ( i = 0, l = match.length; i < l; i++ ) {
2849
+ close = match[i];
2850
+
2556
2851
  for ( j = 0; j < live.length; j++ ) {
2557
2852
  handleObj = live[j];
2558
2853
 
2559
- if ( match[i].selector === handleObj.selector ) {
2560
- elem = match[i].elem;
2854
+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
2855
+ elem = close.elem;
2561
2856
  related = null;
2562
2857
 
2563
2858
  // Those two events require additional checking
2564
2859
  if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
2860
+ event.type = handleObj.preType;
2565
2861
  related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
2566
2862
  }
2567
2863
 
2568
2864
  if ( !related || related !== elem ) {
2569
- elems.push({ elem: elem, handleObj: handleObj });
2865
+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
2570
2866
  }
2571
2867
  }
2572
2868
  }
@@ -2574,13 +2870,23 @@ function liveHandler( event ) {
2574
2870
 
2575
2871
  for ( i = 0, l = elems.length; i < l; i++ ) {
2576
2872
  match = elems[i];
2873
+
2874
+ if ( maxLevel && match.level > maxLevel ) {
2875
+ break;
2876
+ }
2877
+
2577
2878
  event.currentTarget = match.elem;
2578
2879
  event.data = match.handleObj.data;
2579
2880
  event.handleObj = match.handleObj;
2580
2881
 
2581
- if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
2582
- stop = false;
2583
- break;
2882
+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
2883
+
2884
+ if ( ret === false || event.isPropagationStopped() ) {
2885
+ maxLevel = match.level;
2886
+
2887
+ if ( ret === false ) {
2888
+ stop = false;
2889
+ }
2584
2890
  }
2585
2891
  }
2586
2892
 
@@ -2588,7 +2894,7 @@ function liveHandler( event ) {
2588
2894
  }
2589
2895
 
2590
2896
  function liveConvert( type, selector ) {
2591
- return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
2897
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
2592
2898
  }
2593
2899
 
2594
2900
  jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
@@ -2596,8 +2902,15 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
2596
2902
  "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
2597
2903
 
2598
2904
  // Handle event binding
2599
- jQuery.fn[ name ] = function( fn ) {
2600
- return fn ? this.bind( name, fn ) : this.trigger( name );
2905
+ jQuery.fn[ name ] = function( data, fn ) {
2906
+ if ( fn == null ) {
2907
+ fn = data;
2908
+ data = null;
2909
+ }
2910
+
2911
+ return arguments.length > 0 ?
2912
+ this.bind( name, data, fn ) :
2913
+ this.trigger( name );
2601
2914
  };
2602
2915
 
2603
2916
  if ( jQuery.attrFn ) {
@@ -2610,7 +2923,7 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
2610
2923
  // More info:
2611
2924
  // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
2612
2925
  if ( window.attachEvent && !window.addEventListener ) {
2613
- window.attachEvent("onunload", function() {
2926
+ jQuery(window).bind("unload", function() {
2614
2927
  for ( var id in jQuery.cache ) {
2615
2928
  if ( jQuery.cache[ id ].handle ) {
2616
2929
  // Try/Catch is to handle iframes being unloaded, see #4280
@@ -2621,6 +2934,8 @@ if ( window.attachEvent && !window.addEventListener ) {
2621
2934
  }
2622
2935
  });
2623
2936
  }
2937
+
2938
+
2624
2939
  /*!
2625
2940
  * Sizzle CSS Selector Engine - v1.0
2626
2941
  * Copyright 2009, The Dojo Foundation
@@ -2629,7 +2944,7 @@ if ( window.attachEvent && !window.addEventListener ) {
2629
2944
  */
2630
2945
  (function(){
2631
2946
 
2632
- var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
2947
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
2633
2948
  done = 0,
2634
2949
  toString = Object.prototype.toString,
2635
2950
  hasDuplicate = false,
@@ -2646,7 +2961,9 @@ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^
2646
2961
 
2647
2962
  var Sizzle = function(selector, context, results, seed) {
2648
2963
  results = results || [];
2649
- var origContext = context = context || document;
2964
+ context = context || document;
2965
+
2966
+ var origContext = context;
2650
2967
 
2651
2968
  if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
2652
2969
  return [];
@@ -2656,20 +2973,25 @@ var Sizzle = function(selector, context, results, seed) {
2656
2973
  return results;
2657
2974
  }
2658
2975
 
2659
- var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
2660
- soFar = selector;
2976
+ var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
2977
+ soFar = selector, ret, cur, pop, i;
2661
2978
 
2662
2979
  // Reset the position of the chunker regexp (start from head)
2663
- while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
2664
- soFar = m[3];
2980
+ do {
2981
+ chunker.exec("");
2982
+ m = chunker.exec(soFar);
2983
+
2984
+ if ( m ) {
2985
+ soFar = m[3];
2665
2986
 
2666
- parts.push( m[1] );
2987
+ parts.push( m[1] );
2667
2988
 
2668
- if ( m[2] ) {
2669
- extra = m[3];
2670
- break;
2989
+ if ( m[2] ) {
2990
+ extra = m[3];
2991
+ break;
2992
+ }
2671
2993
  }
2672
- }
2994
+ } while ( m );
2673
2995
 
2674
2996
  if ( parts.length > 1 && origPOS.exec( selector ) ) {
2675
2997
  if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
@@ -2694,12 +3016,12 @@ var Sizzle = function(selector, context, results, seed) {
2694
3016
  // (but not if it'll be faster if the inner selector is an ID)
2695
3017
  if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
2696
3018
  Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
2697
- var ret = Sizzle.find( parts.shift(), context, contextXML );
3019
+ ret = Sizzle.find( parts.shift(), context, contextXML );
2698
3020
  context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
2699
3021
  }
2700
3022
 
2701
3023
  if ( context ) {
2702
- var ret = seed ?
3024
+ ret = seed ?
2703
3025
  { expr: parts.pop(), set: makeArray(seed) } :
2704
3026
  Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
2705
3027
  set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
@@ -2711,7 +3033,8 @@ var Sizzle = function(selector, context, results, seed) {
2711
3033
  }
2712
3034
 
2713
3035
  while ( parts.length ) {
2714
- var cur = parts.pop(), pop = cur;
3036
+ cur = parts.pop();
3037
+ pop = cur;
2715
3038
 
2716
3039
  if ( !Expr.relative[ cur ] ) {
2717
3040
  cur = "";
@@ -2742,13 +3065,13 @@ var Sizzle = function(selector, context, results, seed) {
2742
3065
  if ( !prune ) {
2743
3066
  results.push.apply( results, checkSet );
2744
3067
  } else if ( context && context.nodeType === 1 ) {
2745
- for ( var i = 0; checkSet[i] != null; i++ ) {
2746
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
3068
+ for ( i = 0; checkSet[i] != null; i++ ) {
3069
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
2747
3070
  results.push( set[i] );
2748
3071
  }
2749
3072
  }
2750
3073
  } else {
2751
- for ( var i = 0; checkSet[i] != null; i++ ) {
3074
+ for ( i = 0; checkSet[i] != null; i++ ) {
2752
3075
  if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
2753
3076
  results.push( set[i] );
2754
3077
  }
@@ -2787,8 +3110,12 @@ Sizzle.matches = function(expr, set){
2787
3110
  return Sizzle(expr, null, null, set);
2788
3111
  };
2789
3112
 
3113
+ Sizzle.matchesSelector = function(node, expr){
3114
+ return Sizzle(expr, null, null, [node]).length > 0;
3115
+ };
3116
+
2790
3117
  Sizzle.find = function(expr, context, isXML){
2791
- var set, match;
3118
+ var set;
2792
3119
 
2793
3120
  if ( !expr ) {
2794
3121
  return [];
@@ -2821,7 +3148,7 @@ Sizzle.find = function(expr, context, isXML){
2821
3148
 
2822
3149
  Sizzle.filter = function(expr, set, inplace, not){
2823
3150
  var old = expr, result = [], curLoop = set, match, anyFound,
2824
- isXMLFilter = set && set[0] && isXML(set[0]);
3151
+ isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);
2825
3152
 
2826
3153
  while ( expr && set.length ) {
2827
3154
  for ( var type in Expr.filter ) {
@@ -2907,14 +3234,14 @@ Sizzle.error = function( msg ) {
2907
3234
  var Expr = Sizzle.selectors = {
2908
3235
  order: [ "ID", "NAME", "TAG" ],
2909
3236
  match: {
2910
- ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
2911
- CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
2912
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
2913
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
2914
- TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
2915
- CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
2916
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
2917
- PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
3237
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3238
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3239
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3240
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
3241
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3242
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
3243
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
3244
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
2918
3245
  },
2919
3246
  leftMatch: {},
2920
3247
  attrMap: {
@@ -2951,21 +3278,22 @@ var Expr = Sizzle.selectors = {
2951
3278
  }
2952
3279
  },
2953
3280
  ">": function(checkSet, part){
2954
- var isPartStr = typeof part === "string";
3281
+ var isPartStr = typeof part === "string",
3282
+ elem, i = 0, l = checkSet.length;
2955
3283
 
2956
3284
  if ( isPartStr && !/\W/.test(part) ) {
2957
3285
  part = part.toLowerCase();
2958
3286
 
2959
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2960
- var elem = checkSet[i];
3287
+ for ( ; i < l; i++ ) {
3288
+ elem = checkSet[i];
2961
3289
  if ( elem ) {
2962
3290
  var parent = elem.parentNode;
2963
3291
  checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
2964
3292
  }
2965
3293
  }
2966
3294
  } else {
2967
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2968
- var elem = checkSet[i];
3295
+ for ( ; i < l; i++ ) {
3296
+ elem = checkSet[i];
2969
3297
  if ( elem ) {
2970
3298
  checkSet[i] = isPartStr ?
2971
3299
  elem.parentNode :
@@ -2979,20 +3307,22 @@ var Expr = Sizzle.selectors = {
2979
3307
  }
2980
3308
  },
2981
3309
  "": function(checkSet, part, isXML){
2982
- var doneName = done++, checkFn = dirCheck;
3310
+ var doneName = done++, checkFn = dirCheck, nodeCheck;
2983
3311
 
2984
3312
  if ( typeof part === "string" && !/\W/.test(part) ) {
2985
- var nodeCheck = part = part.toLowerCase();
3313
+ part = part.toLowerCase();
3314
+ nodeCheck = part;
2986
3315
  checkFn = dirNodeCheck;
2987
3316
  }
2988
3317
 
2989
3318
  checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
2990
3319
  },
2991
3320
  "~": function(checkSet, part, isXML){
2992
- var doneName = done++, checkFn = dirCheck;
3321
+ var doneName = done++, checkFn = dirCheck, nodeCheck;
2993
3322
 
2994
3323
  if ( typeof part === "string" && !/\W/.test(part) ) {
2995
- var nodeCheck = part = part.toLowerCase();
3324
+ part = part.toLowerCase();
3325
+ nodeCheck = part;
2996
3326
  checkFn = dirNodeCheck;
2997
3327
  }
2998
3328
 
@@ -3003,7 +3333,9 @@ var Expr = Sizzle.selectors = {
3003
3333
  ID: function(match, context, isXML){
3004
3334
  if ( typeof context.getElementById !== "undefined" && !isXML ) {
3005
3335
  var m = context.getElementById(match[1]);
3006
- return m ? [m] : [];
3336
+ // Check parentNode to catch when Blackberry 4.6 returns
3337
+ // nodes that are no longer in the document #6963
3338
+ return m && m.parentNode ? [m] : [];
3007
3339
  }
3008
3340
  },
3009
3341
  NAME: function(match, context){
@@ -3130,7 +3462,7 @@ var Expr = Sizzle.selectors = {
3130
3462
  return !!Sizzle( match[3], elem ).length;
3131
3463
  },
3132
3464
  header: function(elem){
3133
- return /h\d/i.test( elem.nodeName );
3465
+ return (/h\d/i).test( elem.nodeName );
3134
3466
  },
3135
3467
  text: function(elem){
3136
3468
  return "text" === elem.type;
@@ -3160,7 +3492,7 @@ var Expr = Sizzle.selectors = {
3160
3492
  return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
3161
3493
  },
3162
3494
  input: function(elem){
3163
- return /input|select|textarea|button/i.test(elem.nodeName);
3495
+ return (/input|select|textarea|button/i).test(elem.nodeName);
3164
3496
  }
3165
3497
  },
3166
3498
  setFilters: {
@@ -3196,12 +3528,12 @@ var Expr = Sizzle.selectors = {
3196
3528
  if ( filter ) {
3197
3529
  return filter( elem, i, match, array );
3198
3530
  } else if ( name === "contains" ) {
3199
- return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
3531
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
3200
3532
  } else if ( name === "not" ) {
3201
3533
  var not = match[3];
3202
3534
 
3203
- for ( var i = 0, l = not.length; i < l; i++ ) {
3204
- if ( not[i] === elem ) {
3535
+ for ( var j = 0, l = not.length; j < l; j++ ) {
3536
+ if ( not[j] === elem ) {
3205
3537
  return false;
3206
3538
  }
3207
3539
  }
@@ -3311,13 +3643,14 @@ var Expr = Sizzle.selectors = {
3311
3643
  }
3312
3644
  };
3313
3645
 
3314
- var origPOS = Expr.match.POS;
3646
+ var origPOS = Expr.match.POS,
3647
+ fescape = function(all, num){
3648
+ return "\\" + (num - 0 + 1);
3649
+ };
3315
3650
 
3316
3651
  for ( var type in Expr.match ) {
3317
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
3318
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
3319
- return "\\" + (num - 0 + 1);
3320
- }));
3652
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
3653
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
3321
3654
  }
3322
3655
 
3323
3656
  var makeArray = function(array, results) {
@@ -3341,17 +3674,17 @@ try {
3341
3674
  // Provide a fallback method if it does not work
3342
3675
  } catch(e){
3343
3676
  makeArray = function(array, results) {
3344
- var ret = results || [];
3677
+ var ret = results || [], i = 0;
3345
3678
 
3346
3679
  if ( toString.call(array) === "[object Array]" ) {
3347
3680
  Array.prototype.push.apply( ret, array );
3348
3681
  } else {
3349
3682
  if ( typeof array.length === "number" ) {
3350
- for ( var i = 0, l = array.length; i < l; i++ ) {
3683
+ for ( var l = array.length; i < l; i++ ) {
3351
3684
  ret.push( array[i] );
3352
3685
  }
3353
3686
  } else {
3354
- for ( var i = 0; array[i]; i++ ) {
3687
+ for ( ; array[i]; i++ ) {
3355
3688
  ret.push( array[i] );
3356
3689
  }
3357
3690
  }
@@ -3361,65 +3694,97 @@ try {
3361
3694
  };
3362
3695
  }
3363
3696
 
3364
- var sortOrder;
3697
+ var sortOrder, siblingCheck;
3365
3698
 
3366
3699
  if ( document.documentElement.compareDocumentPosition ) {
3367
3700
  sortOrder = function( a, b ) {
3701
+ if ( a === b ) {
3702
+ hasDuplicate = true;
3703
+ return 0;
3704
+ }
3705
+
3368
3706
  if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
3369
- if ( a == b ) {
3370
- hasDuplicate = true;
3371
- }
3372
3707
  return a.compareDocumentPosition ? -1 : 1;
3373
3708
  }
3374
3709
 
3375
- var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
3376
- if ( ret === 0 ) {
3377
- hasDuplicate = true;
3378
- }
3379
- return ret;
3710
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
3380
3711
  };
3381
- } else if ( "sourceIndex" in document.documentElement ) {
3712
+ } else {
3382
3713
  sortOrder = function( a, b ) {
3383
- if ( !a.sourceIndex || !b.sourceIndex ) {
3384
- if ( a == b ) {
3385
- hasDuplicate = true;
3386
- }
3387
- return a.sourceIndex ? -1 : 1;
3388
- }
3714
+ var ap = [], bp = [], aup = a.parentNode, bup = b.parentNode,
3715
+ cur = aup, al, bl;
3389
3716
 
3390
- var ret = a.sourceIndex - b.sourceIndex;
3391
- if ( ret === 0 ) {
3717
+ // The nodes are identical, we can exit early
3718
+ if ( a === b ) {
3392
3719
  hasDuplicate = true;
3720
+ return 0;
3721
+
3722
+ // If the nodes are siblings (or identical) we can do a quick check
3723
+ } else if ( aup === bup ) {
3724
+ return siblingCheck( a, b );
3725
+
3726
+ // If no parents were found then the nodes are disconnected
3727
+ } else if ( !aup ) {
3728
+ return -1;
3729
+
3730
+ } else if ( !bup ) {
3731
+ return 1;
3393
3732
  }
3394
- return ret;
3395
- };
3396
- } else if ( document.createRange ) {
3397
- sortOrder = function( a, b ) {
3398
- if ( !a.ownerDocument || !b.ownerDocument ) {
3399
- if ( a == b ) {
3400
- hasDuplicate = true;
3401
- }
3402
- return a.ownerDocument ? -1 : 1;
3733
+
3734
+ // Otherwise they're somewhere else in the tree so we need
3735
+ // to build up a full list of the parentNodes for comparison
3736
+ while ( cur ) {
3737
+ ap.unshift( cur );
3738
+ cur = cur.parentNode;
3403
3739
  }
3404
3740
 
3405
- var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
3406
- aRange.setStart(a, 0);
3407
- aRange.setEnd(a, 0);
3408
- bRange.setStart(b, 0);
3409
- bRange.setEnd(b, 0);
3410
- var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
3411
- if ( ret === 0 ) {
3412
- hasDuplicate = true;
3741
+ cur = bup;
3742
+
3743
+ while ( cur ) {
3744
+ bp.unshift( cur );
3745
+ cur = cur.parentNode;
3413
3746
  }
3414
- return ret;
3415
- };
3416
- }
3417
3747
 
3418
- // Utility function for retreiving the text value of an array of DOM nodes
3419
- function getText( elems ) {
3420
- var ret = "", elem;
3748
+ al = ap.length;
3749
+ bl = bp.length;
3421
3750
 
3422
- for ( var i = 0; elems[i]; i++ ) {
3751
+ // Start walking down the tree looking for a discrepancy
3752
+ for ( var i = 0; i < al && i < bl; i++ ) {
3753
+ if ( ap[i] !== bp[i] ) {
3754
+ return siblingCheck( ap[i], bp[i] );
3755
+ }
3756
+ }
3757
+
3758
+ // We ended someplace up the tree so do a sibling check
3759
+ return i === al ?
3760
+ siblingCheck( a, bp[i], -1 ) :
3761
+ siblingCheck( ap[i], b, 1 );
3762
+ };
3763
+
3764
+ siblingCheck = function( a, b, ret ) {
3765
+ if ( a === b ) {
3766
+ return ret;
3767
+ }
3768
+
3769
+ var cur = a.nextSibling;
3770
+
3771
+ while ( cur ) {
3772
+ if ( cur === b ) {
3773
+ return -1;
3774
+ }
3775
+
3776
+ cur = cur.nextSibling;
3777
+ }
3778
+
3779
+ return 1;
3780
+ };
3781
+ }
3782
+
3783
+ // Utility function for retreiving the text value of an array of DOM nodes
3784
+ Sizzle.getText = function( elems ) {
3785
+ var ret = "", elem;
3786
+
3787
+ for ( var i = 0; elems[i]; i++ ) {
3423
3788
  elem = elems[i];
3424
3789
 
3425
3790
  // Get the text from text nodes and CDATA nodes
@@ -3428,19 +3793,19 @@ function getText( elems ) {
3428
3793
 
3429
3794
  // Traverse everything else, except comment nodes
3430
3795
  } else if ( elem.nodeType !== 8 ) {
3431
- ret += getText( elem.childNodes );
3796
+ ret += Sizzle.getText( elem.childNodes );
3432
3797
  }
3433
3798
  }
3434
3799
 
3435
3800
  return ret;
3436
- }
3801
+ };
3437
3802
 
3438
3803
  // Check to see if the browser returns elements by name when
3439
3804
  // querying by getElementById (and provide a workaround)
3440
3805
  (function(){
3441
3806
  // We're going to inject a fake input element with a specified name
3442
3807
  var form = document.createElement("div"),
3443
- id = "script" + (new Date).getTime();
3808
+ id = "script" + (new Date()).getTime();
3444
3809
  form.innerHTML = "<a name='" + id + "'/>";
3445
3810
 
3446
3811
  // Inject it into the root element, check its status, and remove it quickly
@@ -3525,10 +3890,32 @@ if ( document.querySelectorAll ) {
3525
3890
 
3526
3891
  // Only use querySelectorAll on non-XML documents
3527
3892
  // (ID selectors don't work in non-HTML documents)
3528
- if ( !seed && context.nodeType === 9 && !isXML(context) ) {
3529
- try {
3530
- return makeArray( context.querySelectorAll(query), extra );
3531
- } catch(e){}
3893
+ if ( !seed && !Sizzle.isXML(context) ) {
3894
+ if ( context.nodeType === 9 ) {
3895
+ try {
3896
+ return makeArray( context.querySelectorAll(query), extra );
3897
+ } catch(qsaError) {}
3898
+
3899
+ // qSA works strangely on Element-rooted queries
3900
+ // We can work around this by specifying an extra ID on the root
3901
+ // and working up from there (Thanks to Andrew Dupont for the technique)
3902
+ // IE 8 doesn't work on object elements
3903
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
3904
+ var old = context.id, id = context.id = "__sizzle__";
3905
+
3906
+ try {
3907
+ return makeArray( context.querySelectorAll( "#" + id + " " + query ), extra );
3908
+
3909
+ } catch(pseudoError) {
3910
+ } finally {
3911
+ if ( old ) {
3912
+ context.id = old;
3913
+
3914
+ } else {
3915
+ context.removeAttribute( "id" );
3916
+ }
3917
+ }
3918
+ }
3532
3919
  }
3533
3920
 
3534
3921
  return oldSizzle(query, context, extra, seed);
@@ -3542,6 +3929,33 @@ if ( document.querySelectorAll ) {
3542
3929
  })();
3543
3930
  }
3544
3931
 
3932
+ (function(){
3933
+ var html = document.documentElement,
3934
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
3935
+ pseudoWorks = false;
3936
+
3937
+ try {
3938
+ // This should fail with an exception
3939
+ // Gecko does not error, returns false instead
3940
+ matches.call( document.documentElement, ":sizzle" );
3941
+
3942
+ } catch( pseudoError ) {
3943
+ pseudoWorks = true;
3944
+ }
3945
+
3946
+ if ( matches ) {
3947
+ Sizzle.matchesSelector = function( node, expr ) {
3948
+ try {
3949
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) ) {
3950
+ return matches.call( node, expr );
3951
+ }
3952
+ } catch(e) {}
3953
+
3954
+ return Sizzle(expr, null, null, [node]).length > 0;
3955
+ };
3956
+ }
3957
+ })();
3958
+
3545
3959
  (function(){
3546
3960
  var div = document.createElement("div");
3547
3961
 
@@ -3639,13 +4053,13 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
3639
4053
  }
3640
4054
  }
3641
4055
 
3642
- var contains = document.compareDocumentPosition ? function(a, b){
3643
- return !!(a.compareDocumentPosition(b) & 16);
3644
- } : function(a, b){
4056
+ Sizzle.contains = document.documentElement.contains ? function(a, b){
3645
4057
  return a !== b && (a.contains ? a.contains(b) : true);
4058
+ } : function(a, b){
4059
+ return !!(a.compareDocumentPosition(b) & 16);
3646
4060
  };
3647
4061
 
3648
- var isXML = function(elem){
4062
+ Sizzle.isXML = function(elem){
3649
4063
  // documentElement is verified for cases where it doesn't yet exist
3650
4064
  // (such as loading iframes in IE - #4833)
3651
4065
  var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
@@ -3677,49 +4091,21 @@ jQuery.find = Sizzle;
3677
4091
  jQuery.expr = Sizzle.selectors;
3678
4092
  jQuery.expr[":"] = jQuery.expr.filters;
3679
4093
  jQuery.unique = Sizzle.uniqueSort;
3680
- jQuery.text = getText;
3681
- jQuery.isXMLDoc = isXML;
3682
- jQuery.contains = contains;
4094
+ jQuery.text = Sizzle.getText;
4095
+ jQuery.isXMLDoc = Sizzle.isXML;
4096
+ jQuery.contains = Sizzle.contains;
3683
4097
 
3684
- return;
3685
-
3686
- window.Sizzle = Sizzle;
3687
4098
 
3688
4099
  })();
4100
+
4101
+
3689
4102
  var runtil = /Until$/,
3690
4103
  rparentsprev = /^(?:parents|prevUntil|prevAll)/,
3691
4104
  // Note: This RegExp should be improved, or likely pulled from Sizzle
3692
4105
  rmultiselector = /,/,
3693
- slice = Array.prototype.slice;
3694
-
3695
- // Implement the identical functionality for filter and not
3696
- var winnow = function( elements, qualifier, keep ) {
3697
- if ( jQuery.isFunction( qualifier ) ) {
3698
- return jQuery.grep(elements, function( elem, i ) {
3699
- return !!qualifier.call( elem, i, elem ) === keep;
3700
- });
3701
-
3702
- } else if ( qualifier.nodeType ) {
3703
- return jQuery.grep(elements, function( elem, i ) {
3704
- return (elem === qualifier) === keep;
3705
- });
3706
-
3707
- } else if ( typeof qualifier === "string" ) {
3708
- var filtered = jQuery.grep(elements, function( elem ) {
3709
- return elem.nodeType === 1;
3710
- });
3711
-
3712
- if ( isSimple.test( qualifier ) ) {
3713
- return jQuery.filter(qualifier, filtered, !keep);
3714
- } else {
3715
- qualifier = jQuery.filter( qualifier, filtered );
3716
- }
3717
- }
3718
-
3719
- return jQuery.grep(elements, function( elem, i ) {
3720
- return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
3721
- });
3722
- };
4106
+ isSimple = /^.[^:#\[\.,]*$/,
4107
+ slice = Array.prototype.slice,
4108
+ POS = jQuery.expr.match.POS;
3723
4109
 
3724
4110
  jQuery.fn.extend({
3725
4111
  find: function( selector ) {
@@ -3769,11 +4155,13 @@ jQuery.fn.extend({
3769
4155
  },
3770
4156
 
3771
4157
  closest: function( selectors, context ) {
4158
+ var ret = [], i, l, cur = this[0];
4159
+
3772
4160
  if ( jQuery.isArray( selectors ) ) {
3773
- var ret = [], cur = this[0], match, matches = {}, selector;
4161
+ var match, matches = {}, selector, level = 1;
3774
4162
 
3775
4163
  if ( cur && selectors.length ) {
3776
- for ( var i = 0, l = selectors.length; i < l; i++ ) {
4164
+ for ( i = 0, l = selectors.length; i < l; i++ ) {
3777
4165
  selector = selectors[i];
3778
4166
 
3779
4167
  if ( !matches[selector] ) {
@@ -3788,29 +4176,41 @@ jQuery.fn.extend({
3788
4176
  match = matches[selector];
3789
4177
 
3790
4178
  if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
3791
- ret.push({ selector: selector, elem: cur });
3792
- delete matches[selector];
4179
+ ret.push({ selector: selector, elem: cur, level: level });
3793
4180
  }
3794
4181
  }
4182
+
3795
4183
  cur = cur.parentNode;
4184
+ level++;
3796
4185
  }
3797
4186
  }
3798
4187
 
3799
4188
  return ret;
3800
4189
  }
3801
4190
 
3802
- var pos = jQuery.expr.match.POS.test( selectors ) ?
4191
+ var pos = POS.test( selectors ) ?
3803
4192
  jQuery( selectors, context || this.context ) : null;
3804
4193
 
3805
- return this.map(function( i, cur ) {
3806
- while ( cur && cur.ownerDocument && cur !== context ) {
3807
- if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
3808
- return cur;
4194
+ for ( i = 0, l = this.length; i < l; i++ ) {
4195
+ cur = this[i];
4196
+
4197
+ while ( cur ) {
4198
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
4199
+ ret.push( cur );
4200
+ break;
4201
+
4202
+ } else {
4203
+ cur = cur.parentNode;
4204
+ if ( !cur || !cur.ownerDocument || cur === context ) {
4205
+ break;
4206
+ }
3809
4207
  }
3810
- cur = cur.parentNode;
3811
4208
  }
3812
- return null;
3813
- });
4209
+ }
4210
+
4211
+ ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4212
+
4213
+ return this.pushStack( ret, "closest", selectors );
3814
4214
  },
3815
4215
 
3816
4216
  // Determine the position of an element within
@@ -3918,7 +4318,9 @@ jQuery.extend({
3918
4318
  expr = ":not(" + expr + ")";
3919
4319
  }
3920
4320
 
3921
- return jQuery.find.matches(expr, elems);
4321
+ return elems.length === 1 ?
4322
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
4323
+ jQuery.find.matches(expr, elems);
3922
4324
  },
3923
4325
 
3924
4326
  dir: function( elem, dir, until ) {
@@ -3957,20 +4359,49 @@ jQuery.extend({
3957
4359
  return r;
3958
4360
  }
3959
4361
  });
4362
+
4363
+ // Implement the identical functionality for filter and not
4364
+ function winnow( elements, qualifier, keep ) {
4365
+ if ( jQuery.isFunction( qualifier ) ) {
4366
+ return jQuery.grep(elements, function( elem, i ) {
4367
+ var retVal = !!qualifier.call( elem, i, elem );
4368
+ return retVal === keep;
4369
+ });
4370
+
4371
+ } else if ( qualifier.nodeType ) {
4372
+ return jQuery.grep(elements, function( elem, i ) {
4373
+ return (elem === qualifier) === keep;
4374
+ });
4375
+
4376
+ } else if ( typeof qualifier === "string" ) {
4377
+ var filtered = jQuery.grep(elements, function( elem ) {
4378
+ return elem.nodeType === 1;
4379
+ });
4380
+
4381
+ if ( isSimple.test( qualifier ) ) {
4382
+ return jQuery.filter(qualifier, filtered, !keep);
4383
+ } else {
4384
+ qualifier = jQuery.filter( qualifier, filtered );
4385
+ }
4386
+ }
4387
+
4388
+ return jQuery.grep(elements, function( elem, i ) {
4389
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
4390
+ });
4391
+ }
4392
+
4393
+
4394
+
4395
+
3960
4396
  var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
3961
4397
  rleadingWhitespace = /^\s+/,
3962
- rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
3963
- rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
4398
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
3964
4399
  rtagName = /<([\w:]+)/,
3965
4400
  rtbody = /<tbody/i,
3966
4401
  rhtml = /<|&#?\w+;/,
3967
- rnocache = /<script|<object|<embed|<option|<style/i,
4402
+ rnocache = /<(?:script|object|embed|option|style)/i,
3968
4403
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
3969
- fcloseTag = function( all, front, tag ) {
3970
- return rselfClosing.test( tag ) ?
3971
- all :
3972
- front + "></" + tag + ">";
3973
- },
4404
+ raction = /\=([^="'>\s]+\/)>/g,
3974
4405
  wrapMap = {
3975
4406
  option: [ 1, "<select multiple='multiple'>", "</select>" ],
3976
4407
  legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -4164,7 +4595,7 @@ jQuery.fn.extend({
4164
4595
 
4165
4596
  return jQuery.clean([html.replace(rinlinejQuery, "")
4166
4597
  // Handle the case in IE 8 where action=/test/> self-closes a tag
4167
- .replace(/=([^="'>\s]+\/)>/g, '="$1">')
4598
+ .replace(raction, '="$1">')
4168
4599
  .replace(rleadingWhitespace, "")], ownerDocument)[0];
4169
4600
  } else {
4170
4601
  return this.cloneNode(true);
@@ -4192,7 +4623,7 @@ jQuery.fn.extend({
4192
4623
  (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
4193
4624
  !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
4194
4625
 
4195
- value = value.replace(rxhtmlTag, fcloseTag);
4626
+ value = value.replace(rxhtmlTag, "<$1></$2>");
4196
4627
 
4197
4628
  try {
4198
4629
  for ( var i = 0, l = this.length; i < l; i++ ) {
@@ -4210,10 +4641,8 @@ jQuery.fn.extend({
4210
4641
 
4211
4642
  } else if ( jQuery.isFunction( value ) ) {
4212
4643
  this.each(function(i){
4213
- var self = jQuery(this), old = self.html();
4214
- self.empty().append(function(){
4215
- return value.call( this, i, old );
4216
- });
4644
+ var self = jQuery(this);
4645
+ self.html( value.call(this, i, self.html()) );
4217
4646
  });
4218
4647
 
4219
4648
  } else {
@@ -4284,7 +4713,7 @@ jQuery.fn.extend({
4284
4713
  results = { fragment: parent };
4285
4714
 
4286
4715
  } else {
4287
- results = buildFragment( args, this, scripts );
4716
+ results = jQuery.buildFragment( args, this, scripts );
4288
4717
  }
4289
4718
 
4290
4719
  fragment = results.fragment;
@@ -4316,16 +4745,16 @@ jQuery.fn.extend({
4316
4745
  }
4317
4746
 
4318
4747
  return this;
4319
-
4320
- function root( elem, cur ) {
4321
- return jQuery.nodeName(elem, "table") ?
4322
- (elem.getElementsByTagName("tbody")[0] ||
4323
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
4324
- elem;
4325
- }
4326
4748
  }
4327
4749
  });
4328
4750
 
4751
+ function root( elem, cur ) {
4752
+ return jQuery.nodeName(elem, "table") ?
4753
+ (elem.getElementsByTagName("tbody")[0] ||
4754
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
4755
+ elem;
4756
+ }
4757
+
4329
4758
  function cloneCopyEvent(orig, ret) {
4330
4759
  var i = 0;
4331
4760
 
@@ -4349,7 +4778,7 @@ function cloneCopyEvent(orig, ret) {
4349
4778
  });
4350
4779
  }
4351
4780
 
4352
- function buildFragment( args, nodes, scripts ) {
4781
+ jQuery.buildFragment = function( args, nodes, scripts ) {
4353
4782
  var fragment, cacheable, cacheresults,
4354
4783
  doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
4355
4784
 
@@ -4379,7 +4808,7 @@ function buildFragment( args, nodes, scripts ) {
4379
4808
  }
4380
4809
 
4381
4810
  return { fragment: fragment, cacheable: cacheable };
4382
- }
4811
+ };
4383
4812
 
4384
4813
  jQuery.fragments = {};
4385
4814
 
@@ -4401,7 +4830,7 @@ jQuery.each({
4401
4830
  } else {
4402
4831
  for ( var i = 0, l = insert.length; i < l; i++ ) {
4403
4832
  var elems = (i > 0 ? this.clone(true) : this).get();
4404
- jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
4833
+ jQuery( insert[i] )[ original ]( elems );
4405
4834
  ret = ret.concat( elems );
4406
4835
  }
4407
4836
 
@@ -4436,7 +4865,7 @@ jQuery.extend({
4436
4865
 
4437
4866
  } else if ( typeof elem === "string" ) {
4438
4867
  // Fix "XHTML"-style tags in all browsers
4439
- elem = elem.replace(rxhtmlTag, fcloseTag);
4868
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
4440
4869
 
4441
4870
  // Trim whitespace, otherwise indexOf won't work as expected
4442
4871
  var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
@@ -4489,7 +4918,7 @@ jQuery.extend({
4489
4918
  }
4490
4919
 
4491
4920
  if ( fragment ) {
4492
- for ( var i = 0; ret[i]; i++ ) {
4921
+ for ( i = 0; ret[i]; i++ ) {
4493
4922
  if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
4494
4923
  scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
4495
4924
 
@@ -4511,18 +4940,22 @@ jQuery.extend({
4511
4940
  deleteExpando = jQuery.support.deleteExpando;
4512
4941
 
4513
4942
  for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
4943
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
4944
+ continue;
4945
+ }
4946
+
4514
4947
  id = elem[ jQuery.expando ];
4515
4948
 
4516
4949
  if ( id ) {
4517
4950
  data = cache[ id ];
4518
4951
 
4519
- if ( data.events ) {
4952
+ if ( data && data.events ) {
4520
4953
  for ( var type in data.events ) {
4521
4954
  if ( special[ type ] ) {
4522
4955
  jQuery.event.remove( elem, type );
4523
4956
 
4524
4957
  } else {
4525
- removeEvent( elem, type, data.handle );
4958
+ jQuery.removeEvent( elem, type, data.handle );
4526
4959
  }
4527
4960
  }
4528
4961
  }
@@ -4539,252 +4972,351 @@ jQuery.extend({
4539
4972
  }
4540
4973
  }
4541
4974
  });
4542
- // exclude the following css properties to add px
4543
- var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
4544
- ralpha = /alpha\([^)]*\)/,
4975
+
4976
+ function evalScript( i, elem ) {
4977
+ if ( elem.src ) {
4978
+ jQuery.ajax({
4979
+ url: elem.src,
4980
+ async: false,
4981
+ dataType: "script"
4982
+ });
4983
+ } else {
4984
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
4985
+ }
4986
+
4987
+ if ( elem.parentNode ) {
4988
+ elem.parentNode.removeChild( elem );
4989
+ }
4990
+ }
4991
+
4992
+
4993
+
4994
+
4995
+ var ralpha = /alpha\([^)]*\)/i,
4545
4996
  ropacity = /opacity=([^)]*)/,
4546
- rfloat = /float/i,
4547
4997
  rdashAlpha = /-([a-z])/ig,
4548
4998
  rupper = /([A-Z])/g,
4549
4999
  rnumpx = /^-?\d+(?:px)?$/i,
4550
5000
  rnum = /^-?\d/,
4551
5001
 
4552
- cssShow = { position: "absolute", visibility: "hidden", display:"block" },
5002
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
4553
5003
  cssWidth = [ "Left", "Right" ],
4554
5004
  cssHeight = [ "Top", "Bottom" ],
5005
+ curCSS,
4555
5006
 
4556
5007
  // cache check for defaultView.getComputedStyle
4557
5008
  getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
4558
- // normalize float css property
4559
- styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
5009
+
4560
5010
  fcamelCase = function( all, letter ) {
4561
5011
  return letter.toUpperCase();
4562
5012
  };
4563
5013
 
4564
5014
  jQuery.fn.css = function( name, value ) {
4565
- return access( this, name, value, true, function( elem, name, value ) {
4566
- if ( value === undefined ) {
4567
- return jQuery.curCSS( elem, name );
4568
- }
4569
-
4570
- if ( typeof value === "number" && !rexclude.test(name) ) {
4571
- value += "px";
4572
- }
5015
+ // Setting 'undefined' is a no-op
5016
+ if ( arguments.length === 2 && value === undefined ) {
5017
+ return this;
5018
+ }
4573
5019
 
4574
- jQuery.style( elem, name, value );
5020
+ return jQuery.access( this, name, value, true, function( elem, name, value ) {
5021
+ return value !== undefined ?
5022
+ jQuery.style( elem, name, value ) :
5023
+ jQuery.css( elem, name );
4575
5024
  });
4576
5025
  };
4577
5026
 
4578
5027
  jQuery.extend({
4579
- style: function( elem, name, value ) {
4580
- // don't set styles on text and comment nodes
4581
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
4582
- return undefined;
5028
+ // Add in style property hooks for overriding the default
5029
+ // behavior of getting and setting a style property
5030
+ cssHooks: {
5031
+ opacity: {
5032
+ get: function( elem, computed ) {
5033
+ if ( computed ) {
5034
+ // We should always get a number back from opacity
5035
+ var ret = curCSS( elem, "opacity", "opacity" );
5036
+ return ret === "" ? "1" : ret;
5037
+
5038
+ } else {
5039
+ return elem.style.opacity;
5040
+ }
5041
+ }
4583
5042
  }
5043
+ },
4584
5044
 
4585
- // ignore negative width and height values #1599
4586
- if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
4587
- value = undefined;
5045
+ // Exclude the following css properties to add px
5046
+ cssNumber: {
5047
+ "zIndex": true,
5048
+ "fontWeight": true,
5049
+ "opacity": true,
5050
+ "zoom": true,
5051
+ "lineHeight": true
5052
+ },
5053
+
5054
+ // Add in properties whose names you wish to fix before
5055
+ // setting or getting the value
5056
+ cssProps: {
5057
+ // normalize float css property
5058
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
5059
+ },
5060
+
5061
+ // Get and set the style property on a DOM Node
5062
+ style: function( elem, name, value, extra ) {
5063
+ // Don't set styles on text and comment nodes
5064
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
5065
+ return;
4588
5066
  }
4589
5067
 
4590
- var style = elem.style || elem, set = value !== undefined;
5068
+ // Make sure that we're working with the right name
5069
+ var ret, origName = jQuery.camelCase( name ),
5070
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
4591
5071
 
4592
- // IE uses filters for opacity
4593
- if ( !jQuery.support.opacity && name === "opacity" ) {
4594
- if ( set ) {
4595
- // IE has trouble with opacity if it does not have layout
4596
- // Force it by setting the zoom level
4597
- style.zoom = 1;
5072
+ name = jQuery.cssProps[ origName ] || origName;
4598
5073
 
4599
- // Set the alpha filter to set the opacity
4600
- var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
4601
- var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
4602
- style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
5074
+ // Check if we're setting a value
5075
+ if ( value !== undefined ) {
5076
+ // Make sure that NaN and null values aren't set. See: #7116
5077
+ if ( typeof value === "number" && isNaN( value ) || value == null ) {
5078
+ return;
4603
5079
  }
4604
5080
 
4605
- return style.filter && style.filter.indexOf("opacity=") >= 0 ?
4606
- (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
4607
- "";
4608
- }
5081
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
5082
+ if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
5083
+ value += "px";
5084
+ }
4609
5085
 
4610
- // Make sure we're using the right name for getting the float value
4611
- if ( rfloat.test( name ) ) {
4612
- name = styleFloat;
4613
- }
5086
+ // If a hook was provided, use that value, otherwise just set the specified value
5087
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
5088
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
5089
+ // Fixes bug #5509
5090
+ try {
5091
+ style[ name ] = value;
5092
+ } catch(e) {}
5093
+ }
4614
5094
 
4615
- name = name.replace(rdashAlpha, fcamelCase);
5095
+ } else {
5096
+ // If a hook was provided get the non-computed value from there
5097
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
5098
+ return ret;
5099
+ }
4616
5100
 
4617
- if ( set ) {
4618
- style[ name ] = value;
5101
+ // Otherwise just get the value from the style object
5102
+ return style[ name ];
4619
5103
  }
4620
-
4621
- return style[ name ];
4622
5104
  },
4623
5105
 
4624
- css: function( elem, name, force, extra ) {
4625
- if ( name === "width" || name === "height" ) {
4626
- var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
5106
+ css: function( elem, name, extra ) {
5107
+ // Make sure that we're working with the right name
5108
+ var ret, origName = jQuery.camelCase( name ),
5109
+ hooks = jQuery.cssHooks[ origName ];
4627
5110
 
4628
- function getWH() {
4629
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
5111
+ name = jQuery.cssProps[ origName ] || origName;
4630
5112
 
4631
- if ( extra === "border" ) {
4632
- return;
4633
- }
4634
-
4635
- jQuery.each( which, function() {
4636
- if ( !extra ) {
4637
- val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
4638
- }
5113
+ // If a hook was provided get the computed value from there
5114
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
5115
+ return ret;
4639
5116
 
4640
- if ( extra === "margin" ) {
4641
- val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
4642
- } else {
4643
- val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
4644
- }
4645
- });
4646
- }
5117
+ // Otherwise, if a way to get the computed value exists, use that
5118
+ } else if ( curCSS ) {
5119
+ return curCSS( elem, name, origName );
5120
+ }
5121
+ },
4647
5122
 
4648
- if ( elem.offsetWidth !== 0 ) {
4649
- getWH();
4650
- } else {
4651
- jQuery.swap( elem, props, getWH );
4652
- }
5123
+ // A method for quickly swapping in/out CSS properties to get correct calculations
5124
+ swap: function( elem, options, callback ) {
5125
+ var old = {};
4653
5126
 
4654
- return Math.max(0, Math.round(val));
5127
+ // Remember the old values, and insert the new ones
5128
+ for ( var name in options ) {
5129
+ old[ name ] = elem.style[ name ];
5130
+ elem.style[ name ] = options[ name ];
4655
5131
  }
4656
5132
 
4657
- return jQuery.curCSS( elem, name, force );
4658
- },
5133
+ callback.call( elem );
4659
5134
 
4660
- curCSS: function( elem, name, force ) {
4661
- var ret, style = elem.style, filter;
5135
+ // Revert the old values
5136
+ for ( name in options ) {
5137
+ elem.style[ name ] = old[ name ];
5138
+ }
5139
+ },
4662
5140
 
4663
- // IE uses filters for opacity
4664
- if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
4665
- ret = ropacity.test(elem.currentStyle.filter || "") ?
4666
- (parseFloat(RegExp.$1) / 100) + "" :
4667
- "";
5141
+ camelCase: function( string ) {
5142
+ return string.replace( rdashAlpha, fcamelCase );
5143
+ }
5144
+ });
4668
5145
 
4669
- return ret === "" ?
4670
- "1" :
4671
- ret;
4672
- }
5146
+ // DEPRECATED, Use jQuery.css() instead
5147
+ jQuery.curCSS = jQuery.css;
4673
5148
 
4674
- // Make sure we're using the right name for getting the float value
4675
- if ( rfloat.test( name ) ) {
4676
- name = styleFloat;
4677
- }
5149
+ jQuery.each(["height", "width"], function( i, name ) {
5150
+ jQuery.cssHooks[ name ] = {
5151
+ get: function( elem, computed, extra ) {
5152
+ var val;
4678
5153
 
4679
- if ( !force && style && style[ name ] ) {
4680
- ret = style[ name ];
5154
+ if ( computed ) {
5155
+ if ( elem.offsetWidth !== 0 ) {
5156
+ val = getWH( elem, name, extra );
4681
5157
 
4682
- } else if ( getComputedStyle ) {
5158
+ } else {
5159
+ jQuery.swap( elem, cssShow, function() {
5160
+ val = getWH( elem, name, extra );
5161
+ });
5162
+ }
4683
5163
 
4684
- // Only "float" is needed here
4685
- if ( rfloat.test( name ) ) {
4686
- name = "float";
5164
+ return val + "px";
4687
5165
  }
5166
+ },
4688
5167
 
4689
- name = name.replace( rupper, "-$1" ).toLowerCase();
5168
+ set: function( elem, value ) {
5169
+ if ( rnumpx.test( value ) ) {
5170
+ // ignore negative width and height values #1599
5171
+ value = parseFloat(value);
4690
5172
 
4691
- var defaultView = elem.ownerDocument.defaultView;
5173
+ if ( value >= 0 ) {
5174
+ return value + "px";
5175
+ }
4692
5176
 
4693
- if ( !defaultView ) {
4694
- return null;
5177
+ } else {
5178
+ return value;
4695
5179
  }
5180
+ }
5181
+ };
5182
+ });
4696
5183
 
4697
- var computedStyle = defaultView.getComputedStyle( elem, null );
5184
+ if ( !jQuery.support.opacity ) {
5185
+ jQuery.cssHooks.opacity = {
5186
+ get: function( elem, computed ) {
5187
+ // IE uses filters for opacity
5188
+ return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
5189
+ (parseFloat(RegExp.$1) / 100) + "" :
5190
+ computed ? "1" : "";
5191
+ },
4698
5192
 
4699
- if ( computedStyle ) {
4700
- ret = computedStyle.getPropertyValue( name );
4701
- }
5193
+ set: function( elem, value ) {
5194
+ var style = elem.style;
4702
5195
 
4703
- // We should always get a number back from opacity
4704
- if ( name === "opacity" && ret === "" ) {
4705
- ret = "1";
4706
- }
5196
+ // IE has trouble with opacity if it does not have layout
5197
+ // Force it by setting the zoom level
5198
+ style.zoom = 1;
4707
5199
 
4708
- } else if ( elem.currentStyle ) {
4709
- var camelCase = name.replace(rdashAlpha, fcamelCase);
5200
+ // Set the alpha filter to set the opacity
5201
+ var opacity = jQuery.isNaN(value) ?
5202
+ "" :
5203
+ "alpha(opacity=" + value * 100 + ")",
5204
+ filter = style.filter || "";
4710
5205
 
4711
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
5206
+ style.filter = ralpha.test(filter) ?
5207
+ filter.replace(ralpha, opacity) :
5208
+ style.filter + ' ' + opacity;
5209
+ }
5210
+ };
5211
+ }
4712
5212
 
4713
- // From the awesome hack by Dean Edwards
4714
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
5213
+ if ( getComputedStyle ) {
5214
+ curCSS = function( elem, newName, name ) {
5215
+ var ret, defaultView, computedStyle;
4715
5216
 
4716
- // If we're not dealing with a regular pixel number
4717
- // but a number that has a weird ending, we need to convert it to pixels
4718
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
4719
- // Remember the original values
4720
- var left = style.left, rsLeft = elem.runtimeStyle.left;
5217
+ name = name.replace( rupper, "-$1" ).toLowerCase();
4721
5218
 
4722
- // Put in the new values to get a computed value out
4723
- elem.runtimeStyle.left = elem.currentStyle.left;
4724
- style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
4725
- ret = style.pixelLeft + "px";
5219
+ if ( !(defaultView = elem.ownerDocument.defaultView) ) {
5220
+ return undefined;
5221
+ }
4726
5222
 
4727
- // Revert the changed values
4728
- style.left = left;
4729
- elem.runtimeStyle.left = rsLeft;
5223
+ if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
5224
+ ret = computedStyle.getPropertyValue( name );
5225
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
5226
+ ret = jQuery.style( elem, name );
4730
5227
  }
4731
5228
  }
4732
5229
 
4733
5230
  return ret;
4734
- },
5231
+ };
4735
5232
 
4736
- // A method for quickly swapping in/out CSS properties to get correct calculations
4737
- swap: function( elem, options, callback ) {
4738
- var old = {};
5233
+ } else if ( document.documentElement.currentStyle ) {
5234
+ curCSS = function( elem, name ) {
5235
+ var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;
4739
5236
 
4740
- // Remember the old values, and insert the new ones
4741
- for ( var name in options ) {
4742
- old[ name ] = elem.style[ name ];
4743
- elem.style[ name ] = options[ name ];
5237
+ // From the awesome hack by Dean Edwards
5238
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
5239
+
5240
+ // If we're not dealing with a regular pixel number
5241
+ // but a number that has a weird ending, we need to convert it to pixels
5242
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
5243
+ // Remember the original values
5244
+ left = style.left;
5245
+ rsLeft = elem.runtimeStyle.left;
5246
+
5247
+ // Put in the new values to get a computed value out
5248
+ elem.runtimeStyle.left = elem.currentStyle.left;
5249
+ style.left = name === "fontSize" ? "1em" : (ret || 0);
5250
+ ret = style.pixelLeft + "px";
5251
+
5252
+ // Revert the changed values
5253
+ style.left = left;
5254
+ elem.runtimeStyle.left = rsLeft;
4744
5255
  }
4745
5256
 
4746
- callback.call( elem );
5257
+ return ret;
5258
+ };
5259
+ }
4747
5260
 
4748
- // Revert the old values
4749
- for ( var name in options ) {
4750
- elem.style[ name ] = old[ name ];
5261
+ function getWH( elem, name, extra ) {
5262
+ var which = name === "width" ? cssWidth : cssHeight,
5263
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
5264
+
5265
+ if ( extra === "border" ) {
5266
+ return val;
5267
+ }
5268
+
5269
+ jQuery.each( which, function() {
5270
+ if ( !extra ) {
5271
+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
5272
+ }
5273
+
5274
+ if ( extra === "margin" ) {
5275
+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
5276
+
5277
+ } else {
5278
+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
4751
5279
  }
4752
- }
4753
- });
5280
+ });
5281
+
5282
+ return val;
5283
+ }
4754
5284
 
4755
5285
  if ( jQuery.expr && jQuery.expr.filters ) {
4756
5286
  jQuery.expr.filters.hidden = function( elem ) {
4757
- var width = elem.offsetWidth, height = elem.offsetHeight,
4758
- skip = elem.nodeName.toLowerCase() === "tr";
4759
-
4760
- return width === 0 && height === 0 && !skip ?
4761
- true :
4762
- width > 0 && height > 0 && !skip ?
4763
- false :
4764
- jQuery.curCSS(elem, "display") === "none";
5287
+ var width = elem.offsetWidth, height = elem.offsetHeight;
5288
+
5289
+ return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
4765
5290
  };
4766
5291
 
4767
5292
  jQuery.expr.filters.visible = function( elem ) {
4768
5293
  return !jQuery.expr.filters.hidden( elem );
4769
5294
  };
4770
5295
  }
4771
- var jsc = now(),
4772
- rscript = /<script(.|\s)*?\/script>/gi,
4773
- rselectTextarea = /select|textarea/i,
4774
- rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
4775
- jsre = /=\?(&|$)/,
5296
+
5297
+
5298
+
5299
+
5300
+ var jsc = jQuery.now(),
5301
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
5302
+ rselectTextarea = /^(?:select|textarea)/i,
5303
+ rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
5304
+ rnoContent = /^(?:GET|HEAD|DELETE)$/,
5305
+ rbracket = /\[\]$/,
5306
+ jsre = /\=\?(&|$)/,
4776
5307
  rquery = /\?/,
4777
- rts = /(\?|&)_=.*?(&|$)/,
5308
+ rts = /([?&])_=[^&]*/,
4778
5309
  rurl = /^(\w+:)?\/\/([^\/?#]+)/,
4779
5310
  r20 = /%20/g,
5311
+ rhash = /#.*$/,
4780
5312
 
4781
5313
  // Keep a copy of the old load method
4782
5314
  _load = jQuery.fn.load;
4783
5315
 
4784
5316
  jQuery.fn.extend({
4785
5317
  load: function( url, params, callback ) {
4786
- if ( typeof url !== "string" ) {
4787
- return _load.call( this, url );
5318
+ if ( typeof url !== "string" && _load ) {
5319
+ return _load.apply( this, arguments );
4788
5320
 
4789
5321
  // Don't do a request if no elements are being requested
4790
5322
  } else if ( !this.length ) {
@@ -4829,7 +5361,7 @@ jQuery.fn.extend({
4829
5361
  // See if a selector was specified
4830
5362
  self.html( selector ?
4831
5363
  // Create a dummy div to hold the results
4832
- jQuery("<div />")
5364
+ jQuery("<div>")
4833
5365
  // inject the contents of the document in, removing the scripts
4834
5366
  // to avoid any 'Permission Denied' errors in IE
4835
5367
  .append(res.responseText.replace(rscript, ""))
@@ -4853,6 +5385,7 @@ jQuery.fn.extend({
4853
5385
  serialize: function() {
4854
5386
  return jQuery.param(this.serializeArray());
4855
5387
  },
5388
+
4856
5389
  serializeArray: function() {
4857
5390
  return this.map(function() {
4858
5391
  return this.elements ? jQuery.makeArray(this.elements) : this;
@@ -4884,7 +5417,6 @@ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".sp
4884
5417
  });
4885
5418
 
4886
5419
  jQuery.extend({
4887
-
4888
5420
  get: function( url, data, callback, type ) {
4889
5421
  // shift arguments if data argument was omited
4890
5422
  if ( jQuery.isFunction( data ) ) {
@@ -4945,19 +5477,10 @@ jQuery.extend({
4945
5477
  password: null,
4946
5478
  traditional: false,
4947
5479
  */
4948
- // Create the request object; Microsoft failed to properly
4949
- // implement the XMLHttpRequest in IE7 (can't request local files),
4950
- // so we use the ActiveXObject when it is available
4951
5480
  // This function can be overriden by calling jQuery.ajaxSetup
4952
- xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
4953
- function() {
4954
- return new window.XMLHttpRequest();
4955
- } :
4956
- function() {
4957
- try {
4958
- return new window.ActiveXObject("Microsoft.XMLHTTP");
4959
- } catch(e) {}
4960
- },
5481
+ xhr: function() {
5482
+ return new window.XMLHttpRequest();
5483
+ },
4961
5484
  accepts: {
4962
5485
  xml: "application/xml, text/xml",
4963
5486
  html: "text/html",
@@ -4968,16 +5491,14 @@ jQuery.extend({
4968
5491
  }
4969
5492
  },
4970
5493
 
4971
- // Last-Modified header cache for next request
4972
- lastModified: {},
4973
- etag: {},
4974
-
4975
5494
  ajax: function( origSettings ) {
4976
- var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
4977
-
4978
- var jsonp, status, data,
4979
- callbackContext = origSettings && origSettings.context || s,
4980
- type = s.type.toUpperCase();
5495
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
5496
+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
5497
+
5498
+ s.url = s.url.replace( rhash, "" );
5499
+
5500
+ // Use original (not extended) context object if it was provided
5501
+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
4981
5502
 
4982
5503
  // convert data if not already a string
4983
5504
  if ( s.data && s.processData && typeof s.data !== "string" ) {
@@ -5012,17 +5533,25 @@ jQuery.extend({
5012
5533
  s.dataType = "script";
5013
5534
 
5014
5535
  // Handle JSONP-style loading
5015
- window[ jsonp ] = window[ jsonp ] || function( tmp ) {
5536
+ var customJsonp = window[ jsonp ];
5537
+
5538
+ window[ jsonp ] = function( tmp ) {
5016
5539
  data = tmp;
5017
- success();
5018
- complete();
5019
- // Garbage collect
5020
- window[ jsonp ] = undefined;
5540
+ jQuery.handleSuccess( s, xhr, status, data );
5541
+ jQuery.handleComplete( s, xhr, status, data );
5021
5542
 
5022
- try {
5023
- delete window[ jsonp ];
5024
- } catch(e) {}
5543
+ if ( jQuery.isFunction( customJsonp ) ) {
5544
+ customJsonp( tmp );
5545
+
5546
+ } else {
5547
+ // Garbage collect
5548
+ window[ jsonp ] = undefined;
5025
5549
 
5550
+ try {
5551
+ delete window[ jsonp ];
5552
+ } catch( jsonpError ) {}
5553
+ }
5554
+
5026
5555
  if ( head ) {
5027
5556
  head.removeChild( script );
5028
5557
  }
@@ -5034,10 +5563,10 @@ jQuery.extend({
5034
5563
  }
5035
5564
 
5036
5565
  if ( s.cache === false && type === "GET" ) {
5037
- var ts = now();
5566
+ var ts = jQuery.now();
5038
5567
 
5039
5568
  // try replacing _= if it is there
5040
- var ret = s.url.replace(rts, "$1_=" + ts + "$2");
5569
+ var ret = s.url.replace(rts, "$1_=" + ts);
5041
5570
 
5042
5571
  // if nothing was replaced, add timestamp to the end
5043
5572
  s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
@@ -5049,7 +5578,7 @@ jQuery.extend({
5049
5578
  }
5050
5579
 
5051
5580
  // Watch for a new set of requests
5052
- if ( s.global && ! jQuery.active++ ) {
5581
+ if ( s.global && jQuery.active++ === 0 ) {
5053
5582
  jQuery.event.trigger( "ajaxStart" );
5054
5583
  }
5055
5584
 
@@ -5062,10 +5591,10 @@ jQuery.extend({
5062
5591
  if ( s.dataType === "script" && type === "GET" && remote ) {
5063
5592
  var head = document.getElementsByTagName("head")[0] || document.documentElement;
5064
5593
  var script = document.createElement("script");
5065
- script.src = s.url;
5066
5594
  if ( s.scriptCharset ) {
5067
5595
  script.charset = s.scriptCharset;
5068
5596
  }
5597
+ script.src = s.url;
5069
5598
 
5070
5599
  // Handle Script loading
5071
5600
  if ( !jsonp ) {
@@ -5076,8 +5605,8 @@ jQuery.extend({
5076
5605
  if ( !done && (!this.readyState ||
5077
5606
  this.readyState === "loaded" || this.readyState === "complete") ) {
5078
5607
  done = true;
5079
- success();
5080
- complete();
5608
+ jQuery.handleSuccess( s, xhr, status, data );
5609
+ jQuery.handleComplete( s, xhr, status, data );
5081
5610
 
5082
5611
  // Handle memory leak in IE
5083
5612
  script.onload = script.onreadystatechange = null;
@@ -5115,8 +5644,8 @@ jQuery.extend({
5115
5644
 
5116
5645
  // Need an extra try/catch for cross domain requests in Firefox 3
5117
5646
  try {
5118
- // Set the correct header, if data is being sent
5119
- if ( s.data || origSettings && origSettings.contentType ) {
5647
+ // Set content-type if data specified and content-body is valid for this type
5648
+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
5120
5649
  xhr.setRequestHeader("Content-Type", s.contentType);
5121
5650
  }
5122
5651
 
@@ -5139,14 +5668,14 @@ jQuery.extend({
5139
5668
 
5140
5669
  // Set the Accepts header for the server, depending on the dataType
5141
5670
  xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
5142
- s.accepts[ s.dataType ] + ", */*" :
5671
+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
5143
5672
  s.accepts._default );
5144
- } catch(e) {}
5673
+ } catch( headerError ) {}
5145
5674
 
5146
5675
  // Allow custom headers/mimetypes and early abort
5147
- if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
5676
+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
5148
5677
  // Handle the global AJAX counter
5149
- if ( s.global && ! --jQuery.active ) {
5678
+ if ( s.global && jQuery.active-- === 1 ) {
5150
5679
  jQuery.event.trigger( "ajaxStop" );
5151
5680
  }
5152
5681
 
@@ -5156,7 +5685,7 @@ jQuery.extend({
5156
5685
  }
5157
5686
 
5158
5687
  if ( s.global ) {
5159
- trigger("ajaxSend", [xhr, s]);
5688
+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
5160
5689
  }
5161
5690
 
5162
5691
  // Wait for a response to come back
@@ -5166,7 +5695,7 @@ jQuery.extend({
5166
5695
  // Opera doesn't call onreadystatechange before this point
5167
5696
  // so we simulate the call
5168
5697
  if ( !requestDone ) {
5169
- complete();
5698
+ jQuery.handleComplete( s, xhr, status, data );
5170
5699
  }
5171
5700
 
5172
5701
  requestDone = true;
@@ -5194,9 +5723,9 @@ jQuery.extend({
5194
5723
  try {
5195
5724
  // process the data (runs the xml through httpData regardless of callback)
5196
5725
  data = jQuery.httpData( xhr, s.dataType, s );
5197
- } catch(err) {
5726
+ } catch( parserError ) {
5198
5727
  status = "parsererror";
5199
- errMsg = err;
5728
+ errMsg = parserError;
5200
5729
  }
5201
5730
  }
5202
5731
 
@@ -5204,14 +5733,16 @@ jQuery.extend({
5204
5733
  if ( status === "success" || status === "notmodified" ) {
5205
5734
  // JSONP handles its own success callback
5206
5735
  if ( !jsonp ) {
5207
- success();
5736
+ jQuery.handleSuccess( s, xhr, status, data );
5208
5737
  }
5209
5738
  } else {
5210
- jQuery.handleError(s, xhr, status, errMsg);
5739
+ jQuery.handleError( s, xhr, status, errMsg );
5211
5740
  }
5212
5741
 
5213
5742
  // Fire the complete handlers
5214
- complete();
5743
+ if ( !jsonp ) {
5744
+ jQuery.handleComplete( s, xhr, status, data );
5745
+ }
5215
5746
 
5216
5747
  if ( isTimeout === "timeout" ) {
5217
5748
  xhr.abort();
@@ -5224,18 +5755,20 @@ jQuery.extend({
5224
5755
  }
5225
5756
  };
5226
5757
 
5227
- // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
5758
+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
5228
5759
  // Opera doesn't fire onreadystatechange at all on abort
5229
5760
  try {
5230
5761
  var oldAbort = xhr.abort;
5231
5762
  xhr.abort = function() {
5232
- if ( xhr ) {
5763
+ // xhr.abort in IE7 is not a native JS function
5764
+ // and does not have a call property
5765
+ if ( xhr && oldAbort.call ) {
5233
5766
  oldAbort.call( xhr );
5234
5767
  }
5235
5768
 
5236
5769
  onreadystatechange( "abort" );
5237
5770
  };
5238
- } catch(e) { }
5771
+ } catch( abortError ) {}
5239
5772
 
5240
5773
  // Timeout checker
5241
5774
  if ( s.async && s.timeout > 0 ) {
@@ -5249,11 +5782,13 @@ jQuery.extend({
5249
5782
 
5250
5783
  // Send the data
5251
5784
  try {
5252
- xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
5253
- } catch(e) {
5254
- jQuery.handleError(s, xhr, null, e);
5785
+ xhr.send( noContent || s.data == null ? null : s.data );
5786
+
5787
+ } catch( sendError ) {
5788
+ jQuery.handleError( s, xhr, null, sendError );
5789
+
5255
5790
  // Fire the complete handlers
5256
- complete();
5791
+ jQuery.handleComplete( s, xhr, status, data );
5257
5792
  }
5258
5793
 
5259
5794
  // firefox 1.5 doesn't fire statechange for sync requests
@@ -5261,66 +5796,144 @@ jQuery.extend({
5261
5796
  onreadystatechange();
5262
5797
  }
5263
5798
 
5264
- function success() {
5265
- // If a local callback was specified, fire it and pass it the data
5266
- if ( s.success ) {
5267
- s.success.call( callbackContext, data, status, xhr );
5268
- }
5799
+ // return XMLHttpRequest to allow aborting the request etc.
5800
+ return xhr;
5801
+ },
5269
5802
 
5270
- // Fire the global callback
5271
- if ( s.global ) {
5272
- trigger( "ajaxSuccess", [xhr, s] );
5803
+ // Serialize an array of form elements or a set of
5804
+ // key/values into a query string
5805
+ param: function( a, traditional ) {
5806
+ var s = [], add = function( key, value ) {
5807
+ // If value is a function, invoke it and return its value
5808
+ value = jQuery.isFunction(value) ? value() : value;
5809
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
5810
+ };
5811
+
5812
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
5813
+ if ( traditional === undefined ) {
5814
+ traditional = jQuery.ajaxSettings.traditional;
5815
+ }
5816
+
5817
+ // If an array was passed in, assume that it is an array of form elements.
5818
+ if ( jQuery.isArray(a) || a.jquery ) {
5819
+ // Serialize the form elements
5820
+ jQuery.each( a, function() {
5821
+ add( this.name, this.value );
5822
+ });
5823
+
5824
+ } else {
5825
+ // If traditional, encode the "old" way (the way 1.3.2 or older
5826
+ // did it), otherwise encode params recursively.
5827
+ for ( var prefix in a ) {
5828
+ buildParams( prefix, a[prefix], traditional, add );
5273
5829
  }
5274
5830
  }
5275
5831
 
5276
- function complete() {
5277
- // Process result
5278
- if ( s.complete ) {
5279
- s.complete.call( callbackContext, xhr, status);
5280
- }
5832
+ // Return the resulting serialization
5833
+ return s.join("&").replace(r20, "+");
5834
+ }
5835
+ });
5281
5836
 
5282
- // The request was completed
5283
- if ( s.global ) {
5284
- trigger( "ajaxComplete", [xhr, s] );
5285
- }
5837
+ function buildParams( prefix, obj, traditional, add ) {
5838
+ if ( jQuery.isArray(obj) && obj.length ) {
5839
+ // Serialize array item.
5840
+ jQuery.each( obj, function( i, v ) {
5841
+ if ( traditional || rbracket.test( prefix ) ) {
5842
+ // Treat each array item as a scalar.
5843
+ add( prefix, v );
5286
5844
 
5287
- // Handle the global AJAX counter
5288
- if ( s.global && ! --jQuery.active ) {
5289
- jQuery.event.trigger( "ajaxStop" );
5845
+ } else {
5846
+ // If array item is non-scalar (array or object), encode its
5847
+ // numeric index to resolve deserialization ambiguity issues.
5848
+ // Note that rack (as of 1.0.0) can't currently deserialize
5849
+ // nested arrays properly, and attempting to do so may cause
5850
+ // a server error. Possible fixes are to modify rack's
5851
+ // deserialization algorithm or to provide an option or flag
5852
+ // to force array serialization to be shallow.
5853
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
5290
5854
  }
5855
+ });
5856
+
5857
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
5858
+ if ( jQuery.isEmptyObject( obj ) ) {
5859
+ add( prefix, "" );
5860
+
5861
+ // Serialize object item.
5862
+ } else {
5863
+ jQuery.each( obj, function( k, v ) {
5864
+ buildParams( prefix + "[" + k + "]", v, traditional, add );
5865
+ });
5291
5866
  }
5292
-
5293
- function trigger(type, args) {
5294
- (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
5295
- }
5867
+
5868
+ } else {
5869
+ // Serialize scalar item.
5870
+ add( prefix, obj );
5871
+ }
5872
+ }
5296
5873
 
5297
- // return XMLHttpRequest to allow aborting the request etc.
5298
- return xhr;
5299
- },
5874
+ // This is still on the jQuery object... for now
5875
+ // Want to move this to jQuery.ajax some day
5876
+ jQuery.extend({
5877
+
5878
+ // Counter for holding the number of active queries
5879
+ active: 0,
5880
+
5881
+ // Last-Modified header cache for next request
5882
+ lastModified: {},
5883
+ etag: {},
5300
5884
 
5301
5885
  handleError: function( s, xhr, status, e ) {
5302
5886
  // If a local callback was specified, fire it
5303
5887
  if ( s.error ) {
5304
- s.error.call( s.context || s, xhr, status, e );
5888
+ s.error.call( s.context, xhr, status, e );
5305
5889
  }
5306
5890
 
5307
5891
  // Fire the global callback
5308
5892
  if ( s.global ) {
5309
- (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
5893
+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
5310
5894
  }
5311
5895
  },
5312
5896
 
5313
- // Counter for holding the number of active queries
5314
- active: 0,
5897
+ handleSuccess: function( s, xhr, status, data ) {
5898
+ // If a local callback was specified, fire it and pass it the data
5899
+ if ( s.success ) {
5900
+ s.success.call( s.context, data, status, xhr );
5901
+ }
5902
+
5903
+ // Fire the global callback
5904
+ if ( s.global ) {
5905
+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
5906
+ }
5907
+ },
5908
+
5909
+ handleComplete: function( s, xhr, status ) {
5910
+ // Process result
5911
+ if ( s.complete ) {
5912
+ s.complete.call( s.context, xhr, status );
5913
+ }
5914
+
5915
+ // The request was completed
5916
+ if ( s.global ) {
5917
+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
5918
+ }
5919
+
5920
+ // Handle the global AJAX counter
5921
+ if ( s.global && jQuery.active-- === 1 ) {
5922
+ jQuery.event.trigger( "ajaxStop" );
5923
+ }
5924
+ },
5925
+
5926
+ triggerGlobal: function( s, type, args ) {
5927
+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
5928
+ },
5315
5929
 
5316
5930
  // Determines if an XMLHttpRequest was successful or not
5317
5931
  httpSuccess: function( xhr ) {
5318
5932
  try {
5319
5933
  // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
5320
5934
  return !xhr.status && location.protocol === "file:" ||
5321
- // Opera returns 0 when status is 304
5322
- ( xhr.status >= 200 && xhr.status < 300 ) ||
5323
- xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
5935
+ xhr.status >= 200 && xhr.status < 300 ||
5936
+ xhr.status === 304 || xhr.status === 1223;
5324
5937
  } catch(e) {}
5325
5938
 
5326
5939
  return false;
@@ -5339,8 +5952,7 @@ jQuery.extend({
5339
5952
  jQuery.etag[url] = etag;
5340
5953
  }
5341
5954
 
5342
- // Opera returns 0 when status is 304
5343
- return xhr.status === 304 || xhr.status === 0;
5955
+ return xhr.status === 304;
5344
5956
  },
5345
5957
 
5346
5958
  httpData: function( xhr, type, s ) {
@@ -5371,77 +5983,40 @@ jQuery.extend({
5371
5983
  }
5372
5984
 
5373
5985
  return data;
5374
- },
5986
+ }
5375
5987
 
5376
- // Serialize an array of form elements or a set of
5377
- // key/values into a query string
5378
- param: function( a, traditional ) {
5379
- var s = [];
5380
-
5381
- // Set traditional to true for jQuery <= 1.3.2 behavior.
5382
- if ( traditional === undefined ) {
5383
- traditional = jQuery.ajaxSettings.traditional;
5384
- }
5385
-
5386
- // If an array was passed in, assume that it is an array of form elements.
5387
- if ( jQuery.isArray(a) || a.jquery ) {
5388
- // Serialize the form elements
5389
- jQuery.each( a, function() {
5390
- add( this.name, this.value );
5391
- });
5392
-
5393
- } else {
5394
- // If traditional, encode the "old" way (the way 1.3.2 or older
5395
- // did it), otherwise encode params recursively.
5396
- for ( var prefix in a ) {
5397
- buildParams( prefix, a[prefix] );
5398
- }
5988
+ });
5989
+
5990
+ /*
5991
+ * Create the request object; Microsoft failed to properly
5992
+ * implement the XMLHttpRequest in IE7 (can't request local files),
5993
+ * so we use the ActiveXObject when it is available
5994
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
5995
+ * we need a fallback.
5996
+ */
5997
+ if ( window.ActiveXObject ) {
5998
+ jQuery.ajaxSettings.xhr = function() {
5999
+ if ( window.location.protocol !== "file:" ) {
6000
+ try {
6001
+ return new window.XMLHttpRequest();
6002
+ } catch(xhrError) {}
5399
6003
  }
5400
6004
 
5401
- // Return the resulting serialization
5402
- return s.join("&").replace(r20, "+");
6005
+ try {
6006
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
6007
+ } catch(activeError) {}
6008
+ };
6009
+ }
6010
+
6011
+ // Does this browser support XHR requests?
6012
+ jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
6013
+
6014
+
5403
6015
 
5404
- function buildParams( prefix, obj ) {
5405
- if ( jQuery.isArray(obj) ) {
5406
- // Serialize array item.
5407
- jQuery.each( obj, function( i, v ) {
5408
- if ( traditional || /\[\]$/.test( prefix ) ) {
5409
- // Treat each array item as a scalar.
5410
- add( prefix, v );
5411
- } else {
5412
- // If array item is non-scalar (array or object), encode its
5413
- // numeric index to resolve deserialization ambiguity issues.
5414
- // Note that rack (as of 1.0.0) can't currently deserialize
5415
- // nested arrays properly, and attempting to do so may cause
5416
- // a server error. Possible fixes are to modify rack's
5417
- // deserialization algorithm or to provide an option or flag
5418
- // to force array serialization to be shallow.
5419
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
5420
- }
5421
- });
5422
-
5423
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
5424
- // Serialize object item.
5425
- jQuery.each( obj, function( k, v ) {
5426
- buildParams( prefix + "[" + k + "]", v );
5427
- });
5428
-
5429
- } else {
5430
- // Serialize scalar item.
5431
- add( prefix, obj );
5432
- }
5433
- }
5434
6016
 
5435
- function add( key, value ) {
5436
- // If value is a function, invoke it and return its value
5437
- value = jQuery.isFunction(value) ? value() : value;
5438
- s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
5439
- }
5440
- }
5441
- });
5442
6017
  var elemdisplay = {},
5443
- rfxtypes = /toggle|show|hide/,
5444
- rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
6018
+ rfxtypes = /^(?:toggle|show|hide)$/,
6019
+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
5445
6020
  timerId,
5446
6021
  fxAttrs = [
5447
6022
  // height animations
@@ -5453,66 +6028,52 @@ var elemdisplay = {},
5453
6028
  ];
5454
6029
 
5455
6030
  jQuery.fn.extend({
5456
- show: function( speed, callback ) {
5457
- if ( speed || speed === 0) {
5458
- return this.animate( genFx("show", 3), speed, callback);
5459
-
6031
+ show: function( speed, easing, callback ) {
6032
+ if ( speed || speed === 0 ) {
6033
+ return this.animate( genFx("show", 3), speed, easing, callback);
5460
6034
  } else {
5461
- for ( var i = 0, l = this.length; i < l; i++ ) {
5462
- var old = jQuery.data(this[i], "olddisplay");
5463
-
5464
- this[i].style.display = old || "";
5465
-
5466
- if ( jQuery.css(this[i], "display") === "none" ) {
5467
- var nodeName = this[i].nodeName, display;
5468
-
5469
- if ( elemdisplay[ nodeName ] ) {
5470
- display = elemdisplay[ nodeName ];
5471
-
5472
- } else {
5473
- var elem = jQuery("<" + nodeName + " />").appendTo("body");
5474
-
5475
- display = elem.css("display");
5476
-
5477
- if ( display === "none" ) {
5478
- display = "block";
5479
- }
5480
-
5481
- elem.remove();
5482
-
5483
- elemdisplay[ nodeName ] = display;
5484
- }
6035
+ for ( var i = 0, j = this.length; i < j; i++ ) {
6036
+ // Reset the inline display of this element to learn if it is
6037
+ // being hidden by cascaded rules or not
6038
+ if ( !jQuery.data(this[i], "olddisplay") && this[i].style.display === "none" ) {
6039
+ this[i].style.display = "";
6040
+ }
5485
6041
 
5486
- jQuery.data(this[i], "olddisplay", display);
6042
+ // Set elements which have been overridden with display: none
6043
+ // in a stylesheet to whatever the default browser style is
6044
+ // for such an element
6045
+ if ( this[i].style.display === "" && jQuery.css( this[i], "display" ) === "none" ) {
6046
+ jQuery.data(this[i], "olddisplay", defaultDisplay(this[i].nodeName));
5487
6047
  }
5488
6048
  }
5489
6049
 
5490
- // Set the display of the elements in a second loop
6050
+ // Set the display of most of the elements in a second loop
5491
6051
  // to avoid the constant reflow
5492
- for ( var j = 0, k = this.length; j < k; j++ ) {
5493
- this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
6052
+ for ( i = 0; i < j; i++ ) {
6053
+ this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
5494
6054
  }
5495
6055
 
5496
6056
  return this;
5497
6057
  }
5498
6058
  },
5499
6059
 
5500
- hide: function( speed, callback ) {
6060
+ hide: function( speed, easing, callback ) {
5501
6061
  if ( speed || speed === 0 ) {
5502
- return this.animate( genFx("hide", 3), speed, callback);
6062
+ return this.animate( genFx("hide", 3), speed, easing, callback);
5503
6063
 
5504
6064
  } else {
5505
- for ( var i = 0, l = this.length; i < l; i++ ) {
5506
- var old = jQuery.data(this[i], "olddisplay");
5507
- if ( !old && old !== "none" ) {
5508
- jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
6065
+ for ( var i = 0, j = this.length; i < j; i++ ) {
6066
+ var display = jQuery.css( this[i], "display" );
6067
+
6068
+ if ( display !== "none" ) {
6069
+ jQuery.data( this[i], "olddisplay", display );
5509
6070
  }
5510
6071
  }
5511
6072
 
5512
6073
  // Set the display of the elements in a second loop
5513
6074
  // to avoid the constant reflow
5514
- for ( var j = 0, k = this.length; j < k; j++ ) {
5515
- this[j].style.display = "none";
6075
+ for ( i = 0; i < j; i++ ) {
6076
+ this[i].style.display = "none";
5516
6077
  }
5517
6078
 
5518
6079
  return this;
@@ -5522,7 +6083,7 @@ jQuery.fn.extend({
5522
6083
  // Save the old toggle function
5523
6084
  _toggle: jQuery.fn.toggle,
5524
6085
 
5525
- toggle: function( fn, fn2 ) {
6086
+ toggle: function( fn, fn2, callback ) {
5526
6087
  var bool = typeof fn === "boolean";
5527
6088
 
5528
6089
  if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
@@ -5535,15 +6096,15 @@ jQuery.fn.extend({
5535
6096
  });
5536
6097
 
5537
6098
  } else {
5538
- this.animate(genFx("toggle", 3), fn, fn2);
6099
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
5539
6100
  }
5540
6101
 
5541
6102
  return this;
5542
6103
  },
5543
6104
 
5544
- fadeTo: function( speed, to, callback ) {
6105
+ fadeTo: function( speed, to, easing, callback ) {
5545
6106
  return this.filter(":hidden").css("opacity", 0).show().end()
5546
- .animate({opacity: to}, speed, callback);
6107
+ .animate({opacity: to}, speed, easing, callback);
5547
6108
  },
5548
6109
 
5549
6110
  animate: function( prop, speed, easing, callback ) {
@@ -5554,12 +6115,16 @@ jQuery.fn.extend({
5554
6115
  }
5555
6116
 
5556
6117
  return this[ optall.queue === false ? "each" : "queue" ](function() {
6118
+ // XXX ‘this’ does not always have a nodeName when running the
6119
+ // test suite
6120
+
5557
6121
  var opt = jQuery.extend({}, optall), p,
5558
- hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
6122
+ isElement = this.nodeType === 1,
6123
+ hidden = isElement && jQuery(this).is(":hidden"),
5559
6124
  self = this;
5560
6125
 
5561
6126
  for ( p in prop ) {
5562
- var name = p.replace(rdashAlpha, fcamelCase);
6127
+ var name = jQuery.camelCase( p );
5563
6128
 
5564
6129
  if ( p !== name ) {
5565
6130
  prop[ name ] = prop[ p ];
@@ -5571,12 +6136,35 @@ jQuery.fn.extend({
5571
6136
  return opt.complete.call(this);
5572
6137
  }
5573
6138
 
5574
- if ( ( p === "height" || p === "width" ) && this.style ) {
5575
- // Store display property
5576
- opt.display = jQuery.css(this, "display");
5577
-
6139
+ if ( isElement && ( p === "height" || p === "width" ) ) {
5578
6140
  // Make sure that nothing sneaks out
5579
- opt.overflow = this.style.overflow;
6141
+ // Record all 3 overflow attributes because IE does not
6142
+ // change the overflow attribute when overflowX and
6143
+ // overflowY are set to the same value
6144
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
6145
+
6146
+ // Set display property to inline-block for height/width
6147
+ // animations on inline elements that are having width/height
6148
+ // animated
6149
+ if ( jQuery.css( this, "display" ) === "inline" &&
6150
+ jQuery.css( this, "float" ) === "none" ) {
6151
+ if ( !jQuery.support.inlineBlockNeedsLayout ) {
6152
+ this.style.display = "inline-block";
6153
+
6154
+ } else {
6155
+ var display = defaultDisplay(this.nodeName);
6156
+
6157
+ // inline-level elements accept inline-block;
6158
+ // block-level elements need to be inline with layout
6159
+ if ( display === "inline" ) {
6160
+ this.style.display = "inline-block";
6161
+
6162
+ } else {
6163
+ this.style.display = "inline";
6164
+ this.style.zoom = 1;
6165
+ }
6166
+ }
6167
+ }
5580
6168
  }
5581
6169
 
5582
6170
  if ( jQuery.isArray( prop[p] ) ) {
@@ -5608,9 +6196,9 @@ jQuery.fn.extend({
5608
6196
 
5609
6197
  // We need to compute starting value
5610
6198
  if ( unit !== "px" ) {
5611
- self.style[ name ] = (end || 1) + unit;
6199
+ jQuery.style( self, name, (end || 1) + unit);
5612
6200
  start = ((end || 1) / e.cur(true)) * start;
5613
- self.style[ name ] = start + unit;
6201
+ jQuery.style( self, name, start + unit);
5614
6202
  }
5615
6203
 
5616
6204
  // If a +=/-= token was provided, we're doing a relative animation
@@ -5662,6 +6250,16 @@ jQuery.fn.extend({
5662
6250
 
5663
6251
  });
5664
6252
 
6253
+ function genFx( type, num ) {
6254
+ var obj = {};
6255
+
6256
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
6257
+ obj[ this ] = type;
6258
+ });
6259
+
6260
+ return obj;
6261
+ }
6262
+
5665
6263
  // Generate shortcuts for custom animations
5666
6264
  jQuery.each({
5667
6265
  slideDown: genFx("show", 1),
@@ -5670,14 +6268,14 @@ jQuery.each({
5670
6268
  fadeIn: { opacity: "show" },
5671
6269
  fadeOut: { opacity: "hide" }
5672
6270
  }, function( name, props ) {
5673
- jQuery.fn[ name ] = function( speed, callback ) {
5674
- return this.animate( props, speed, callback );
6271
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
6272
+ return this.animate( props, speed, easing, callback );
5675
6273
  };
5676
6274
  });
5677
6275
 
5678
6276
  jQuery.extend({
5679
6277
  speed: function( speed, easing, fn ) {
5680
- var opt = speed && typeof speed === "object" ? speed : {
6278
+ var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
5681
6279
  complete: fn || !fn && easing ||
5682
6280
  jQuery.isFunction( speed ) && speed,
5683
6281
  duration: speed,
@@ -5685,7 +6283,7 @@ jQuery.extend({
5685
6283
  };
5686
6284
 
5687
6285
  opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
5688
- jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
6286
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
5689
6287
 
5690
6288
  // Queueing
5691
6289
  opt.old = opt.complete;
@@ -5732,33 +6330,28 @@ jQuery.fx.prototype = {
5732
6330
  }
5733
6331
 
5734
6332
  (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
5735
-
5736
- // Set display property to block for height/width animations
5737
- if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
5738
- this.elem.style.display = "block";
5739
- }
5740
6333
  },
5741
6334
 
5742
6335
  // Get the current size
5743
- cur: function( force ) {
6336
+ cur: function() {
5744
6337
  if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
5745
6338
  return this.elem[ this.prop ];
5746
6339
  }
5747
6340
 
5748
- var r = parseFloat(jQuery.css(this.elem, this.prop, force));
5749
- return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
6341
+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
6342
+ return r && r > -10000 ? r : 0;
5750
6343
  },
5751
6344
 
5752
6345
  // Start an animation from one number to another
5753
6346
  custom: function( from, to, unit ) {
5754
- this.startTime = now();
6347
+ this.startTime = jQuery.now();
5755
6348
  this.start = from;
5756
6349
  this.end = to;
5757
6350
  this.unit = unit || this.unit || "px";
5758
6351
  this.now = this.start;
5759
6352
  this.pos = this.state = 0;
5760
6353
 
5761
- var self = this;
6354
+ var self = this, fx = jQuery.fx;
5762
6355
  function t( gotoEnd ) {
5763
6356
  return self.step(gotoEnd);
5764
6357
  }
@@ -5766,7 +6359,7 @@ jQuery.fx.prototype = {
5766
6359
  t.elem = this.elem;
5767
6360
 
5768
6361
  if ( t() && jQuery.timers.push(t) && !timerId ) {
5769
- timerId = setInterval(jQuery.fx.tick, 13);
6362
+ timerId = setInterval(fx.tick, fx.interval);
5770
6363
  }
5771
6364
  },
5772
6365
 
@@ -5797,7 +6390,7 @@ jQuery.fx.prototype = {
5797
6390
 
5798
6391
  // Each step of an animation
5799
6392
  step: function( gotoEnd ) {
5800
- var t = now(), done = true;
6393
+ var t = jQuery.now(), done = true;
5801
6394
 
5802
6395
  if ( gotoEnd || t >= this.options.duration + this.startTime ) {
5803
6396
  this.now = this.end;
@@ -5813,17 +6406,12 @@ jQuery.fx.prototype = {
5813
6406
  }
5814
6407
 
5815
6408
  if ( done ) {
5816
- if ( this.options.display != null ) {
5817
- // Reset the overflow
5818
- this.elem.style.overflow = this.options.overflow;
5819
-
5820
- // Reset the display
5821
- var old = jQuery.data(this.elem, "olddisplay");
5822
- this.elem.style.display = old ? old : this.options.display;
5823
-
5824
- if ( jQuery.css(this.elem, "display") === "none" ) {
5825
- this.elem.style.display = "block";
5826
- }
6409
+ // Reset the overflow
6410
+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
6411
+ var elem = this.elem, options = this.options;
6412
+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
6413
+ elem.style[ "overflow" + value ] = options.overflow[index];
6414
+ } );
5827
6415
  }
5828
6416
 
5829
6417
  // Hide the element if the "hide" operation was done
@@ -5834,7 +6422,7 @@ jQuery.fx.prototype = {
5834
6422
  // Reset the properties, if the item has been hidden or shown
5835
6423
  if ( this.options.hide || this.options.show ) {
5836
6424
  for ( var p in this.options.curAnim ) {
5837
- jQuery.style(this.elem, p, this.options.orig[p]);
6425
+ jQuery.style( this.elem, p, this.options.orig[p] );
5838
6426
  }
5839
6427
  }
5840
6428
 
@@ -5876,22 +6464,24 @@ jQuery.extend( jQuery.fx, {
5876
6464
  jQuery.fx.stop();
5877
6465
  }
5878
6466
  },
5879
-
6467
+
6468
+ interval: 13,
6469
+
5880
6470
  stop: function() {
5881
6471
  clearInterval( timerId );
5882
6472
  timerId = null;
5883
6473
  },
5884
-
6474
+
5885
6475
  speeds: {
5886
6476
  slow: 600,
5887
- fast: 200,
5888
- // Default speed
5889
- _default: 400
6477
+ fast: 200,
6478
+ // Default speed
6479
+ _default: 400
5890
6480
  },
5891
6481
 
5892
6482
  step: {
5893
6483
  opacity: function( fx ) {
5894
- jQuery.style(fx.elem, "opacity", fx.now);
6484
+ jQuery.style( fx.elem, "opacity", fx.now );
5895
6485
  },
5896
6486
 
5897
6487
  _default: function( fx ) {
@@ -5912,18 +6502,32 @@ if ( jQuery.expr && jQuery.expr.filters ) {
5912
6502
  };
5913
6503
  }
5914
6504
 
5915
- function genFx( type, num ) {
5916
- var obj = {};
6505
+ function defaultDisplay( nodeName ) {
6506
+ if ( !elemdisplay[ nodeName ] ) {
6507
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
6508
+ display = elem.css("display");
5917
6509
 
5918
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
5919
- obj[ this ] = type;
5920
- });
6510
+ elem.remove();
5921
6511
 
5922
- return obj;
6512
+ if ( display === "none" || display === "" ) {
6513
+ display = "block";
6514
+ }
6515
+
6516
+ elemdisplay[ nodeName ] = display;
6517
+ }
6518
+
6519
+ return elemdisplay[ nodeName ];
5923
6520
  }
6521
+
6522
+
6523
+
6524
+
6525
+ var rtable = /^t(?:able|d|h)$/i,
6526
+ rroot = /^(?:body|html)$/i;
6527
+
5924
6528
  if ( "getBoundingClientRect" in document.documentElement ) {
5925
6529
  jQuery.fn.offset = function( options ) {
5926
- var elem = this[0];
6530
+ var elem = this[0], box;
5927
6531
 
5928
6532
  if ( options ) {
5929
6533
  return this.each(function( i ) {
@@ -5939,10 +6543,26 @@ if ( "getBoundingClientRect" in document.documentElement ) {
5939
6543
  return jQuery.offset.bodyOffset( elem );
5940
6544
  }
5941
6545
 
5942
- var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
5943
- clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
5944
- top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
5945
- left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
6546
+ try {
6547
+ box = elem.getBoundingClientRect();
6548
+ } catch(e) {}
6549
+
6550
+ var doc = elem.ownerDocument,
6551
+ docElem = doc.documentElement;
6552
+
6553
+ // Make sure we're not dealing with a disconnected DOM node
6554
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
6555
+ return box || { top: 0, left: 0 };
6556
+ }
6557
+
6558
+ var body = doc.body,
6559
+ win = getWindow(doc),
6560
+ clientTop = docElem.clientTop || body.clientTop || 0,
6561
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
6562
+ scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
6563
+ scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
6564
+ top = box.top + scrollTop - clientTop,
6565
+ left = box.left + scrollLeft - clientLeft;
5946
6566
 
5947
6567
  return { top: top, left: left };
5948
6568
  };
@@ -5986,12 +6606,13 @@ if ( "getBoundingClientRect" in document.documentElement ) {
5986
6606
  top += elem.offsetTop;
5987
6607
  left += elem.offsetLeft;
5988
6608
 
5989
- if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
6609
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
5990
6610
  top += parseFloat( computedStyle.borderTopWidth ) || 0;
5991
6611
  left += parseFloat( computedStyle.borderLeftWidth ) || 0;
5992
6612
  }
5993
6613
 
5994
- prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
6614
+ prevOffsetParent = offsetParent;
6615
+ offsetParent = elem.offsetParent;
5995
6616
  }
5996
6617
 
5997
6618
  if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
@@ -6018,7 +6639,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
6018
6639
 
6019
6640
  jQuery.offset = {
6020
6641
  initialize: function() {
6021
- var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
6642
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
6022
6643
  html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
6023
6644
 
6024
6645
  jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
@@ -6032,12 +6653,16 @@ jQuery.offset = {
6032
6653
  this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
6033
6654
  this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
6034
6655
 
6035
- checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
6656
+ checkDiv.style.position = "fixed";
6657
+ checkDiv.style.top = "20px";
6658
+
6036
6659
  // safari subtracts parent border width here which is 5px
6037
6660
  this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
6038
6661
  checkDiv.style.position = checkDiv.style.top = "";
6039
6662
 
6040
- innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
6663
+ innerDiv.style.overflow = "hidden";
6664
+ innerDiv.style.position = "relative";
6665
+
6041
6666
  this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
6042
6667
 
6043
6668
  this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
@@ -6053,31 +6678,46 @@ jQuery.offset = {
6053
6678
  jQuery.offset.initialize();
6054
6679
 
6055
6680
  if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
6056
- top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
6057
- left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
6681
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
6682
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
6058
6683
  }
6059
6684
 
6060
6685
  return { top: top, left: left };
6061
6686
  },
6062
6687
 
6063
6688
  setOffset: function( elem, options, i ) {
6689
+ var position = jQuery.css( elem, "position" );
6690
+
6064
6691
  // set position first, in-case top/left are set even on static elem
6065
- if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
6692
+ if ( position === "static" ) {
6066
6693
  elem.style.position = "relative";
6067
6694
  }
6068
- var curElem = jQuery( elem ),
6695
+
6696
+ var curElem = jQuery( elem ),
6069
6697
  curOffset = curElem.offset(),
6070
- curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
6071
- curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
6698
+ curCSSTop = jQuery.css( elem, "top" ),
6699
+ curCSSLeft = jQuery.css( elem, "left" ),
6700
+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
6701
+ props = {}, curPosition = {}, curTop, curLeft;
6702
+
6703
+ // need to be able to calculate position if either top or left is auto and position is absolute
6704
+ if ( calculatePosition ) {
6705
+ curPosition = curElem.position();
6706
+ }
6707
+
6708
+ curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
6709
+ curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
6072
6710
 
6073
6711
  if ( jQuery.isFunction( options ) ) {
6074
6712
  options = options.call( elem, i, curOffset );
6075
6713
  }
6076
6714
 
6077
- var props = {
6078
- top: (options.top - curOffset.top) + curTop,
6079
- left: (options.left - curOffset.left) + curLeft
6080
- };
6715
+ if (options.top != null) {
6716
+ props.top = (options.top - curOffset.top) + curTop;
6717
+ }
6718
+ if (options.left != null) {
6719
+ props.left = (options.left - curOffset.left) + curLeft;
6720
+ }
6081
6721
 
6082
6722
  if ( "using" in options ) {
6083
6723
  options.using.call( elem, props );
@@ -6101,17 +6741,17 @@ jQuery.fn.extend({
6101
6741
 
6102
6742
  // Get correct offsets
6103
6743
  offset = this.offset(),
6104
- parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
6744
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
6105
6745
 
6106
6746
  // Subtract element margins
6107
6747
  // note: when an element has margin: auto the offsetLeft and marginLeft
6108
6748
  // are the same in Safari causing offset.left to incorrectly be 0
6109
- offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
6110
- offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
6749
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
6750
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
6111
6751
 
6112
6752
  // Add offsetParent borders
6113
- parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
6114
- parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
6753
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
6754
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
6115
6755
 
6116
6756
  // Subtract the two offsets
6117
6757
  return {
@@ -6123,7 +6763,7 @@ jQuery.fn.extend({
6123
6763
  offsetParent: function() {
6124
6764
  return this.map(function() {
6125
6765
  var offsetParent = this.offsetParent || document.body;
6126
- while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
6766
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
6127
6767
  offsetParent = offsetParent.offsetParent;
6128
6768
  }
6129
6769
  return offsetParent;
@@ -6171,12 +6811,16 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
6171
6811
  });
6172
6812
 
6173
6813
  function getWindow( elem ) {
6174
- return ("scrollTo" in elem && elem.document) ?
6814
+ return jQuery.isWindow( elem ) ?
6175
6815
  elem :
6176
6816
  elem.nodeType === 9 ?
6177
6817
  elem.defaultView || elem.parentWindow :
6178
6818
  false;
6179
6819
  }
6820
+
6821
+
6822
+
6823
+
6180
6824
  // Create innerHeight, innerWidth, outerHeight and outerWidth methods
6181
6825
  jQuery.each([ "Height", "Width" ], function( i, name ) {
6182
6826
 
@@ -6185,14 +6829,14 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
6185
6829
  // innerHeight and innerWidth
6186
6830
  jQuery.fn["inner" + name] = function() {
6187
6831
  return this[0] ?
6188
- jQuery.css( this[0], type, false, "padding" ) :
6832
+ parseFloat( jQuery.css( this[0], type, "padding" ) ) :
6189
6833
  null;
6190
6834
  };
6191
6835
 
6192
6836
  // outerHeight and outerWidth
6193
6837
  jQuery.fn["outer" + name] = function( margin ) {
6194
6838
  return this[0] ?
6195
- jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
6839
+ parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
6196
6840
  null;
6197
6841
  };
6198
6842
 
@@ -6210,7 +6854,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
6210
6854
  });
6211
6855
  }
6212
6856
 
6213
- return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
6857
+ return jQuery.isWindow( elem ) ?
6214
6858
  // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
6215
6859
  elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
6216
6860
  elem.document.body[ "client" + name ] :
@@ -6227,14 +6871,13 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
6227
6871
  // Get or set width or height on the element
6228
6872
  size === undefined ?
6229
6873
  // Get width or height on the element
6230
- jQuery.css( elem, type ) :
6874
+ parseFloat( jQuery.css( elem, type ) ) :
6231
6875
 
6232
6876
  // Set the width or height on the element (default to pixels if value is unitless)
6233
6877
  this.css( type, typeof size === "string" ? size : size + "px" );
6234
6878
  };
6235
6879
 
6236
6880
  });
6237
- // Expose jQuery to the global object
6238
- window.jQuery = window.$ = jQuery;
6881
+
6239
6882
 
6240
6883
  })(window);