compass-jquery-plugin 0.3.2.2 → 0.3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -5,12 +5,14 @@ Get gem from [Gemcutter][1].
5
5
 
6
6
  Get source from [github][2].
7
7
 
8
+ Get example application showing everything live from [github][39].
9
+
8
10
  Description
9
11
  -----------
10
12
 
11
13
  A Sass-based Meta-Framework for Compass that allows you to mix and match any of the following:
12
14
 
13
- * jRails with jQuery 1.4.4 and jQuery.UI 1.8.9 including themes
15
+ * jRails with jQuery 1.5.0 and jQuery.UI 1.8.9 including themes
14
16
  * jQuery Tools 1.2.5
15
17
  * jquery.jstree.js V1.0rc3
16
18
  * jquery.dynatree.js V1.0.2
@@ -286,7 +288,7 @@ Copyright © 2009-2011 Kosmas Schuetz. See LICENSE for details.
286
288
 
287
289
  [1]: http://gemcutter.org/gems/compass-jquery-plugin
288
290
  [2]: http://github.com/kosmas58/compass-jquery-plugin
289
- [3]: http://wiki.github.com/chriseppstein/compass
291
+ [3]: http://compass-style.org/docs/
290
292
  [4]: http://groups.google.com/group/ruby-bundler/msg/e375ee77b225609f
291
293
  [5]: http://code.google.com/p/ennerchi/
292
294
  [6]: http://github.com/dturnbull/compass-jquery/tree/master
@@ -322,4 +324,5 @@ Copyright © 2009-2011 Kosmas Schuetz. See LICENSE for details.
322
324
  [36]: http://github.com/cowboy/jquery-replacetext
323
325
  [37]: http://github.com/cowboy/jquery-dotimeout
324
326
  [38]: http://github.com/gamache/DSt
327
+ [39]: http://github.com/kosmas58/compass-jquery-plugin-sample
325
328
 
data/VERSION.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :commit:
3
- :state: 2
3
+ :state: 3
4
4
  :tiny: 2
5
5
  :minor: 3
6
6
  :major: 0
@@ -24,11 +24,11 @@ module ActionView
24
24
  :add => 'false',
25
25
  :delete => 'false',
26
26
  :search => 'true',
27
- :edit => 'false',
27
+ :edit => 'false',
28
28
  :inline_edit => 'false',
29
29
  :autowidth => 'false',
30
30
  :hidegrid => 'false',
31
- :rownumbers => 'false'
31
+ :rownumbers => 'false'
32
32
  }.merge(options)
33
33
 
34
34
  # Stringify options values
@@ -498,7 +498,7 @@ DynaTreeNode.prototype = {
498
498
  return;
499
499
  }
500
500
  cmp = cmp || function(a, b) {
501
- return a.data.title === b.data.title ? 0 : a.data.title > b.data.title;
501
+ return a.data.title === b.data.title ? 0 : a.data.title > b.data.title ? 1 : -1;
502
502
  };
503
503
  cl.sort(cmp);
504
504
  if( deep ){
@@ -11,7 +11,7 @@ j.push(h.combinedExpanderPrefix+(this.bExpanded?"e":"c")+(e.isLazy&&this.childLi
11
11
  f.fx&&c===e){d=f.fx.duration||200;g(this.ul).animate(f.fx,d)}else this.ul.style.display=this.bExpanded||!d?"":"none"}},getKeyPath:function(a){var b=[];this.visitParents(function(c){c.parent&&b.unshift(c.data.key)},!a);return"/"+b.join(this.tree.options.keyPathSeparator)},getParent:function(){return this.parent},getChildren:function(){return this.childList},hasChildren:function(){if(this.data.isLazy){if(this.childList===null||this.childList===undefined)return;else if(this.childList.length===0)return false;
12
12
  else if(this.childList.length===1&&this.childList[0].isStatusNode())return;return true}return!!this.childList},isFirstSibling:function(){var a=this.parent;return!a||a.childList[0]===this},isLastSibling:function(){var a=this.parent;return!a||a.childList[a.childList.length-1]===this},getPrevSibling:function(){if(!this.parent)return null;for(var a=this.parent.childList,b=1,c=a.length;b<c;b++)if(a[b]===this)return a[b-1];return null},getNextSibling:function(){if(!this.parent)return null;for(var a=this.parent.childList,
13
13
  b=0,c=a.length-1;b<c;b++)if(a[b]===this)return a[b+1];return null},isStatusNode:function(){return this.data.isStatusNode===true},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a)return false;for(var b=this.parent;b;){if(b===a)return true;b=b.parent}return false},countChildren:function(){var a=this.childList;if(!a)return 0;for(var b=a.length,c=0,d=b;c<d;c++)b+=a[c].countChildren();return b},sortChildren:function(a,b){var c=this.childList;if(c){a=a||function(f,
14
- h){return f.data.title===h.data.title?0:f.data.title>h.data.title};c.sort(a);if(b)for(var d=0,e=c.length;d<e;d++)c[d].childList&&c[d].sortChildren(a,"$norender$");b!=="$norender$"&&this.render()}},_setStatusNode:function(a){var b=this.childList?this.childList[0]:null;if(a)if(b){a.isStatusNode=true;a.key="_statusNode";b.data=a;b.render()}else{a.isStatusNode=true;a.key="_statusNode";this.addChild(a)}else if(b&&b.isStatusNode()){try{this.ul&&this.ul.removeChild(b.li)}catch(c){}if(this.childList.length===
14
+ h){return f.data.title===h.data.title?0:f.data.title>h.data.title?1:-1};c.sort(a);if(b)for(var d=0,e=c.length;d<e;d++)c[d].childList&&c[d].sortChildren(a,"$norender$");b!=="$norender$"&&this.render()}},_setStatusNode:function(a){var b=this.childList?this.childList[0]:null;if(a)if(b){a.isStatusNode=true;a.key="_statusNode";b.data=a;b.render()}else{a.isStatusNode=true;a.key="_statusNode";this.addChild(a)}else if(b&&b.isStatusNode()){try{this.ul&&this.ul.removeChild(b.li)}catch(c){}if(this.childList.length===
15
15
  1)this.childList=[];else this.childList.shift()}},setLazyNodeStatus:function(a,b){var c=b&&b.tooltip?b.tooltip:null,d=b&&b.info?" ("+b.info+")":"";switch(a){case DTNodeStatus_Ok:this._setStatusNode(null);g(this.span).removeClass(this.tree.options.classNames.nodeLoading);this.isLoading=false;this.render();if(this.tree.options.autoFocus)this===this.tree.tnRoot&&this.childList&&this.childList.length>0?this.childList[0].focus():this.focus();break;case DTNodeStatus_Loading:this.isLoading=true;g(this.span).addClass(this.tree.options.classNames.nodeLoading);
16
16
  this.parent||this._setStatusNode({title:this.tree.options.strings.loading+d,tooltip:c,addClass:this.tree.options.classNames.nodeWait});break;case DTNodeStatus_Error:this.isLoading=false;this._setStatusNode({title:this.tree.options.strings.loadError+d,tooltip:c,addClass:this.tree.options.classNames.nodeError});break;default:throw"Bad LazyNodeStatus: '"+a+"'.";}},_parentList:function(a,b){for(var c=[],d=b?this:this.parent;d;){if(a||d.parent)c.unshift(d);d=d.parent}return c},getLevel:function(){for(var a=
17
17
  0,b=this.parent;b;){a++;b=b.parent}return a},_getTypeForOuterNodeEvent:function(a){var b=this.tree.options.classNames,c=a.target;if(c.className.indexOf(b.node)<0)return null;var d=a.pageX-c.offsetLeft;a=a.pageY-c.offsetTop;for(var e=0,f=c.childNodes.length;e<f;e++){var h=c.childNodes[e],i=h.offsetLeft-c.offsetLeft,j=h.offsetTop-c.offsetTop,k=h.clientWidth,r=h.clientHeight;if(d>=i&&d<=i+k&&a>=j&&a<=j+r)if(h.className==b.title)return"title";else if(h.className==b.expander)return"expander";else if(h.className==
@@ -174,9 +174,11 @@ body {
174
174
 
175
175
  @-webkit-keyframes slideLeftOut {
176
176
  0% {
177
- -webkit-transform: translateX(0px); }
177
+ -webkit-transform: translateX(0px);
178
+ opacity: 1; }
178
179
  100% {
179
- -webkit-transform: translateX(-100%); } }
180
+ -webkit-transform: translateX(-100%);
181
+ opacity: 0; } }
180
182
 
181
183
 
182
184
  /* Slide Right */
@@ -190,9 +192,11 @@ body {
190
192
 
191
193
  @-webkit-keyframes slideRightOut {
192
194
  0% {
193
- -webkit-transform: translateX(0); }
195
+ -webkit-transform: translateX(0);
196
+ opacity: 1; }
194
197
  100% {
195
- -webkit-transform: translateX(100%); } }
198
+ -webkit-transform: translateX(100%);
199
+ opacity: 0; } }
196
200
 
197
201
 
198
202
  /* Slide Up */
@@ -2,16 +2,16 @@
2
2
  * jQuery JavaScript Library v@VERSION
3
3
  * http://jquery.com/
4
4
  *
5
- * Copyright 2010, John Resig
5
+ * Copyright 2011, John Resig
6
6
  * Dual licensed under the MIT or GPL Version 2 licenses.
7
7
  * http://jquery.org/license
8
8
  *
9
9
  * Includes Sizzle.js
10
10
  * http://sizzlejs.com/
11
- * Copyright 2010, The Dojo Foundation
11
+ * Copyright 2011, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date:
14
+ * Date: @DATE
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
@@ -24,7 +24,7 @@ var jQuery = (function() {
24
24
  // Define a local copy of jQuery
25
25
  var jQuery = function( selector, context ) {
26
26
  // The jQuery object is actually just the init constructor 'enhanced'
27
- return new jQuery.fn.init( selector, context );
27
+ return new jQuery.fn.init( selector, context, rootjQuery );
28
28
  },
29
29
 
30
30
  // Map over jQuery in case of overwrite
@@ -40,20 +40,13 @@ var jQuery = function( selector, context ) {
40
40
  // (both of which we optimize for)
41
41
  quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
42
42
 
43
- // Is it a simple selector
44
- isSimple = /^.[^:#\[\.,]*$/,
45
-
46
43
  // Check if a string has a non-whitespace character in it
47
44
  rnotwhite = /\S/,
48
- rwhite = /\s/,
49
45
 
50
46
  // Used for trimming whitespace
51
47
  trimLeft = /^\s+/,
52
48
  trimRight = /\s+$/,
53
49
 
54
- // Check for non-word characters
55
- rnonword = /\W/,
56
-
57
50
  // Check for digits
58
51
  rdigit = /\d/,
59
52
 
@@ -77,12 +70,23 @@ var jQuery = function( selector, context ) {
77
70
 
78
71
  // For matching the engine and version of the browser
79
72
  browserMatch,
80
-
73
+
81
74
  // Has the ready events already been bound?
82
75
  readyBound = false,
83
-
84
- // The functions to execute on DOM ready
85
- readyList = [],
76
+
77
+ // The deferred used on DOM ready
78
+ readyList,
79
+
80
+ // Promise methods (with equivalent for invert)
81
+ promiseMethods = {
82
+ then: 0, // will be overwritten for invert
83
+ done: "fail",
84
+ fail: "done",
85
+ isResolved: "isRejected",
86
+ isRejected: "isResolved",
87
+ promise: "invert",
88
+ invert: "promise"
89
+ },
86
90
 
87
91
  // The ready event handler
88
92
  DOMContentLoaded,
@@ -94,12 +98,13 @@ var jQuery = function( selector, context ) {
94
98
  slice = Array.prototype.slice,
95
99
  trim = String.prototype.trim,
96
100
  indexOf = Array.prototype.indexOf,
97
-
101
+
98
102
  // [[Class]] -> type pairs
99
103
  class2type = {};
100
104
 
101
105
  jQuery.fn = jQuery.prototype = {
102
- init: function( selector, context ) {
106
+ constructor: jQuery,
107
+ init: function( selector, context, rootjQuery ) {
103
108
  var match, elem, ret, doc;
104
109
 
105
110
  // Handle $(""), $(null), or $(undefined)
@@ -113,7 +118,7 @@ jQuery.fn = jQuery.prototype = {
113
118
  this.length = 1;
114
119
  return this;
115
120
  }
116
-
121
+
117
122
  // The body element only exists once, optimize finding it
118
123
  if ( selector === "body" && !context && document.body ) {
119
124
  this.context = document;
@@ -133,6 +138,7 @@ jQuery.fn = jQuery.prototype = {
133
138
 
134
139
  // HANDLE: $(html) -> $(array)
135
140
  if ( match[1] ) {
141
+ context = context instanceof jQuery ? context[0] : context;
136
142
  doc = (context ? context.ownerDocument || context : document);
137
143
 
138
144
  // If a single string is passed in and it's a single tag
@@ -150,11 +156,11 @@ jQuery.fn = jQuery.prototype = {
150
156
 
151
157
  } else {
152
158
  ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
153
- selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
159
+ selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
154
160
  }
155
-
161
+
156
162
  return jQuery.merge( this, selector );
157
-
163
+
158
164
  // HANDLE: $("#id")
159
165
  } else {
160
166
  elem = document.getElementById( match[2] );
@@ -178,13 +184,6 @@ jQuery.fn = jQuery.prototype = {
178
184
  return this;
179
185
  }
180
186
 
181
- // HANDLE: $("TAG")
182
- } else if ( !context && !rnonword.test( selector ) ) {
183
- this.selector = selector;
184
- this.context = document;
185
- selector = document.getElementsByTagName( selector );
186
- return jQuery.merge( this, selector );
187
-
188
187
  // HANDLE: $(expr, $(...))
189
188
  } else if ( !context || context.jquery ) {
190
189
  return (context || rootjQuery).find( selector );
@@ -192,7 +191,7 @@ jQuery.fn = jQuery.prototype = {
192
191
  // HANDLE: $(expr, context)
193
192
  // (which is just equivalent to: $(context).find(expr)
194
193
  } else {
195
- return jQuery( context ).find( selector );
194
+ return this.constructor( context ).find( selector );
196
195
  }
197
196
 
198
197
  // HANDLE: $(function)
@@ -236,18 +235,18 @@ jQuery.fn = jQuery.prototype = {
236
235
  this.toArray() :
237
236
 
238
237
  // Return just the object
239
- ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
238
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
240
239
  },
241
240
 
242
241
  // Take an array of elements and push it onto the stack
243
242
  // (returning the new matched element set)
244
243
  pushStack: function( elems, name, selector ) {
245
244
  // Build a new jQuery matched element set
246
- var ret = jQuery();
245
+ var ret = this.constructor();
247
246
 
248
247
  if ( jQuery.isArray( elems ) ) {
249
248
  push.apply( ret, elems );
250
-
249
+
251
250
  } else {
252
251
  jQuery.merge( ret, elems );
253
252
  }
@@ -273,25 +272,17 @@ jQuery.fn = jQuery.prototype = {
273
272
  each: function( callback, args ) {
274
273
  return jQuery.each( this, callback, args );
275
274
  },
276
-
275
+
277
276
  ready: function( fn ) {
278
277
  // Attach the listeners
279
278
  jQuery.bindReady();
280
279
 
281
- // If the DOM is already ready
282
- if ( jQuery.isReady ) {
283
- // Execute the function immediately
284
- fn.call( document, jQuery );
285
-
286
- // Otherwise, remember the function for later
287
- } else if ( readyList ) {
288
- // Add the function to the wait list
289
- readyList.push( fn );
290
- }
280
+ // Add the callback
281
+ readyList.done( fn );
291
282
 
292
283
  return this;
293
284
  },
294
-
285
+
295
286
  eq: function( i ) {
296
287
  return i === -1 ?
297
288
  this.slice( i ) :
@@ -316,9 +307,9 @@ jQuery.fn = jQuery.prototype = {
316
307
  return callback.call( elem, i, elem );
317
308
  }));
318
309
  },
319
-
310
+
320
311
  end: function() {
321
- return this.prevObject || jQuery(null);
312
+ return this.prevObject || this.constructor(null);
322
313
  },
323
314
 
324
315
  // For internal use only.
@@ -405,14 +396,14 @@ jQuery.extend({
405
396
 
406
397
  return jQuery;
407
398
  },
408
-
399
+
409
400
  // Is the DOM ready to be used? Set to true once it occurs.
410
401
  isReady: false,
411
402
 
412
403
  // A counter to track how many items to wait for before
413
404
  // the ready event fires. See #6781
414
405
  readyWait: 1,
415
-
406
+
416
407
  // Handle when the DOM is ready
417
408
  ready: function( wait ) {
418
409
  // A third-party is pushing the ready event forwards
@@ -436,27 +427,15 @@ jQuery.extend({
436
427
  }
437
428
 
438
429
  // If there are functions bound, to execute
439
- if ( readyList ) {
440
- // Execute all of them
441
- var fn,
442
- i = 0,
443
- ready = readyList;
444
-
445
- // Reset the list of functions
446
- readyList = null;
447
-
448
- while ( (fn = ready[ i++ ]) ) {
449
- fn.call( document, jQuery );
450
- }
430
+ readyList.resolveWith( document, [ jQuery ] );
451
431
 
452
- // Trigger any bound ready events
453
- if ( jQuery.fn.trigger ) {
454
- jQuery( document ).trigger( "ready" ).unbind( "ready" );
455
- }
432
+ // Trigger any bound ready events
433
+ if ( jQuery.fn.trigger ) {
434
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
456
435
  }
457
436
  }
458
437
  },
459
-
438
+
460
439
  bindReady: function() {
461
440
  if ( readyBound ) {
462
441
  return;
@@ -475,7 +454,7 @@ jQuery.extend({
475
454
  if ( document.addEventListener ) {
476
455
  // Use the handy event callback
477
456
  document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
478
-
457
+
479
458
  // A fallback to window.onload, that will always work
480
459
  window.addEventListener( "load", jQuery.ready, false );
481
460
 
@@ -484,7 +463,7 @@ jQuery.extend({
484
463
  // ensure firing before onload,
485
464
  // maybe late but safe also for iframes
486
465
  document.attachEvent("onreadystatechange", DOMContentLoaded);
487
-
466
+
488
467
  // A fallback to window.onload, that will always work
489
468
  window.attachEvent( "onload", jQuery.ready );
490
469
 
@@ -535,20 +514,20 @@ jQuery.extend({
535
514
  if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
536
515
  return false;
537
516
  }
538
-
517
+
539
518
  // Not own constructor property must be Object
540
519
  if ( obj.constructor &&
541
520
  !hasOwn.call(obj, "constructor") &&
542
521
  !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
543
522
  return false;
544
523
  }
545
-
524
+
546
525
  // Own properties are enumerated firstly, so to speed up,
547
526
  // if last one is own, then all properties are own.
548
-
527
+
549
528
  var key;
550
529
  for ( key in obj ) {}
551
-
530
+
552
531
  return key === undefined || hasOwn.call( obj, key );
553
532
  },
554
533
 
@@ -558,11 +537,11 @@ jQuery.extend({
558
537
  }
559
538
  return true;
560
539
  },
561
-
540
+
562
541
  error: function( msg ) {
563
542
  throw msg;
564
543
  },
565
-
544
+
566
545
  parseJSON: function( data ) {
567
546
  if ( typeof data !== "string" || !data ) {
568
547
  return null;
@@ -570,7 +549,7 @@ jQuery.extend({
570
549
 
571
550
  // Make sure leading/trailing whitespace is removed (IE can't handle it)
572
551
  data = jQuery.trim( data );
573
-
552
+
574
553
  // Make sure the incoming data is actual JSON
575
554
  // Logic borrowed from http://json.org/json2.js
576
555
  if ( rvalidchars.test(data.replace(rvalidescape, "@")
@@ -587,6 +566,28 @@ jQuery.extend({
587
566
  }
588
567
  },
589
568
 
569
+ // Cross-browser xml parsing
570
+ // (xml & tmp used internally)
571
+ parseXML: function( data , xml , tmp ) {
572
+
573
+ if ( window.DOMParser ) { // Standard
574
+ tmp = new DOMParser();
575
+ xml = tmp.parseFromString( data , "text/xml" );
576
+ } else { // IE
577
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
578
+ xml.async = "false";
579
+ xml.loadXML( data );
580
+ }
581
+
582
+ tmp = xml.documentElement;
583
+
584
+ if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
585
+ jQuery.error( "Invalid XML: " + data );
586
+ }
587
+
588
+ return xml;
589
+ },
590
+
590
591
  noop: function() {},
591
592
 
592
593
  // Evalulates a script in a global context
@@ -594,12 +595,10 @@ jQuery.extend({
594
595
  if ( data && rnotwhite.test(data) ) {
595
596
  // Inspired by code by Andrea Giammarchi
596
597
  // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
597
- var head = document.getElementsByTagName("head")[0] || document.documentElement,
598
- script = document.createElement("script");
599
-
600
- script.type = "text/javascript";
598
+ var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
599
+ script = document.createElement( "script" );
601
600
 
602
- if ( jQuery.support.scriptEval ) {
601
+ if ( jQuery.support.scriptEval() ) {
603
602
  script.appendChild( document.createTextNode( data ) );
604
603
  } else {
605
604
  script.text = data;
@@ -712,7 +711,7 @@ jQuery.extend({
712
711
  for ( var l = second.length; j < l; j++ ) {
713
712
  first[ i++ ] = second[ j ];
714
713
  }
715
-
714
+
716
715
  } else {
717
716
  while ( second[j] !== undefined ) {
718
717
  first[ i++ ] = second[ j++ ];
@@ -754,6 +753,7 @@ jQuery.extend({
754
753
  }
755
754
  }
756
755
 
756
+ // Flatten any nested arrays
757
757
  return ret.concat.apply( [], ret );
758
758
  },
759
759
 
@@ -792,7 +792,7 @@ jQuery.extend({
792
792
  // The value/s can be optionally by executed if its a function
793
793
  access: function( elems, key, value, exec, fn, pass ) {
794
794
  var length = elems.length;
795
-
795
+
796
796
  // Setting many attributes
797
797
  if ( typeof key === "object" ) {
798
798
  for ( var k in key ) {
@@ -800,19 +800,19 @@ jQuery.extend({
800
800
  }
801
801
  return elems;
802
802
  }
803
-
803
+
804
804
  // Setting one attribute
805
805
  if ( value !== undefined ) {
806
806
  // Optionally, function values get executed if exec is true
807
807
  exec = !pass && exec && jQuery.isFunction(value);
808
-
808
+
809
809
  for ( var i = 0; i < length; i++ ) {
810
810
  fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
811
811
  }
812
-
812
+
813
813
  return elems;
814
814
  }
815
-
815
+
816
816
  // Getting an attribute
817
817
  return length ? fn( elems[0], key ) : undefined;
818
818
  },
@@ -821,6 +821,173 @@ jQuery.extend({
821
821
  return (new Date()).getTime();
822
822
  },
823
823
 
824
+ // Create a simple deferred (one callbacks list)
825
+ _Deferred: function() {
826
+ var // callbacks list
827
+ callbacks = [],
828
+ // stored [ context , args ]
829
+ fired,
830
+ // to avoid firing when already doing so
831
+ firing,
832
+ // flag to know if the deferred has been cancelled
833
+ cancelled,
834
+ // the deferred itself
835
+ deferred = {
836
+
837
+ // done( f1, f2, ...)
838
+ done: function() {
839
+ if ( !cancelled ) {
840
+ var args = arguments,
841
+ i,
842
+ length,
843
+ elem,
844
+ type,
845
+ _fired;
846
+ if ( fired ) {
847
+ _fired = fired;
848
+ fired = 0;
849
+ }
850
+ for ( i = 0, length = args.length; i < length; i++ ) {
851
+ elem = args[ i ];
852
+ type = jQuery.type( elem );
853
+ if ( type === "array" ) {
854
+ deferred.done.apply( deferred, elem );
855
+ } else if ( type === "function" ) {
856
+ callbacks.push( elem );
857
+ }
858
+ }
859
+ if ( _fired ) {
860
+ deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
861
+ }
862
+ }
863
+ return this;
864
+ },
865
+
866
+ // resolve with given context and args
867
+ resolveWith: function( context, args ) {
868
+ if ( !cancelled && !fired && !firing ) {
869
+ firing = 1;
870
+ try {
871
+ while( callbacks[ 0 ] ) {
872
+ callbacks.shift().apply( context, args );
873
+ }
874
+ }
875
+ finally {
876
+ fired = [ context, args ];
877
+ firing = 0;
878
+ }
879
+ }
880
+ return this;
881
+ },
882
+
883
+ // resolve with this as context and given arguments
884
+ resolve: function() {
885
+ deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );
886
+ return this;
887
+ },
888
+
889
+ // Has this deferred been resolved?
890
+ isResolved: function() {
891
+ return !!( firing || fired );
892
+ },
893
+
894
+ // Cancel
895
+ cancel: function() {
896
+ cancelled = 1;
897
+ callbacks = [];
898
+ return this;
899
+ }
900
+ };
901
+
902
+ return deferred;
903
+ },
904
+
905
+ // Full fledged deferred (two callbacks list)
906
+ Deferred: function( func ) {
907
+ var deferred = jQuery._Deferred(),
908
+ failDeferred = jQuery._Deferred(),
909
+ promise,
910
+ invert;
911
+ // Add errorDeferred methods, then, promise and invert
912
+ jQuery.extend( deferred, {
913
+ then: function( doneCallbacks, failCallbacks ) {
914
+ deferred.done( doneCallbacks ).fail( failCallbacks );
915
+ return this;
916
+ },
917
+ fail: failDeferred.done,
918
+ rejectWith: failDeferred.resolveWith,
919
+ reject: failDeferred.resolve,
920
+ isRejected: failDeferred.isResolved,
921
+ // Get a promise for this deferred
922
+ // If obj is provided, the promise aspect is added to the object
923
+ promise: function( obj ) {
924
+ if ( obj == null ) {
925
+ if ( promise ) {
926
+ return promise;
927
+ }
928
+ promise = obj = {};
929
+ }
930
+ for( var methodName in promiseMethods ) {
931
+ obj[ methodName ] = deferred[ methodName ];
932
+ }
933
+ return obj;
934
+ },
935
+ // Get the invert promise for this deferred
936
+ // If obj is provided, the invert promise aspect is added to the object
937
+ invert: function( obj ) {
938
+ if ( obj == null ) {
939
+ if ( invert ) {
940
+ return invert;
941
+ }
942
+ invert = obj = {};
943
+ }
944
+ for( var methodName in promiseMethods ) {
945
+ obj[ methodName ] = promiseMethods[ methodName ] && deferred[ promiseMethods[methodName] ];
946
+ }
947
+ obj.then = invert.then || function( doneCallbacks, failCallbacks ) {
948
+ deferred.done( failCallbacks ).fail( doneCallbacks );
949
+ return this;
950
+ };
951
+ return obj;
952
+ }
953
+ } );
954
+ // Make sure only one callback list will be used
955
+ deferred.then( failDeferred.cancel, deferred.cancel );
956
+ // Unexpose cancel
957
+ delete deferred.cancel;
958
+ // Call given func if any
959
+ if ( func ) {
960
+ func.call( deferred, deferred );
961
+ }
962
+ return deferred;
963
+ },
964
+
965
+ // Deferred helper
966
+ when: function( object ) {
967
+ var args = arguments,
968
+ length = args.length,
969
+ deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ?
970
+ object :
971
+ jQuery.Deferred(),
972
+ promise = deferred.promise(),
973
+ resolveArray;
974
+
975
+ if ( length > 1 ) {
976
+ resolveArray = new Array( length );
977
+ jQuery.each( args, function( index, element ) {
978
+ jQuery.when( element ).then( function( value ) {
979
+ resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
980
+ if( ! --length ) {
981
+ deferred.resolveWith( promise, resolveArray );
982
+ }
983
+ }, deferred.reject );
984
+ } );
985
+ } else if ( deferred !== object ) {
986
+ deferred.resolve( object );
987
+ }
988
+ return promise;
989
+ },
990
+
824
991
  // Use of jQuery.browser is frowned upon.
825
992
  // More details: http://docs.jquery.com/Utilities/jQuery.browser
826
993
  uaMatch: function( ua ) {
@@ -835,9 +1002,33 @@ jQuery.extend({
835
1002
  return { browser: match[1] || "", version: match[2] || "0" };
836
1003
  },
837
1004
 
1005
+ sub: function() {
1006
+ function jQuerySubclass( selector, context ) {
1007
+ return new jQuerySubclass.fn.init( selector, context );
1008
+ }
1009
+ jQuery.extend( true, jQuerySubclass, this );
1010
+ jQuerySubclass.superclass = this;
1011
+ jQuerySubclass.fn = jQuerySubclass.prototype = this();
1012
+ jQuerySubclass.fn.constructor = jQuerySubclass;
1013
+ jQuerySubclass.subclass = this.subclass;
1014
+ jQuerySubclass.fn.init = function init( selector, context ) {
1015
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
1016
+ context = jQuerySubclass(context);
1017
+ }
1018
+
1019
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
1020
+ };
1021
+ jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
1022
+ var rootjQuerySubclass = jQuerySubclass(document);
1023
+ return jQuerySubclass;
1024
+ },
1025
+
838
1026
  browser: {}
839
1027
  });
840
1028
 
1029
+ // Create readyList deferred
1030
+ readyList = jQuery._Deferred();
1031
+
841
1032
  // Populate the class2type map
842
1033
  jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
843
1034
  class2type[ "[object " + name + "]" ] = name.toLowerCase();
@@ -860,9 +1051,8 @@ if ( indexOf ) {
860
1051
  };
861
1052
  }
862
1053
 
863
- // Verify that \s matches non-breaking spaces
864
- // (IE fails on this test)
865
- if ( !rwhite.test( "\xA0" ) ) {
1054
+ // IE doesn't match non-breaking spaces with \s
1055
+ if ( rnotwhite.test( "\xA0" ) ) {
866
1056
  trimLeft = /^[\s\xA0]+/;
867
1057
  trimRight = /[\s\xA0]+$/;
868
1058
  }
@@ -918,10 +1108,7 @@ return (window.jQuery = window.$ = jQuery);
918
1108
 
919
1109
  jQuery.support = {};
920
1110
 
921
- var root = document.documentElement,
922
- script = document.createElement("script"),
923
- div = document.createElement("div"),
924
- id = "script" + jQuery.now();
1111
+ var div = document.createElement("div");
925
1112
 
926
1113
  div.style.display = "none";
927
1114
  div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
@@ -978,7 +1165,7 @@ return (window.jQuery = window.$ = jQuery);
978
1165
  deleteExpando: true,
979
1166
  optDisabled: false,
980
1167
  checkClone: false,
981
- scriptEval: false,
1168
+ _scriptEval: null,
982
1169
  noCloneEvent: true,
983
1170
  boxModel: null,
984
1171
  inlineBlockNeedsLayout: false,
@@ -991,32 +1178,46 @@ return (window.jQuery = window.$ = jQuery);
991
1178
  select.disabled = true;
992
1179
  jQuery.support.optDisabled = !opt.disabled;
993
1180
 
994
- script.type = "text/javascript";
995
- try {
996
- script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
997
- } catch(e) {}
1181
+ jQuery.support.scriptEval = function() {
1182
+ if ( jQuery.support._scriptEval === null ) {
1183
+ var root = document.documentElement,
1184
+ script = document.createElement("script"),
1185
+ id = "script" + jQuery.now();
998
1186
 
999
- root.insertBefore( script, root.firstChild );
1187
+ script.type = "text/javascript";
1188
+ try {
1189
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
1190
+ } catch(e) {}
1000
1191
 
1001
- // Make sure that the execution of code works by injecting a script
1002
- // tag with appendChild/createTextNode
1003
- // (IE doesn't support this, fails, and uses .text instead)
1004
- if ( window[ id ] ) {
1005
- jQuery.support.scriptEval = true;
1006
- delete window[ id ];
1007
- }
1192
+ root.insertBefore( script, root.firstChild );
1193
+
1194
+ // Make sure that the execution of code works by injecting a script
1195
+ // tag with appendChild/createTextNode
1196
+ // (IE doesn't support this, fails, and uses .text instead)
1197
+ if ( window[ id ] ) {
1198
+ jQuery.support._scriptEval = true;
1199
+ delete window[ id ];
1200
+ } else {
1201
+ jQuery.support._scriptEval = false;
1202
+ }
1203
+
1204
+ root.removeChild( script );
1205
+ // release memory in IE
1206
+ root = script = id = null;
1207
+ }
1208
+
1209
+ return jQuery.support._scriptEval;
1210
+ };
1008
1211
 
1009
1212
  // Test to see if it's possible to delete an expando from an element
1010
1213
  // Fails in Internet Explorer
1011
1214
  try {
1012
- delete script.test;
1215
+ delete div.test;
1013
1216
 
1014
1217
  } catch(e) {
1015
1218
  jQuery.support.deleteExpando = false;
1016
1219
  }
1017
1220
 
1018
- root.removeChild( script );
1019
-
1020
1221
  if ( div.attachEvent && div.fireEvent ) {
1021
1222
  div.attachEvent("onclick", function click() {
1022
1223
  // Cloning a node shouldn't copy over any
@@ -1039,10 +1240,16 @@ return (window.jQuery = window.$ = jQuery);
1039
1240
  // Figure out if the W3C box model works as expected
1040
1241
  // document.body must exist before we can do this
1041
1242
  jQuery(function() {
1042
- var div = document.createElement("div");
1043
- div.style.width = div.style.paddingLeft = "1px";
1243
+ var div = document.createElement("div"),
1244
+ body = document.getElementsByTagName("body")[0];
1245
+
1246
+ // Frameset documents with no body should not run this code
1247
+ if ( !body ) {
1248
+ return;
1249
+ }
1044
1250
 
1045
- document.body.appendChild( div );
1251
+ div.style.width = div.style.paddingLeft = "1px";
1252
+ body.appendChild( div );
1046
1253
  jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
1047
1254
 
1048
1255
  if ( "zoom" in div.style ) {
@@ -1061,7 +1268,7 @@ return (window.jQuery = window.$ = jQuery);
1061
1268
  jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1062
1269
  }
1063
1270
 
1064
- div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
1271
+ div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1065
1272
  var tds = div.getElementsByTagName("td");
1066
1273
 
1067
1274
  // Check if table cells still have offsetWidth/Height when they are set
@@ -1081,7 +1288,7 @@ return (window.jQuery = window.$ = jQuery);
1081
1288
  jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1082
1289
  div.innerHTML = "";
1083
1290
 
1084
- document.body.removeChild( div ).style.display = "none";
1291
+ body.removeChild( div ).style.display = "none";
1085
1292
  div = tds = null;
1086
1293
  });
1087
1294
 
@@ -1091,6 +1298,14 @@ return (window.jQuery = window.$ = jQuery);
1091
1298
  var el = document.createElement("div");
1092
1299
  eventName = "on" + eventName;
1093
1300
 
1301
+ // We only care about the case where non-standard event systems
1302
+ // are used, namely in IE. Short-circuiting here helps us to
1303
+ // avoid an eval call (in setAttribute) which can cause CSP
1304
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1305
+ if ( !el.attachEvent ) {
1306
+ return true;
1307
+ }
1308
+
1094
1309
  var isSupported = (eventName in el);
1095
1310
  if ( !isSupported ) {
1096
1311
  el.setAttribute(eventName, "return;");
@@ -1105,15 +1320,14 @@ return (window.jQuery = window.$ = jQuery);
1105
1320
  jQuery.support.changeBubbles = eventSupported("change");
1106
1321
 
1107
1322
  // release memory in IE
1108
- root = script = div = all = a = null;
1323
+ div = all = a = null;
1109
1324
  })();
1110
1325
  })( jQuery );
1111
1326
 
1112
1327
 
1113
1328
  (function( jQuery ) {
1114
1329
 
1115
- var windowData = {},
1116
- rbrace = /^(?:\{.*\}|\[.*\])$/;
1330
+ var rbrace = /^(?:\{.*\}|\[.*\])$/;
1117
1331
 
1118
1332
  jQuery.extend({
1119
1333
  cache: {},
@@ -1121,8 +1335,9 @@ jQuery.extend({
1121
1335
  // Please use with caution
1122
1336
  uuid: 0,
1123
1337
 
1124
- // Unique for each copy of jQuery on the page
1125
- expando: "jQuery" + jQuery.now(),
1338
+ // Unique for each copy of jQuery on the page
1339
+ // Non-digits removed to match rinlinejQuery
1340
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1126
1341
 
1127
1342
  // The following elements throw uncatchable exceptions if you
1128
1343
  // attempt to add expando properties to them.
@@ -1133,103 +1348,171 @@ jQuery.extend({
1133
1348
  "applet": true
1134
1349
  },
1135
1350
 
1136
- data: function( elem, name, data ) {
1351
+ hasData: function( elem ) {
1352
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1353
+
1354
+ return !!elem && !jQuery.isEmptyObject(elem);
1355
+ },
1356
+
1357
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1137
1358
  if ( !jQuery.acceptData( elem ) ) {
1138
1359
  return;
1139
1360
  }
1140
1361
 
1141
- elem = elem == window ?
1142
- windowData :
1143
- elem;
1362
+ var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
1363
+
1364
+ // We have to handle DOM nodes and JS objects differently because IE6-7
1365
+ // can't GC object references properly across the DOM-JS boundary
1366
+ isNode = elem.nodeType,
1144
1367
 
1145
- var isNode = elem.nodeType,
1146
- id = isNode ? elem[ jQuery.expando ] : null,
1147
- cache = jQuery.cache, thisCache;
1368
+ // Only DOM nodes need the global jQuery cache; JS object data is
1369
+ // attached directly to the object so GC can occur automatically
1370
+ cache = isNode ? jQuery.cache : elem,
1148
1371
 
1149
- if ( isNode && !id && typeof name === "string" && data === undefined ) {
1372
+ // Only defining an ID for JS objects if its cache already exists allows
1373
+ // the code to shortcut on the same path as a DOM node with no cache
1374
+ id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
1375
+
1376
+ // Avoid doing any more work than we need to when trying to get data on an
1377
+ // object that has no data at all
1378
+ if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
1150
1379
  return;
1151
1380
  }
1152
1381
 
1153
- // Get the data from the object directly
1154
- if ( !isNode ) {
1155
- cache = elem;
1382
+ if ( !id ) {
1383
+ // Only DOM nodes need a new unique ID for each element since their data
1384
+ // ends up in the global cache
1385
+ if ( isNode ) {
1386
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
1387
+ } else {
1388
+ id = jQuery.expando;
1389
+ }
1390
+ }
1156
1391
 
1157
- // Compute a unique ID for the element
1158
- } else if ( !id ) {
1159
- elem[ jQuery.expando ] = id = ++jQuery.uuid;
1392
+ if ( !cache[ id ] ) {
1393
+ cache[ id ] = {};
1160
1394
  }
1161
1395
 
1162
- // Avoid generating a new cache unless none exists and we
1163
- // want to manipulate it.
1396
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
1397
+ // shallow copied over onto the existing cache
1164
1398
  if ( typeof name === "object" ) {
1165
- if ( isNode ) {
1399
+ if ( pvt ) {
1400
+ cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
1401
+ } else {
1166
1402
  cache[ id ] = jQuery.extend(cache[ id ], name);
1403
+ }
1404
+ }
1167
1405
 
1168
- } else {
1169
- jQuery.extend( cache, name );
1406
+ thisCache = cache[ id ];
1407
+
1408
+ // Internal jQuery data is stored in a separate object inside the object's data
1409
+ // cache in order to avoid key collisions between internal data and user-defined
1410
+ // data
1411
+ if ( pvt ) {
1412
+ if ( !thisCache[ internalKey ] ) {
1413
+ thisCache[ internalKey ] = {};
1170
1414
  }
1171
1415
 
1172
- } else if ( isNode && !cache[ id ] ) {
1173
- cache[ id ] = {};
1416
+ thisCache = thisCache[ internalKey ];
1174
1417
  }
1175
1418
 
1176
- thisCache = isNode ? cache[ id ] : cache;
1177
-
1178
- // Prevent overriding the named cache with undefined values
1179
1419
  if ( data !== undefined ) {
1180
1420
  thisCache[ name ] = data;
1181
1421
  }
1182
1422
 
1183
- return typeof name === "string" ? thisCache[ name ] : thisCache;
1423
+ // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
1424
+ // not attempt to inspect the internal events object using jQuery.data, as this
1425
+ // internal data object is undocumented and subject to change.
1426
+ if ( name === "events" && !thisCache[name] ) {
1427
+ return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1428
+ }
1429
+
1430
+ return getByName ? thisCache[ name ] : thisCache;
1184
1431
  },
1185
1432
 
1186
- removeData: function( elem, name ) {
1433
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1187
1434
  if ( !jQuery.acceptData( elem ) ) {
1188
1435
  return;
1189
1436
  }
1190
1437
 
1191
- elem = elem == window ?
1192
- windowData :
1193
- elem;
1438
+ var internalKey = jQuery.expando, isNode = elem.nodeType,
1194
1439
 
1195
- var isNode = elem.nodeType,
1196
- id = isNode ? elem[ jQuery.expando ] : elem,
1197
- cache = jQuery.cache,
1198
- thisCache = isNode ? cache[ id ] : id;
1440
+ // See jQuery.data for more information
1441
+ cache = isNode ? jQuery.cache : elem,
1442
+
1443
+ // See jQuery.data for more information
1444
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1445
+
1446
+ // If there is already no cache entry for this object, there is no
1447
+ // purpose in continuing
1448
+ if ( !cache[ id ] ) {
1449
+ return;
1450
+ }
1199
1451
 
1200
- // If we want to remove a specific section of the element's data
1201
1452
  if ( name ) {
1453
+ var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
1454
+
1202
1455
  if ( thisCache ) {
1203
- // Remove the section of cache data
1204
1456
  delete thisCache[ name ];
1205
1457
 
1206
- // If we've removed all the data, remove the element's cache
1207
- if ( isNode && jQuery.isEmptyObject(thisCache) ) {
1208
- jQuery.removeData( elem );
1458
+ // If there is no data left in the cache, we want to continue
1459
+ // and let the cache object itself get destroyed
1460
+ if ( !jQuery.isEmptyObject(thisCache) ) {
1461
+ return;
1209
1462
  }
1210
1463
  }
1464
+ }
1465
+
1466
+ // See jQuery.data for more information
1467
+ if ( pvt ) {
1468
+ delete cache[ id ][ internalKey ];
1469
+
1470
+ // Don't destroy the parent cache unless the internal data object
1471
+ // had been the only thing left in it
1472
+ if ( !jQuery.isEmptyObject(cache[ id ]) ) {
1473
+ return;
1474
+ }
1475
+ }
1476
+
1477
+ var internalCache = cache[ id ][ internalKey ];
1211
1478
 
1212
- // Otherwise, we want to remove all of the element's data
1479
+ // Browsers that fail expando deletion also refuse to delete expandos on
1480
+ // the window, but it will allow it on all other JS objects; other browsers
1481
+ // don't care
1482
+ if ( jQuery.support.deleteExpando || cache != window ) {
1483
+ delete cache[ id ];
1213
1484
  } else {
1214
- if ( isNode && jQuery.support.deleteExpando ) {
1215
- delete elem[ jQuery.expando ];
1485
+ cache[ id ] = null;
1486
+ }
1216
1487
 
1488
+ // We destroyed the entire user cache at once because it's faster than
1489
+ // iterating through each key, but we need to continue to persist internal
1490
+ // data if it existed
1491
+ if ( internalCache ) {
1492
+ cache[ id ] = {};
1493
+ cache[ id ][ internalKey ] = internalCache;
1494
+
1495
+ // Otherwise, we need to eliminate the expando on the node to avoid
1496
+ // false lookups in the cache for entries that no longer exist
1497
+ } else if ( isNode ) {
1498
+ // IE does not allow us to delete expando properties from nodes,
1499
+ // nor does it have a removeAttribute function on Document nodes;
1500
+ // we must handle all of these cases
1501
+ if ( jQuery.support.deleteExpando ) {
1502
+ delete elem[ jQuery.expando ];
1217
1503
  } else if ( elem.removeAttribute ) {
1218
1504
  elem.removeAttribute( jQuery.expando );
1219
-
1220
- // Completely remove the data cache
1221
- } else if ( isNode ) {
1222
- delete cache[ id ];
1223
-
1224
- // Remove all fields from the object
1225
1505
  } else {
1226
- for ( var n in elem ) {
1227
- delete elem[ n ];
1228
- }
1506
+ elem[ jQuery.expando ] = null;
1229
1507
  }
1230
1508
  }
1231
1509
  },
1232
1510
 
1511
+ // For internal use only.
1512
+ _data: function( elem, name, data ) {
1513
+ return jQuery.data( elem, name, data, true );
1514
+ },
1515
+
1233
1516
  // A method for determining if a DOM node can handle the data expando
1234
1517
  acceptData: function( elem ) {
1235
1518
  if ( elem.nodeName ) {
@@ -1250,15 +1533,17 @@ jQuery.fn.extend({
1250
1533
 
1251
1534
  if ( typeof key === "undefined" ) {
1252
1535
  if ( this.length ) {
1253
- var attr = this[0].attributes, name;
1254
1536
  data = jQuery.data( this[0] );
1255
1537
 
1256
- for ( var i = 0, l = attr.length; i < l; i++ ) {
1257
- name = attr[i].name;
1538
+ if ( this[0].nodeType === 1 ) {
1539
+ var attr = this[0].attributes, name;
1540
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
1541
+ name = attr[i].name;
1258
1542
 
1259
- if ( name.indexOf( "data-" ) === 0 ) {
1260
- name = name.substr( 5 );
1261
- dataAttr( this[0], name, data[ name ] );
1543
+ if ( name.indexOf( "data-" ) === 0 ) {
1544
+ name = name.substr( 5 );
1545
+ dataAttr( this[0], name, data[ name ] );
1546
+ }
1262
1547
  }
1263
1548
  }
1264
1549
  }
@@ -1345,7 +1630,7 @@ jQuery.extend({
1345
1630
  }
1346
1631
 
1347
1632
  type = (type || "fx") + "queue";
1348
- var q = jQuery.data( elem, type );
1633
+ var q = jQuery._data( elem, type );
1349
1634
 
1350
1635
  // Speed up dequeue by getting out quickly if this is just a lookup
1351
1636
  if ( !data ) {
@@ -1353,7 +1638,7 @@ jQuery.extend({
1353
1638
  }
1354
1639
 
1355
1640
  if ( !q || jQuery.isArray(data) ) {
1356
- q = jQuery.data( elem, type, jQuery.makeArray(data) );
1641
+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
1357
1642
 
1358
1643
  } else {
1359
1644
  q.push( data );
@@ -1384,6 +1669,10 @@ jQuery.extend({
1384
1669
  jQuery.dequeue(elem, type);
1385
1670
  });
1386
1671
  }
1672
+
1673
+ if ( !queue.length ) {
1674
+ jQuery.removeData( elem, type + "queue", true );
1675
+ }
1387
1676
  }
1388
1677
  });
1389
1678
 
@@ -1435,7 +1724,7 @@ jQuery.fn.extend({
1435
1724
 
1436
1725
  (function( jQuery ) {
1437
1726
 
1438
- var rclass = /[\n\t]/g,
1727
+ var rclass = /[\n\t\r]/g,
1439
1728
  rspaces = /\s+/,
1440
1729
  rreturn = /\r/g,
1441
1730
  rspecialurl = /^(?:href|src|style)$/,
@@ -1568,11 +1857,11 @@ jQuery.fn.extend({
1568
1857
  } else if ( type === "undefined" || type === "boolean" ) {
1569
1858
  if ( this.className ) {
1570
1859
  // store className if set
1571
- jQuery.data( this, "__className__", this.className );
1860
+ jQuery._data( this, "__className__", this.className );
1572
1861
  }
1573
1862
 
1574
1863
  // toggle whole className
1575
- this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
1864
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
1576
1865
  }
1577
1866
  });
1578
1867
  },
@@ -1617,7 +1906,7 @@ jQuery.fn.extend({
1617
1906
  var option = options[ i ];
1618
1907
 
1619
1908
  // Don't return options that are disabled or in a disabled optgroup
1620
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1909
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1621
1910
  (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1622
1911
 
1623
1912
  // Get the specific value for the option
@@ -1640,7 +1929,6 @@ jQuery.fn.extend({
1640
1929
  if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
1641
1930
  return elem.getAttribute("value") === null ? "on" : elem.value;
1642
1931
  }
1643
-
1644
1932
 
1645
1933
  // Everything else, we just grab the value
1646
1934
  return (elem.value || "").replace(rreturn, "");
@@ -1706,10 +1994,10 @@ jQuery.extend({
1706
1994
  height: true,
1707
1995
  offset: true
1708
1996
  },
1709
-
1997
+
1710
1998
  attr: function( elem, name, value, pass ) {
1711
- // don't set attributes on text and comment nodes
1712
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
1999
+ // don't get/set attributes on text, comment and attribute nodes
2000
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
1713
2001
  return undefined;
1714
2002
  }
1715
2003
 
@@ -1724,88 +2012,96 @@ jQuery.extend({
1724
2012
  // Try to normalize/fix the name
1725
2013
  name = notxml && jQuery.props[ name ] || name;
1726
2014
 
1727
- // These attributes require special treatment
1728
- var special = rspecialurl.test( name );
2015
+ // Only do all the following if this is a node (faster for style)
2016
+ if ( elem.nodeType === 1 ) {
2017
+ // These attributes require special treatment
2018
+ var special = rspecialurl.test( name );
2019
+
2020
+ // Safari mis-reports the default selected property of an option
2021
+ // Accessing the parent's selectedIndex property fixes it
2022
+ if ( name === "selected" && !jQuery.support.optSelected ) {
2023
+ var parent = elem.parentNode;
2024
+ if ( parent ) {
2025
+ parent.selectedIndex;
2026
+
2027
+ // Make sure that it also works with optgroups, see #5701
2028
+ if ( parent.parentNode ) {
2029
+ parent.parentNode.selectedIndex;
2030
+ }
2031
+ }
2032
+ }
2033
+
2034
+ // If applicable, access the attribute via the DOM 0 way
2035
+ // 'in' checks fail in Blackberry 4.7 #6931
2036
+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
2037
+ if ( set ) {
2038
+ // We can't allow the type property to be changed (since it causes problems in IE)
2039
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
2040
+ jQuery.error( "type property can't be changed" );
2041
+ }
1729
2042
 
1730
- // Safari mis-reports the default selected property of an option
1731
- // Accessing the parent's selectedIndex property fixes it
1732
- if ( name === "selected" && !jQuery.support.optSelected ) {
1733
- var parent = elem.parentNode;
1734
- if ( parent ) {
1735
- parent.selectedIndex;
2043
+ if ( value === null ) {
2044
+ if ( elem.nodeType === 1 ) {
2045
+ elem.removeAttribute( name );
2046
+ }
1736
2047
 
1737
- // Make sure that it also works with optgroups, see #5701
1738
- if ( parent.parentNode ) {
1739
- parent.parentNode.selectedIndex;
2048
+ } else {
2049
+ elem[ name ] = value;
2050
+ }
1740
2051
  }
1741
- }
1742
- }
1743
2052
 
1744
- // If applicable, access the attribute via the DOM 0 way
1745
- // 'in' checks fail in Blackberry 4.7 #6931
1746
- if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
1747
- if ( set ) {
1748
- // We can't allow the type property to be changed (since it causes problems in IE)
1749
- if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1750
- jQuery.error( "type property can't be changed" );
2053
+ // browsers index elements by id/name on forms, give priority to attributes.
2054
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
2055
+ return elem.getAttributeNode( name ).nodeValue;
1751
2056
  }
1752
2057
 
1753
- if ( value === null ) {
1754
- if ( elem.nodeType === 1 ) {
1755
- elem.removeAttribute( name );
1756
- }
2058
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2059
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2060
+ if ( name === "tabIndex" ) {
2061
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
1757
2062
 
1758
- } else {
1759
- elem[ name ] = value;
2063
+ return attributeNode && attributeNode.specified ?
2064
+ attributeNode.value :
2065
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2066
+ 0 :
2067
+ undefined;
1760
2068
  }
1761
- }
1762
2069
 
1763
- // browsers index elements by id/name on forms, give priority to attributes.
1764
- if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
1765
- return elem.getAttributeNode( name ).nodeValue;
2070
+ return elem[ name ];
1766
2071
  }
1767
2072
 
1768
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1769
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1770
- if ( name === "tabIndex" ) {
1771
- var attributeNode = elem.getAttributeNode( "tabIndex" );
2073
+ if ( !jQuery.support.style && notxml && name === "style" ) {
2074
+ if ( set ) {
2075
+ elem.style.cssText = "" + value;
2076
+ }
1772
2077
 
1773
- return attributeNode && attributeNode.specified ?
1774
- attributeNode.value :
1775
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
1776
- 0 :
1777
- undefined;
2078
+ return elem.style.cssText;
1778
2079
  }
1779
2080
 
1780
- return elem[ name ];
1781
- }
1782
-
1783
- if ( !jQuery.support.style && notxml && name === "style" ) {
1784
2081
  if ( set ) {
1785
- elem.style.cssText = "" + value;
2082
+ // convert the value to a string (all browsers do this but IE) see #1070
2083
+ elem.setAttribute( name, "" + value );
1786
2084
  }
1787
2085
 
1788
- return elem.style.cssText;
1789
- }
2086
+ // Ensure that missing attributes return undefined
2087
+ // Blackberry 4.7 returns "" from getAttribute #6938
2088
+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
2089
+ return undefined;
2090
+ }
1790
2091
 
1791
- if ( set ) {
1792
- // convert the value to a string (all browsers do this but IE) see #1070
1793
- elem.setAttribute( name, "" + value );
1794
- }
2092
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
2093
+ // Some attributes require a special call on IE
2094
+ elem.getAttribute( name, 2 ) :
2095
+ elem.getAttribute( name );
1795
2096
 
1796
- // Ensure that missing attributes return undefined
1797
- // Blackberry 4.7 returns "" from getAttribute #6938
1798
- if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
1799
- return undefined;
2097
+ // Non-existent attributes return null, we normalize to undefined
2098
+ return attr === null ? undefined : attr;
1800
2099
  }
1801
-
1802
- var attr = !jQuery.support.hrefNormalized && notxml && special ?
1803
- // Some attributes require a special call on IE
1804
- elem.getAttribute( name, 2 ) :
1805
- elem.getAttribute( name );
1806
-
1807
- // Non-existent attributes return null, we normalize to undefined
1808
- return attr === null ? undefined : attr;
2100
+ // Handle everything which isn't a DOM element node
2101
+ if ( set ) {
2102
+ elem[ name ] = value;
2103
+ }
2104
+ return elem[ name ];
1809
2105
  }
1810
2106
  });
1811
2107
 
@@ -1822,7 +2118,7 @@ var rnamespaces = /\.(.*)$/,
1822
2118
  fcleanup = function( nm ) {
1823
2119
  return nm.replace(rescape, "\\$&");
1824
2120
  },
1825
- focusCounts = { focusin: 0, focusout: 0 };
2121
+ eventKey = "events";
1826
2122
 
1827
2123
  /*
1828
2124
  * A number of helper functions used for managing events.
@@ -1864,7 +2160,7 @@ jQuery.event = {
1864
2160
  }
1865
2161
 
1866
2162
  // Init the element's event structure
1867
- var elemData = jQuery.data( elem );
2163
+ var elemData = jQuery._data( elem );
1868
2164
 
1869
2165
  // If no elemData is found then we must be trying to bind to one of the
1870
2166
  // banned noData elements
@@ -1872,12 +2168,9 @@ jQuery.event = {
1872
2168
  return;
1873
2169
  }
1874
2170
 
1875
- // Use a key less likely to result in collisions for plain JS objects.
1876
- // Fixes bug #7150.
1877
- var eventKey = elem.nodeType ? "events" : "__events__",
1878
- events = elemData[ eventKey ],
2171
+ var events = elemData[ eventKey ],
1879
2172
  eventHandle = elemData.handle;
1880
-
2173
+
1881
2174
  if ( typeof events === "function" ) {
1882
2175
  // On plain objects events is a fn that holds the the data
1883
2176
  // which prevents this data from being JSON serialized
@@ -1957,9 +2250,9 @@ jQuery.event = {
1957
2250
  }
1958
2251
  }
1959
2252
  }
1960
-
1961
- if ( special.add ) {
1962
- special.add.call( elem, handleObj );
2253
+
2254
+ if ( special.add ) {
2255
+ special.add.call( elem, handleObj );
1963
2256
 
1964
2257
  if ( !handleObj.handler.guid ) {
1965
2258
  handleObj.handler.guid = handler.guid;
@@ -1991,14 +2284,13 @@ jQuery.event = {
1991
2284
  }
1992
2285
 
1993
2286
  var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
1994
- eventKey = elem.nodeType ? "events" : "__events__",
1995
- elemData = jQuery.data( elem ),
2287
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
1996
2288
  events = elemData && elemData[ eventKey ];
1997
2289
 
1998
2290
  if ( !elemData || !events ) {
1999
2291
  return;
2000
2292
  }
2001
-
2293
+
2002
2294
  if ( typeof events === "function" ) {
2003
2295
  elemData = events;
2004
2296
  events = events.events;
@@ -2036,7 +2328,7 @@ jQuery.event = {
2036
2328
  namespaces = type.split(".");
2037
2329
  type = namespaces.shift();
2038
2330
 
2039
- namespace = new RegExp("(^|\\.)" +
2331
+ namespace = new RegExp("(^|\\.)" +
2040
2332
  jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
2041
2333
  }
2042
2334
 
@@ -2104,10 +2396,10 @@ jQuery.event = {
2104
2396
  delete elemData.handle;
2105
2397
 
2106
2398
  if ( typeof elemData === "function" ) {
2107
- jQuery.removeData( elem, eventKey );
2399
+ jQuery.removeData( elem, eventKey, true );
2108
2400
 
2109
2401
  } else if ( jQuery.isEmptyObject( elemData ) ) {
2110
- jQuery.removeData( elem );
2402
+ jQuery.removeData( elem, undefined, true );
2111
2403
  }
2112
2404
  }
2113
2405
  },
@@ -2139,9 +2431,16 @@ jQuery.event = {
2139
2431
 
2140
2432
  // Only trigger if we've ever bound an event for it
2141
2433
  if ( jQuery.event.global[ type ] ) {
2434
+ // XXX This code smells terrible. event.js should not be directly
2435
+ // inspecting the data cache
2142
2436
  jQuery.each( jQuery.cache, function() {
2143
- if ( this.events && this.events[type] ) {
2144
- jQuery.event.trigger( event, data, this.handle.elem );
2437
+ // internalKey variable is just used to make it easier to find
2438
+ // and potentially change this stuff later; currently it just
2439
+ // points to jQuery.expando
2440
+ var internalKey = jQuery.expando,
2441
+ internalCache = this[ internalKey ];
2442
+ if ( internalCache && internalCache.events && internalCache.events[type] ) {
2443
+ jQuery.event.trigger( event, data, internalCache.handle.elem );
2145
2444
  }
2146
2445
  });
2147
2446
  }
@@ -2167,8 +2466,8 @@ jQuery.event = {
2167
2466
 
2168
2467
  // Trigger the event, it is assumed that "handle" is a function
2169
2468
  var handle = elem.nodeType ?
2170
- jQuery.data( elem, "handle" ) :
2171
- (jQuery.data( elem, "__events__" ) || {}).handle;
2469
+ jQuery._data( elem, "handle" ) :
2470
+ (jQuery._data( elem, eventKey ) || {}).handle;
2172
2471
 
2173
2472
  if ( handle ) {
2174
2473
  handle.apply( elem, data );
@@ -2198,7 +2497,7 @@ jQuery.event = {
2198
2497
  isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
2199
2498
  special = jQuery.event.special[ targetType ] || {};
2200
2499
 
2201
- if ( (!special._default || special._default.call( elem, event ) === false) &&
2500
+ if ( (!special._default || special._default.call( elem, event ) === false) &&
2202
2501
  !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
2203
2502
 
2204
2503
  try {
@@ -2246,7 +2545,7 @@ jQuery.event = {
2246
2545
 
2247
2546
  event.namespace = event.namespace || namespace_sort.join(".");
2248
2547
 
2249
- events = jQuery.data(this, this.nodeType ? "events" : "__events__");
2548
+ events = jQuery._data(this, eventKey);
2250
2549
 
2251
2550
  if ( typeof events === "function" ) {
2252
2551
  events = events.events;
@@ -2268,7 +2567,7 @@ jQuery.event = {
2268
2567
  event.handler = handleObj.handler;
2269
2568
  event.data = handleObj.data;
2270
2569
  event.handleObj = handleObj;
2271
-
2570
+
2272
2571
  var ret = handleObj.handler.apply( this, args );
2273
2572
 
2274
2573
  if ( ret !== undefined ) {
@@ -2367,7 +2666,7 @@ jQuery.event = {
2367
2666
  add: function( handleObj ) {
2368
2667
  jQuery.event.add( this,
2369
2668
  liveConvert( handleObj.origType, handleObj.selector ),
2370
- jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
2669
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
2371
2670
  },
2372
2671
 
2373
2672
  remove: function( handleObj ) {
@@ -2397,7 +2696,7 @@ jQuery.removeEvent = document.removeEventListener ?
2397
2696
  if ( elem.removeEventListener ) {
2398
2697
  elem.removeEventListener( type, handle, false );
2399
2698
  }
2400
- } :
2699
+ } :
2401
2700
  function( elem, type, handle ) {
2402
2701
  if ( elem.detachEvent ) {
2403
2702
  elem.detachEvent( "on" + type, handle );
@@ -2414,6 +2713,12 @@ jQuery.Event = function( src ) {
2414
2713
  if ( src && src.type ) {
2415
2714
  this.originalEvent = src;
2416
2715
  this.type = src.type;
2716
+
2717
+ // Events bubbling up the document may have been marked as prevented
2718
+ // by a handler lower down the tree; reflect the correct value.
2719
+ this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
2720
+ src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
2721
+
2417
2722
  // Event type
2418
2723
  } else {
2419
2724
  this.type = src;
@@ -2444,7 +2749,7 @@ jQuery.Event.prototype = {
2444
2749
  if ( !e ) {
2445
2750
  return;
2446
2751
  }
2447
-
2752
+
2448
2753
  // if preventDefault exists run it on the original event
2449
2754
  if ( e.preventDefault ) {
2450
2755
  e.preventDefault();
@@ -2530,7 +2835,7 @@ if ( !jQuery.support.submitBubbles ) {
2530
2835
 
2531
2836
  jQuery.event.special.submit = {
2532
2837
  setup: function( data, namespaces ) {
2533
- if ( this.nodeName.toLowerCase() !== "form" ) {
2838
+ if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
2534
2839
  jQuery.event.add(this, "click.specialSubmit", function( e ) {
2535
2840
  var elem = e.target,
2536
2841
  type = elem.type;
@@ -2540,7 +2845,7 @@ if ( !jQuery.support.submitBubbles ) {
2540
2845
  return trigger( "submit", this, arguments );
2541
2846
  }
2542
2847
  });
2543
-
2848
+
2544
2849
  jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
2545
2850
  var elem = e.target,
2546
2851
  type = elem.type;
@@ -2595,14 +2900,14 @@ if ( !jQuery.support.changeBubbles ) {
2595
2900
  return;
2596
2901
  }
2597
2902
 
2598
- data = jQuery.data( elem, "_change_data" );
2903
+ data = jQuery._data( elem, "_change_data" );
2599
2904
  val = getVal(elem);
2600
2905
 
2601
2906
  // the current data will be also retrieved by beforeactivate
2602
2907
  if ( e.type !== "focusout" || elem.type !== "radio" ) {
2603
- jQuery.data( elem, "_change_data", val );
2908
+ jQuery._data( elem, "_change_data", val );
2604
2909
  }
2605
-
2910
+
2606
2911
  if ( data === undefined || val === data ) {
2607
2912
  return;
2608
2913
  }
@@ -2616,7 +2921,7 @@ if ( !jQuery.support.changeBubbles ) {
2616
2921
 
2617
2922
  jQuery.event.special.change = {
2618
2923
  filters: {
2619
- focusout: testChange,
2924
+ focusout: testChange,
2620
2925
 
2621
2926
  beforedeactivate: testChange,
2622
2927
 
@@ -2645,7 +2950,7 @@ if ( !jQuery.support.changeBubbles ) {
2645
2950
  // information
2646
2951
  beforeactivate: function( e ) {
2647
2952
  var elem = e.target;
2648
- jQuery.data( elem, "_change_data", getVal(elem) );
2953
+ jQuery._data( elem, "_change_data", getVal(elem) );
2649
2954
  }
2650
2955
  },
2651
2956
 
@@ -2684,21 +2989,17 @@ if ( document.addEventListener ) {
2684
2989
  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2685
2990
  jQuery.event.special[ fix ] = {
2686
2991
  setup: function() {
2687
- if ( focusCounts[fix]++ === 0 ) {
2688
- document.addEventListener( orig, handler, true );
2689
- }
2992
+ this.addEventListener( orig, handler, true );
2690
2993
  },
2691
2994
  teardown: function() {
2692
- if ( --focusCounts[fix] === 0 ) {
2693
- document.removeEventListener( orig, handler, true );
2694
- }
2995
+ this.removeEventListener( orig, handler, true );
2695
2996
  }
2696
2997
  };
2697
2998
 
2698
- function handler( e ) {
2999
+ function handler( e ) {
2699
3000
  e = jQuery.event.fix( e );
2700
3001
  e.type = fix;
2701
- return jQuery.event.trigger( e, null, e.target );
3002
+ return jQuery.event.handle.call( this, e );
2702
3003
  }
2703
3004
  });
2704
3005
  }
@@ -2712,7 +3013,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
2712
3013
  }
2713
3014
  return this;
2714
3015
  }
2715
-
3016
+
2716
3017
  if ( jQuery.isFunction( data ) || data === false ) {
2717
3018
  fn = data;
2718
3019
  data = undefined;
@@ -2752,20 +3053,20 @@ jQuery.fn.extend({
2752
3053
 
2753
3054
  return this;
2754
3055
  },
2755
-
3056
+
2756
3057
  delegate: function( selector, types, data, fn ) {
2757
3058
  return this.live( types, data, fn, selector );
2758
3059
  },
2759
-
3060
+
2760
3061
  undelegate: function( selector, types, fn ) {
2761
3062
  if ( arguments.length === 0 ) {
2762
3063
  return this.unbind( "live" );
2763
-
3064
+
2764
3065
  } else {
2765
3066
  return this.die( types, null, fn, selector );
2766
3067
  }
2767
3068
  },
2768
-
3069
+
2769
3070
  trigger: function( type, data ) {
2770
3071
  return this.each(function() {
2771
3072
  jQuery.event.trigger( type, data, this );
@@ -2794,8 +3095,8 @@ jQuery.fn.extend({
2794
3095
 
2795
3096
  return this.click( jQuery.proxy( fn, function( event ) {
2796
3097
  // Figure out which function to execute
2797
- var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
2798
- jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3098
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3099
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
2799
3100
 
2800
3101
  // Make sure that clicks stop
2801
3102
  event.preventDefault();
@@ -2822,12 +3123,12 @@ jQuery.each(["live", "die"], function( i, name ) {
2822
3123
  var type, i = 0, match, namespaces, preType,
2823
3124
  selector = origSelector || this.selector,
2824
3125
  context = origSelector ? this : jQuery( this.context );
2825
-
3126
+
2826
3127
  if ( typeof types === "object" && !types.preventDefault ) {
2827
3128
  for ( var key in types ) {
2828
3129
  context[ name ]( key, data, types[key], selector );
2829
3130
  }
2830
-
3131
+
2831
3132
  return this;
2832
3133
  }
2833
3134
 
@@ -2874,7 +3175,7 @@ jQuery.each(["live", "die"], function( i, name ) {
2874
3175
  context.unbind( "live." + liveConvert( type, selector ), fn );
2875
3176
  }
2876
3177
  }
2877
-
3178
+
2878
3179
  return this;
2879
3180
  };
2880
3181
  });
@@ -2883,17 +3184,17 @@ function liveHandler( event ) {
2883
3184
  var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
2884
3185
  elems = [],
2885
3186
  selectors = [],
2886
- events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
3187
+ events = jQuery._data( this, eventKey );
2887
3188
 
2888
3189
  if ( typeof events === "function" ) {
2889
3190
  events = events.events;
2890
3191
  }
2891
3192
 
2892
- // Make sure we avoid non-left-click bubbling in Firefox (#3861)
2893
- if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
3193
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
3194
+ if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
2894
3195
  return;
2895
3196
  }
2896
-
3197
+
2897
3198
  if ( event.namespace ) {
2898
3199
  namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
2899
3200
  }
@@ -2991,29 +3292,12 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
2991
3292
  }
2992
3293
  });
2993
3294
 
2994
- // Prevent memory leaks in IE
2995
- // Window isn't included so as not to unbind existing unload events
2996
- // More info:
2997
- // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
2998
- if ( window.attachEvent && !window.addEventListener ) {
2999
- jQuery(window).bind("unload", function() {
3000
- for ( var id in jQuery.cache ) {
3001
- if ( jQuery.cache[ id ].handle ) {
3002
- // Try/Catch is to handle iframes being unloaded, see #4280
3003
- try {
3004
- jQuery.event.remove( jQuery.cache[ id ].handle.elem );
3005
- } catch(e) {}
3006
- }
3007
- }
3008
- });
3009
- }
3010
-
3011
3295
  })( jQuery );
3012
3296
 
3013
3297
 
3014
3298
  /*!
3015
- * Sizzle CSS Selector Engine - v1.0
3016
- * Copyright 2009, The Dojo Foundation
3299
+ * Sizzle CSS Selector Engine
3300
+ * Copyright 2011, The Dojo Foundation
3017
3301
  * Released under the MIT, BSD, and GPL Licenses.
3018
3302
  * More information: http://sizzlejs.com/
3019
3303
  */
@@ -3234,7 +3518,9 @@ Sizzle.find = function( expr, context, isXML ) {
3234
3518
  }
3235
3519
 
3236
3520
  if ( !set ) {
3237
- set = context.getElementsByTagName( "*" );
3521
+ set = typeof context.getElementsByTagName !== "undefined" ?
3522
+ context.getElementsByTagName( "*" ) :
3523
+ [];
3238
3524
  }
3239
3525
 
3240
3526
  return { set: set, expr: expr };
@@ -3342,9 +3628,9 @@ var Expr = Sizzle.selectors = {
3342
3628
  ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3343
3629
  CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
3344
3630
  NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3345
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
3631
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
3346
3632
  TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3347
- CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
3633
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
3348
3634
  POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
3349
3635
  PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
3350
3636
  },
@@ -3477,7 +3763,9 @@ var Expr = Sizzle.selectors = {
3477
3763
  },
3478
3764
 
3479
3765
  TAG: function( match, context ) {
3480
- return context.getElementsByTagName( match[1] );
3766
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
3767
+ return context.getElementsByTagName( match[1] );
3768
+ }
3481
3769
  }
3482
3770
  },
3483
3771
  preFilter: {
@@ -3490,7 +3778,7 @@ var Expr = Sizzle.selectors = {
3490
3778
 
3491
3779
  for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
3492
3780
  if ( elem ) {
3493
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
3781
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
3494
3782
  if ( !inplace ) {
3495
3783
  result.push( elem );
3496
3784
  }
@@ -3514,8 +3802,14 @@ var Expr = Sizzle.selectors = {
3514
3802
 
3515
3803
  CHILD: function( match ) {
3516
3804
  if ( match[1] === "nth" ) {
3805
+ if ( !match[2] ) {
3806
+ Sizzle.error( match[0] );
3807
+ }
3808
+
3809
+ match[2] = match[2].replace(/^\+|\s*/g, '');
3810
+
3517
3811
  // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
3518
- var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
3812
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
3519
3813
  match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
3520
3814
  !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
3521
3815
 
@@ -3523,6 +3817,9 @@ var Expr = Sizzle.selectors = {
3523
3817
  match[2] = (test[1] + (test[2] || 1)) - 0;
3524
3818
  match[3] = test[3] - 0;
3525
3819
  }
3820
+ else if ( match[2] ) {
3821
+ Sizzle.error( match[0] );
3822
+ }
3526
3823
 
3527
3824
  // TODO: Move to normal caching system
3528
3825
  match[0] = done++;
@@ -3531,12 +3828,15 @@ var Expr = Sizzle.selectors = {
3531
3828
  },
3532
3829
 
3533
3830
  ATTR: function( match, curLoop, inplace, result, not, isXML ) {
3534
- var name = match[1].replace(/\\/g, "");
3831
+ var name = match[1] = match[1].replace(/\\/g, "");
3535
3832
 
3536
3833
  if ( !isXML && Expr.attrMap[name] ) {
3537
3834
  match[1] = Expr.attrMap[name];
3538
3835
  }
3539
3836
 
3837
+ // Handle if an un-quoted value was used
3838
+ match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");
3839
+
3540
3840
  if ( match[2] === "~=" ) {
3541
3841
  match[4] = " " + match[4] + " ";
3542
3842
  }
@@ -3705,7 +4005,7 @@ var Expr = Sizzle.selectors = {
3705
4005
  return true;
3706
4006
 
3707
4007
  } else {
3708
- Sizzle.error( "Syntax error, unrecognized expression: " + name );
4008
+ Sizzle.error( name );
3709
4009
  }
3710
4010
  },
3711
4011
 
@@ -4095,13 +4395,47 @@ if ( document.querySelectorAll ) {
4095
4395
  Sizzle = function( query, context, extra, seed ) {
4096
4396
  context = context || document;
4097
4397
 
4098
- // Make sure that attribute selectors are quoted
4099
- query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
4100
-
4101
4398
  // Only use querySelectorAll on non-XML documents
4102
4399
  // (ID selectors don't work in non-HTML documents)
4103
4400
  if ( !seed && !Sizzle.isXML(context) ) {
4401
+ // See if we find a selector to speed up
4402
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
4403
+
4404
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
4405
+ // Speed-up: Sizzle("TAG")
4406
+ if ( match[1] ) {
4407
+ return makeArray( context.getElementsByTagName( query ), extra );
4408
+
4409
+ // Speed-up: Sizzle(".CLASS")
4410
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
4411
+ return makeArray( context.getElementsByClassName( match[2] ), extra );
4412
+ }
4413
+ }
4414
+
4104
4415
  if ( context.nodeType === 9 ) {
4416
+ // Speed-up: Sizzle("body")
4417
+ // The body element only exists once, optimize finding it
4418
+ if ( query === "body" && context.body ) {
4419
+ return makeArray( [ context.body ], extra );
4420
+
4421
+ // Speed-up: Sizzle("#ID")
4422
+ } else if ( match && match[3] ) {
4423
+ var elem = context.getElementById( match[3] );
4424
+
4425
+ // Check parentNode to catch when Blackberry 4.6 returns
4426
+ // nodes that are no longer in the document #6963
4427
+ if ( elem && elem.parentNode ) {
4428
+ // Handle the case where IE and Opera return items
4429
+ // by name instead of ID
4430
+ if ( elem.id === match[3] ) {
4431
+ return makeArray( [ elem ], extra );
4432
+ }
4433
+
4434
+ } else {
4435
+ return makeArray( [], extra );
4436
+ }
4437
+ }
4438
+
4105
4439
  try {
4106
4440
  return makeArray( context.querySelectorAll(query), extra );
4107
4441
  } catch(qsaError) {}
@@ -4112,14 +4446,23 @@ if ( document.querySelectorAll ) {
4112
4446
  // IE 8 doesn't work on object elements
4113
4447
  } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
4114
4448
  var old = context.getAttribute( "id" ),
4115
- nid = old || id;
4449
+ nid = old || id,
4450
+ hasParent = context.parentNode,
4451
+ relativeHierarchySelector = /^\s*[+~]/.test( query );
4116
4452
 
4117
4453
  if ( !old ) {
4118
4454
  context.setAttribute( "id", nid );
4455
+ } else {
4456
+ nid = nid.replace( /'/g, "\\$&" );
4457
+ }
4458
+ if ( relativeHierarchySelector && hasParent ) {
4459
+ context = context.parentNode;
4119
4460
  }
4120
4461
 
4121
4462
  try {
4122
- return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
4463
+ if ( !relativeHierarchySelector || hasParent ) {
4464
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
4465
+ }
4123
4466
 
4124
4467
  } catch(pseudoError) {
4125
4468
  } finally {
@@ -4344,7 +4687,14 @@ var runtil = /Until$/,
4344
4687
  rmultiselector = /,/,
4345
4688
  isSimple = /^.[^:#\[\.,]*$/,
4346
4689
  slice = Array.prototype.slice,
4347
- POS = jQuery.expr.match.POS;
4690
+ POS = jQuery.expr.match.POS,
4691
+ // methods guaranteed to produce a unique set when starting from a unique set
4692
+ guaranteedUnique = {
4693
+ children: true,
4694
+ contents: true,
4695
+ next: true,
4696
+ prev: true
4697
+ };
4348
4698
 
4349
4699
  jQuery.fn.extend({
4350
4700
  find: function( selector ) {
@@ -4389,7 +4739,7 @@ jQuery.fn.extend({
4389
4739
  filter: function( selector ) {
4390
4740
  return this.pushStack( winnow(this, selector, true), "filter", selector );
4391
4741
  },
4392
-
4742
+
4393
4743
  is: function( selector ) {
4394
4744
  return !!selector && jQuery.filter( selector, this ).length > 0;
4395
4745
  },
@@ -4407,7 +4757,7 @@ jQuery.fn.extend({
4407
4757
  selector = selectors[i];
4408
4758
 
4409
4759
  if ( !matches[selector] ) {
4410
- matches[selector] = jQuery.expr.match.POS.test( selector ) ?
4760
+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
4411
4761
  jQuery( selector, context || this.context ) :
4412
4762
  selector;
4413
4763
  }
@@ -4430,7 +4780,7 @@ jQuery.fn.extend({
4430
4780
  return ret;
4431
4781
  }
4432
4782
 
4433
- var pos = POS.test( selectors ) ?
4783
+ var pos = POS.test( selectors ) ?
4434
4784
  jQuery( selectors, context || this.context ) : null;
4435
4785
 
4436
4786
  for ( i = 0, l = this.length; i < l; i++ ) {
@@ -4451,10 +4801,10 @@ jQuery.fn.extend({
4451
4801
  }
4452
4802
 
4453
4803
  ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4454
-
4804
+
4455
4805
  return this.pushStack( ret, "closest", selectors );
4456
4806
  },
4457
-
4807
+
4458
4808
  // Determine the position of an element within
4459
4809
  // the matched set of elements
4460
4810
  index: function( elem ) {
@@ -4472,7 +4822,7 @@ jQuery.fn.extend({
4472
4822
 
4473
4823
  add: function( selector, context ) {
4474
4824
  var set = typeof selector === "string" ?
4475
- jQuery( selector, context || this.context ) :
4825
+ jQuery( selector, context ) :
4476
4826
  jQuery.makeArray( selector ),
4477
4827
  all = jQuery.merge( this.get(), set );
4478
4828
 
@@ -4534,8 +4884,13 @@ jQuery.each({
4534
4884
  }
4535
4885
  }, function( name, fn ) {
4536
4886
  jQuery.fn[ name ] = function( until, selector ) {
4537
- var ret = jQuery.map( this, fn, until );
4538
-
4887
+ var ret = jQuery.map( this, fn, until ),
4888
+ // The variable 'args' was introduced in
4889
+ // https://github.com/jquery/jquery/commit/52a0238
4890
+ // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
4891
+ // http://code.google.com/p/v8/issues/detail?id=1050
4892
+ args = slice.call(arguments);
4893
+
4539
4894
  if ( !runtil.test( name ) ) {
4540
4895
  selector = until;
4541
4896
  }
@@ -4544,13 +4899,13 @@ jQuery.each({
4544
4899
  ret = jQuery.filter( selector, ret );
4545
4900
  }
4546
4901
 
4547
- ret = this.length > 1 ? jQuery.unique( ret ) : ret;
4902
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
4548
4903
 
4549
4904
  if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
4550
4905
  ret = ret.reverse();
4551
4906
  }
4552
4907
 
4553
- return this.pushStack( ret, name, slice.call(arguments).join(",") );
4908
+ return this.pushStack( ret, name, args.join(",") );
4554
4909
  };
4555
4910
  });
4556
4911
 
@@ -4564,7 +4919,7 @@ jQuery.extend({
4564
4919
  jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
4565
4920
  jQuery.find.matches(expr, elems);
4566
4921
  },
4567
-
4922
+
4568
4923
  dir: function( elem, dir, until ) {
4569
4924
  var matched = [],
4570
4925
  cur = elem[ dir ];
@@ -4646,9 +5001,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
4646
5001
  rtbody = /<tbody/i,
4647
5002
  rhtml = /<|&#?\w+;/,
4648
5003
  rnocache = /<(?:script|object|embed|option|style)/i,
4649
- // checked="checked" or checked (html5)
5004
+ // checked="checked" or checked
4650
5005
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
4651
- raction = /\=([^="'>\s]+\/)>/g,
4652
5006
  wrapMap = {
4653
5007
  option: [ 1, "<select multiple='multiple'>", "</select>" ],
4654
5008
  legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -4788,7 +5142,7 @@ jQuery.fn.extend({
4788
5142
  return set;
4789
5143
  }
4790
5144
  },
4791
-
5145
+
4792
5146
  // keepData is for internal use only--do not document
4793
5147
  remove: function( selector, keepData ) {
4794
5148
  for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
@@ -4803,7 +5157,7 @@ jQuery.fn.extend({
4803
5157
  }
4804
5158
  }
4805
5159
  }
4806
-
5160
+
4807
5161
  return this;
4808
5162
  },
4809
5163
 
@@ -4819,48 +5173,17 @@ jQuery.fn.extend({
4819
5173
  elem.removeChild( elem.firstChild );
4820
5174
  }
4821
5175
  }
4822
-
5176
+
4823
5177
  return this;
4824
5178
  },
4825
5179
 
4826
- clone: function( events ) {
4827
- // Do the clone
4828
- var ret = this.map(function() {
4829
- if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
4830
- // IE copies events bound via attachEvent when
4831
- // using cloneNode. Calling detachEvent on the
4832
- // clone will also remove the events from the orignal
4833
- // In order to get around this, we use innerHTML.
4834
- // Unfortunately, this means some modifications to
4835
- // attributes in IE that are actually only stored
4836
- // as properties will not be copied (such as the
4837
- // the name attribute on an input).
4838
- var html = this.outerHTML,
4839
- ownerDocument = this.ownerDocument;
4840
-
4841
- if ( !html ) {
4842
- var div = ownerDocument.createElement("div");
4843
- div.appendChild( this.cloneNode(true) );
4844
- html = div.innerHTML;
4845
- }
4846
-
4847
- return jQuery.clean([html.replace(rinlinejQuery, "")
4848
- // Handle the case in IE 8 where action=/test/> self-closes a tag
4849
- .replace(raction, '="$1">')
4850
- .replace(rleadingWhitespace, "")], ownerDocument)[0];
4851
- } else {
4852
- return this.cloneNode(true);
4853
- }
4854
- });
4855
-
4856
- // Copy the events from the original to the clone
4857
- if ( events === true ) {
4858
- cloneCopyEvent( this, ret );
4859
- cloneCopyEvent( this.find("*"), ret.find("*") );
4860
- }
5180
+ clone: function( dataAndEvents, deepDataAndEvents ) {
5181
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5182
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
4861
5183
 
4862
- // Return the cloned set
4863
- return ret;
5184
+ return this.map( function () {
5185
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5186
+ });
4864
5187
  },
4865
5188
 
4866
5189
  html: function( value ) {
@@ -4970,9 +5293,9 @@ jQuery.fn.extend({
4970
5293
  } else {
4971
5294
  results = jQuery.buildFragment( args, this, scripts );
4972
5295
  }
4973
-
5296
+
4974
5297
  fragment = results.fragment;
4975
-
5298
+
4976
5299
  if ( fragment.childNodes.length === 1 ) {
4977
5300
  first = fragment = fragment.firstChild;
4978
5301
  } else {
@@ -4982,13 +5305,20 @@ jQuery.fn.extend({
4982
5305
  if ( first ) {
4983
5306
  table = table && jQuery.nodeName( first, "tr" );
4984
5307
 
4985
- for ( var i = 0, l = this.length; i < l; i++ ) {
5308
+ for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
4986
5309
  callback.call(
4987
5310
  table ?
4988
5311
  root(this[i], first) :
4989
5312
  this[i],
4990
- i > 0 || results.cacheable || this.length > 1 ?
4991
- fragment.cloneNode(true) :
5313
+ // Make sure that we do not leak memory by inadvertently discarding
5314
+ // the original fragment (which might have attached data) instead of
5315
+ // using it; in addition, use the original fragment object for the last
5316
+ // item instead of first because it can end up being emptied incorrectly
5317
+ // in certain situations (Bug #8070).
5318
+ // Fragments from the fragment cache must always be cloned and never used
5319
+ // in place.
5320
+ results.cacheable || (l > 1 && i < lastIndex) ?
5321
+ jQuery.clone( fragment, true, true ) :
4992
5322
  fragment
4993
5323
  );
4994
5324
  }
@@ -5010,41 +5340,97 @@ function root( elem, cur ) {
5010
5340
  elem;
5011
5341
  }
5012
5342
 
5013
- function cloneCopyEvent(orig, ret) {
5014
- var i = 0;
5343
+ function cloneCopyEvent( src, dest ) {
5015
5344
 
5016
- ret.each(function() {
5017
- if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
5018
- return;
5019
- }
5345
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5346
+ return;
5347
+ }
5348
+
5349
+ var internalKey = jQuery.expando,
5350
+ oldData = jQuery.data( src ),
5351
+ curData = jQuery.data( dest, oldData );
5020
5352
 
5021
- var oldData = jQuery.data( orig[i++] ),
5022
- curData = jQuery.data( this, oldData ),
5023
- events = oldData && oldData.events;
5353
+ // Switch to use the internal data object, if it exists, for the next
5354
+ // stage of data copying
5355
+ if ( (oldData = oldData[ internalKey ]) ) {
5356
+ var events = oldData.events;
5357
+ curData = curData[ internalKey ] = jQuery.extend({}, oldData);
5024
5358
 
5025
5359
  if ( events ) {
5026
5360
  delete curData.handle;
5027
5361
  curData.events = {};
5028
5362
 
5029
5363
  for ( var type in events ) {
5030
- for ( var handler in events[ type ] ) {
5031
- jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
5364
+ for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
5365
+ jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data );
5032
5366
  }
5033
5367
  }
5034
5368
  }
5035
- });
5369
+ }
5370
+ }
5371
+
5372
+ function cloneFixAttributes(src, dest) {
5373
+ // We do not need to do anything for non-Elements
5374
+ if ( dest.nodeType !== 1 ) {
5375
+ return;
5376
+ }
5377
+
5378
+ var nodeName = dest.nodeName.toLowerCase();
5379
+
5380
+ // clearAttributes removes the attributes, which we don't want,
5381
+ // but also removes the attachEvent events, which we *do* want
5382
+ dest.clearAttributes();
5383
+
5384
+ // mergeAttributes, in contrast, only merges back on the
5385
+ // original attributes, not the events
5386
+ dest.mergeAttributes(src);
5387
+
5388
+ // IE6-8 fail to clone children inside object elements that use
5389
+ // the proprietary classid attribute value (rather than the type
5390
+ // attribute) to identify the type of content to display
5391
+ if ( nodeName === "object" ) {
5392
+ dest.outerHTML = src.outerHTML;
5393
+
5394
+ } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
5395
+ // IE6-8 fails to persist the checked state of a cloned checkbox
5396
+ // or radio button. Worse, IE6-7 fail to give the cloned element
5397
+ // a checked appearance if the defaultChecked value isn't also set
5398
+ if ( src.checked ) {
5399
+ dest.defaultChecked = dest.checked = src.checked;
5400
+ }
5401
+
5402
+ // IE6-7 get confused and end up setting the value of a cloned
5403
+ // checkbox/radio button to an empty string instead of "on"
5404
+ if ( dest.value !== src.value ) {
5405
+ dest.value = src.value;
5406
+ }
5407
+
5408
+ // IE6-8 fails to return the selected option to the default selected
5409
+ // state when cloning options
5410
+ } else if ( nodeName === "option" ) {
5411
+ dest.selected = src.defaultSelected;
5412
+
5413
+ // IE6-8 fails to set the defaultValue to the correct value when
5414
+ // cloning other types of input fields
5415
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
5416
+ dest.defaultValue = src.defaultValue;
5417
+ }
5418
+
5419
+ // Event data gets referenced instead of copied if the expando
5420
+ // gets copied too
5421
+ dest.removeAttribute( jQuery.expando );
5036
5422
  }
5037
5423
 
5038
5424
  jQuery.buildFragment = function( args, nodes, scripts ) {
5039
5425
  var fragment, cacheable, cacheresults,
5040
5426
  doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
5041
5427
 
5042
- // Only cache "small" (1/2 KB) strings that are associated with the main document
5428
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5043
5429
  // Cloning options loses the selected state, so don't cache them
5044
5430
  // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
5045
5431
  // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5046
5432
  if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5047
- !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
5433
+ args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
5048
5434
 
5049
5435
  cacheable = true;
5050
5436
  cacheresults = jQuery.fragments[ args[0] ];
@@ -5080,24 +5466,72 @@ jQuery.each({
5080
5466
  var ret = [],
5081
5467
  insert = jQuery( selector ),
5082
5468
  parent = this.length === 1 && this[0].parentNode;
5083
-
5469
+
5084
5470
  if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
5085
5471
  insert[ original ]( this[0] );
5086
5472
  return this;
5087
-
5473
+
5088
5474
  } else {
5089
5475
  for ( var i = 0, l = insert.length; i < l; i++ ) {
5090
5476
  var elems = (i > 0 ? this.clone(true) : this).get();
5091
5477
  jQuery( insert[i] )[ original ]( elems );
5092
5478
  ret = ret.concat( elems );
5093
5479
  }
5094
-
5480
+
5095
5481
  return this.pushStack( ret, name, insert.selector );
5096
5482
  }
5097
5483
  };
5098
5484
  });
5099
5485
 
5100
5486
  jQuery.extend({
5487
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5488
+ var clone = elem.cloneNode(true),
5489
+ srcElements,
5490
+ destElements,
5491
+ i;
5492
+
5493
+ if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5494
+ // IE copies events bound via attachEvent when using cloneNode.
5495
+ // Calling detachEvent on the clone will also remove the events
5496
+ // from the original. In order to get around this, we use some
5497
+ // proprietary methods to clear the events. Thanks to MooTools
5498
+ // guys for this hotness.
5499
+
5500
+ cloneFixAttributes( elem, clone );
5501
+
5502
+ // Using Sizzle here is crazy slow, so we use getElementsByTagName
5503
+ // instead
5504
+ srcElements = elem.getElementsByTagName("*");
5505
+ destElements = clone.getElementsByTagName("*");
5506
+
5507
+ // Weird iteration because IE will replace the length property
5508
+ // with an element if you are cloning the body and one of the
5509
+ // elements on the page has a name or id of "length"
5510
+ for ( i = 0; srcElements[i]; ++i ) {
5511
+ cloneFixAttributes( srcElements[i], destElements[i] );
5512
+ }
5513
+ }
5514
+
5515
+ // Copy the events from the original to the clone
5516
+ if ( dataAndEvents ) {
5517
+
5518
+ cloneCopyEvent( elem, clone );
5519
+
5520
+ if ( deepDataAndEvents && "getElementsByTagName" in elem ) {
5521
+
5522
+ srcElements = elem.getElementsByTagName("*");
5523
+ destElements = clone.getElementsByTagName("*");
5524
+
5525
+ if ( srcElements.length ) {
5526
+ for ( i = 0; srcElements[i]; ++i ) {
5527
+ cloneCopyEvent( srcElements[i], destElements[i] );
5528
+ }
5529
+ }
5530
+ }
5531
+ }
5532
+ // Return the cloned set
5533
+ return clone;
5534
+ },
5101
5535
  clean: function( elems, context, fragment, scripts ) {
5102
5536
  context = context || document;
5103
5537
 
@@ -5179,7 +5613,7 @@ jQuery.extend({
5179
5613
  for ( i = 0; ret[i]; i++ ) {
5180
5614
  if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
5181
5615
  scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5182
-
5616
+
5183
5617
  } else {
5184
5618
  if ( ret[i].nodeType === 1 ) {
5185
5619
  ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
@@ -5191,40 +5625,45 @@ jQuery.extend({
5191
5625
 
5192
5626
  return ret;
5193
5627
  },
5194
-
5628
+
5195
5629
  cleanData: function( elems ) {
5196
- var data, id, cache = jQuery.cache,
5197
- special = jQuery.event.special,
5630
+ var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
5198
5631
  deleteExpando = jQuery.support.deleteExpando;
5199
-
5632
+
5200
5633
  for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5201
5634
  if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
5202
5635
  continue;
5203
5636
  }
5204
5637
 
5205
5638
  id = elem[ jQuery.expando ];
5206
-
5639
+
5207
5640
  if ( id ) {
5208
- data = cache[ id ];
5209
-
5641
+ data = cache[ id ] && cache[ id ][ internalKey ];
5642
+
5210
5643
  if ( data && data.events ) {
5211
5644
  for ( var type in data.events ) {
5212
5645
  if ( special[ type ] ) {
5213
5646
  jQuery.event.remove( elem, type );
5214
5647
 
5648
+ // This is a shortcut to avoid jQuery.event.remove's overhead
5215
5649
  } else {
5216
5650
  jQuery.removeEvent( elem, type, data.handle );
5217
5651
  }
5218
5652
  }
5653
+
5654
+ // Null the DOM reference to avoid IE6/7/8 leak (#7054)
5655
+ if ( data.handle ) {
5656
+ data.handle.elem = null;
5657
+ }
5219
5658
  }
5220
-
5659
+
5221
5660
  if ( deleteExpando ) {
5222
5661
  delete elem[ jQuery.expando ];
5223
5662
 
5224
5663
  } else if ( elem.removeAttribute ) {
5225
5664
  elem.removeAttribute( jQuery.expando );
5226
5665
  }
5227
-
5666
+
5228
5667
  delete cache[ id ];
5229
5668
  }
5230
5669
  }
@@ -5515,8 +5954,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
5515
5954
 
5516
5955
  if ( document.documentElement.currentStyle ) {
5517
5956
  currentStyle = function( elem, name ) {
5518
- var left, rsLeft,
5957
+ var left,
5519
5958
  ret = elem.currentStyle && elem.currentStyle[ name ],
5959
+ rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
5520
5960
  style = elem.style;
5521
5961
 
5522
5962
  // From the awesome hack by Dean Edwards
@@ -5527,16 +5967,19 @@ if ( document.documentElement.currentStyle ) {
5527
5967
  if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
5528
5968
  // Remember the original values
5529
5969
  left = style.left;
5530
- rsLeft = elem.runtimeStyle.left;
5531
5970
 
5532
5971
  // Put in the new values to get a computed value out
5533
- elem.runtimeStyle.left = elem.currentStyle.left;
5972
+ if ( rsLeft ) {
5973
+ elem.runtimeStyle.left = elem.currentStyle.left;
5974
+ }
5534
5975
  style.left = name === "fontSize" ? "1em" : (ret || 0);
5535
5976
  ret = style.pixelLeft + "px";
5536
5977
 
5537
5978
  // Revert the changed values
5538
5979
  style.left = left;
5539
- elem.runtimeStyle.left = rsLeft;
5980
+ if ( rsLeft ) {
5981
+ elem.runtimeStyle.left = rsLeft;
5982
+ }
5540
5983
  }
5541
5984
 
5542
5985
  return ret === "" ? "auto" : ret;
@@ -5587,21 +6030,140 @@ if ( jQuery.expr && jQuery.expr.filters ) {
5587
6030
 
5588
6031
  (function( jQuery ) {
5589
6032
 
5590
- var jsc = jQuery.now(),
5591
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
5592
- rselectTextarea = /^(?:select|textarea)/i,
6033
+ var r20 = /%20/g,
6034
+ rbracket = /\[\]$/,
6035
+ rCRLF = /\r?\n/g,
6036
+ rhash = /#.*$/,
6037
+ rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
5593
6038
  rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6039
+ // #7653, #8125, #8152: local protocol detection
6040
+ rlocalProtocol = /(?:^file|^widget|\-extension):$/,
5594
6041
  rnoContent = /^(?:GET|HEAD)$/,
5595
- rbracket = /\[\]$/,
5596
- jsre = /\=\?(&|$)/,
6042
+ rprotocol = /^\/\//,
5597
6043
  rquery = /\?/,
6044
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
6045
+ rselectTextarea = /^(?:select|textarea)/i,
6046
+ rspacesAjax = /\s+/,
5598
6047
  rts = /([?&])_=[^&]*/,
5599
- rurl = /^(\w+:)?\/\/([^\/?#]+)/,
5600
- r20 = /%20/g,
5601
- rhash = /#.*$/,
6048
+ rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
5602
6049
 
5603
6050
  // Keep a copy of the old load method
5604
- _load = jQuery.fn.load;
6051
+ _load = jQuery.fn.load,
6052
+
6053
+ /* Prefilters
6054
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
6055
+ * 2) These are called:
6056
+ * - BEFORE asking for a transport
6057
+ * - AFTER param serialization (s.data is a string if s.processData is true)
6058
+ * 3) key is the dataType
6059
+ * 4) the catchall symbol "*" can be used
6060
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
6061
+ */
6062
+ prefilters = {},
6063
+
6064
+ /* Transports bindings
6065
+ * 1) key is the dataType
6066
+ * 2) the catchall symbol "*" can be used
6067
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
6068
+ */
6069
+ transports = {},
6070
+
6071
+ // Document location
6072
+ ajaxLocation,
6073
+
6074
+ // Document location segments
6075
+ ajaxLocParts;
6076
+
6077
+ // #8138, IE may throw an exception when accessing
6078
+ // a field from document.location if document.domain has been set
6079
+ try {
6080
+ ajaxLocation = document.location.href;
6081
+ } catch( e ) {
6082
+ // Use the href attribute of an A element
6083
+ // since IE will modify it given document.location
6084
+ ajaxLocation = document.createElement( "a" );
6085
+ ajaxLocation.href = "";
6086
+ ajaxLocation = ajaxLocation.href;
6087
+ }
6088
+
6089
+ // Segment location into parts
6090
+ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
6091
+
6092
+ // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6093
+ function addToPrefiltersOrTransports( structure ) {
6094
+
6095
+ // dataTypeExpression is optional and defaults to "*"
6096
+ return function( dataTypeExpression, func ) {
6097
+
6098
+ if ( typeof dataTypeExpression !== "string" ) {
6099
+ func = dataTypeExpression;
6100
+ dataTypeExpression = "*";
6101
+ }
6102
+
6103
+ if ( jQuery.isFunction( func ) ) {
6104
+ var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
6105
+ i = 0,
6106
+ length = dataTypes.length,
6107
+ dataType,
6108
+ list,
6109
+ placeBefore;
6110
+
6111
+ // For each dataType in the dataTypeExpression
6112
+ for(; i < length; i++ ) {
6113
+ dataType = dataTypes[ i ];
6114
+ // We control if we're asked to add before
6115
+ // any existing element
6116
+ placeBefore = /^\+/.test( dataType );
6117
+ if ( placeBefore ) {
6118
+ dataType = dataType.substr( 1 ) || "*";
6119
+ }
6120
+ list = structure[ dataType ] = structure[ dataType ] || [];
6121
+ // then we add to the structure accordingly
6122
+ list[ placeBefore ? "unshift" : "push" ]( func );
6123
+ }
6124
+ }
6125
+ };
6126
+ }
6127
+
6128
+ //Base inspection function for prefilters and transports
6129
+ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
6130
+ dataType /* internal */, inspected /* internal */ ) {
6131
+
6132
+ dataType = dataType || options.dataTypes[ 0 ];
6133
+ inspected = inspected || {};
6134
+
6135
+ inspected[ dataType ] = true;
6136
+
6137
+ var list = structure[ dataType ],
6138
+ i = 0,
6139
+ length = list ? list.length : 0,
6140
+ executeOnly = ( structure === prefilters ),
6141
+ selection;
6142
+
6143
+ for(; i < length && ( executeOnly || !selection ); i++ ) {
6144
+ selection = list[ i ]( options, originalOptions, jqXHR );
6145
+ // If we got redirected to another dataType
6146
+ // we try there if executing only and not done already
6147
+ if ( typeof selection === "string" ) {
6148
+ if ( !executeOnly || inspected[ selection ] ) {
6149
+ selection = undefined;
6150
+ } else {
6151
+ options.dataTypes.unshift( selection );
6152
+ selection = inspectPrefiltersOrTransports(
6153
+ structure, options, originalOptions, jqXHR, selection, inspected );
6154
+ }
6155
+ }
6156
+ }
6157
+ // If we're only executing or nothing was selected
6158
+ // we try the catchall dataType if not done already
6159
+ if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
6160
+ selection = inspectPrefiltersOrTransports(
6161
+ structure, options, originalOptions, jqXHR, "*", inspected );
6162
+ }
6163
+ // unnecessary when only executing (prefilters)
6164
+ // but it'll be ignored by the caller in that case
6165
+ return selection;
6166
+ }
5605
6167
 
5606
6168
  jQuery.fn.extend({
5607
6169
  load: function( url, params, callback ) {
@@ -5613,10 +6175,10 @@ jQuery.fn.extend({
5613
6175
  return this;
5614
6176
  }
5615
6177
 
5616
- var off = url.indexOf(" ");
6178
+ var off = url.indexOf( " " );
5617
6179
  if ( off >= 0 ) {
5618
- var selector = url.slice(off, url.length);
5619
- url = url.slice(0, off);
6180
+ var selector = url.slice( off, url.length );
6181
+ url = url.slice( 0, off );
5620
6182
  }
5621
6183
 
5622
6184
  // Default to a GET request
@@ -5645,26 +6207,34 @@ jQuery.fn.extend({
5645
6207
  type: type,
5646
6208
  dataType: "html",
5647
6209
  data: params,
5648
- complete: function( res, status ) {
6210
+ // Complete callback (responseText is used internally)
6211
+ complete: function( jqXHR, status, responseText ) {
6212
+ // Store the response as specified by the jqXHR object
6213
+ responseText = jqXHR.responseText;
5649
6214
  // If successful, inject the HTML into all the matched elements
5650
- if ( status === "success" || status === "notmodified" ) {
6215
+ if ( jqXHR.isResolved() ) {
6216
+ // #4825: Get the actual response in case
6217
+ // a dataFilter is present in ajaxSettings
6218
+ jqXHR.done(function( r ) {
6219
+ responseText = r;
6220
+ });
5651
6221
  // See if a selector was specified
5652
6222
  self.html( selector ?
5653
6223
  // Create a dummy div to hold the results
5654
6224
  jQuery("<div>")
5655
6225
  // inject the contents of the document in, removing the scripts
5656
6226
  // to avoid any 'Permission Denied' errors in IE
5657
- .append(res.responseText.replace(rscript, ""))
6227
+ .append(responseText.replace(rscript, ""))
5658
6228
 
5659
6229
  // Locate the specified elements
5660
6230
  .find(selector) :
5661
6231
 
5662
6232
  // If not, just inject the full result
5663
- res.responseText );
6233
+ responseText );
5664
6234
  }
5665
6235
 
5666
6236
  if ( callback ) {
5667
- self.each( callback, [res.responseText, status, res] );
6237
+ self.each( callback, [ responseText, status, jqXHR ] );
5668
6238
  }
5669
6239
  }
5670
6240
  });
@@ -5673,42 +6243,42 @@ jQuery.fn.extend({
5673
6243
  },
5674
6244
 
5675
6245
  serialize: function() {
5676
- return jQuery.param(this.serializeArray());
6246
+ return jQuery.param( this.serializeArray() );
5677
6247
  },
5678
6248
 
5679
6249
  serializeArray: function() {
5680
- return this.map(function() {
5681
- return this.elements ? jQuery.makeArray(this.elements) : this;
6250
+ return this.map(function(){
6251
+ return this.elements ? jQuery.makeArray( this.elements ) : this;
5682
6252
  })
5683
- .filter(function() {
6253
+ .filter(function(){
5684
6254
  return this.name && !this.disabled &&
5685
- (this.checked || rselectTextarea.test(this.nodeName) ||
5686
- rinput.test(this.type));
6255
+ ( this.checked || rselectTextarea.test( this.nodeName ) ||
6256
+ rinput.test( this.type ) );
5687
6257
  })
5688
- .map(function( i, elem ) {
5689
- var val = jQuery(this).val();
6258
+ .map(function( i, elem ){
6259
+ var val = jQuery( this ).val();
5690
6260
 
5691
6261
  return val == null ?
5692
6262
  null :
5693
- jQuery.isArray(val) ?
5694
- jQuery.map( val, function( val, i ) {
5695
- return { name: elem.name, value: val };
6263
+ jQuery.isArray( val ) ?
6264
+ jQuery.map( val, function( val, i ){
6265
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
5696
6266
  }) :
5697
- { name: elem.name, value: val };
6267
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
5698
6268
  }).get();
5699
6269
  }
5700
6270
  });
5701
6271
 
5702
6272
  // Attach a bunch of functions for handling common AJAX events
5703
- jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
5704
- jQuery.fn[o] = function( f ) {
5705
- return this.bind(o, f);
6273
+ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
6274
+ jQuery.fn[ o ] = function( f ){
6275
+ return this.bind( o, f );
5706
6276
  };
5707
- });
6277
+ } );
5708
6278
 
5709
- jQuery.extend({
5710
- get: function( url, data, callback, type ) {
5711
- // shift arguments if data argument was omited
6279
+ jQuery.each( [ "get", "post" ], function( i, method ) {
6280
+ jQuery[ method ] = function( url, data, callback, type ) {
6281
+ // shift arguments if data argument was omitted
5712
6282
  if ( jQuery.isFunction( data ) ) {
5713
6283
  type = type || callback;
5714
6284
  callback = data;
@@ -5716,45 +6286,35 @@ jQuery.extend({
5716
6286
  }
5717
6287
 
5718
6288
  return jQuery.ajax({
5719
- type: "GET",
6289
+ type: method,
5720
6290
  url: url,
5721
6291
  data: data,
5722
6292
  success: callback,
5723
6293
  dataType: type
5724
6294
  });
5725
- },
6295
+ };
6296
+ } );
6297
+
6298
+ jQuery.extend({
5726
6299
 
5727
6300
  getScript: function( url, callback ) {
5728
- return jQuery.get(url, null, callback, "script");
6301
+ return jQuery.get( url, null, callback, "script" );
5729
6302
  },
5730
6303
 
5731
6304
  getJSON: function( url, data, callback ) {
5732
- return jQuery.get(url, data, callback, "json");
5733
- },
5734
-
5735
- post: function( url, data, callback, type ) {
5736
- // shift arguments if data argument was omited
5737
- if ( jQuery.isFunction( data ) ) {
5738
- type = type || callback;
5739
- callback = data;
5740
- data = {};
5741
- }
5742
-
5743
- return jQuery.ajax({
5744
- type: "POST",
5745
- url: url,
5746
- data: data,
5747
- success: callback,
5748
- dataType: type
5749
- });
6305
+ return jQuery.get( url, data, callback, "json" );
5750
6306
  },
5751
6307
 
5752
6308
  ajaxSetup: function( settings ) {
5753
- jQuery.extend( jQuery.ajaxSettings, settings );
6309
+ jQuery.extend( true, jQuery.ajaxSettings, settings );
6310
+ if ( settings.context ) {
6311
+ jQuery.ajaxSettings.context = settings.context;
6312
+ }
5754
6313
  },
5755
6314
 
5756
6315
  ajaxSettings: {
5757
- url: location.href,
6316
+ url: ajaxLocation,
6317
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
5758
6318
  global: true,
5759
6319
  type: "GET",
5760
6320
  contentType: "application/x-www-form-urlencoded",
@@ -5763,332 +6323,424 @@ jQuery.extend({
5763
6323
  /*
5764
6324
  timeout: 0,
5765
6325
  data: null,
6326
+ dataType: null,
5766
6327
  username: null,
5767
6328
  password: null,
6329
+ cache: null,
5768
6330
  traditional: false,
6331
+ headers: {},
6332
+ crossDomain: null,
5769
6333
  */
5770
- // This function can be overriden by calling jQuery.ajaxSetup
5771
- xhr: function() {
5772
- return new window.XMLHttpRequest();
5773
- },
6334
+
5774
6335
  accepts: {
5775
6336
  xml: "application/xml, text/xml",
5776
6337
  html: "text/html",
5777
- script: "text/javascript, application/javascript",
5778
- json: "application/json, text/javascript",
5779
6338
  text: "text/plain",
5780
- _default: "*/*"
5781
- }
5782
- },
6339
+ json: "application/json, text/javascript",
6340
+ "*": "*/*"
6341
+ },
5783
6342
 
5784
- ajax: function( origSettings ) {
5785
- var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
5786
- jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
6343
+ contents: {
6344
+ xml: /xml/,
6345
+ html: /html/,
6346
+ json: /json/
6347
+ },
5787
6348
 
5788
- s.url = s.url.replace( rhash, "" );
6349
+ responseFields: {
6350
+ xml: "responseXML",
6351
+ text: "responseText"
6352
+ },
5789
6353
 
5790
- // Use original (not extended) context object if it was provided
5791
- s.context = origSettings && origSettings.context != null ? origSettings.context : s;
6354
+ // List of data converters
6355
+ // 1) key format is "source_type destination_type" (a single space in-between)
6356
+ // 2) the catchall symbol "*" can be used for source_type
6357
+ converters: {
6358
+
6359
+ // Convert anything to text
6360
+ "* text": window.String,
6361
+
6362
+ // Text to html (true = no transformation)
6363
+ "text html": true,
6364
+
6365
+ // Evaluate text as a json expression
6366
+ "text json": jQuery.parseJSON,
6367
+
6368
+ // Parse text as xml
6369
+ "text xml": jQuery.parseXML
6370
+ }
6371
+ },
6372
+
6373
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
6374
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
6375
+
6376
+ // Main method
6377
+ ajax: function( url, options ) {
6378
+
6379
+ // If url is an object, simulate pre-1.5 signature
6380
+ if ( typeof url === "object" ) {
6381
+ options = url;
6382
+ url = undefined;
6383
+ }
6384
+
6385
+ // Force options to be an object
6386
+ options = options || {};
6387
+
6388
+ var // Create the final options object
6389
+ s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
6390
+ // Callbacks context
6391
+ // We force the original context if it exists
6392
+ // or take it from jQuery.ajaxSettings otherwise
6393
+ // (plain objects used as context get extended)
6394
+ callbackContext =
6395
+ ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
6396
+ // Context for global events
6397
+ // It's the callbackContext if one was provided in the options
6398
+ // and if it's a DOM node
6399
+ globalEventContext = callbackContext !== s && callbackContext.nodeType ?
6400
+ jQuery( callbackContext ) : jQuery.event,
6401
+ // Deferreds
6402
+ deferred = jQuery.Deferred(),
6403
+ completeDeferred = jQuery._Deferred(),
6404
+ // Status-dependent callbacks
6405
+ statusCode = s.statusCode || {},
6406
+ // ifModified key
6407
+ ifModifiedKey,
6408
+ // Headers (they are sent all at once)
6409
+ requestHeaders = {},
6410
+ // Response headers
6411
+ responseHeadersString,
6412
+ responseHeaders,
6413
+ // transport
6414
+ transport,
6415
+ // timeout handle
6416
+ timeoutTimer,
6417
+ // Cross-domain detection vars
6418
+ parts,
6419
+ // The jqXHR state
6420
+ state = 0,
6421
+ // To know if global events are to be dispatched
6422
+ fireGlobals,
6423
+ // Loop variable
6424
+ i,
6425
+ // Fake xhr
6426
+ jqXHR = {
6427
+
6428
+ readyState: 0,
6429
+
6430
+ // Caches the header
6431
+ setRequestHeader: function( name, value ) {
6432
+ if ( state === 0 ) {
6433
+ requestHeaders[ name.toLowerCase() ] = value;
6434
+ }
6435
+ return this;
6436
+ },
6437
+
6438
+ // Raw string
6439
+ getAllResponseHeaders: function() {
6440
+ return state === 2 ? responseHeadersString : null;
6441
+ },
6442
+
6443
+ // Builds headers hashtable if needed
6444
+ getResponseHeader: function( key ) {
6445
+ var match;
6446
+ if ( state === 2 ) {
6447
+ if ( !responseHeaders ) {
6448
+ responseHeaders = {};
6449
+ while( ( match = rheaders.exec( responseHeadersString ) ) ) {
6450
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
6451
+ }
6452
+ }
6453
+ match = responseHeaders[ key.toLowerCase() ];
6454
+ }
6455
+ return match || null;
6456
+ },
6457
+
6458
+ // Cancel the request
6459
+ abort: function( statusText ) {
6460
+ statusText = statusText || "abort";
6461
+ if ( transport ) {
6462
+ transport.abort( statusText );
6463
+ }
6464
+ done( 0, statusText );
6465
+ return this;
6466
+ }
6467
+ };
5792
6468
 
5793
- // convert data if not already a string
5794
- if ( s.data && s.processData && typeof s.data !== "string" ) {
5795
- s.data = jQuery.param( s.data, s.traditional );
5796
- }
6469
+ // Callback for when everything is done
6470
+ // It is defined here because jslint complains if it is declared
6471
+ // at the end of the function (which would be more logical and readable)
6472
+ function done( status, statusText, responses, headers) {
5797
6473
 
5798
- // Handle JSONP Parameter Callbacks
5799
- if ( s.dataType === "jsonp" ) {
5800
- if ( type === "GET" ) {
5801
- if ( !jsre.test( s.url ) ) {
5802
- s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
5803
- }
5804
- } else if ( !s.data || !jsre.test(s.data) ) {
5805
- s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
6474
+ // Called once
6475
+ if ( state === 2 ) {
6476
+ return;
5806
6477
  }
5807
- s.dataType = "json";
5808
- }
5809
6478
 
5810
- // Build temporary JSONP function
5811
- if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
5812
- jsonp = s.jsonpCallback || ("jsonp" + jsc++);
6479
+ // State is "done" now
6480
+ state = 2;
5813
6481
 
5814
- // Replace the =? sequence both in the query string and the data
5815
- if ( s.data ) {
5816
- s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
6482
+ // Clear timeout if it exists
6483
+ if ( timeoutTimer ) {
6484
+ clearTimeout( timeoutTimer );
5817
6485
  }
5818
6486
 
5819
- s.url = s.url.replace(jsre, "=" + jsonp + "$1");
6487
+ // Dereference transport for early garbage collection
6488
+ // (no matter how long the jqXHR object will be used)
6489
+ transport = undefined;
5820
6490
 
5821
- // We need to make sure
5822
- // that a JSONP style response is executed properly
5823
- s.dataType = "script";
6491
+ // Cache response headers
6492
+ responseHeadersString = headers || "";
5824
6493
 
5825
- // Handle JSONP-style loading
5826
- var customJsonp = window[ jsonp ];
6494
+ // Set readyState
6495
+ jqXHR.readyState = status ? 4 : 0;
5827
6496
 
5828
- window[ jsonp ] = function( tmp ) {
5829
- if ( jQuery.isFunction( customJsonp ) ) {
5830
- customJsonp( tmp );
6497
+ var isSuccess,
6498
+ success,
6499
+ error,
6500
+ response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
6501
+ lastModified,
6502
+ etag;
5831
6503
 
5832
- } else {
5833
- // Garbage collect
5834
- window[ jsonp ] = undefined;
6504
+ // If successful, handle type chaining
6505
+ if ( status >= 200 && status < 300 || status === 304 ) {
5835
6506
 
5836
- try {
5837
- delete window[ jsonp ];
5838
- } catch( jsonpError ) {}
5839
- }
6507
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6508
+ if ( s.ifModified ) {
5840
6509
 
5841
- data = tmp;
5842
- jQuery.handleSuccess( s, xhr, status, data );
5843
- jQuery.handleComplete( s, xhr, status, data );
5844
-
5845
- if ( head ) {
5846
- head.removeChild( script );
6510
+ if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
6511
+ jQuery.lastModified[ ifModifiedKey ] = lastModified;
6512
+ }
6513
+ if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
6514
+ jQuery.etag[ ifModifiedKey ] = etag;
6515
+ }
5847
6516
  }
5848
- };
5849
- }
5850
-
5851
- if ( s.dataType === "script" && s.cache === null ) {
5852
- s.cache = false;
5853
- }
5854
6517
 
5855
- if ( s.cache === false && noContent ) {
5856
- var ts = jQuery.now();
6518
+ // If not modified
6519
+ if ( status === 304 ) {
5857
6520
 
5858
- // try replacing _= if it is there
5859
- var ret = s.url.replace(rts, "$1_=" + ts);
6521
+ statusText = "notmodified";
6522
+ isSuccess = true;
5860
6523
 
5861
- // if nothing was replaced, add timestamp to the end
5862
- s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
5863
- }
5864
-
5865
- // If data is available, append data to url for GET/HEAD requests
5866
- if ( s.data && noContent ) {
5867
- s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
5868
- }
5869
-
5870
- // Watch for a new set of requests
5871
- if ( s.global && jQuery.active++ === 0 ) {
5872
- jQuery.event.trigger( "ajaxStart" );
5873
- }
5874
-
5875
- // Matches an absolute URL, and saves the domain
5876
- var parts = rurl.exec( s.url ),
5877
- remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
5878
-
5879
- // If we're requesting a remote document
5880
- // and trying to load JSON or Script with a GET
5881
- if ( s.dataType === "script" && type === "GET" && remote ) {
5882
- var head = document.getElementsByTagName("head")[0] || document.documentElement;
5883
- var script = document.createElement("script");
5884
- if ( s.scriptCharset ) {
5885
- script.charset = s.scriptCharset;
5886
- }
5887
- script.src = s.url;
5888
-
5889
- // Handle Script loading
5890
- if ( !jsonp ) {
5891
- var done = false;
5892
-
5893
- // Attach handlers for all browsers
5894
- script.onload = script.onreadystatechange = function() {
5895
- if ( !done && (!this.readyState ||
5896
- this.readyState === "loaded" || this.readyState === "complete") ) {
5897
- done = true;
5898
- jQuery.handleSuccess( s, xhr, status, data );
5899
- jQuery.handleComplete( s, xhr, status, data );
6524
+ // If we have data
6525
+ } else {
5900
6526
 
5901
- // Handle memory leak in IE
5902
- script.onload = script.onreadystatechange = null;
5903
- if ( head && script.parentNode ) {
5904
- head.removeChild( script );
5905
- }
6527
+ try {
6528
+ success = ajaxConvert( s, response );
6529
+ statusText = "success";
6530
+ isSuccess = true;
6531
+ } catch(e) {
6532
+ // We have a parsererror
6533
+ statusText = "parsererror";
6534
+ error = e;
5906
6535
  }
5907
- };
6536
+ }
6537
+ } else {
6538
+ // We extract error from statusText
6539
+ // then normalize statusText and status for non-aborts
6540
+ error = statusText;
6541
+ if( status ) {
6542
+ statusText = "error";
6543
+ if ( status < 0 ) {
6544
+ status = 0;
6545
+ }
6546
+ }
5908
6547
  }
5909
6548
 
5910
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
5911
- // This arises when a base node is used (#2709 and #4378).
5912
- head.insertBefore( script, head.firstChild );
5913
-
5914
- // We handle everything using the script element injection
5915
- return undefined;
5916
- }
6549
+ // Set data for the fake xhr object
6550
+ jqXHR.status = status;
6551
+ jqXHR.statusText = statusText;
5917
6552
 
5918
- var requestDone = false;
6553
+ // Success/Error
6554
+ if ( isSuccess ) {
6555
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
6556
+ } else {
6557
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
6558
+ }
5919
6559
 
5920
- // Create the request object
5921
- var xhr = s.xhr();
6560
+ // Status-dependent callbacks
6561
+ jqXHR.statusCode( statusCode );
6562
+ statusCode = undefined;
5922
6563
 
5923
- if ( !xhr ) {
5924
- return;
5925
- }
6564
+ if ( fireGlobals ) {
6565
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
6566
+ [ jqXHR, s, isSuccess ? success : error ] );
6567
+ }
5926
6568
 
5927
- // Open the socket
5928
- // Passing null username, generates a login popup on Opera (#2865)
5929
- if ( s.username ) {
5930
- xhr.open(type, s.url, s.async, s.username, s.password);
5931
- } else {
5932
- xhr.open(type, s.url, s.async);
5933
- }
6569
+ // Complete
6570
+ completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
5934
6571
 
5935
- // Need an extra try/catch for cross domain requests in Firefox 3
5936
- try {
5937
- // Set content-type if data specified and content-body is valid for this type
5938
- if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
5939
- xhr.setRequestHeader("Content-Type", s.contentType);
6572
+ if ( fireGlobals ) {
6573
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
6574
+ // Handle the global AJAX counter
6575
+ if ( !( --jQuery.active ) ) {
6576
+ jQuery.event.trigger( "ajaxStop" );
6577
+ }
5940
6578
  }
6579
+ }
5941
6580
 
5942
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
5943
- if ( s.ifModified ) {
5944
- if ( jQuery.lastModified[s.url] ) {
5945
- xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
5946
- }
6581
+ // Attach deferreds
6582
+ deferred.promise( jqXHR );
6583
+ jqXHR.success = jqXHR.done;
6584
+ jqXHR.error = jqXHR.fail;
6585
+ jqXHR.complete = completeDeferred.done;
5947
6586
 
5948
- if ( jQuery.etag[s.url] ) {
5949
- xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
6587
+ // Status-dependent callbacks
6588
+ jqXHR.statusCode = function( map ) {
6589
+ if ( map ) {
6590
+ var tmp;
6591
+ if ( state < 2 ) {
6592
+ for( tmp in map ) {
6593
+ statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
6594
+ }
6595
+ } else {
6596
+ tmp = map[ jqXHR.status ];
6597
+ jqXHR.then( tmp, tmp );
5950
6598
  }
5951
6599
  }
6600
+ return this;
6601
+ };
5952
6602
 
5953
- // Set header so the called script knows that it's an XMLHttpRequest
5954
- // Only send the header if it's not a remote XHR
5955
- if ( !remote ) {
5956
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
5957
- }
6603
+ // Remove hash character (#7531: and string promotion)
6604
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
6605
+ // We also use the url parameter if available
6606
+ s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
6607
+
6608
+ // Extract dataTypes list
6609
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
6610
+
6611
+ // Determine if a cross-domain request is in order
6612
+ if ( !s.crossDomain ) {
6613
+ parts = rurl.exec( s.url.toLowerCase() );
6614
+ s.crossDomain = !!( parts &&
6615
+ ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
6616
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
6617
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
6618
+ );
6619
+ }
5958
6620
 
5959
- // Set the Accepts header for the server, depending on the dataType
5960
- xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
5961
- s.accepts[ s.dataType ] + ", */*; q=0.01" :
5962
- s.accepts._default );
5963
- } catch( headerError ) {}
6621
+ // Convert data if not already a string
6622
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
6623
+ s.data = jQuery.param( s.data, s.traditional );
6624
+ }
5964
6625
 
5965
- // Allow custom headers/mimetypes and early abort
5966
- if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
5967
- // Handle the global AJAX counter
5968
- if ( s.global && jQuery.active-- === 1 ) {
5969
- jQuery.event.trigger( "ajaxStop" );
5970
- }
6626
+ // Apply prefilters
6627
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
5971
6628
 
5972
- // close opended socket
5973
- xhr.abort();
6629
+ // If request was aborted inside a prefiler, stop there
6630
+ if ( state === 2 ) {
5974
6631
  return false;
5975
6632
  }
5976
6633
 
5977
- if ( s.global ) {
5978
- jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
5979
- }
6634
+ // We can fire global events as of now if asked to
6635
+ fireGlobals = s.global;
5980
6636
 
5981
- // Wait for a response to come back
5982
- var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
5983
- // The request was aborted
5984
- if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
5985
- // Opera doesn't call onreadystatechange before this point
5986
- // so we simulate the call
5987
- if ( !requestDone ) {
5988
- jQuery.handleComplete( s, xhr, status, data );
5989
- }
6637
+ // Uppercase the type
6638
+ s.type = s.type.toUpperCase();
5990
6639
 
5991
- requestDone = true;
5992
- if ( xhr ) {
5993
- xhr.onreadystatechange = jQuery.noop;
5994
- }
6640
+ // Determine if request has content
6641
+ s.hasContent = !rnoContent.test( s.type );
5995
6642
 
5996
- // The transfer is complete and the data is available, or the request timed out
5997
- } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
5998
- requestDone = true;
5999
- xhr.onreadystatechange = jQuery.noop;
6643
+ // Watch for a new set of requests
6644
+ if ( fireGlobals && jQuery.active++ === 0 ) {
6645
+ jQuery.event.trigger( "ajaxStart" );
6646
+ }
6000
6647
 
6001
- status = isTimeout === "timeout" ?
6002
- "timeout" :
6003
- !jQuery.httpSuccess( xhr ) ?
6004
- "error" :
6005
- s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
6006
- "notmodified" :
6007
- "success";
6648
+ // More options handling for requests with no content
6649
+ if ( !s.hasContent ) {
6008
6650
 
6009
- var errMsg;
6651
+ // If data is available, append data to url
6652
+ if ( s.data ) {
6653
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
6654
+ }
6010
6655
 
6011
- if ( status === "success" ) {
6012
- // Watch for, and catch, XML document parse errors
6013
- try {
6014
- // process the data (runs the xml through httpData regardless of callback)
6015
- data = jQuery.httpData( xhr, s.dataType, s );
6016
- } catch( parserError ) {
6017
- status = "parsererror";
6018
- errMsg = parserError;
6019
- }
6020
- }
6656
+ // Get ifModifiedKey before adding the anti-cache parameter
6657
+ ifModifiedKey = s.url;
6021
6658
 
6022
- // Make sure that the request was successful or notmodified
6023
- if ( status === "success" || status === "notmodified" ) {
6024
- // JSONP handles its own success callback
6025
- if ( !jsonp ) {
6026
- jQuery.handleSuccess( s, xhr, status, data );
6027
- }
6028
- } else {
6029
- jQuery.handleError( s, xhr, status, errMsg );
6030
- }
6031
-
6032
- // Fire the complete handlers
6033
- if ( !jsonp ) {
6034
- jQuery.handleComplete( s, xhr, status, data );
6035
- }
6659
+ // Add anti-cache in url if needed
6660
+ if ( s.cache === false ) {
6036
6661
 
6037
- if ( isTimeout === "timeout" ) {
6038
- xhr.abort();
6039
- }
6662
+ var ts = jQuery.now(),
6663
+ // try replacing _= if it is there
6664
+ ret = s.url.replace( rts, "$1_=" + ts );
6040
6665
 
6041
- // Stop memory leaks
6042
- if ( s.async ) {
6043
- xhr = null;
6044
- }
6666
+ // if nothing was replaced, add timestamp to the end
6667
+ s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
6045
6668
  }
6046
- };
6669
+ }
6047
6670
 
6048
- // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
6049
- // Opera doesn't fire onreadystatechange at all on abort
6050
- try {
6051
- var oldAbort = xhr.abort;
6052
- xhr.abort = function() {
6053
- if ( xhr ) {
6054
- // oldAbort has no call property in IE7 so
6055
- // just do it this way, which works in all
6056
- // browsers
6057
- Function.prototype.call.call( oldAbort, xhr );
6058
- }
6671
+ // Set the correct header, if data is being sent
6672
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6673
+ requestHeaders[ "content-type" ] = s.contentType;
6674
+ }
6059
6675
 
6060
- onreadystatechange( "abort" );
6061
- };
6062
- } catch( abortError ) {}
6676
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6677
+ if ( s.ifModified ) {
6678
+ ifModifiedKey = ifModifiedKey || s.url;
6679
+ if ( jQuery.lastModified[ ifModifiedKey ] ) {
6680
+ requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ ifModifiedKey ];
6681
+ }
6682
+ if ( jQuery.etag[ ifModifiedKey ] ) {
6683
+ requestHeaders[ "if-none-match" ] = jQuery.etag[ ifModifiedKey ];
6684
+ }
6685
+ }
6063
6686
 
6064
- // Timeout checker
6065
- if ( s.async && s.timeout > 0 ) {
6066
- setTimeout(function() {
6067
- // Check to see if the request is still happening
6068
- if ( xhr && !requestDone ) {
6069
- onreadystatechange( "timeout" );
6070
- }
6071
- }, s.timeout);
6687
+ // Set the Accepts header for the server, depending on the dataType
6688
+ requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6689
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
6690
+ s.accepts[ "*" ];
6691
+
6692
+ // Check for headers option
6693
+ for ( i in s.headers ) {
6694
+ requestHeaders[ i.toLowerCase() ] = s.headers[ i ];
6072
6695
  }
6073
6696
 
6074
- // Send the data
6075
- try {
6076
- xhr.send( noContent || s.data == null ? null : s.data );
6697
+ // Allow custom headers/mimetypes and early abort
6698
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
6699
+ // Abort if not done already
6700
+ jqXHR.abort();
6701
+ return false;
6077
6702
 
6078
- } catch( sendError ) {
6079
- jQuery.handleError( s, xhr, null, sendError );
6703
+ }
6080
6704
 
6081
- // Fire the complete handlers
6082
- jQuery.handleComplete( s, xhr, status, data );
6705
+ // Install callbacks on deferreds
6706
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
6707
+ jqXHR[ i ]( s[ i ] );
6083
6708
  }
6084
6709
 
6085
- // firefox 1.5 doesn't fire statechange for sync requests
6086
- if ( !s.async ) {
6087
- onreadystatechange();
6710
+ // Get transport
6711
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
6712
+
6713
+ // If no transport, we auto-abort
6714
+ if ( !transport ) {
6715
+ done( -1, "No Transport" );
6716
+ } else {
6717
+ // Set state as sending
6718
+ state = jqXHR.readyState = 1;
6719
+ // Send global event
6720
+ if ( fireGlobals ) {
6721
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
6722
+ }
6723
+ // Timeout
6724
+ if ( s.async && s.timeout > 0 ) {
6725
+ timeoutTimer = setTimeout( function(){
6726
+ jqXHR.abort( "timeout" );
6727
+ }, s.timeout );
6728
+ }
6729
+
6730
+ try {
6731
+ transport.send( requestHeaders, done );
6732
+ } catch (e) {
6733
+ // Propagate exception as error if not done
6734
+ if ( status < 2 ) {
6735
+ done( -1, e );
6736
+ // Simply rethrow otherwise
6737
+ } else {
6738
+ jQuery.error( e );
6739
+ }
6740
+ }
6088
6741
  }
6089
6742
 
6090
- // return XMLHttpRequest to allow aborting the request etc.
6091
- return xhr;
6743
+ return jqXHR;
6092
6744
  },
6093
6745
 
6094
6746
  // Serialize an array of form elements or a set of
@@ -6097,37 +6749,37 @@ jQuery.extend({
6097
6749
  var s = [],
6098
6750
  add = function( key, value ) {
6099
6751
  // If value is a function, invoke it and return its value
6100
- value = jQuery.isFunction(value) ? value() : value;
6101
- s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
6752
+ value = jQuery.isFunction( value ) ? value() : value;
6753
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
6102
6754
  };
6103
-
6755
+
6104
6756
  // Set traditional to true for jQuery <= 1.3.2 behavior.
6105
6757
  if ( traditional === undefined ) {
6106
6758
  traditional = jQuery.ajaxSettings.traditional;
6107
6759
  }
6108
-
6760
+
6109
6761
  // If an array was passed in, assume that it is an array of form elements.
6110
- if ( jQuery.isArray(a) || a.jquery ) {
6762
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
6111
6763
  // Serialize the form elements
6112
6764
  jQuery.each( a, function() {
6113
6765
  add( this.name, this.value );
6114
- });
6115
-
6766
+ } );
6767
+
6116
6768
  } else {
6117
6769
  // If traditional, encode the "old" way (the way 1.3.2 or older
6118
6770
  // did it), otherwise encode params recursively.
6119
6771
  for ( var prefix in a ) {
6120
- buildParams( prefix, a[prefix], traditional, add );
6772
+ buildParams( prefix, a[ prefix ], traditional, add );
6121
6773
  }
6122
6774
  }
6123
6775
 
6124
6776
  // Return the resulting serialization
6125
- return s.join("&").replace(r20, "+");
6777
+ return s.join( "&" ).replace( r20, "+" );
6126
6778
  }
6127
6779
  });
6128
6780
 
6129
6781
  function buildParams( prefix, obj, traditional, add ) {
6130
- if ( jQuery.isArray(obj) && obj.length ) {
6782
+ if ( jQuery.isArray( obj ) && obj.length ) {
6131
6783
  // Serialize array item.
6132
6784
  jQuery.each( obj, function( i, v ) {
6133
6785
  if ( traditional || rbracket.test( prefix ) ) {
@@ -6145,18 +6797,20 @@ function buildParams( prefix, obj, traditional, add ) {
6145
6797
  buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
6146
6798
  }
6147
6799
  });
6148
-
6800
+
6149
6801
  } else if ( !traditional && obj != null && typeof obj === "object" ) {
6150
- if ( jQuery.isEmptyObject( obj ) ) {
6802
+ // If we see an array here, it is empty and should be treated as an empty
6803
+ // object
6804
+ if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {
6151
6805
  add( prefix, "" );
6152
6806
 
6153
6807
  // Serialize object item.
6154
6808
  } else {
6155
- jQuery.each( obj, function( k, v ) {
6156
- buildParams( prefix + "[" + k + "]", v, traditional, add );
6157
- });
6809
+ for ( var name in obj ) {
6810
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6811
+ }
6158
6812
  }
6159
-
6813
+
6160
6814
  } else {
6161
6815
  // Serialize scalar item.
6162
6816
  add( prefix, obj );
@@ -6172,136 +6826,582 @@ jQuery.extend({
6172
6826
 
6173
6827
  // Last-Modified header cache for next request
6174
6828
  lastModified: {},
6175
- etag: {},
6829
+ etag: {}
6176
6830
 
6177
- handleError: function( s, xhr, status, e ) {
6178
- // If a local callback was specified, fire it
6179
- if ( s.error ) {
6180
- s.error.call( s.context, xhr, status, e );
6181
- }
6831
+ });
6182
6832
 
6183
- // Fire the global callback
6184
- if ( s.global ) {
6185
- jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
6186
- }
6187
- },
6833
+ /* Handles responses to an ajax request:
6834
+ * - sets all responseXXX fields accordingly
6835
+ * - finds the right dataType (mediates between content-type and expected dataType)
6836
+ * - returns the corresponding response
6837
+ */
6838
+ function ajaxHandleResponses( s, jqXHR, responses ) {
6188
6839
 
6189
- handleSuccess: function( s, xhr, status, data ) {
6190
- // If a local callback was specified, fire it and pass it the data
6191
- if ( s.success ) {
6192
- s.success.call( s.context, data, status, xhr );
6193
- }
6840
+ var contents = s.contents,
6841
+ dataTypes = s.dataTypes,
6842
+ responseFields = s.responseFields,
6843
+ ct,
6844
+ type,
6845
+ finalDataType,
6846
+ firstDataType;
6194
6847
 
6195
- // Fire the global callback
6196
- if ( s.global ) {
6197
- jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
6848
+ // Fill responseXXX fields
6849
+ for( type in responseFields ) {
6850
+ if ( type in responses ) {
6851
+ jqXHR[ responseFields[type] ] = responses[ type ];
6198
6852
  }
6199
- },
6853
+ }
6200
6854
 
6201
- handleComplete: function( s, xhr, status ) {
6202
- // Process result
6203
- if ( s.complete ) {
6204
- s.complete.call( s.context, xhr, status );
6855
+ // Remove auto dataType and get content-type in the process
6856
+ while( dataTypes[ 0 ] === "*" ) {
6857
+ dataTypes.shift();
6858
+ if ( ct === undefined ) {
6859
+ ct = jqXHR.getResponseHeader( "content-type" );
6205
6860
  }
6861
+ }
6206
6862
 
6207
- // The request was completed
6208
- if ( s.global ) {
6209
- jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
6863
+ // Check if we're dealing with a known content-type
6864
+ if ( ct ) {
6865
+ for ( type in contents ) {
6866
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
6867
+ dataTypes.unshift( type );
6868
+ break;
6869
+ }
6210
6870
  }
6871
+ }
6211
6872
 
6212
- // Handle the global AJAX counter
6213
- if ( s.global && jQuery.active-- === 1 ) {
6214
- jQuery.event.trigger( "ajaxStop" );
6873
+ // Check to see if we have a response for the expected dataType
6874
+ if ( dataTypes[ 0 ] in responses ) {
6875
+ finalDataType = dataTypes[ 0 ];
6876
+ } else {
6877
+ // Try convertible dataTypes
6878
+ for ( type in responses ) {
6879
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
6880
+ finalDataType = type;
6881
+ break;
6882
+ }
6883
+ if ( !firstDataType ) {
6884
+ firstDataType = type;
6885
+ }
6215
6886
  }
6216
- },
6217
-
6218
- triggerGlobal: function( s, type, args ) {
6219
- (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
6220
- },
6887
+ // Or just use first one
6888
+ finalDataType = finalDataType || firstDataType;
6889
+ }
6221
6890
 
6222
- // Determines if an XMLHttpRequest was successful or not
6223
- httpSuccess: function( xhr ) {
6224
- try {
6225
- // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
6226
- return !xhr.status && location.protocol === "file:" ||
6227
- xhr.status >= 200 && xhr.status < 300 ||
6228
- xhr.status === 304 || xhr.status === 1223;
6229
- } catch(e) {}
6891
+ // If we found a dataType
6892
+ // We add the dataType to the list if needed
6893
+ // and return the corresponding response
6894
+ if ( finalDataType ) {
6895
+ if ( finalDataType !== dataTypes[ 0 ] ) {
6896
+ dataTypes.unshift( finalDataType );
6897
+ }
6898
+ return responses[ finalDataType ];
6899
+ }
6900
+ }
6230
6901
 
6231
- return false;
6232
- },
6902
+ // Chain conversions given the request and the original response
6903
+ function ajaxConvert( s, response ) {
6233
6904
 
6234
- // Determines if an XMLHttpRequest returns NotModified
6235
- httpNotModified: function( xhr, url ) {
6236
- var lastModified = xhr.getResponseHeader("Last-Modified"),
6237
- etag = xhr.getResponseHeader("Etag");
6905
+ // Apply the dataFilter if provided
6906
+ if ( s.dataFilter ) {
6907
+ response = s.dataFilter( response, s.dataType );
6908
+ }
6238
6909
 
6239
- if ( lastModified ) {
6240
- jQuery.lastModified[url] = lastModified;
6910
+ var dataTypes = s.dataTypes,
6911
+ converters = {},
6912
+ i,
6913
+ key,
6914
+ length = dataTypes.length,
6915
+ tmp,
6916
+ // Current and previous dataTypes
6917
+ current = dataTypes[ 0 ],
6918
+ prev,
6919
+ // Conversion expression
6920
+ conversion,
6921
+ // Conversion function
6922
+ conv,
6923
+ // Conversion functions (transitive conversion)
6924
+ conv1,
6925
+ conv2;
6926
+
6927
+ // For each dataType in the chain
6928
+ for( i = 1; i < length; i++ ) {
6929
+
6930
+ // Create converters map
6931
+ // with lowercased keys
6932
+ if ( i === 1 ) {
6933
+ for( key in s.converters ) {
6934
+ if( typeof key === "string" ) {
6935
+ converters[ key.toLowerCase() ] = s.converters[ key ];
6936
+ }
6937
+ }
6241
6938
  }
6242
6939
 
6243
- if ( etag ) {
6244
- jQuery.etag[url] = etag;
6940
+ // Get the dataTypes
6941
+ prev = current;
6942
+ current = dataTypes[ i ];
6943
+
6944
+ // If current is auto dataType, update it to prev
6945
+ if( current === "*" ) {
6946
+ current = prev;
6947
+ // If no auto and dataTypes are actually different
6948
+ } else if ( prev !== "*" && prev !== current ) {
6949
+
6950
+ // Get the converter
6951
+ conversion = prev + " " + current;
6952
+ conv = converters[ conversion ] || converters[ "* " + current ];
6953
+
6954
+ // If there is no direct converter, search transitively
6955
+ if ( !conv ) {
6956
+ conv2 = undefined;
6957
+ for( conv1 in converters ) {
6958
+ tmp = conv1.split( " " );
6959
+ if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
6960
+ conv2 = converters[ tmp[1] + " " + current ];
6961
+ if ( conv2 ) {
6962
+ conv1 = converters[ conv1 ];
6963
+ if ( conv1 === true ) {
6964
+ conv = conv2;
6965
+ } else if ( conv2 === true ) {
6966
+ conv = conv1;
6967
+ }
6968
+ break;
6969
+ }
6970
+ }
6971
+ }
6972
+ }
6973
+ // If we found no converter, dispatch an error
6974
+ if ( !( conv || conv2 ) ) {
6975
+ jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
6976
+ }
6977
+ // If found converter is not an equivalence
6978
+ if ( conv !== true ) {
6979
+ // Convert with 1 or 2 converters accordingly
6980
+ response = conv ? conv( response ) : conv2( conv1(response) );
6981
+ }
6245
6982
  }
6983
+ }
6984
+ return response;
6985
+ }
6246
6986
 
6247
- return xhr.status === 304;
6248
- },
6987
+ })( jQuery );
6249
6988
 
6250
- httpData: function( xhr, type, s ) {
6251
- var ct = xhr.getResponseHeader("content-type") || "",
6252
- xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
6253
- data = xml ? xhr.responseXML : xhr.responseText;
6254
6989
 
6255
- if ( xml && data.documentElement.nodeName === "parsererror" ) {
6256
- jQuery.error( "parsererror" );
6257
- }
6990
+ (function( jQuery ) {
6258
6991
 
6259
- // Allow a pre-filtering function to sanitize the response
6260
- // s is checked to keep backwards compatibility
6261
- if ( s && s.dataFilter ) {
6262
- data = s.dataFilter( data, type );
6263
- }
6992
+ var jsc = jQuery.now(),
6993
+ jsre = /(\=)\?(&|$)|()\?\?()/i;
6264
6994
 
6265
- // The filter can actually parse the response
6266
- if ( typeof data === "string" ) {
6267
- // Get the JavaScript object, if JSON is used.
6268
- if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
6269
- data = jQuery.parseJSON( data );
6995
+ // Default jsonp settings
6996
+ jQuery.ajaxSetup({
6997
+ jsonp: "callback",
6998
+ jsonpCallback: function() {
6999
+ return jQuery.expando + "_" + ( jsc++ );
7000
+ }
7001
+ });
7002
+
7003
+ // Detect, normalize options and install callbacks for jsonp requests
7004
+ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7005
+
7006
+ var dataIsString = ( typeof s.data === "string" );
7007
+
7008
+ if ( s.dataTypes[ 0 ] === "jsonp" ||
7009
+ originalSettings.jsonpCallback ||
7010
+ originalSettings.jsonp != null ||
7011
+ s.jsonp !== false && ( jsre.test( s.url ) ||
7012
+ dataIsString && jsre.test( s.data ) ) ) {
7013
+
7014
+ var responseContainer,
7015
+ jsonpCallback = s.jsonpCallback =
7016
+ jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
7017
+ previous = window[ jsonpCallback ],
7018
+ url = s.url,
7019
+ data = s.data,
7020
+ replace = "$1" + jsonpCallback + "$2",
7021
+ cleanUp = function() {
7022
+ // Set callback back to previous value
7023
+ window[ jsonpCallback ] = previous;
7024
+ // Call if it was a function and we have a response
7025
+ if ( responseContainer && jQuery.isFunction( previous ) ) {
7026
+ window[ jsonpCallback ]( responseContainer[ 0 ] );
7027
+ }
7028
+ };
6270
7029
 
6271
- // If the type is "script", eval it in global context
6272
- } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
6273
- jQuery.globalEval( data );
7030
+ if ( s.jsonp !== false ) {
7031
+ url = url.replace( jsre, replace );
7032
+ if ( s.url === url ) {
7033
+ if ( dataIsString ) {
7034
+ data = data.replace( jsre, replace );
7035
+ }
7036
+ if ( s.data === data ) {
7037
+ // Add callback manually
7038
+ url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
7039
+ }
6274
7040
  }
6275
7041
  }
6276
7042
 
6277
- return data;
7043
+ s.url = url;
7044
+ s.data = data;
7045
+
7046
+ // Install callback
7047
+ window[ jsonpCallback ] = function( response ) {
7048
+ responseContainer = [ response ];
7049
+ };
7050
+
7051
+ // Install cleanUp function
7052
+ jqXHR.then( cleanUp, cleanUp );
7053
+
7054
+ // Use data converter to retrieve json after script execution
7055
+ s.converters["script json"] = function() {
7056
+ if ( !responseContainer ) {
7057
+ jQuery.error( jsonpCallback + " was not called" );
7058
+ }
7059
+ return responseContainer[ 0 ];
7060
+ };
7061
+
7062
+ // force json dataType
7063
+ s.dataTypes[ 0 ] = "json";
7064
+
7065
+ // Delegate to script
7066
+ return "script";
6278
7067
  }
7068
+ } );
6279
7069
 
6280
- });
7070
+ })( jQuery );
6281
7071
 
6282
- /*
6283
- * Create the request object; Microsoft failed to properly
6284
- * implement the XMLHttpRequest in IE7 (can't request local files),
6285
- * so we use the ActiveXObject when it is available
6286
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
6287
- * we need a fallback.
6288
- */
6289
- if ( window.ActiveXObject ) {
6290
- jQuery.ajaxSettings.xhr = function() {
6291
- if ( window.location.protocol !== "file:" ) {
6292
- try {
6293
- return new window.XMLHttpRequest();
6294
- } catch(xhrError) {}
7072
+
7073
+ (function( jQuery ) {
7074
+
7075
+ // Install script dataType
7076
+ jQuery.ajaxSetup({
7077
+ accepts: {
7078
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
7079
+ },
7080
+ contents: {
7081
+ script: /javascript|ecmascript/
7082
+ },
7083
+ converters: {
7084
+ "text script": function( text ) {
7085
+ jQuery.globalEval( text );
7086
+ return text;
6295
7087
  }
7088
+ }
7089
+ });
6296
7090
 
6297
- try {
6298
- return new window.ActiveXObject("Microsoft.XMLHTTP");
6299
- } catch(activeError) {}
6300
- };
7091
+ // Handle cache's special case and global
7092
+ jQuery.ajaxPrefilter( "script", function( s ) {
7093
+ if ( s.cache === undefined ) {
7094
+ s.cache = false;
7095
+ }
7096
+ if ( s.crossDomain ) {
7097
+ s.type = "GET";
7098
+ s.global = false;
7099
+ }
7100
+ } );
7101
+
7102
+ // Bind script tag hack transport
7103
+ jQuery.ajaxTransport( "script", function(s) {
7104
+
7105
+ // This transport only deals with cross domain requests
7106
+ if ( s.crossDomain ) {
7107
+
7108
+ var script,
7109
+ head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
7110
+
7111
+ return {
7112
+
7113
+ send: function( _, callback ) {
7114
+
7115
+ script = document.createElement( "script" );
7116
+
7117
+ script.async = "async";
7118
+
7119
+ if ( s.scriptCharset ) {
7120
+ script.charset = s.scriptCharset;
7121
+ }
7122
+
7123
+ script.src = s.url;
7124
+
7125
+ // Attach handlers for all browsers
7126
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
7127
+
7128
+ if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
7129
+
7130
+ // Handle memory leak in IE
7131
+ script.onload = script.onreadystatechange = null;
7132
+
7133
+ // Remove the script
7134
+ if ( head && script.parentNode ) {
7135
+ head.removeChild( script );
7136
+ }
7137
+
7138
+ // Dereference the script
7139
+ script = undefined;
7140
+
7141
+ // Callback if not abort
7142
+ if ( !isAbort ) {
7143
+ callback( 200, "success" );
7144
+ }
7145
+ }
7146
+ };
7147
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
7148
+ // This arises when a base node is used (#2709 and #4378).
7149
+ head.insertBefore( script, head.firstChild );
7150
+ },
7151
+
7152
+ abort: function() {
7153
+ if ( script ) {
7154
+ script.onload( 0, 1 );
7155
+ }
7156
+ }
7157
+ };
7158
+ }
7159
+ } );
7160
+
7161
+ })( jQuery );
7162
+
7163
+
7164
+ (function( jQuery ) {
7165
+
7166
+ // Functions to create xhrs
7167
+ function createStandardXHR() {
7168
+ try {
7169
+ return new window.XMLHttpRequest();
7170
+ } catch( e ) {}
6301
7171
  }
6302
7172
 
6303
- // Does this browser support XHR requests?
6304
- jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
7173
+ function createActiveXHR() {
7174
+ try {
7175
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
7176
+ } catch( e ) {}
7177
+ }
7178
+
7179
+ var // Next active xhr id
7180
+ xhrId = jQuery.now(),
7181
+
7182
+ // active xhrs
7183
+ xhrs = {},
7184
+
7185
+ // #5280: see below
7186
+ xhrUnloadAbortInstalled,
7187
+
7188
+ // XHR used to determine supports properties
7189
+ testXHR;
7190
+
7191
+ // Create the request object
7192
+ // (This is still attached to ajaxSettings for backward compatibility)
7193
+ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
7194
+ /* Microsoft failed to properly
7195
+ * implement the XMLHttpRequest in IE7 (can't request local files),
7196
+ * so we use the ActiveXObject when it is available
7197
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
7198
+ * we need a fallback.
7199
+ */
7200
+ function() {
7201
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
7202
+ } :
7203
+ // For all other browsers, use the standard XMLHttpRequest object
7204
+ createStandardXHR;
7205
+
7206
+ // Test if we can create an xhr object
7207
+ testXHR = jQuery.ajaxSettings.xhr();
7208
+ jQuery.support.ajax = !!testXHR;
7209
+
7210
+ // Does this browser support crossDomain XHR requests
7211
+ jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
7212
+
7213
+ // No need for the temporary xhr anymore
7214
+ testXHR = undefined;
7215
+
7216
+ // Create transport if the browser can provide an xhr
7217
+ if ( jQuery.support.ajax ) {
7218
+
7219
+ jQuery.ajaxTransport(function( s ) {
7220
+ // Cross domain only allowed if supported through XMLHttpRequest
7221
+ if ( !s.crossDomain || jQuery.support.cors ) {
7222
+
7223
+ var callback;
7224
+
7225
+ return {
7226
+ send: function( headers, complete ) {
7227
+
7228
+ // #5280: we need to abort on unload or IE will keep connections alive
7229
+ if ( !xhrUnloadAbortInstalled ) {
7230
+
7231
+ xhrUnloadAbortInstalled = 1;
7232
+
7233
+ jQuery(window).bind( "unload", function() {
7234
+
7235
+ // Abort all pending requests
7236
+ jQuery.each( xhrs, function( _, xhr ) {
7237
+ if ( xhr.onreadystatechange ) {
7238
+ xhr.onreadystatechange( 1 );
7239
+ }
7240
+ } );
7241
+
7242
+ } );
7243
+ }
7244
+
7245
+ // Get a new xhr
7246
+ var xhr = s.xhr(),
7247
+ handle,
7248
+ i;
7249
+
7250
+ // Open the socket
7251
+ // Passing null username, generates a login popup on Opera (#2865)
7252
+ if ( s.username ) {
7253
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
7254
+ } else {
7255
+ xhr.open( s.type, s.url, s.async );
7256
+ }
7257
+
7258
+ // Apply custom fields if provided
7259
+ if ( s.xhrFields ) {
7260
+ for ( i in s.xhrFields ) {
7261
+ xhr[ i ] = s.xhrFields[ i ];
7262
+ }
7263
+ }
7264
+
7265
+ // Requested-With header
7266
+ // Not set for crossDomain requests with no content
7267
+ // (see why at http://trac.dojotoolkit.org/ticket/9486)
7268
+ // Won't change header if already provided
7269
+ if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) {
7270
+ headers[ "x-requested-with" ] = "XMLHttpRequest";
7271
+ }
7272
+
7273
+ // Need an extra try/catch for cross domain requests in Firefox 3
7274
+ try {
7275
+ jQuery.each( headers, function( key, value ) {
7276
+ xhr.setRequestHeader( key, value );
7277
+ } );
7278
+ } catch( _ ) {}
7279
+
7280
+ // Do send the request
7281
+ // This may raise an exception which is actually
7282
+ // handled in jQuery.ajax (so no try/catch here)
7283
+ xhr.send( ( s.hasContent && s.data ) || null );
7284
+
7285
+ // Listener
7286
+ callback = function( _, isAbort ) {
7287
+
7288
+ var status,
7289
+ statusText,
7290
+ responseHeaders,
7291
+ responses,
7292
+ xml;
7293
+
7294
+ // Firefox throws exceptions when accessing properties
7295
+ // of an xhr when a network error occured
7296
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
7297
+ try {
7298
+
7299
+ // Was never called and is aborted or complete
7300
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
7301
+
7302
+ // Only called once
7303
+ callback = undefined;
7304
+
7305
+ // Do not keep as active anymore
7306
+ if ( handle ) {
7307
+ xhr.onreadystatechange = jQuery.noop;
7308
+ delete xhrs[ handle ];
7309
+ }
7310
+
7311
+ // If it's an abort
7312
+ if ( isAbort ) {
7313
+ // Abort it manually if needed
7314
+ if ( xhr.readyState !== 4 ) {
7315
+ xhr.abort();
7316
+ }
7317
+ } else {
7318
+ // Get info
7319
+ status = xhr.status;
7320
+ responseHeaders = xhr.getAllResponseHeaders();
7321
+ responses = {};
7322
+ xml = xhr.responseXML;
7323
+
7324
+ // Construct response list
7325
+ if ( xml && xml.documentElement /* #4958 */ ) {
7326
+ responses.xml = xml;
7327
+ }
7328
+ responses.text = xhr.responseText;
7329
+
7330
+ // Firefox throws an exception when accessing
7331
+ // statusText for faulty cross-domain requests
7332
+ try {
7333
+ statusText = xhr.statusText;
7334
+ } catch( e ) {
7335
+ // We normalize with Webkit giving an empty statusText
7336
+ statusText = "";
7337
+ }
7338
+
7339
+ // Filter status for non standard behaviors
7340
+
7341
+ // IE - #1450: sometimes returns 1223 when it should be 204
7342
+ if ( status === 1223 ) {
7343
+ status = 204;
7344
+ // Various - #8177: a Not Modified response was received
7345
+ // yet no conditional request headers was provided
7346
+ } else if ( status === 304 &&
7347
+ !headers[ "if-modified-since" ] &&
7348
+ !headers[ "if-none-match" ] ) {
7349
+ status = 200;
7350
+ // Status 0 encompasses several cases
7351
+ } else if ( !status ) {
7352
+ // Cross-domain
7353
+ if ( s.crossDomain ) {
7354
+ if ( !s.statusText ) {
7355
+ // FF, Webkit (other?): There is no status text for errors
7356
+ // 302 is the most generic cross-domain status code
7357
+ // for errors, could be anything really (even a real 0)
7358
+ status = 302;
7359
+ }
7360
+ // All same-domain: for local files, 0 is a success
7361
+ } else if( s.isLocal ) {
7362
+ status = 200;
7363
+ // Opera: this notifies success for all requests
7364
+ // (verified in 11.01). Patch welcome.
7365
+ }
7366
+ // Opera - #6060: sets status as 0 for 304
7367
+ // Patch welcome.
7368
+ }
7369
+ }
7370
+ }
7371
+ } catch( firefoxAccessException ) {
7372
+ if ( !isAbort ) {
7373
+ complete( -1, firefoxAccessException );
7374
+ }
7375
+ }
7376
+
7377
+ // Call complete if needed
7378
+ if ( responses ) {
7379
+ complete( status, statusText, responses, responseHeaders );
7380
+ }
7381
+ };
7382
+
7383
+ // if we're in sync mode or it's in cache
7384
+ // and has been retrieved directly (IE6 & IE7)
7385
+ // we need to manually fire the callback
7386
+ if ( !s.async || xhr.readyState === 4 ) {
7387
+ callback();
7388
+ } else {
7389
+ // Add to list of active xhrs
7390
+ handle = xhrId++;
7391
+ xhrs[ handle ] = xhr;
7392
+ xhr.onreadystatechange = callback;
7393
+ }
7394
+ },
7395
+
7396
+ abort: function() {
7397
+ if ( callback ) {
7398
+ callback(0,1);
7399
+ }
7400
+ }
7401
+ };
7402
+ }
7403
+ });
7404
+ }
6305
7405
 
6306
7406
  })( jQuery );
6307
7407
 
@@ -6310,7 +7410,7 @@ jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
6310
7410
 
6311
7411
  var elemdisplay = {},
6312
7412
  rfxtypes = /^(?:toggle|show|hide)$/,
6313
- rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
7413
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
6314
7414
  timerId,
6315
7415
  fxAttrs = [
6316
7416
  // height animations
@@ -6335,7 +7435,7 @@ jQuery.fn.extend({
6335
7435
 
6336
7436
  // Reset the inline display of this element to learn if it is
6337
7437
  // being hidden by cascaded rules or not
6338
- if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
7438
+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
6339
7439
  display = elem.style.display = "";
6340
7440
  }
6341
7441
 
@@ -6343,7 +7443,7 @@ jQuery.fn.extend({
6343
7443
  // in a stylesheet to whatever the default browser style is
6344
7444
  // for such an element
6345
7445
  if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
6346
- jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
7446
+ jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
6347
7447
  }
6348
7448
  }
6349
7449
 
@@ -6354,7 +7454,7 @@ jQuery.fn.extend({
6354
7454
  display = elem.style.display;
6355
7455
 
6356
7456
  if ( display === "" || display === "none" ) {
6357
- elem.style.display = jQuery.data(elem, "olddisplay") || "";
7457
+ elem.style.display = jQuery._data(elem, "olddisplay") || "";
6358
7458
  }
6359
7459
  }
6360
7460
 
@@ -6370,8 +7470,8 @@ jQuery.fn.extend({
6370
7470
  for ( var i = 0, j = this.length; i < j; i++ ) {
6371
7471
  var display = jQuery.css( this[i], "display" );
6372
7472
 
6373
- if ( display !== "none" ) {
6374
- jQuery.data( this[i], "olddisplay", display );
7473
+ if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
7474
+ jQuery._data( this[i], "olddisplay", display );
6375
7475
  }
6376
7476
  }
6377
7477
 
@@ -6645,7 +7745,7 @@ jQuery.fx.prototype = {
6645
7745
  }
6646
7746
 
6647
7747
  var r = parseFloat( jQuery.css( this.elem, this.prop ) );
6648
- return r && r > -10000 ? r : 0;
7748
+ return r || 0;
6649
7749
  },
6650
7750
 
6651
7751
  // Start an animation from one number to another
@@ -6841,7 +7941,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
6841
7941
  jQuery.fn.offset = function( options ) {
6842
7942
  var elem = this[0], box;
6843
7943
 
6844
- if ( options ) {
7944
+ if ( options ) {
6845
7945
  return this.each(function( i ) {
6846
7946
  jQuery.offset.setOffset( this, options, i );
6847
7947
  });
@@ -6864,7 +7964,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
6864
7964
 
6865
7965
  // Make sure we're not dealing with a disconnected DOM node
6866
7966
  if ( !box || !jQuery.contains( docElem, elem ) ) {
6867
- return box || { top: 0, left: 0 };
7967
+ return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
6868
7968
  }
6869
7969
 
6870
7970
  var body = doc.body,
@@ -6883,7 +7983,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
6883
7983
  jQuery.fn.offset = function( options ) {
6884
7984
  var elem = this[0];
6885
7985
 
6886
- if ( options ) {
7986
+ if ( options ) {
6887
7987
  return this.each(function( i ) {
6888
7988
  jQuery.offset.setOffset( this, options, i );
6889
7989
  });
@@ -7002,7 +8102,7 @@ jQuery.offset = {
7002
8102
 
7003
8103
  return { top: top, left: left };
7004
8104
  },
7005
-
8105
+
7006
8106
  setOffset: function( elem, options, i ) {
7007
8107
  var position = jQuery.css( elem, "position" );
7008
8108
 
@@ -7036,7 +8136,7 @@ jQuery.offset = {
7036
8136
  if (options.left != null) {
7037
8137
  props.left = (options.left - curOffset.left) + curLeft;
7038
8138
  }
7039
-
8139
+
7040
8140
  if ( "using" in options ) {
7041
8141
  options.using.call( elem, props );
7042
8142
  } else {
@@ -7096,7 +8196,7 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
7096
8196
 
7097
8197
  jQuery.fn[ method ] = function(val) {
7098
8198
  var elem = this[0], win;
7099
-
8199
+
7100
8200
  if ( !elem ) {
7101
8201
  return null;
7102
8202
  }
@@ -7166,7 +8266,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
7166
8266
  if ( !elem ) {
7167
8267
  return size == null ? null : this;
7168
8268
  }
7169
-
8269
+
7170
8270
  if ( jQuery.isFunction( size ) ) {
7171
8271
  return this.each(function( i ) {
7172
8272
  var self = jQuery( this );
@@ -7176,8 +8276,10 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
7176
8276
 
7177
8277
  if ( jQuery.isWindow( elem ) ) {
7178
8278
  // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
7179
- return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
7180
- elem.document.body[ "client" + name ];
8279
+ // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
8280
+ var docElemProp = elem.document.documentElement[ "client" + name ];
8281
+ return elem.document.compatMode === "CSS1Compat" && docElemProp ||
8282
+ elem.document.body[ "client" + name ] || docElemProp;
7181
8283
 
7182
8284
  // Get document width or height
7183
8285
  } else if ( elem.nodeType === 9 ) {