slideshow 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ require 'pp'
15
15
 
16
16
  module Slideshow
17
17
 
18
- VERSION = '0.7.4'
18
+ VERSION = '0.7.5'
19
19
 
20
20
  class Params
21
21
 
@@ -3,8 +3,9 @@
3
3
  __file__.svg gradient.svg.erb
4
4
  __file__.html s6/header.html.erb + s6/footer.html.erb
5
5
  __file__.css s6/style.css.erb
6
- s6/jquery.js
7
6
  s6/outline.css
8
7
  s6/print.css
9
8
  s6/slides.css
10
- s6/slides.js
9
+ s6/jquery.js
10
+ s6/slides.js
11
+ s6/slides.core.js
@@ -5,8 +5,9 @@ gradient.svg.erb
5
5
  header.html.erb s6/header.html.erb
6
6
  footer.html.erb s6/footer.html.erb
7
7
  style.css.erb s6/style.css.erb
8
- s6/jquery.js
9
8
  s6/outline.css
10
9
  s6/print.css
11
10
  s6/slides.css
11
+ s6/jquery.js
12
+ s6/slides.core.js
12
13
  s6/slides.js
@@ -8,8 +8,9 @@
8
8
  __file__.svg gradient.svg.erb
9
9
  __file__.html header.html.erb + footer.html.erb
10
10
  __file__.css style.css.erb
11
- s6/jquery.js
12
11
  s6/outline.css
13
12
  s6/print.css
14
13
  s6/slides.css
14
+ s6/jquery.js
15
+ s6/slides.core.js
15
16
  s6/slides.js
@@ -1,21 +1,19 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1
2
  <html>
2
-
3
3
  <head>
4
-
5
- <title><%= @headers['title'] %></title>
4
+ <title><%= @headers['title'] %></title>
6
5
 
7
6
  <!-- configuration parameters -->
8
- <meta name="defaultView" content="slideshow" />
7
+ <meta name="defaultView" content="slideshow">
9
8
  <!-- style sheet links -->
10
- <link rel="stylesheet" href="<%= "#{@name}.css" %>" type="text/css" media="projection" id="slideProj" />
11
- <link rel="stylesheet" href="s6/outline.css" type="text/css" media="screen" id="outlineStyle" />
12
- <link rel="stylesheet" href="s6/print.css" type="text/css" media="print" id="slidePrint" />
9
+ <link rel="stylesheet" href="<%= "#{@name}.css" %>" type="text/css" media="projection" id="slideProj">
10
+ <link rel="stylesheet" href="s6/outline.css" type="text/css" media="screen" id="outlineStyle">
11
+ <link rel="stylesheet" href="s6/print.css" type="text/css" media="print" id="slidePrint">
13
12
 
14
13
  <!-- S6 JS -->
15
14
  <script src="s6/jquery.js" type="text/javascript"></script>
16
15
  <script src="s6/slides.js" type="text/javascript"></script>
17
16
 
18
-
19
17
  </head>
20
18
  <body>
21
19
 
@@ -43,7 +41,7 @@
43
41
  <p>
44
42
  Please upgrade to a better browser
45
43
  such as <a href='http://getfirefox.com'>Firefox</a>, <a href='http://www.opera.com/download'>Opera</a>,
46
- <a href='http://apple.com/safari/download'>Safari</a> or others
44
+ <a href='http://google.com/chrome'>Chrome</a>, <a href='http://apple.com/safari/download'>Safari</a> or others
47
45
  with built-in vector graphics machinery and much more.
48
46
 
49
47
  (Learn more or post questions or comments
@@ -1,34 +1,36 @@
1
- (function(){
2
- /*
3
- * jQuery 1.2.6 - New Wave Javascript
1
+ /*!
2
+ * jQuery JavaScript Library v1.3.1
3
+ * http://jquery.com/
4
4
  *
5
- * Copyright (c) 2008 John Resig (jquery.com)
6
- * Dual licensed under the MIT (MIT-LICENSE.txt)
7
- * and GPL (GPL-LICENSE.txt) licenses.
5
+ * Copyright (c) 2009 John Resig
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://docs.jquery.com/License
8
8
  *
9
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
10
- * $Rev: 5685 $
9
+ * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
10
+ * Revision: 6158
11
11
  */
12
+ (function(){
12
13
 
13
- // Map over jQuery in case of overwrite
14
- var _jQuery = window.jQuery,
15
- // Map over the $ in case of overwrite
16
- _$ = window.$;
17
-
18
- var jQuery = window.jQuery = window.$ = function( selector, context ) {
19
- // The jQuery object is actually just the init constructor 'enhanced'
20
- return new jQuery.fn.init( selector, context );
21
- };
22
-
23
- // A simple way to check for HTML strings or ID strings
24
- // (both of which we optimize for)
25
- var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
26
-
27
- // Is it a simple selector
28
- isSimple = /^.[^:#\[\.]*$/,
14
+ var
15
+ // Will speed up references to window, and allows munging its name.
16
+ window = this,
17
+ // Will speed up references to undefined, and allows munging its name.
18
+ undefined,
19
+ // Map over jQuery in case of overwrite
20
+ _jQuery = window.jQuery,
21
+ // Map over the $ in case of overwrite
22
+ _$ = window.$,
23
+
24
+ jQuery = window.jQuery = window.$ = function( selector, context ) {
25
+ // The jQuery object is actually just the init constructor 'enhanced'
26
+ return new jQuery.fn.init( selector, context );
27
+ },
29
28
 
30
- // Will speed up references to undefined, and allows munging its name.
31
- undefined;
29
+ // A simple way to check for HTML strings or ID strings
30
+ // (both of which we optimize for)
31
+ quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
32
+ // Is it a simple selector
33
+ isSimple = /^.[^:#\[\.,]*$/;
32
34
 
33
35
  jQuery.fn = jQuery.prototype = {
34
36
  init: function( selector, context ) {
@@ -39,10 +41,11 @@ jQuery.fn = jQuery.prototype = {
39
41
  if ( selector.nodeType ) {
40
42
  this[0] = selector;
41
43
  this.length = 1;
44
+ this.context = selector;
42
45
  return this;
43
46
  }
44
47
  // Handle HTML strings
45
- if ( typeof selector == "string" ) {
48
+ if ( typeof selector === "string" ) {
46
49
  // Are we dealing with HTML string or an ID?
47
50
  var match = quickExpr.exec( selector );
48
51
 
@@ -57,17 +60,16 @@ jQuery.fn = jQuery.prototype = {
57
60
  else {
58
61
  var elem = document.getElementById( match[3] );
59
62
 
60
- // Make sure an element was located
61
- if ( elem ){
62
- // Handle the case where IE and Opera return items
63
- // by name instead of ID
64
- if ( elem.id != match[3] )
65
- return jQuery().find( selector );
63
+ // Handle the case where IE and Opera return items
64
+ // by name instead of ID
65
+ if ( elem && elem.id != match[3] )
66
+ return jQuery().find( selector );
66
67
 
67
- // Otherwise, we inject the element directly into the jQuery object
68
- return jQuery( elem );
69
- }
70
- selector = [];
68
+ // Otherwise, we inject the element directly into the jQuery object
69
+ var ret = jQuery( elem || [] );
70
+ ret.context = document;
71
+ ret.selector = selector;
72
+ return ret;
71
73
  }
72
74
 
73
75
  // HANDLE: $(expr, [context])
@@ -78,26 +80,32 @@ jQuery.fn = jQuery.prototype = {
78
80
  // HANDLE: $(function)
79
81
  // Shortcut for document ready
80
82
  } else if ( jQuery.isFunction( selector ) )
81
- return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
83
+ return jQuery( document ).ready( selector );
84
+
85
+ // Make sure that old selector state is passed along
86
+ if ( selector.selector && selector.context ) {
87
+ this.selector = selector.selector;
88
+ this.context = selector.context;
89
+ }
82
90
 
83
91
  return this.setArray(jQuery.makeArray(selector));
84
92
  },
85
93
 
94
+ // Start with an empty selector
95
+ selector: "",
96
+
86
97
  // The current version of jQuery being used
87
- jquery: "1.2.6",
98
+ jquery: "1.3.1",
88
99
 
89
100
  // The number of elements contained in the matched element set
90
101
  size: function() {
91
102
  return this.length;
92
103
  },
93
104
 
94
- // The number of elements contained in the matched element set
95
- length: 0,
96
-
97
105
  // Get the Nth element in the matched element set OR
98
106
  // Get the whole matched element set as a clean array
99
107
  get: function( num ) {
100
- return num == undefined ?
108
+ return num === undefined ?
101
109
 
102
110
  // Return a 'clean' array
103
111
  jQuery.makeArray( this ) :
@@ -108,13 +116,20 @@ jQuery.fn = jQuery.prototype = {
108
116
 
109
117
  // Take an array of elements and push it onto the stack
110
118
  // (returning the new matched element set)
111
- pushStack: function( elems ) {
119
+ pushStack: function( elems, name, selector ) {
112
120
  // Build a new jQuery matched element set
113
121
  var ret = jQuery( elems );
114
122
 
115
123
  // Add the old object onto the stack (as a reference)
116
124
  ret.prevObject = this;
117
125
 
126
+ ret.context = this.context;
127
+
128
+ if ( name === "find" )
129
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
130
+ else if ( name )
131
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
132
+
118
133
  // Return the newly-formed element set
119
134
  return ret;
120
135
  },
@@ -141,8 +156,6 @@ jQuery.fn = jQuery.prototype = {
141
156
  // Determine the position of an element within
142
157
  // the matched set of elements
143
158
  index: function( elem ) {
144
- var ret = -1;
145
-
146
159
  // Locate the position of the desired element
147
160
  return jQuery.inArray(
148
161
  // If it receives a jQuery object, the first element is used
@@ -154,7 +167,7 @@ jQuery.fn = jQuery.prototype = {
154
167
  var options = name;
155
168
 
156
169
  // Look for the case where we're accessing a style value
157
- if ( name.constructor == String )
170
+ if ( typeof name === "string" )
158
171
  if ( value === undefined )
159
172
  return this[0] && jQuery[ type || "attr" ]( this[0], name );
160
173
 
@@ -184,7 +197,7 @@ jQuery.fn = jQuery.prototype = {
184
197
  },
185
198
 
186
199
  text: function( text ) {
187
- if ( typeof text != "object" && text != null )
200
+ if ( typeof text !== "object" && text != null )
188
201
  return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
189
202
 
190
203
  var ret = "";
@@ -202,20 +215,22 @@ jQuery.fn = jQuery.prototype = {
202
215
  },
203
216
 
204
217
  wrapAll: function( html ) {
205
- if ( this[0] )
218
+ if ( this[0] ) {
206
219
  // The elements to wrap the target around
207
- jQuery( html, this[0].ownerDocument )
208
- .clone()
209
- .insertBefore( this[0] )
210
- .map(function(){
211
- var elem = this;
220
+ var wrap = jQuery( html, this[0].ownerDocument ).clone();
212
221
 
213
- while ( elem.firstChild )
214
- elem = elem.firstChild;
222
+ if ( this[0].parentNode )
223
+ wrap.insertBefore( this[0] );
215
224
 
216
- return elem;
217
- })
218
- .append(this);
225
+ wrap.map(function(){
226
+ var elem = this;
227
+
228
+ while ( elem.firstChild )
229
+ elem = elem.firstChild;
230
+
231
+ return elem;
232
+ }).append(this);
233
+ }
219
234
 
220
235
  return this;
221
236
  },
@@ -233,27 +248,27 @@ jQuery.fn = jQuery.prototype = {
233
248
  },
234
249
 
235
250
  append: function() {
236
- return this.domManip(arguments, true, false, function(elem){
251
+ return this.domManip(arguments, true, function(elem){
237
252
  if (this.nodeType == 1)
238
253
  this.appendChild( elem );
239
254
  });
240
255
  },
241
256
 
242
257
  prepend: function() {
243
- return this.domManip(arguments, true, true, function(elem){
258
+ return this.domManip(arguments, true, function(elem){
244
259
  if (this.nodeType == 1)
245
260
  this.insertBefore( elem, this.firstChild );
246
261
  });
247
262
  },
248
263
 
249
264
  before: function() {
250
- return this.domManip(arguments, false, false, function(elem){
265
+ return this.domManip(arguments, false, function(elem){
251
266
  this.parentNode.insertBefore( elem, this );
252
267
  });
253
268
  },
254
269
 
255
270
  after: function() {
256
- return this.domManip(arguments, false, true, function(elem){
271
+ return this.domManip(arguments, false, function(elem){
257
272
  this.parentNode.insertBefore( elem, this.nextSibling );
258
273
  });
259
274
  },
@@ -262,20 +277,31 @@ jQuery.fn = jQuery.prototype = {
262
277
  return this.prevObject || jQuery( [] );
263
278
  },
264
279
 
280
+ // For internal use only.
281
+ // Behaves like an Array's .push method, not like a jQuery method.
282
+ push: [].push,
283
+
265
284
  find: function( selector ) {
266
- var elems = jQuery.map(this, function(elem){
267
- return jQuery.find( selector, elem );
268
- });
285
+ if ( this.length === 1 && !/,/.test(selector) ) {
286
+ var ret = this.pushStack( [], "find", selector );
287
+ ret.length = 0;
288
+ jQuery.find( selector, this[0], ret );
289
+ return ret;
290
+ } else {
291
+ var elems = jQuery.map(this, function(elem){
292
+ return jQuery.find( selector, elem );
293
+ });
269
294
 
270
- return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
271
- jQuery.unique( elems ) :
272
- elems );
295
+ return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
296
+ jQuery.unique( elems ) :
297
+ elems, "find", selector );
298
+ }
273
299
  },
274
300
 
275
301
  clone: function( events ) {
276
302
  // Do the clone
277
303
  var ret = this.map(function(){
278
- if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
304
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
279
305
  // IE copies events bound via attachEvent when
280
306
  // using cloneNode. Calling detachEvent on the
281
307
  // clone will also remove the events from the orignal
@@ -296,7 +322,7 @@ jQuery.fn = jQuery.prototype = {
296
322
  // removeData doesn't work here, IE removes it from the original as well
297
323
  // this is primarily for IE but the data expando shouldn't be copied over in any browser
298
324
  var clone = ret.find("*").andSelf().each(function(){
299
- if ( this[ expando ] != undefined )
325
+ if ( this[ expando ] !== undefined )
300
326
  this[ expando ] = null;
301
327
  });
302
328
 
@@ -323,14 +349,29 @@ jQuery.fn = jQuery.prototype = {
323
349
  return selector.call( elem, i );
324
350
  }) ||
325
351
 
326
- jQuery.multiFilter( selector, this ) );
352
+ jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
353
+ return elem.nodeType === 1;
354
+ }) ), "filter", selector );
355
+ },
356
+
357
+ closest: function( selector ) {
358
+ var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
359
+
360
+ return this.map(function(){
361
+ var cur = this;
362
+ while ( cur && cur.ownerDocument ) {
363
+ if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) )
364
+ return cur;
365
+ cur = cur.parentNode;
366
+ }
367
+ });
327
368
  },
328
369
 
329
370
  not: function( selector ) {
330
- if ( selector.constructor == String )
371
+ if ( typeof selector === "string" )
331
372
  // test special case where just one selector is passed in
332
373
  if ( isSimple.test( selector ) )
333
- return this.pushStack( jQuery.multiFilter( selector, this, true ) );
374
+ return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
334
375
  else
335
376
  selector = jQuery.multiFilter( selector, this );
336
377
 
@@ -343,7 +384,7 @@ jQuery.fn = jQuery.prototype = {
343
384
  add: function( selector ) {
344
385
  return this.pushStack( jQuery.unique( jQuery.merge(
345
386
  this.get(),
346
- typeof selector == 'string' ?
387
+ typeof selector === "string" ?
347
388
  jQuery( selector ) :
348
389
  jQuery.makeArray( selector )
349
390
  )));
@@ -354,15 +395,17 @@ jQuery.fn = jQuery.prototype = {
354
395
  },
355
396
 
356
397
  hasClass: function( selector ) {
357
- return this.is( "." + selector );
398
+ return !!selector && this.is( "." + selector );
358
399
  },
359
400
 
360
401
  val: function( value ) {
361
- if ( value == undefined ) {
362
-
363
- if ( this.length ) {
364
- var elem = this[0];
402
+ if ( value === undefined ) {
403
+ var elem = this[0];
365
404
 
405
+ if ( elem ) {
406
+ if( jQuery.nodeName( elem, 'option' ) )
407
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
408
+
366
409
  // We need to handle select boxes special
367
410
  if ( jQuery.nodeName( elem, "select" ) ) {
368
411
  var index = elem.selectedIndex,
@@ -380,7 +423,7 @@ jQuery.fn = jQuery.prototype = {
380
423
 
381
424
  if ( option.selected ) {
382
425
  // Get the specifc value for the option
383
- value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
426
+ value = jQuery(option).val();
384
427
 
385
428
  // We don't need an array for one selects
386
429
  if ( one )
@@ -391,25 +434,25 @@ jQuery.fn = jQuery.prototype = {
391
434
  }
392
435
  }
393
436
 
394
- return values;
437
+ return values;
438
+ }
395
439
 
396
440
  // Everything else, we just grab the value
397
- } else
398
- return (this[0].value || "").replace(/\r/g, "");
441
+ return (elem.value || "").replace(/\r/g, "");
399
442
 
400
443
  }
401
444
 
402
445
  return undefined;
403
446
  }
404
447
 
405
- if( value.constructor == Number )
448
+ if ( typeof value === "number" )
406
449
  value += '';
407
450
 
408
451
  return this.each(function(){
409
452
  if ( this.nodeType != 1 )
410
453
  return;
411
454
 
412
- if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
455
+ if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
413
456
  this.checked = (jQuery.inArray(this.value, value) >= 0 ||
414
457
  jQuery.inArray(this.name, value) >= 0);
415
458
 
@@ -430,7 +473,7 @@ jQuery.fn = jQuery.prototype = {
430
473
  },
431
474
 
432
475
  html: function( value ) {
433
- return value == undefined ?
476
+ return value === undefined ?
434
477
  (this[0] ?
435
478
  this[0].innerHTML :
436
479
  null) :
@@ -442,11 +485,12 @@ jQuery.fn = jQuery.prototype = {
442
485
  },
443
486
 
444
487
  eq: function( i ) {
445
- return this.slice( i, i + 1 );
488
+ return this.slice( i, +i + 1 );
446
489
  },
447
490
 
448
491
  slice: function() {
449
- return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
492
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ),
493
+ "slice", Array.prototype.slice.call(arguments).join(",") );
450
494
  },
451
495
 
452
496
  map: function( callback ) {
@@ -459,69 +503,29 @@ jQuery.fn = jQuery.prototype = {
459
503
  return this.add( this.prevObject );
460
504
  },
461
505
 
462
- data: function( key, value ){
463
- var parts = key.split(".");
464
- parts[1] = parts[1] ? "." + parts[1] : "";
465
-
466
- if ( value === undefined ) {
467
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
468
-
469
- if ( data === undefined && this.length )
470
- data = jQuery.data( this[0], key );
471
-
472
- return data === undefined && parts[1] ?
473
- this.data( parts[0] ) :
474
- data;
475
- } else
476
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
477
- jQuery.data( this, key, value );
478
- });
479
- },
480
-
481
- removeData: function( key ){
482
- return this.each(function(){
483
- jQuery.removeData( this, key );
484
- });
485
- },
486
-
487
- domManip: function( args, table, reverse, callback ) {
488
- var clone = this.length > 1, elems;
489
-
490
- return this.each(function(){
491
- if ( !elems ) {
492
- elems = jQuery.clean( args, this.ownerDocument );
493
-
494
- if ( reverse )
495
- elems.reverse();
496
- }
497
-
498
- var obj = this;
499
-
500
- if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
501
- obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
502
-
503
- var scripts = jQuery( [] );
504
-
505
- jQuery.each(elems, function(){
506
- var elem = clone ?
507
- jQuery( this ).clone( true )[0] :
508
- this;
509
-
510
- // execute all scripts after the elements have been injected
511
- if ( jQuery.nodeName( elem, "script" ) )
512
- scripts = scripts.add( elem );
513
- else {
514
- // Remove any inner scripts for later evaluation
515
- if ( elem.nodeType == 1 )
516
- scripts = scripts.add( jQuery( "script", elem ).remove() );
517
-
518
- // Inject the elements into the document
519
- callback.call( obj, elem );
520
- }
521
- });
506
+ domManip: function( args, table, callback ) {
507
+ if ( this[0] ) {
508
+ var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
509
+ scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
510
+ first = fragment.firstChild,
511
+ extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
512
+
513
+ if ( first )
514
+ for ( var i = 0, l = this.length; i < l; i++ )
515
+ callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
516
+
517
+ if ( scripts )
518
+ jQuery.each( scripts, evalScript );
519
+ }
522
520
 
523
- scripts.each( evalScript );
524
- });
521
+ return this;
522
+
523
+ function root( elem, cur ) {
524
+ return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
525
+ (elem.getElementsByTagName("tbody")[0] ||
526
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
527
+ elem;
528
+ }
525
529
  }
526
530
  };
527
531
 
@@ -552,7 +556,7 @@ jQuery.extend = jQuery.fn.extend = function() {
552
556
  var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
553
557
 
554
558
  // Handle a deep copy situation
555
- if ( target.constructor == Boolean ) {
559
+ if ( typeof target === "boolean" ) {
556
560
  deep = target;
557
561
  target = arguments[1] || {};
558
562
  // skip the boolean and the target
@@ -560,7 +564,7 @@ jQuery.extend = jQuery.fn.extend = function() {
560
564
  }
561
565
 
562
566
  // Handle case when target is a string or something (possible in deep copy)
563
- if ( typeof target != "object" && typeof target != "function" )
567
+ if ( typeof target !== "object" && !jQuery.isFunction(target) )
564
568
  target = {};
565
569
 
566
570
  // extend jQuery itself if only one argument is passed
@@ -581,7 +585,7 @@ jQuery.extend = jQuery.fn.extend = function() {
581
585
  continue;
582
586
 
583
587
  // Recurse if we're merging object values
584
- if ( deep && copy && typeof copy == "object" && !copy.nodeType )
588
+ if ( deep && copy && typeof copy === "object" && !copy.nodeType )
585
589
  target[ name ] = jQuery.extend( deep,
586
590
  // Never move original objects, clone them
587
591
  src || ( copy.length != null ? [ ] : { } )
@@ -597,11 +601,11 @@ jQuery.extend = jQuery.fn.extend = function() {
597
601
  return target;
598
602
  };
599
603
 
600
- var expando = "jQuery" + now(), uuid = 0, windowData = {},
601
- // exclude the following css properties to add px
602
- exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
604
+ // exclude the following css properties to add px
605
+ var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
603
606
  // cache defaultView
604
- defaultView = document.defaultView || {};
607
+ defaultView = document.defaultView || {},
608
+ toString = Object.prototype.toString;
605
609
 
606
610
  jQuery.extend({
607
611
  noConflict: function( deep ) {
@@ -613,16 +617,21 @@ jQuery.extend({
613
617
  return jQuery;
614
618
  },
615
619
 
616
- // See test/unit/core.js for details concerning this function.
617
- isFunction: function( fn ) {
618
- return !!fn && typeof fn != "string" && !fn.nodeName &&
619
- fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
620
+ // See test/unit/core.js for details concerning isFunction.
621
+ // Since version 1.3, DOM methods and functions like alert
622
+ // aren't supported. They return false on IE (#2968).
623
+ isFunction: function( obj ) {
624
+ return toString.call(obj) === "[object Function]";
625
+ },
626
+
627
+ isArray: function( obj ) {
628
+ return toString.call(obj) === "[object Array]";
620
629
  },
621
630
 
622
631
  // check if an element is in a (or is an) XML document
623
632
  isXMLDoc: function( elem ) {
624
- return elem.documentElement && !elem.body ||
625
- elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
633
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
634
+ !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
626
635
  },
627
636
 
628
637
  // Evalulates a script in a global context
@@ -636,10 +645,10 @@ jQuery.extend({
636
645
  script = document.createElement("script");
637
646
 
638
647
  script.type = "text/javascript";
639
- if ( jQuery.browser.msie )
640
- script.text = data;
641
- else
648
+ if ( jQuery.support.scriptEval )
642
649
  script.appendChild( document.createTextNode( data ) );
650
+ else
651
+ script.text = data;
643
652
 
644
653
  // Use insertBefore instead of appendChild to circumvent an IE6 bug.
645
654
  // This arises when a base node is used (#2709).
@@ -652,80 +661,12 @@ jQuery.extend({
652
661
  return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
653
662
  },
654
663
 
655
- cache: {},
656
-
657
- data: function( elem, name, data ) {
658
- elem = elem == window ?
659
- windowData :
660
- elem;
661
-
662
- var id = elem[ expando ];
663
-
664
- // Compute a unique ID for the element
665
- if ( !id )
666
- id = elem[ expando ] = ++uuid;
667
-
668
- // Only generate the data cache if we're
669
- // trying to access or manipulate it
670
- if ( name && !jQuery.cache[ id ] )
671
- jQuery.cache[ id ] = {};
672
-
673
- // Prevent overriding the named cache with undefined values
674
- if ( data !== undefined )
675
- jQuery.cache[ id ][ name ] = data;
676
-
677
- // Return the named cache data, or the ID for the element
678
- return name ?
679
- jQuery.cache[ id ][ name ] :
680
- id;
681
- },
682
-
683
- removeData: function( elem, name ) {
684
- elem = elem == window ?
685
- windowData :
686
- elem;
687
-
688
- var id = elem[ expando ];
689
-
690
- // If we want to remove a specific section of the element's data
691
- if ( name ) {
692
- if ( jQuery.cache[ id ] ) {
693
- // Remove the section of cache data
694
- delete jQuery.cache[ id ][ name ];
695
-
696
- // If we've removed all the data, remove the element's cache
697
- name = "";
698
-
699
- for ( name in jQuery.cache[ id ] )
700
- break;
701
-
702
- if ( !name )
703
- jQuery.removeData( elem );
704
- }
705
-
706
- // Otherwise, we want to remove all of the element's data
707
- } else {
708
- // Clean up the element expando
709
- try {
710
- delete elem[ expando ];
711
- } catch(e){
712
- // IE has trouble directly removing the expando
713
- // but it's ok with using removeAttribute
714
- if ( elem.removeAttribute )
715
- elem.removeAttribute( expando );
716
- }
717
-
718
- // Completely remove the data cache
719
- delete jQuery.cache[ id ];
720
- }
721
- },
722
-
723
664
  // args is for internal usage only
724
665
  each: function( object, callback, args ) {
725
666
  var name, i = 0, length = object.length;
726
667
 
727
668
  if ( args ) {
728
- if ( length == undefined ) {
669
+ if ( length === undefined ) {
729
670
  for ( name in object )
730
671
  if ( callback.apply( object[ name ], args ) === false )
731
672
  break;
@@ -736,7 +677,7 @@ jQuery.extend({
736
677
 
737
678
  // A special, fast, case for the most common use of each
738
679
  } else {
739
- if ( length == undefined ) {
680
+ if ( length === undefined ) {
740
681
  for ( name in object )
741
682
  if ( callback.call( object[ name ], name, object[ name ] ) === false )
742
683
  break;
@@ -754,7 +695,7 @@ jQuery.extend({
754
695
  value = value.call( elem, i );
755
696
 
756
697
  // Handle passing in a number to a CSS property
757
- return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
698
+ return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
758
699
  value + "px" :
759
700
  value;
760
701
  },
@@ -771,7 +712,7 @@ jQuery.extend({
771
712
  // internal only, use removeClass("class")
772
713
  remove: function( elem, classNames ) {
773
714
  if (elem.nodeType == 1)
774
- elem.className = classNames != undefined ?
715
+ elem.className = classNames !== undefined ?
775
716
  jQuery.grep(elem.className.split(/\s+/), function(className){
776
717
  return !jQuery.className.has( classNames, className );
777
718
  }).join(" ") :
@@ -780,7 +721,7 @@ jQuery.extend({
780
721
 
781
722
  // internal only, use hasClass("class")
782
723
  has: function( elem, className ) {
783
- return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
724
+ return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
784
725
  }
785
726
  },
786
727
 
@@ -828,30 +769,14 @@ jQuery.extend({
828
769
  curCSS: function( elem, name, force ) {
829
770
  var ret, style = elem.style;
830
771
 
831
- // A helper method for determining if an element's values are broken
832
- function color( elem ) {
833
- if ( !jQuery.browser.safari )
834
- return false;
835
-
836
- // defaultView is cached
837
- var ret = defaultView.getComputedStyle( elem, null );
838
- return !ret || ret.getPropertyValue("color") == "";
839
- }
840
-
841
772
  // We need to handle opacity special in IE
842
- if ( name == "opacity" && jQuery.browser.msie ) {
773
+ if ( name == "opacity" && !jQuery.support.opacity ) {
843
774
  ret = jQuery.attr( style, "opacity" );
844
775
 
845
776
  return ret == "" ?
846
777
  "1" :
847
778
  ret;
848
779
  }
849
- // Opera sometimes will give the wrong display answer, this fixes it, see #2037
850
- if ( jQuery.browser.opera && name == "display" ) {
851
- var save = style.outline;
852
- style.outline = "0 solid black";
853
- style.outline = save;
854
- }
855
780
 
856
781
  // Make sure we're using the right name for getting the float value
857
782
  if ( name.match( /float/i ) )
@@ -870,38 +795,9 @@ jQuery.extend({
870
795
 
871
796
  var computedStyle = defaultView.getComputedStyle( elem, null );
872
797
 
873
- if ( computedStyle && !color( elem ) )
798
+ if ( computedStyle )
874
799
  ret = computedStyle.getPropertyValue( name );
875
800
 
876
- // If the element isn't reporting its values properly in Safari
877
- // then some display: none elements are involved
878
- else {
879
- var swap = [], stack = [], a = elem, i = 0;
880
-
881
- // Locate all of the parent display: none elements
882
- for ( ; a && color(a); a = a.parentNode )
883
- stack.unshift(a);
884
-
885
- // Go through and make them visible, but in reverse
886
- // (It would be better if we knew the exact display type that they had)
887
- for ( ; i < stack.length; i++ )
888
- if ( color( stack[ i ] ) ) {
889
- swap[ i ] = stack[ i ].style.display;
890
- stack[ i ].style.display = "block";
891
- }
892
-
893
- // Since we flip the display style, we have to handle that
894
- // one special, otherwise get the value
895
- ret = name == "display" && swap[ stack.length - 1 ] != null ?
896
- "none" :
897
- ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
898
-
899
- // Finally, revert the display styles back
900
- for ( i = 0; i < swap.length; i++ )
901
- if ( swap[ i ] != null )
902
- stack[ i ].style.display = swap[ i ];
903
- }
904
-
905
801
  // We should always get a number back from opacity
906
802
  if ( name == "opacity" && ret == "" )
907
803
  ret = "1";
@@ -936,22 +832,32 @@ jQuery.extend({
936
832
  return ret;
937
833
  },
938
834
 
939
- clean: function( elems, context ) {
940
- var ret = [];
835
+ clean: function( elems, context, fragment ) {
941
836
  context = context || document;
837
+
942
838
  // !context.createElement fails in IE with an error but returns typeof 'object'
943
- if (typeof context.createElement == 'undefined')
839
+ if ( typeof context.createElement === "undefined" )
944
840
  context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
945
841
 
842
+ // If a single string is passed in and it's a single tag
843
+ // just do a createElement and skip the rest
844
+ if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
845
+ var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
846
+ if ( match )
847
+ return [ context.createElement( match[1] ) ];
848
+ }
849
+
850
+ var ret = [], scripts = [], div = context.createElement("div");
851
+
946
852
  jQuery.each(elems, function(i, elem){
853
+ if ( typeof elem === "number" )
854
+ elem += '';
855
+
947
856
  if ( !elem )
948
857
  return;
949
858
 
950
- if ( elem.constructor == Number )
951
- elem += '';
952
-
953
859
  // Convert html string into DOM nodes
954
- if ( typeof elem == "string" ) {
860
+ if ( typeof elem === "string" ) {
955
861
  // Fix "XHTML"-style tags in all browsers
956
862
  elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
957
863
  return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
@@ -960,7 +866,7 @@ jQuery.extend({
960
866
  });
961
867
 
962
868
  // Trim whitespace, otherwise indexOf won't work as expected
963
- var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
869
+ var tags = jQuery.trim( elem ).toLowerCase();
964
870
 
965
871
  var wrap =
966
872
  // option or optgroup
@@ -984,7 +890,7 @@ jQuery.extend({
984
890
  [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
985
891
 
986
892
  // IE can't serialize <link> and <script> tags normally
987
- jQuery.browser.msie &&
893
+ !jQuery.support.htmlSerialize &&
988
894
  [ 1, "div<div>", "</div>" ] ||
989
895
 
990
896
  [ 0, "", "" ];
@@ -997,7 +903,7 @@ jQuery.extend({
997
903
  div = div.lastChild;
998
904
 
999
905
  // Remove IE's autoinserted <tbody> from table fragments
1000
- if ( jQuery.browser.msie ) {
906
+ if ( !jQuery.support.tbody ) {
1001
907
 
1002
908
  // String was a <table>, *may* have spurious <tbody>
1003
909
  var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
@@ -1012,26 +918,36 @@ jQuery.extend({
1012
918
  if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
1013
919
  tbody[ j ].parentNode.removeChild( tbody[ j ] );
1014
920
 
1015
- // IE completely kills leading whitespace when innerHTML is used
1016
- if ( /^\s/.test( elem ) )
1017
- div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
1018
-
1019
- }
921
+ }
1020
922
 
923
+ // IE completely kills leading whitespace when innerHTML is used
924
+ if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
925
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
926
+
1021
927
  elem = jQuery.makeArray( div.childNodes );
1022
928
  }
1023
929
 
1024
- if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
1025
- return;
1026
-
1027
- if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
930
+ if ( elem.nodeType )
1028
931
  ret.push( elem );
1029
-
1030
932
  else
1031
933
  ret = jQuery.merge( ret, elem );
1032
934
 
1033
935
  });
1034
936
 
937
+ if ( fragment ) {
938
+ for ( var i = 0; ret[i]; i++ ) {
939
+ if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
940
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
941
+ } else {
942
+ if ( ret[i].nodeType === 1 )
943
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
944
+ fragment.appendChild( ret[i] );
945
+ }
946
+ }
947
+
948
+ return scripts;
949
+ }
950
+
1035
951
  return ret;
1036
952
  },
1037
953
 
@@ -1042,8 +958,7 @@ jQuery.extend({
1042
958
 
1043
959
  var notxml = !jQuery.isXMLDoc( elem ),
1044
960
  // Whether we are setting (or getting)
1045
- set = value !== undefined,
1046
- msie = jQuery.browser.msie;
961
+ set = value !== undefined;
1047
962
 
1048
963
  // Try to normalize/fix the name
1049
964
  name = notxml && jQuery.props[ name ] || name;
@@ -1057,7 +972,7 @@ jQuery.extend({
1057
972
 
1058
973
  // Safari mis-reports the default selected property of a hidden option
1059
974
  // Accessing the parent's selectedIndex property fixes it
1060
- if ( name == "selected" && jQuery.browser.safari )
975
+ if ( name == "selected" && elem.parentNode )
1061
976
  elem.parentNode.selectedIndex;
1062
977
 
1063
978
  // If applicable, access the attribute via the DOM 0 way
@@ -1074,17 +989,30 @@ jQuery.extend({
1074
989
  if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
1075
990
  return elem.getAttributeNode( name ).nodeValue;
1076
991
 
992
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
993
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
994
+ if ( name == "tabIndex" ) {
995
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
996
+ return attributeNode && attributeNode.specified
997
+ ? attributeNode.value
998
+ : elem.nodeName.match(/(button|input|object|select|textarea)/i)
999
+ ? 0
1000
+ : elem.nodeName.match(/^(a|area)$/i) && elem.href
1001
+ ? 0
1002
+ : undefined;
1003
+ }
1004
+
1077
1005
  return elem[ name ];
1078
1006
  }
1079
1007
 
1080
- if ( msie && notxml && name == "style" )
1008
+ if ( !jQuery.support.style && notxml && name == "style" )
1081
1009
  return jQuery.attr( elem.style, "cssText", value );
1082
1010
 
1083
1011
  if ( set )
1084
1012
  // convert the value to a string (all browsers do this but IE) see #1070
1085
1013
  elem.setAttribute( name, "" + value );
1086
1014
 
1087
- var attr = msie && notxml && special
1015
+ var attr = !jQuery.support.hrefNormalized && notxml && special
1088
1016
  // Some attributes require a special call on IE
1089
1017
  ? elem.getAttribute( name, 2 )
1090
1018
  : elem.getAttribute( name );
@@ -1096,7 +1024,7 @@ jQuery.extend({
1096
1024
  // elem is actually elem.style ... set the style
1097
1025
 
1098
1026
  // IE uses filters for opacity
1099
- if ( msie && name == "opacity" ) {
1027
+ if ( !jQuery.support.opacity && name == "opacity" ) {
1100
1028
  if ( set ) {
1101
1029
  // IE has trouble with opacity if it does not have layout
1102
1030
  // Force it by setting the zoom level
@@ -1131,8 +1059,8 @@ jQuery.extend({
1131
1059
 
1132
1060
  if( array != null ){
1133
1061
  var i = array.length;
1134
- //the window, strings and functions also have 'length'
1135
- if( i == null || array.split || array.setInterval || array.call )
1062
+ // The window, strings (and functions) also have 'length'
1063
+ if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
1136
1064
  ret[0] = array;
1137
1065
  else
1138
1066
  while( i )
@@ -1157,13 +1085,13 @@ jQuery.extend({
1157
1085
  var i = 0, elem, pos = first.length;
1158
1086
  // Also, we need to make sure that the correct elements are being returned
1159
1087
  // (IE returns comment nodes in a '*' query)
1160
- if ( jQuery.browser.msie ) {
1161
- while ( elem = second[ i++ ] )
1088
+ if ( !jQuery.support.getAll ) {
1089
+ while ( (elem = second[ i++ ]) != null )
1162
1090
  if ( elem.nodeType != 8 )
1163
1091
  first[ pos++ ] = elem;
1164
1092
 
1165
1093
  } else
1166
- while ( elem = second[ i++ ] )
1094
+ while ( (elem = second[ i++ ]) != null )
1167
1095
  first[ pos++ ] = elem;
1168
1096
 
1169
1097
  return first;
@@ -1218,37 +1146,21 @@ jQuery.extend({
1218
1146
  }
1219
1147
  });
1220
1148
 
1149
+ // Use of jQuery.browser is deprecated.
1150
+ // It's included for backwards compatibility and plugins,
1151
+ // although they should work to migrate away.
1152
+
1221
1153
  var userAgent = navigator.userAgent.toLowerCase();
1222
1154
 
1223
1155
  // Figure out what browser is being used
1224
1156
  jQuery.browser = {
1225
- version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
1157
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
1226
1158
  safari: /webkit/.test( userAgent ),
1227
1159
  opera: /opera/.test( userAgent ),
1228
1160
  msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
1229
1161
  mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
1230
1162
  };
1231
1163
 
1232
- var styleFloat = jQuery.browser.msie ?
1233
- "styleFloat" :
1234
- "cssFloat";
1235
-
1236
- jQuery.extend({
1237
- // Check to see if the W3C box model is being used
1238
- boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
1239
-
1240
- props: {
1241
- "for": "htmlFor",
1242
- "class": "className",
1243
- "float": styleFloat,
1244
- cssFloat: styleFloat,
1245
- styleFloat: styleFloat,
1246
- readonly: "readOnly",
1247
- maxlength: "maxLength",
1248
- cellspacing: "cellSpacing"
1249
- }
1250
- });
1251
-
1252
1164
  jQuery.each({
1253
1165
  parent: function(elem){return elem.parentNode;},
1254
1166
  parents: function(elem){return jQuery.dir(elem,"parentNode");},
@@ -1266,7 +1178,7 @@ jQuery.each({
1266
1178
  if ( selector && typeof selector == "string" )
1267
1179
  ret = jQuery.multiFilter( selector, ret );
1268
1180
 
1269
- return this.pushStack( jQuery.unique( ret ) );
1181
+ return this.pushStack( jQuery.unique( ret ), name, selector );
1270
1182
  };
1271
1183
  });
1272
1184
 
@@ -1302,14 +1214,16 @@ jQuery.each({
1302
1214
  jQuery.className.remove( this, classNames );
1303
1215
  },
1304
1216
 
1305
- toggleClass: function( classNames ) {
1306
- jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
1217
+ toggleClass: function( classNames, state ) {
1218
+ if( typeof state !== "boolean" )
1219
+ state = !jQuery.className.has( this, classNames );
1220
+ jQuery.className[ state ? "add" : "remove" ]( this, classNames );
1307
1221
  },
1308
1222
 
1309
1223
  remove: function( selector ) {
1310
- if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
1224
+ if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
1311
1225
  // Prevent memory leaks
1312
- jQuery( "*", this ).add(this).each(function(){
1226
+ jQuery( "*", this ).add([this]).each(function(){
1313
1227
  jQuery.event.remove(this);
1314
1228
  jQuery.removeData(this);
1315
1229
  });
@@ -1332,489 +1246,1073 @@ jQuery.each({
1332
1246
  };
1333
1247
  });
1334
1248
 
1335
- jQuery.each([ "Height", "Width" ], function(i, name){
1336
- var type = name.toLowerCase();
1249
+ // Helper function used by the dimensions and offset modules
1250
+ function num(elem, prop) {
1251
+ return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
1252
+ }
1253
+ var expando = "jQuery" + now(), uuid = 0, windowData = {};
1254
+
1255
+ jQuery.extend({
1256
+ cache: {},
1257
+
1258
+ data: function( elem, name, data ) {
1259
+ elem = elem == window ?
1260
+ windowData :
1261
+ elem;
1262
+
1263
+ var id = elem[ expando ];
1264
+
1265
+ // Compute a unique ID for the element
1266
+ if ( !id )
1267
+ id = elem[ expando ] = ++uuid;
1268
+
1269
+ // Only generate the data cache if we're
1270
+ // trying to access or manipulate it
1271
+ if ( name && !jQuery.cache[ id ] )
1272
+ jQuery.cache[ id ] = {};
1273
+
1274
+ // Prevent overriding the named cache with undefined values
1275
+ if ( data !== undefined )
1276
+ jQuery.cache[ id ][ name ] = data;
1277
+
1278
+ // Return the named cache data, or the ID for the element
1279
+ return name ?
1280
+ jQuery.cache[ id ][ name ] :
1281
+ id;
1282
+ },
1283
+
1284
+ removeData: function( elem, name ) {
1285
+ elem = elem == window ?
1286
+ windowData :
1287
+ elem;
1288
+
1289
+ var id = elem[ expando ];
1290
+
1291
+ // If we want to remove a specific section of the element's data
1292
+ if ( name ) {
1293
+ if ( jQuery.cache[ id ] ) {
1294
+ // Remove the section of cache data
1295
+ delete jQuery.cache[ id ][ name ];
1296
+
1297
+ // If we've removed all the data, remove the element's cache
1298
+ name = "";
1299
+
1300
+ for ( name in jQuery.cache[ id ] )
1301
+ break;
1302
+
1303
+ if ( !name )
1304
+ jQuery.removeData( elem );
1305
+ }
1306
+
1307
+ // Otherwise, we want to remove all of the element's data
1308
+ } else {
1309
+ // Clean up the element expando
1310
+ try {
1311
+ delete elem[ expando ];
1312
+ } catch(e){
1313
+ // IE has trouble directly removing the expando
1314
+ // but it's ok with using removeAttribute
1315
+ if ( elem.removeAttribute )
1316
+ elem.removeAttribute( expando );
1317
+ }
1318
+
1319
+ // Completely remove the data cache
1320
+ delete jQuery.cache[ id ];
1321
+ }
1322
+ },
1323
+ queue: function( elem, type, data ) {
1324
+ if ( elem ){
1325
+
1326
+ type = (type || "fx") + "queue";
1327
+
1328
+ var q = jQuery.data( elem, type );
1329
+
1330
+ if ( !q || jQuery.isArray(data) )
1331
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
1332
+ else if( data )
1333
+ q.push( data );
1334
+
1335
+ }
1336
+ return q;
1337
+ },
1338
+
1339
+ dequeue: function( elem, type ){
1340
+ var queue = jQuery.queue( elem, type ),
1341
+ fn = queue.shift();
1342
+
1343
+ if( !type || type === "fx" )
1344
+ fn = queue[0];
1345
+
1346
+ if( fn !== undefined )
1347
+ fn.call(elem);
1348
+ }
1349
+ });
1350
+
1351
+ jQuery.fn.extend({
1352
+ data: function( key, value ){
1353
+ var parts = key.split(".");
1354
+ parts[1] = parts[1] ? "." + parts[1] : "";
1355
+
1356
+ if ( value === undefined ) {
1357
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1358
+
1359
+ if ( data === undefined && this.length )
1360
+ data = jQuery.data( this[0], key );
1361
+
1362
+ return data === undefined && parts[1] ?
1363
+ this.data( parts[0] ) :
1364
+ data;
1365
+ } else
1366
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
1367
+ jQuery.data( this, key, value );
1368
+ });
1369
+ },
1370
+
1371
+ removeData: function( key ){
1372
+ return this.each(function(){
1373
+ jQuery.removeData( this, key );
1374
+ });
1375
+ },
1376
+ queue: function(type, data){
1377
+ if ( typeof type !== "string" ) {
1378
+ data = type;
1379
+ type = "fx";
1380
+ }
1381
+
1382
+ if ( data === undefined )
1383
+ return jQuery.queue( this[0], type );
1384
+
1385
+ return this.each(function(){
1386
+ var queue = jQuery.queue( this, type, data );
1387
+
1388
+ if( type == "fx" && queue.length == 1 )
1389
+ queue[0].call(this);
1390
+ });
1391
+ },
1392
+ dequeue: function(type){
1393
+ return this.each(function(){
1394
+ jQuery.dequeue( this, type );
1395
+ });
1396
+ }
1397
+ });/*!
1398
+ * Sizzle CSS Selector Engine - v0.9.3
1399
+ * Copyright 2009, The Dojo Foundation
1400
+ * Released under the MIT, BSD, and GPL Licenses.
1401
+ * More information: http://sizzlejs.com/
1402
+ */
1403
+ (function(){
1337
1404
 
1338
- jQuery.fn[ type ] = function( size ) {
1339
- // Get window width or height
1340
- return this[0] == window ?
1341
- // Opera reports document.body.client[Width/Height] properly in both quirks and standards
1342
- jQuery.browser.opera && document.body[ "client" + name ] ||
1405
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
1406
+ done = 0,
1407
+ toString = Object.prototype.toString;
1343
1408
 
1344
- // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
1345
- jQuery.browser.safari && window[ "inner" + name ] ||
1409
+ var Sizzle = function(selector, context, results, seed) {
1410
+ results = results || [];
1411
+ context = context || document;
1346
1412
 
1347
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
1348
- document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
1413
+ if ( context.nodeType !== 1 && context.nodeType !== 9 )
1414
+ return [];
1415
+
1416
+ if ( !selector || typeof selector !== "string" ) {
1417
+ return results;
1418
+ }
1349
1419
 
1350
- // Get document width or height
1351
- this[0] == document ?
1352
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
1353
- Math.max(
1354
- Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
1355
- Math.max(document.body["offset" + name], document.documentElement["offset" + name])
1356
- ) :
1420
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true;
1421
+
1422
+ // Reset the position of the chunker regexp (start from head)
1423
+ chunker.lastIndex = 0;
1424
+
1425
+ while ( (m = chunker.exec(selector)) !== null ) {
1426
+ parts.push( m[1] );
1427
+
1428
+ if ( m[2] ) {
1429
+ extra = RegExp.rightContext;
1430
+ break;
1431
+ }
1432
+ }
1357
1433
 
1358
- // Get or set width or height on the element
1359
- size == undefined ?
1360
- // Get width or height on the element
1361
- (this.length ? jQuery.css( this[0], type ) : null) :
1434
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
1435
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
1436
+ set = posProcess( parts[0] + parts[1], context );
1437
+ } else {
1438
+ set = Expr.relative[ parts[0] ] ?
1439
+ [ context ] :
1440
+ Sizzle( parts.shift(), context );
1362
1441
 
1363
- // Set the width or height on the element (default to pixels if value is unitless)
1364
- this.css( type, size.constructor == String ? size : size + "px" );
1365
- };
1366
- });
1442
+ while ( parts.length ) {
1443
+ selector = parts.shift();
1367
1444
 
1368
- // Helper function used by the dimensions and offset modules
1369
- function num(elem, prop) {
1370
- return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
1371
- }var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
1372
- "(?:[\\w*_-]|\\\\.)" :
1373
- "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
1374
- quickChild = new RegExp("^>\\s*(" + chars + "+)"),
1375
- quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
1376
- quickClass = new RegExp("^([#.]?)(" + chars + "*)");
1445
+ if ( Expr.relative[ selector ] )
1446
+ selector += parts.shift();
1377
1447
 
1378
- jQuery.extend({
1379
- expr: {
1380
- "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
1381
- "#": function(a,i,m){return a.getAttribute("id")==m[2];},
1382
- ":": {
1383
- // Position Checks
1384
- lt: function(a,i,m){return i<m[3]-0;},
1385
- gt: function(a,i,m){return i>m[3]-0;},
1386
- nth: function(a,i,m){return m[3]-0==i;},
1387
- eq: function(a,i,m){return m[3]-0==i;},
1388
- first: function(a,i){return i==0;},
1389
- last: function(a,i,m,r){return i==r.length-1;},
1390
- even: function(a,i){return i%2==0;},
1391
- odd: function(a,i){return i%2;},
1392
-
1393
- // Child Checks
1394
- "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
1395
- "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
1396
- "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
1397
-
1398
- // Parent Checks
1399
- parent: function(a){return a.firstChild;},
1400
- empty: function(a){return !a.firstChild;},
1401
-
1402
- // Text Check
1403
- contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
1404
-
1405
- // Visibility
1406
- visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
1407
- hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
1408
-
1409
- // Form attributes
1410
- enabled: function(a){return !a.disabled;},
1411
- disabled: function(a){return a.disabled;},
1412
- checked: function(a){return a.checked;},
1413
- selected: function(a){return a.selected||jQuery.attr(a,"selected");},
1414
-
1415
- // Form elements
1416
- text: function(a){return "text"==a.type;},
1417
- radio: function(a){return "radio"==a.type;},
1418
- checkbox: function(a){return "checkbox"==a.type;},
1419
- file: function(a){return "file"==a.type;},
1420
- password: function(a){return "password"==a.type;},
1421
- submit: function(a){return "submit"==a.type;},
1422
- image: function(a){return "image"==a.type;},
1423
- reset: function(a){return "reset"==a.type;},
1424
- button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
1425
- input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
1426
-
1427
- // :has()
1428
- has: function(a,i,m){return jQuery.find(m[3],a).length;},
1429
-
1430
- // :header
1431
- header: function(a){return /h\d/i.test(a.nodeName);},
1432
-
1433
- // :animated
1434
- animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
1435
- }
1436
- },
1437
-
1438
- // The regular expressions that power the parsing engine
1439
- parse: [
1440
- // Match: [@value='test'], [@foo]
1441
- /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
1442
-
1443
- // Match: :contains('foo')
1444
- /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
1445
-
1446
- // Match: :even, :last-child, #id, .class
1447
- new RegExp("^([:.#]*)(" + chars + "+)")
1448
- ],
1449
-
1450
- multiFilter: function( expr, elems, not ) {
1451
- var old, cur = [];
1452
-
1453
- while ( expr && expr != old ) {
1454
- old = expr;
1455
- var f = jQuery.filter( expr, elems, not );
1456
- expr = f.t.replace(/^\s*,\s*/, "" );
1457
- cur = not ? elems = f.r : jQuery.merge( cur, f.r );
1458
- }
1459
-
1460
- return cur;
1461
- },
1462
-
1463
- find: function( t, context ) {
1464
- // Quickly handle non-string expressions
1465
- if ( typeof t != "string" )
1466
- return [ t ];
1467
-
1468
- // check to make sure context is a DOM element or a document
1469
- if ( context && context.nodeType != 1 && context.nodeType != 9)
1470
- return [ ];
1471
-
1472
- // Set the correct context (if none is provided)
1473
- context = context || document;
1448
+ set = posProcess( selector, set );
1449
+ }
1450
+ }
1451
+ } else {
1452
+ var ret = seed ?
1453
+ { expr: parts.pop(), set: makeArray(seed) } :
1454
+ Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
1455
+ set = Sizzle.filter( ret.expr, ret.set );
1456
+
1457
+ if ( parts.length > 0 ) {
1458
+ checkSet = makeArray(set);
1459
+ } else {
1460
+ prune = false;
1461
+ }
1474
1462
 
1475
- // Initialize the search
1476
- var ret = [context], done = [], last, nodeName;
1463
+ while ( parts.length ) {
1464
+ var cur = parts.pop(), pop = cur;
1477
1465
 
1478
- // Continue while a selector expression exists, and while
1479
- // we're no longer looping upon ourselves
1480
- while ( t && last != t ) {
1481
- var r = [];
1482
- last = t;
1466
+ if ( !Expr.relative[ cur ] ) {
1467
+ cur = "";
1468
+ } else {
1469
+ pop = parts.pop();
1470
+ }
1483
1471
 
1484
- t = jQuery.trim(t);
1472
+ if ( pop == null ) {
1473
+ pop = context;
1474
+ }
1485
1475
 
1486
- var foundToken = false,
1476
+ Expr.relative[ cur ]( checkSet, pop, isXML(context) );
1477
+ }
1478
+ }
1487
1479
 
1488
- // An attempt at speeding up child selectors that
1489
- // point to a specific element tag
1490
- re = quickChild,
1480
+ if ( !checkSet ) {
1481
+ checkSet = set;
1482
+ }
1491
1483
 
1492
- m = re.exec(t);
1484
+ if ( !checkSet ) {
1485
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
1486
+ }
1493
1487
 
1494
- if ( m ) {
1495
- nodeName = m[1].toUpperCase();
1488
+ if ( toString.call(checkSet) === "[object Array]" ) {
1489
+ if ( !prune ) {
1490
+ results.push.apply( results, checkSet );
1491
+ } else if ( context.nodeType === 1 ) {
1492
+ for ( var i = 0; checkSet[i] != null; i++ ) {
1493
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
1494
+ results.push( set[i] );
1495
+ }
1496
+ }
1497
+ } else {
1498
+ for ( var i = 0; checkSet[i] != null; i++ ) {
1499
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
1500
+ results.push( set[i] );
1501
+ }
1502
+ }
1503
+ }
1504
+ } else {
1505
+ makeArray( checkSet, results );
1506
+ }
1496
1507
 
1497
- // Perform our own iteration and filter
1498
- for ( var i = 0; ret[i]; i++ )
1499
- for ( var c = ret[i].firstChild; c; c = c.nextSibling )
1500
- if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
1501
- r.push( c );
1508
+ if ( extra ) {
1509
+ Sizzle( extra, context, results, seed );
1510
+ }
1502
1511
 
1503
- ret = r;
1504
- t = t.replace( re, "" );
1505
- if ( t.indexOf(" ") == 0 ) continue;
1506
- foundToken = true;
1507
- } else {
1508
- re = /^([>+~])\s*(\w*)/i;
1512
+ return results;
1513
+ };
1514
+
1515
+ Sizzle.matches = function(expr, set){
1516
+ return Sizzle(expr, null, null, set);
1517
+ };
1518
+
1519
+ Sizzle.find = function(expr, context, isXML){
1520
+ var set, match;
1509
1521
 
1510
- if ( (m = re.exec(t)) != null ) {
1511
- r = [];
1522
+ if ( !expr ) {
1523
+ return [];
1524
+ }
1525
+
1526
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
1527
+ var type = Expr.order[i], match;
1528
+
1529
+ if ( (match = Expr.match[ type ].exec( expr )) ) {
1530
+ var left = RegExp.leftContext;
1531
+
1532
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
1533
+ match[1] = (match[1] || "").replace(/\\/g, "");
1534
+ set = Expr.find[ type ]( match, context, isXML );
1535
+ if ( set != null ) {
1536
+ expr = expr.replace( Expr.match[ type ], "" );
1537
+ break;
1538
+ }
1539
+ }
1540
+ }
1541
+ }
1512
1542
 
1513
- var merge = {};
1514
- nodeName = m[2].toUpperCase();
1515
- m = m[1];
1543
+ if ( !set ) {
1544
+ set = context.getElementsByTagName("*");
1545
+ }
1516
1546
 
1517
- for ( var j = 0, rl = ret.length; j < rl; j++ ) {
1518
- var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
1519
- for ( ; n; n = n.nextSibling )
1520
- if ( n.nodeType == 1 ) {
1521
- var id = jQuery.data(n);
1547
+ return {set: set, expr: expr};
1548
+ };
1522
1549
 
1523
- if ( m == "~" && merge[id] ) break;
1550
+ Sizzle.filter = function(expr, set, inplace, not){
1551
+ var old = expr, result = [], curLoop = set, match, anyFound;
1524
1552
 
1525
- if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
1526
- if ( m == "~" ) merge[id] = true;
1527
- r.push( n );
1528
- }
1553
+ while ( expr && set.length ) {
1554
+ for ( var type in Expr.filter ) {
1555
+ if ( (match = Expr.match[ type ].exec( expr )) != null ) {
1556
+ var filter = Expr.filter[ type ], found, item;
1557
+ anyFound = false;
1529
1558
 
1530
- if ( m == "+" ) break;
1559
+ if ( curLoop == result ) {
1560
+ result = [];
1561
+ }
1562
+
1563
+ if ( Expr.preFilter[ type ] ) {
1564
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not );
1565
+
1566
+ if ( !match ) {
1567
+ anyFound = found = true;
1568
+ } else if ( match === true ) {
1569
+ continue;
1570
+ }
1571
+ }
1572
+
1573
+ if ( match ) {
1574
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
1575
+ if ( item ) {
1576
+ found = filter( item, match, i, curLoop );
1577
+ var pass = not ^ !!found;
1578
+
1579
+ if ( inplace && found != null ) {
1580
+ if ( pass ) {
1581
+ anyFound = true;
1582
+ } else {
1583
+ curLoop[i] = false;
1584
+ }
1585
+ } else if ( pass ) {
1586
+ result.push( item );
1587
+ anyFound = true;
1531
1588
  }
1589
+ }
1590
+ }
1591
+ }
1592
+
1593
+ if ( found !== undefined ) {
1594
+ if ( !inplace ) {
1595
+ curLoop = result;
1532
1596
  }
1533
1597
 
1534
- ret = r;
1598
+ expr = expr.replace( Expr.match[ type ], "" );
1599
+
1600
+ if ( !anyFound ) {
1601
+ return [];
1602
+ }
1535
1603
 
1536
- // And remove the token
1537
- t = jQuery.trim( t.replace( re, "" ) );
1538
- foundToken = true;
1604
+ break;
1539
1605
  }
1540
1606
  }
1607
+ }
1541
1608
 
1542
- // See if there's still an expression, and that we haven't already
1543
- // matched a token
1544
- if ( t && !foundToken ) {
1545
- // Handle multiple expressions
1546
- if ( !t.indexOf(",") ) {
1547
- // Clean the result set
1548
- if ( context == ret[0] ) ret.shift();
1549
-
1550
- // Merge the result sets
1551
- done = jQuery.merge( done, ret );
1609
+ expr = expr.replace(/\s*,\s*/, "");
1552
1610
 
1553
- // Reset the context
1554
- r = ret = [context];
1611
+ // Improper expression
1612
+ if ( expr == old ) {
1613
+ if ( anyFound == null ) {
1614
+ throw "Syntax error, unrecognized expression: " + expr;
1615
+ } else {
1616
+ break;
1617
+ }
1618
+ }
1555
1619
 
1556
- // Touch up the selector string
1557
- t = " " + t.substr(1,t.length);
1620
+ old = expr;
1621
+ }
1558
1622
 
1559
- } else {
1560
- // Optimize for the case nodeName#idName
1561
- var re2 = quickID;
1562
- var m = re2.exec(t);
1623
+ return curLoop;
1624
+ };
1563
1625
 
1564
- // Re-organize the results, so that they're consistent
1565
- if ( m ) {
1566
- m = [ 0, m[2], m[3], m[1] ];
1626
+ var Expr = Sizzle.selectors = {
1627
+ order: [ "ID", "NAME", "TAG" ],
1628
+ match: {
1629
+ ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
1630
+ CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
1631
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
1632
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
1633
+ TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
1634
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
1635
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
1636
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
1637
+ },
1638
+ attrMap: {
1639
+ "class": "className",
1640
+ "for": "htmlFor"
1641
+ },
1642
+ attrHandle: {
1643
+ href: function(elem){
1644
+ return elem.getAttribute("href");
1645
+ }
1646
+ },
1647
+ relative: {
1648
+ "+": function(checkSet, part){
1649
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1650
+ var elem = checkSet[i];
1651
+ if ( elem ) {
1652
+ var cur = elem.previousSibling;
1653
+ while ( cur && cur.nodeType !== 1 ) {
1654
+ cur = cur.previousSibling;
1655
+ }
1656
+ checkSet[i] = typeof part === "string" ?
1657
+ cur || false :
1658
+ cur === part;
1659
+ }
1660
+ }
1567
1661
 
1568
- } else {
1569
- // Otherwise, do a traditional filter check for
1570
- // ID, class, and element selectors
1571
- re2 = quickClass;
1572
- m = re2.exec(t);
1662
+ if ( typeof part === "string" ) {
1663
+ Sizzle.filter( part, checkSet, true );
1664
+ }
1665
+ },
1666
+ ">": function(checkSet, part, isXML){
1667
+ if ( typeof part === "string" && !/\W/.test(part) ) {
1668
+ part = isXML ? part : part.toUpperCase();
1669
+
1670
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1671
+ var elem = checkSet[i];
1672
+ if ( elem ) {
1673
+ var parent = elem.parentNode;
1674
+ checkSet[i] = parent.nodeName === part ? parent : false;
1573
1675
  }
1676
+ }
1677
+ } else {
1678
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1679
+ var elem = checkSet[i];
1680
+ if ( elem ) {
1681
+ checkSet[i] = typeof part === "string" ?
1682
+ elem.parentNode :
1683
+ elem.parentNode === part;
1684
+ }
1685
+ }
1574
1686
 
1575
- m[2] = m[2].replace(/\\/g, "");
1687
+ if ( typeof part === "string" ) {
1688
+ Sizzle.filter( part, checkSet, true );
1689
+ }
1690
+ }
1691
+ },
1692
+ "": function(checkSet, part, isXML){
1693
+ var doneName = "done" + (done++), checkFn = dirCheck;
1576
1694
 
1577
- var elem = ret[ret.length-1];
1695
+ if ( !part.match(/\W/) ) {
1696
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
1697
+ checkFn = dirNodeCheck;
1698
+ }
1578
1699
 
1579
- // Try to do a global search by ID, where we can
1580
- if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
1581
- // Optimization for HTML document case
1582
- var oid = elem.getElementById(m[2]);
1700
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
1701
+ },
1702
+ "~": function(checkSet, part, isXML){
1703
+ var doneName = "done" + (done++), checkFn = dirCheck;
1583
1704
 
1584
- // Do a quick check for the existence of the actual ID attribute
1585
- // to avoid selecting by the name attribute in IE
1586
- // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
1587
- if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
1588
- oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
1705
+ if ( typeof part === "string" && !part.match(/\W/) ) {
1706
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
1707
+ checkFn = dirNodeCheck;
1708
+ }
1589
1709
 
1590
- // Do a quick check for node name (where applicable) so
1591
- // that div#foo searches will be really fast
1592
- ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
1593
- } else {
1594
- // We need to find all descendant elements
1595
- for ( var i = 0; ret[i]; i++ ) {
1596
- // Grab the tag name being searched for
1597
- var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
1710
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
1711
+ }
1712
+ },
1713
+ find: {
1714
+ ID: function(match, context, isXML){
1715
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
1716
+ var m = context.getElementById(match[1]);
1717
+ return m ? [m] : [];
1718
+ }
1719
+ },
1720
+ NAME: function(match, context, isXML){
1721
+ if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
1722
+ return context.getElementsByName(match[1]);
1723
+ }
1724
+ },
1725
+ TAG: function(match, context){
1726
+ return context.getElementsByTagName(match[1]);
1727
+ }
1728
+ },
1729
+ preFilter: {
1730
+ CLASS: function(match, curLoop, inplace, result, not){
1731
+ match = " " + match[1].replace(/\\/g, "") + " ";
1732
+
1733
+ var elem;
1734
+ for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
1735
+ if ( elem ) {
1736
+ if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
1737
+ if ( !inplace )
1738
+ result.push( elem );
1739
+ } else if ( inplace ) {
1740
+ curLoop[i] = false;
1741
+ }
1742
+ }
1743
+ }
1598
1744
 
1599
- // Handle IE7 being really dumb about <object>s
1600
- if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
1601
- tag = "param";
1745
+ return false;
1746
+ },
1747
+ ID: function(match){
1748
+ return match[1].replace(/\\/g, "");
1749
+ },
1750
+ TAG: function(match, curLoop){
1751
+ for ( var i = 0; curLoop[i] === false; i++ ){}
1752
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
1753
+ },
1754
+ CHILD: function(match){
1755
+ if ( match[1] == "nth" ) {
1756
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
1757
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
1758
+ match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
1759
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
1760
+
1761
+ // calculate the numbers (first)n+(last) including if they are negative
1762
+ match[2] = (test[1] + (test[2] || 1)) - 0;
1763
+ match[3] = test[3] - 0;
1764
+ }
1602
1765
 
1603
- r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
1604
- }
1766
+ // TODO: Move to normal caching system
1767
+ match[0] = "done" + (done++);
1605
1768
 
1606
- // It's faster to filter by class and be done with it
1607
- if ( m[1] == "." )
1608
- r = jQuery.classFilter( r, m[2] );
1769
+ return match;
1770
+ },
1771
+ ATTR: function(match){
1772
+ var name = match[1].replace(/\\/g, "");
1773
+
1774
+ if ( Expr.attrMap[name] ) {
1775
+ match[1] = Expr.attrMap[name];
1776
+ }
1609
1777
 
1610
- // Same with ID filtering
1611
- if ( m[1] == "#" ) {
1612
- var tmp = [];
1778
+ if ( match[2] === "~=" ) {
1779
+ match[4] = " " + match[4] + " ";
1780
+ }
1613
1781
 
1614
- // Try to find the element with the ID
1615
- for ( var i = 0; r[i]; i++ )
1616
- if ( r[i].getAttribute("id") == m[2] ) {
1617
- tmp = [ r[i] ];
1618
- break;
1619
- }
1782
+ return match;
1783
+ },
1784
+ PSEUDO: function(match, curLoop, inplace, result, not){
1785
+ if ( match[1] === "not" ) {
1786
+ // If we're dealing with a complex expression, or a simple one
1787
+ if ( match[3].match(chunker).length > 1 ) {
1788
+ match[3] = Sizzle(match[3], null, null, curLoop);
1789
+ } else {
1790
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
1791
+ if ( !inplace ) {
1792
+ result.push.apply( result, ret );
1793
+ }
1794
+ return false;
1795
+ }
1796
+ } else if ( Expr.match.POS.test( match[0] ) ) {
1797
+ return true;
1798
+ }
1799
+
1800
+ return match;
1801
+ },
1802
+ POS: function(match){
1803
+ match.unshift( true );
1804
+ return match;
1805
+ }
1806
+ },
1807
+ filters: {
1808
+ enabled: function(elem){
1809
+ return elem.disabled === false && elem.type !== "hidden";
1810
+ },
1811
+ disabled: function(elem){
1812
+ return elem.disabled === true;
1813
+ },
1814
+ checked: function(elem){
1815
+ return elem.checked === true;
1816
+ },
1817
+ selected: function(elem){
1818
+ // Accessing this property makes selected-by-default
1819
+ // options in Safari work properly
1820
+ elem.parentNode.selectedIndex;
1821
+ return elem.selected === true;
1822
+ },
1823
+ parent: function(elem){
1824
+ return !!elem.firstChild;
1825
+ },
1826
+ empty: function(elem){
1827
+ return !elem.firstChild;
1828
+ },
1829
+ has: function(elem, i, match){
1830
+ return !!Sizzle( match[3], elem ).length;
1831
+ },
1832
+ header: function(elem){
1833
+ return /h\d/i.test( elem.nodeName );
1834
+ },
1835
+ text: function(elem){
1836
+ return "text" === elem.type;
1837
+ },
1838
+ radio: function(elem){
1839
+ return "radio" === elem.type;
1840
+ },
1841
+ checkbox: function(elem){
1842
+ return "checkbox" === elem.type;
1843
+ },
1844
+ file: function(elem){
1845
+ return "file" === elem.type;
1846
+ },
1847
+ password: function(elem){
1848
+ return "password" === elem.type;
1849
+ },
1850
+ submit: function(elem){
1851
+ return "submit" === elem.type;
1852
+ },
1853
+ image: function(elem){
1854
+ return "image" === elem.type;
1855
+ },
1856
+ reset: function(elem){
1857
+ return "reset" === elem.type;
1858
+ },
1859
+ button: function(elem){
1860
+ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
1861
+ },
1862
+ input: function(elem){
1863
+ return /input|select|textarea|button/i.test(elem.nodeName);
1864
+ }
1865
+ },
1866
+ setFilters: {
1867
+ first: function(elem, i){
1868
+ return i === 0;
1869
+ },
1870
+ last: function(elem, i, match, array){
1871
+ return i === array.length - 1;
1872
+ },
1873
+ even: function(elem, i){
1874
+ return i % 2 === 0;
1875
+ },
1876
+ odd: function(elem, i){
1877
+ return i % 2 === 1;
1878
+ },
1879
+ lt: function(elem, i, match){
1880
+ return i < match[3] - 0;
1881
+ },
1882
+ gt: function(elem, i, match){
1883
+ return i > match[3] - 0;
1884
+ },
1885
+ nth: function(elem, i, match){
1886
+ return match[3] - 0 == i;
1887
+ },
1888
+ eq: function(elem, i, match){
1889
+ return match[3] - 0 == i;
1890
+ }
1891
+ },
1892
+ filter: {
1893
+ CHILD: function(elem, match){
1894
+ var type = match[1], parent = elem.parentNode;
1620
1895
 
1621
- r = tmp;
1622
- }
1896
+ var doneName = match[0];
1897
+
1898
+ if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
1899
+ var count = 1;
1623
1900
 
1624
- ret = r;
1901
+ for ( var node = parent.firstChild; node; node = node.nextSibling ) {
1902
+ if ( node.nodeType == 1 ) {
1903
+ node.nodeIndex = count++;
1625
1904
  }
1905
+ }
1906
+
1907
+ parent[ doneName ] = count - 1;
1908
+ }
1626
1909
 
1627
- t = t.replace( re2, "" );
1910
+ if ( type == "first" ) {
1911
+ return elem.nodeIndex == 1;
1912
+ } else if ( type == "last" ) {
1913
+ return elem.nodeIndex == parent[ doneName ];
1914
+ } else if ( type == "only" ) {
1915
+ return parent[ doneName ] == 1;
1916
+ } else if ( type == "nth" ) {
1917
+ var add = false, first = match[2], last = match[3];
1918
+
1919
+ if ( first == 1 && last == 0 ) {
1920
+ return true;
1628
1921
  }
1629
1922
 
1923
+ if ( first == 0 ) {
1924
+ if ( elem.nodeIndex == last ) {
1925
+ add = true;
1926
+ }
1927
+ } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {
1928
+ add = true;
1929
+ }
1930
+
1931
+ return add;
1630
1932
  }
1933
+ },
1934
+ PSEUDO: function(elem, match, i, array){
1935
+ var name = match[1], filter = Expr.filters[ name ];
1936
+
1937
+ if ( filter ) {
1938
+ return filter( elem, i, match, array );
1939
+ } else if ( name === "contains" ) {
1940
+ return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
1941
+ } else if ( name === "not" ) {
1942
+ var not = match[3];
1943
+
1944
+ for ( var i = 0, l = not.length; i < l; i++ ) {
1945
+ if ( not[i] === elem ) {
1946
+ return false;
1947
+ }
1948
+ }
1631
1949
 
1632
- // If a selector string still exists
1633
- if ( t ) {
1634
- // Attempt to filter it
1635
- var val = jQuery.filter(t,r);
1636
- ret = r = val.r;
1637
- t = jQuery.trim(val.t);
1950
+ return true;
1951
+ }
1952
+ },
1953
+ ID: function(elem, match){
1954
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
1955
+ },
1956
+ TAG: function(elem, match){
1957
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
1958
+ },
1959
+ CLASS: function(elem, match){
1960
+ return match.test( elem.className );
1961
+ },
1962
+ ATTR: function(elem, match){
1963
+ var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
1964
+ return result == null ?
1965
+ type === "!=" :
1966
+ type === "=" ?
1967
+ value === check :
1968
+ type === "*=" ?
1969
+ value.indexOf(check) >= 0 :
1970
+ type === "~=" ?
1971
+ (" " + value + " ").indexOf(check) >= 0 :
1972
+ !match[4] ?
1973
+ result :
1974
+ type === "!=" ?
1975
+ value != check :
1976
+ type === "^=" ?
1977
+ value.indexOf(check) === 0 :
1978
+ type === "$=" ?
1979
+ value.substr(value.length - check.length) === check :
1980
+ type === "|=" ?
1981
+ value === check || value.substr(0, check.length + 1) === check + "-" :
1982
+ false;
1983
+ },
1984
+ POS: function(elem, match, i, array){
1985
+ var name = match[2], filter = Expr.setFilters[ name ];
1986
+
1987
+ if ( filter ) {
1988
+ return filter( elem, i, match, array );
1638
1989
  }
1639
1990
  }
1991
+ }
1992
+ };
1640
1993
 
1641
- // An error occurred with the selector;
1642
- // just return an empty set instead
1643
- if ( t )
1644
- ret = [];
1994
+ var origPOS = Expr.match.POS;
1645
1995
 
1646
- // Remove the root context
1647
- if ( ret && context == ret[0] )
1648
- ret.shift();
1996
+ for ( var type in Expr.match ) {
1997
+ Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
1998
+ }
1649
1999
 
1650
- // And combine the results
1651
- done = jQuery.merge( done, ret );
2000
+ var makeArray = function(array, results) {
2001
+ array = Array.prototype.slice.call( array );
1652
2002
 
1653
- return done;
1654
- },
2003
+ if ( results ) {
2004
+ results.push.apply( results, array );
2005
+ return results;
2006
+ }
2007
+
2008
+ return array;
2009
+ };
2010
+
2011
+ // Perform a simple check to determine if the browser is capable of
2012
+ // converting a NodeList to an array using builtin methods.
2013
+ try {
2014
+ Array.prototype.slice.call( document.documentElement.childNodes );
1655
2015
 
1656
- classFilter: function(r,m,not){
1657
- m = " " + m + " ";
1658
- var tmp = [];
1659
- for ( var i = 0; r[i]; i++ ) {
1660
- var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
1661
- if ( !not && pass || not && !pass )
1662
- tmp.push( r[i] );
2016
+ // Provide a fallback method if it does not work
2017
+ } catch(e){
2018
+ makeArray = function(array, results) {
2019
+ var ret = results || [];
2020
+
2021
+ if ( toString.call(array) === "[object Array]" ) {
2022
+ Array.prototype.push.apply( ret, array );
2023
+ } else {
2024
+ if ( typeof array.length === "number" ) {
2025
+ for ( var i = 0, l = array.length; i < l; i++ ) {
2026
+ ret.push( array[i] );
2027
+ }
2028
+ } else {
2029
+ for ( var i = 0; array[i]; i++ ) {
2030
+ ret.push( array[i] );
2031
+ }
2032
+ }
1663
2033
  }
1664
- return tmp;
1665
- },
1666
2034
 
1667
- filter: function(t,r,not) {
1668
- var last;
2035
+ return ret;
2036
+ };
2037
+ }
1669
2038
 
1670
- // Look for common filter expressions
1671
- while ( t && t != last ) {
1672
- last = t;
2039
+ // Check to see if the browser returns elements by name when
2040
+ // querying by getElementById (and provide a workaround)
2041
+ (function(){
2042
+ // We're going to inject a fake input element with a specified name
2043
+ var form = document.createElement("form"),
2044
+ id = "script" + (new Date).getTime();
2045
+ form.innerHTML = "<input name='" + id + "'/>";
2046
+
2047
+ // Inject it into the root element, check its status, and remove it quickly
2048
+ var root = document.documentElement;
2049
+ root.insertBefore( form, root.firstChild );
2050
+
2051
+ // The workaround has to do additional checks after a getElementById
2052
+ // Which slows things down for other browsers (hence the branching)
2053
+ if ( !!document.getElementById( id ) ) {
2054
+ Expr.find.ID = function(match, context, isXML){
2055
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
2056
+ var m = context.getElementById(match[1]);
2057
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
2058
+ }
2059
+ };
1673
2060
 
1674
- var p = jQuery.parse, m;
2061
+ Expr.filter.ID = function(elem, match){
2062
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
2063
+ return elem.nodeType === 1 && node && node.nodeValue === match;
2064
+ };
2065
+ }
1675
2066
 
1676
- for ( var i = 0; p[i]; i++ ) {
1677
- m = p[i].exec( t );
2067
+ root.removeChild( form );
2068
+ })();
1678
2069
 
1679
- if ( m ) {
1680
- // Remove what we just matched
1681
- t = t.substring( m[0].length );
2070
+ (function(){
2071
+ // Check to see if the browser returns only elements
2072
+ // when doing getElementsByTagName("*")
1682
2073
 
1683
- m[2] = m[2].replace(/\\/g, "");
1684
- break;
2074
+ // Create a fake element
2075
+ var div = document.createElement("div");
2076
+ div.appendChild( document.createComment("") );
2077
+
2078
+ // Make sure no comments are found
2079
+ if ( div.getElementsByTagName("*").length > 0 ) {
2080
+ Expr.find.TAG = function(match, context){
2081
+ var results = context.getElementsByTagName(match[1]);
2082
+
2083
+ // Filter out possible comments
2084
+ if ( match[1] === "*" ) {
2085
+ var tmp = [];
2086
+
2087
+ for ( var i = 0; results[i]; i++ ) {
2088
+ if ( results[i].nodeType === 1 ) {
2089
+ tmp.push( results[i] );
2090
+ }
1685
2091
  }
2092
+
2093
+ results = tmp;
1686
2094
  }
1687
2095
 
1688
- if ( !m )
1689
- break;
2096
+ return results;
2097
+ };
2098
+ }
1690
2099
 
1691
- // :not() is a special case that can be optimized by
1692
- // keeping it out of the expression list
1693
- if ( m[1] == ":" && m[2] == "not" )
1694
- // optimize if only one selector found (most common case)
1695
- r = isSimple.test( m[3] ) ?
1696
- jQuery.filter(m[3], r, true).r :
1697
- jQuery( r ).not( m[3] );
1698
-
1699
- // We can get a big speed boost by filtering by class here
1700
- else if ( m[1] == "." )
1701
- r = jQuery.classFilter(r, m[2], not);
1702
-
1703
- else if ( m[1] == "[" ) {
1704
- var tmp = [], type = m[3];
1705
-
1706
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
1707
- var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
1708
-
1709
- if ( z == null || /href|src|selected/.test(m[2]) )
1710
- z = jQuery.attr(a,m[2]) || '';
1711
-
1712
- if ( (type == "" && !!z ||
1713
- type == "=" && z == m[5] ||
1714
- type == "!=" && z != m[5] ||
1715
- type == "^=" && z && !z.indexOf(m[5]) ||
1716
- type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
1717
- (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
1718
- tmp.push( a );
1719
- }
2100
+ // Check to see if an attribute returns normalized href attributes
2101
+ div.innerHTML = "<a href='#'></a>";
2102
+ if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) {
2103
+ Expr.attrHandle.href = function(elem){
2104
+ return elem.getAttribute("href", 2);
2105
+ };
2106
+ }
2107
+ })();
1720
2108
 
1721
- r = tmp;
2109
+ if ( document.querySelectorAll ) (function(){
2110
+ var oldSizzle = Sizzle, div = document.createElement("div");
2111
+ div.innerHTML = "<p class='TEST'></p>";
1722
2112
 
1723
- // We can get a speed boost by handling nth-child here
1724
- } else if ( m[1] == ":" && m[2] == "nth-child" ) {
1725
- var merge = {}, tmp = [],
1726
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
1727
- test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
1728
- m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
1729
- !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
1730
- // calculate the numbers (first)n+(last) including if they are negative
1731
- first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
2113
+ // Safari can't handle uppercase or unicode characters when
2114
+ // in quirks mode.
2115
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
2116
+ return;
2117
+ }
2118
+
2119
+ Sizzle = function(query, context, extra, seed){
2120
+ context = context || document;
1732
2121
 
1733
- // loop through all the elements left in the jQuery object
1734
- for ( var i = 0, rl = r.length; i < rl; i++ ) {
1735
- var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
2122
+ // Only use querySelectorAll on non-XML documents
2123
+ // (ID selectors don't work in non-HTML documents)
2124
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
2125
+ try {
2126
+ return makeArray( context.querySelectorAll(query), extra );
2127
+ } catch(e){}
2128
+ }
2129
+
2130
+ return oldSizzle(query, context, extra, seed);
2131
+ };
1736
2132
 
1737
- if ( !merge[id] ) {
1738
- var c = 1;
2133
+ Sizzle.find = oldSizzle.find;
2134
+ Sizzle.filter = oldSizzle.filter;
2135
+ Sizzle.selectors = oldSizzle.selectors;
2136
+ Sizzle.matches = oldSizzle.matches;
2137
+ })();
1739
2138
 
1740
- for ( var n = parentNode.firstChild; n; n = n.nextSibling )
1741
- if ( n.nodeType == 1 )
1742
- n.nodeIndex = c++;
2139
+ if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) {
2140
+ Expr.order.splice(1, 0, "CLASS");
2141
+ Expr.find.CLASS = function(match, context) {
2142
+ return context.getElementsByClassName(match[1]);
2143
+ };
2144
+ }
1743
2145
 
1744
- merge[id] = true;
1745
- }
2146
+ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
2147
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2148
+ var elem = checkSet[i];
2149
+ if ( elem ) {
2150
+ elem = elem[dir];
2151
+ var match = false;
2152
+
2153
+ while ( elem && elem.nodeType ) {
2154
+ var done = elem[doneName];
2155
+ if ( done ) {
2156
+ match = checkSet[ done ];
2157
+ break;
2158
+ }
1746
2159
 
1747
- var add = false;
2160
+ if ( elem.nodeType === 1 && !isXML )
2161
+ elem[doneName] = i;
1748
2162
 
1749
- if ( first == 0 ) {
1750
- if ( node.nodeIndex == last )
1751
- add = true;
1752
- } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
1753
- add = true;
2163
+ if ( elem.nodeName === cur ) {
2164
+ match = elem;
2165
+ break;
2166
+ }
2167
+
2168
+ elem = elem[dir];
2169
+ }
1754
2170
 
1755
- if ( add ^ not )
1756
- tmp.push( node );
2171
+ checkSet[i] = match;
2172
+ }
2173
+ }
2174
+ }
2175
+
2176
+ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
2177
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2178
+ var elem = checkSet[i];
2179
+ if ( elem ) {
2180
+ elem = elem[dir];
2181
+ var match = false;
2182
+
2183
+ while ( elem && elem.nodeType ) {
2184
+ if ( elem[doneName] ) {
2185
+ match = checkSet[ elem[doneName] ];
2186
+ break;
1757
2187
  }
1758
2188
 
1759
- r = tmp;
2189
+ if ( elem.nodeType === 1 ) {
2190
+ if ( !isXML )
2191
+ elem[doneName] = i;
1760
2192
 
1761
- // Otherwise, find the expression to execute
1762
- } else {
1763
- var fn = jQuery.expr[ m[1] ];
1764
- if ( typeof fn == "object" )
1765
- fn = fn[ m[2] ];
2193
+ if ( typeof cur !== "string" ) {
2194
+ if ( elem === cur ) {
2195
+ match = true;
2196
+ break;
2197
+ }
1766
2198
 
1767
- if ( typeof fn == "string" )
1768
- fn = eval("false||function(a,i){return " + fn + ";}");
2199
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
2200
+ match = elem;
2201
+ break;
2202
+ }
2203
+ }
1769
2204
 
1770
- // Execute it against the current filter
1771
- r = jQuery.grep( r, function(elem, i){
1772
- return fn(elem, i, m, r);
1773
- }, not );
2205
+ elem = elem[dir];
1774
2206
  }
2207
+
2208
+ checkSet[i] = match;
1775
2209
  }
2210
+ }
2211
+ }
1776
2212
 
1777
- // Return an array of filtered elements (r)
1778
- // and the modified expression string (t)
1779
- return { r: r, t: t };
1780
- },
2213
+ var contains = document.compareDocumentPosition ? function(a, b){
2214
+ return a.compareDocumentPosition(b) & 16;
2215
+ } : function(a, b){
2216
+ return a !== b && (a.contains ? a.contains(b) : true);
2217
+ };
1781
2218
 
1782
- dir: function( elem, dir ){
1783
- var matched = [],
1784
- cur = elem[dir];
1785
- while ( cur && cur != document ) {
1786
- if ( cur.nodeType == 1 )
1787
- matched.push( cur );
1788
- cur = cur[dir];
1789
- }
1790
- return matched;
1791
- },
2219
+ var isXML = function(elem){
2220
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
2221
+ !!elem.ownerDocument && isXML( elem.ownerDocument );
2222
+ };
1792
2223
 
1793
- nth: function(cur,result,dir,elem){
1794
- result = result || 1;
1795
- var num = 0;
2224
+ var posProcess = function(selector, context){
2225
+ var tmpSet = [], later = "", match,
2226
+ root = context.nodeType ? [context] : context;
1796
2227
 
1797
- for ( ; cur; cur = cur[dir] )
1798
- if ( cur.nodeType == 1 && ++num == result )
1799
- break;
2228
+ // Position selectors must be done after the filter
2229
+ // And so must :not(positional) so we move all PSEUDOs to the end
2230
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
2231
+ later += match[0];
2232
+ selector = selector.replace( Expr.match.PSEUDO, "" );
2233
+ }
1800
2234
 
1801
- return cur;
1802
- },
2235
+ selector = Expr.relative[selector] ? selector + "*" : selector;
1803
2236
 
1804
- sibling: function( n, elem ) {
1805
- var r = [];
2237
+ for ( var i = 0, l = root.length; i < l; i++ ) {
2238
+ Sizzle( selector, root[i], tmpSet );
2239
+ }
1806
2240
 
1807
- for ( ; n; n = n.nextSibling ) {
1808
- if ( n.nodeType == 1 && n != elem )
1809
- r.push( n );
1810
- }
2241
+ return Sizzle.filter( later, tmpSet );
2242
+ };
2243
+
2244
+ // EXPOSE
2245
+ jQuery.find = Sizzle;
2246
+ jQuery.filter = Sizzle.filter;
2247
+ jQuery.expr = Sizzle.selectors;
2248
+ jQuery.expr[":"] = jQuery.expr.filters;
2249
+
2250
+ Sizzle.selectors.filters.hidden = function(elem){
2251
+ return "hidden" === elem.type ||
2252
+ jQuery.css(elem, "display") === "none" ||
2253
+ jQuery.css(elem, "visibility") === "hidden";
2254
+ };
2255
+
2256
+ Sizzle.selectors.filters.visible = function(elem){
2257
+ return "hidden" !== elem.type &&
2258
+ jQuery.css(elem, "display") !== "none" &&
2259
+ jQuery.css(elem, "visibility") !== "hidden";
2260
+ };
1811
2261
 
1812
- return r;
2262
+ Sizzle.selectors.filters.animated = function(elem){
2263
+ return jQuery.grep(jQuery.timers, function(fn){
2264
+ return elem === fn.elem;
2265
+ }).length;
2266
+ };
2267
+
2268
+ jQuery.multiFilter = function( expr, elems, not ) {
2269
+ if ( not ) {
2270
+ expr = ":not(" + expr + ")";
1813
2271
  }
1814
- });
2272
+
2273
+ return Sizzle.matches(expr, elems);
2274
+ };
2275
+
2276
+ jQuery.dir = function( elem, dir ){
2277
+ var matched = [], cur = elem[dir];
2278
+ while ( cur && cur != document ) {
2279
+ if ( cur.nodeType == 1 )
2280
+ matched.push( cur );
2281
+ cur = cur[dir];
2282
+ }
2283
+ return matched;
2284
+ };
2285
+
2286
+ jQuery.nth = function(cur, result, dir, elem){
2287
+ result = result || 1;
2288
+ var num = 0;
2289
+
2290
+ for ( ; cur; cur = cur[dir] )
2291
+ if ( cur.nodeType == 1 && ++num == result )
2292
+ break;
2293
+
2294
+ return cur;
2295
+ };
2296
+
2297
+ jQuery.sibling = function(n, elem){
2298
+ var r = [];
2299
+
2300
+ for ( ; n; n = n.nextSibling ) {
2301
+ if ( n.nodeType == 1 && n != elem )
2302
+ r.push( n );
2303
+ }
2304
+
2305
+ return r;
2306
+ };
2307
+
2308
+ return;
2309
+
2310
+ window.Sizzle = Sizzle;
2311
+
2312
+ })();
1815
2313
  /*
1816
2314
  * A number of helper functions used for managing events.
1817
- * Many of the ideas behind this code orignated from
2315
+ * Many of the ideas behind this code originated from
1818
2316
  * Dean Edwards' addEvent library.
1819
2317
  */
1820
2318
  jQuery.event = {
@@ -1827,7 +2325,7 @@ jQuery.event = {
1827
2325
 
1828
2326
  // For whatever reason, IE has trouble passing the window object
1829
2327
  // around, causing it to be cloned in the process
1830
- if ( jQuery.browser.msie && elem.setInterval )
2328
+ if ( elem.setInterval && elem != window )
1831
2329
  elem = window;
1832
2330
 
1833
2331
  // Make sure that the function being executed has a unique ID
@@ -1835,15 +2333,12 @@ jQuery.event = {
1835
2333
  handler.guid = this.guid++;
1836
2334
 
1837
2335
  // if data is passed, bind to handler
1838
- if( data != undefined ) {
2336
+ if ( data !== undefined ) {
1839
2337
  // Create temporary function pointer to original handler
1840
2338
  var fn = handler;
1841
2339
 
1842
2340
  // Create unique handler function, wrapped around original handler
1843
- handler = this.proxy( fn, function() {
1844
- // Pass arguments and context to original handler
1845
- return fn.apply(this, arguments);
1846
- });
2341
+ handler = this.proxy( fn );
1847
2342
 
1848
2343
  // Store data in unique handler
1849
2344
  handler.data = data;
@@ -1854,8 +2349,9 @@ jQuery.event = {
1854
2349
  handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
1855
2350
  // Handle the second event of a trigger and when
1856
2351
  // an event is called after a page has unloaded
1857
- if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
1858
- return jQuery.event.handle.apply(arguments.callee.elem, arguments);
2352
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
2353
+ jQuery.event.handle.apply(arguments.callee.elem, arguments) :
2354
+ undefined;
1859
2355
  });
1860
2356
  // Add elem as a property of the handle function
1861
2357
  // This is to prevent a memory leak with non-native
@@ -1866,12 +2362,15 @@ jQuery.event = {
1866
2362
  // jQuery(...).bind("mouseover mouseout", fn);
1867
2363
  jQuery.each(types.split(/\s+/), function(index, type) {
1868
2364
  // Namespaced event handlers
1869
- var parts = type.split(".");
1870
- type = parts[0];
1871
- handler.type = parts[1];
2365
+ var namespaces = type.split(".");
2366
+ type = namespaces.shift();
2367
+ handler.type = namespaces.slice().sort().join(".");
1872
2368
 
1873
2369
  // Get the current list of functions bound to this event
1874
2370
  var handlers = events[type];
2371
+
2372
+ if ( jQuery.event.specialAll[type] )
2373
+ jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
1875
2374
 
1876
2375
  // Init the event handler queue
1877
2376
  if (!handlers) {
@@ -1880,7 +2379,7 @@ jQuery.event = {
1880
2379
  // Check for a special event handler
1881
2380
  // Only use addEventListener/attachEvent if the special
1882
2381
  // events handler returns false
1883
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
2382
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
1884
2383
  // Bind the global event handler to the element
1885
2384
  if (elem.addEventListener)
1886
2385
  elem.addEventListener(type, handle, false);
@@ -1913,7 +2412,7 @@ jQuery.event = {
1913
2412
 
1914
2413
  if ( events ) {
1915
2414
  // Unbind all events for the element
1916
- if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
2415
+ if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
1917
2416
  for ( var type in events )
1918
2417
  this.remove( elem, type + (types || "") );
1919
2418
  else {
@@ -1927,8 +2426,9 @@ jQuery.event = {
1927
2426
  // jQuery(...).unbind("mouseover mouseout", fn);
1928
2427
  jQuery.each(types.split(/\s+/), function(index, type){
1929
2428
  // Namespaced event handlers
1930
- var parts = type.split(".");
1931
- type = parts[0];
2429
+ var namespaces = type.split(".");
2430
+ type = namespaces.shift();
2431
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
1932
2432
 
1933
2433
  if ( events[type] ) {
1934
2434
  // remove the given handler for the given type
@@ -1937,15 +2437,18 @@ jQuery.event = {
1937
2437
 
1938
2438
  // remove all handlers for the given type
1939
2439
  else
1940
- for ( handler in events[type] )
2440
+ for ( var handle in events[type] )
1941
2441
  // Handle the removal of namespaced events
1942
- if ( !parts[1] || events[type][handler].type == parts[1] )
1943
- delete events[type][handler];
2442
+ if ( namespace.test(events[type][handle].type) )
2443
+ delete events[type][handle];
2444
+
2445
+ if ( jQuery.event.specialAll[type] )
2446
+ jQuery.event.specialAll[type].teardown.call(elem, namespaces);
1944
2447
 
1945
2448
  // remove generic event handler if no more handlers exist
1946
2449
  for ( ret in events[type] ) break;
1947
2450
  if ( !ret ) {
1948
- if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
2451
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
1949
2452
  if (elem.removeEventListener)
1950
2453
  elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
1951
2454
  else if (elem.detachEvent)
@@ -1969,97 +2472,95 @@ jQuery.event = {
1969
2472
  }
1970
2473
  },
1971
2474
 
1972
- trigger: function(type, data, elem, donative, extra) {
1973
- // Clone the incoming data, if any
1974
- data = jQuery.makeArray(data);
2475
+ // bubbling is internal
2476
+ trigger: function( event, data, elem, bubbling ) {
2477
+ // Event object or event type
2478
+ var type = event.type || event;
2479
+
2480
+ if( !bubbling ){
2481
+ event = typeof event === "object" ?
2482
+ // jQuery.Event object
2483
+ event[expando] ? event :
2484
+ // Object literal
2485
+ jQuery.extend( jQuery.Event(type), event ) :
2486
+ // Just the event type (string)
2487
+ jQuery.Event(type);
2488
+
2489
+ if ( type.indexOf("!") >= 0 ) {
2490
+ event.type = type = type.slice(0, -1);
2491
+ event.exclusive = true;
2492
+ }
1975
2493
 
1976
- if ( type.indexOf("!") >= 0 ) {
1977
- type = type.slice(0, -1);
1978
- var exclusive = true;
1979
- }
2494
+ // Handle a global trigger
2495
+ if ( !elem ) {
2496
+ // Don't bubble custom events when global (to avoid too much overhead)
2497
+ event.stopPropagation();
2498
+ // Only trigger if we've ever bound an event for it
2499
+ if ( this.global[type] )
2500
+ jQuery.each( jQuery.cache, function(){
2501
+ if ( this.events && this.events[type] )
2502
+ jQuery.event.trigger( event, data, this.handle.elem );
2503
+ });
2504
+ }
1980
2505
 
1981
- // Handle a global trigger
1982
- if ( !elem ) {
1983
- // Only trigger if we've ever bound an event for it
1984
- if ( this.global[type] )
1985
- jQuery("*").add([window, document]).trigger(type, data);
2506
+ // Handle triggering a single element
1986
2507
 
1987
- // Handle triggering a single element
1988
- } else {
1989
2508
  // don't do events on text and comment nodes
1990
- if ( elem.nodeType == 3 || elem.nodeType == 8 )
2509
+ if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
1991
2510
  return undefined;
2511
+
2512
+ // Clean up in case it is reused
2513
+ event.result = undefined;
2514
+ event.target = elem;
2515
+
2516
+ // Clone the incoming data, if any
2517
+ data = jQuery.makeArray(data);
2518
+ data.unshift( event );
2519
+ }
1992
2520
 
1993
- var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
1994
- // Check to see if we need to provide a fake event, or not
1995
- event = !data[0] || !data[0].preventDefault;
1996
-
1997
- // Pass along a fake event
1998
- if ( event ) {
1999
- data.unshift({
2000
- type: type,
2001
- target: elem,
2002
- preventDefault: function(){},
2003
- stopPropagation: function(){},
2004
- timeStamp: now()
2005
- });
2006
- data[0][expando] = true; // no need to fix fake event
2007
- }
2521
+ event.currentTarget = elem;
2008
2522
 
2009
- // Enforce the right trigger type
2010
- data[0].type = type;
2011
- if ( exclusive )
2012
- data[0].exclusive = true;
2013
-
2014
- // Trigger the event, it is assumed that "handle" is a function
2015
- var handle = jQuery.data(elem, "handle");
2016
- if ( handle )
2017
- val = handle.apply( elem, data );
2018
-
2019
- // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
2020
- if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
2021
- val = false;
2022
-
2023
- // Extra functions don't get the custom event object
2024
- if ( event )
2025
- data.shift();
2026
-
2027
- // Handle triggering of extra function
2028
- if ( extra && jQuery.isFunction( extra ) ) {
2029
- // call the extra function and tack the current return value on the end for possible inspection
2030
- ret = extra.apply( elem, val == null ? data : data.concat( val ) );
2031
- // if anything is returned, give it precedence and have it overwrite the previous value
2032
- if (ret !== undefined)
2033
- val = ret;
2034
- }
2523
+ // Trigger the event, it is assumed that "handle" is a function
2524
+ var handle = jQuery.data(elem, "handle");
2525
+ if ( handle )
2526
+ handle.apply( elem, data );
2035
2527
 
2036
- // Trigger the native events (except for clicks on links)
2037
- if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
2038
- this.triggered = true;
2039
- try {
2040
- elem[ type ]();
2041
- // prevent IE from throwing an error for some hidden elements
2042
- } catch (e) {}
2043
- }
2528
+ // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
2529
+ if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
2530
+ event.result = false;
2044
2531
 
2045
- this.triggered = false;
2532
+ // Trigger the native events (except for clicks on links)
2533
+ if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
2534
+ this.triggered = true;
2535
+ try {
2536
+ elem[ type ]();
2537
+ // prevent IE from throwing an error for some hidden elements
2538
+ } catch (e) {}
2046
2539
  }
2047
2540
 
2048
- return val;
2541
+ this.triggered = false;
2542
+
2543
+ if ( !event.isPropagationStopped() ) {
2544
+ var parent = elem.parentNode || elem.ownerDocument;
2545
+ if ( parent )
2546
+ jQuery.event.trigger(event, data, parent, true);
2547
+ }
2049
2548
  },
2050
2549
 
2051
2550
  handle: function(event) {
2052
2551
  // returned undefined or false
2053
- var val, ret, namespace, all, handlers;
2552
+ var all, handlers;
2054
2553
 
2055
2554
  event = arguments[0] = jQuery.event.fix( event || window.event );
2056
2555
 
2057
2556
  // Namespaced event handlers
2058
- namespace = event.type.split(".");
2059
- event.type = namespace[0];
2060
- namespace = namespace[1];
2557
+ var namespaces = event.type.split(".");
2558
+ event.type = namespaces.shift();
2559
+
2061
2560
  // Cache this now, all = true means, any handler
2062
- all = !namespace && !event.exclusive;
2561
+ all = !namespaces.length && !event.exclusive;
2562
+
2563
+ var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
2063
2564
 
2064
2565
  handlers = ( jQuery.data(this, "events") || {} )[event.type];
2065
2566
 
@@ -2067,61 +2568,44 @@ jQuery.event = {
2067
2568
  var handler = handlers[j];
2068
2569
 
2069
2570
  // Filter the functions by class
2070
- if ( all || handler.type == namespace ) {
2571
+ if ( all || namespace.test(handler.type) ) {
2071
2572
  // Pass in a reference to the handler function itself
2072
2573
  // So that we can later remove it
2073
2574
  event.handler = handler;
2074
2575
  event.data = handler.data;
2075
2576
 
2076
- ret = handler.apply( this, arguments );
2577
+ var ret = handler.apply(this, arguments);
2077
2578
 
2078
- if ( val !== false )
2079
- val = ret;
2080
-
2081
- if ( ret === false ) {
2082
- event.preventDefault();
2083
- event.stopPropagation();
2579
+ if( ret !== undefined ){
2580
+ event.result = ret;
2581
+ if ( ret === false ) {
2582
+ event.preventDefault();
2583
+ event.stopPropagation();
2584
+ }
2084
2585
  }
2586
+
2587
+ if( event.isImmediatePropagationStopped() )
2588
+ break;
2589
+
2085
2590
  }
2086
2591
  }
2087
-
2088
- return val;
2089
2592
  },
2090
2593
 
2594
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
2595
+
2091
2596
  fix: function(event) {
2092
- if ( event[expando] == true )
2597
+ if ( event[expando] )
2093
2598
  return event;
2094
2599
 
2095
2600
  // store a copy of the original event object
2096
2601
  // and "clone" to set read-only properties
2097
2602
  var originalEvent = event;
2098
- event = { originalEvent: originalEvent };
2099
- var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
2100
- for ( var i=props.length; i; i-- )
2101
- event[ props[i] ] = originalEvent[ props[i] ];
2102
-
2103
- // Mark it as fixed
2104
- event[expando] = true;
2105
-
2106
- // add preventDefault and stopPropagation since
2107
- // they will not work on the clone
2108
- event.preventDefault = function() {
2109
- // if preventDefault exists run it on the original event
2110
- if (originalEvent.preventDefault)
2111
- originalEvent.preventDefault();
2112
- // otherwise set the returnValue property of the original event to false (IE)
2113
- originalEvent.returnValue = false;
2114
- };
2115
- event.stopPropagation = function() {
2116
- // if stopPropagation exists run it on the original event
2117
- if (originalEvent.stopPropagation)
2118
- originalEvent.stopPropagation();
2119
- // otherwise set the cancelBubble property of the original event to true (IE)
2120
- originalEvent.cancelBubble = true;
2121
- };
2603
+ event = jQuery.Event( originalEvent );
2122
2604
 
2123
- // Fix timeStamp
2124
- event.timeStamp = event.timeStamp || now();
2605
+ for ( var i = this.props.length, prop; i; ){
2606
+ prop = this.props[ --i ];
2607
+ event[ prop ] = originalEvent[ prop ];
2608
+ }
2125
2609
 
2126
2610
  // Fix target property, if necessary
2127
2611
  if ( !event.target )
@@ -2159,6 +2643,7 @@ jQuery.event = {
2159
2643
  },
2160
2644
 
2161
2645
  proxy: function( fn, proxy ){
2646
+ proxy = proxy || function(){ return fn.apply(this, arguments); };
2162
2647
  // Set the guid of unique handler to the same of original handler, so it can be removed
2163
2648
  proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
2164
2649
  // So proxy can be declared as an argument
@@ -2167,60 +2652,128 @@ jQuery.event = {
2167
2652
 
2168
2653
  special: {
2169
2654
  ready: {
2170
- setup: function() {
2171
- // Make sure the ready event is setup
2172
- bindReady();
2173
- return;
2174
- },
2175
-
2176
- teardown: function() { return; }
2177
- },
2178
-
2179
- mouseenter: {
2180
- setup: function() {
2181
- if ( jQuery.browser.msie ) return false;
2182
- jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
2183
- return true;
2655
+ // Make sure the ready event is setup
2656
+ setup: bindReady,
2657
+ teardown: function() {}
2658
+ }
2659
+ },
2660
+
2661
+ specialAll: {
2662
+ live: {
2663
+ setup: function( selector, namespaces ){
2664
+ jQuery.event.add( this, namespaces[0], liveHandler );
2184
2665
  },
2666
+ teardown: function( namespaces ){
2667
+ if ( namespaces.length ) {
2668
+ var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
2669
+
2670
+ jQuery.each( (jQuery.data(this, "events").live || {}), function(){
2671
+ if ( name.test(this.type) )
2672
+ remove++;
2673
+ });
2674
+
2675
+ if ( remove < 1 )
2676
+ jQuery.event.remove( this, namespaces[0], liveHandler );
2677
+ }
2678
+ }
2679
+ }
2680
+ }
2681
+ };
2185
2682
 
2186
- teardown: function() {
2187
- if ( jQuery.browser.msie ) return false;
2188
- jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
2189
- return true;
2190
- },
2683
+ jQuery.Event = function( src ){
2684
+ // Allow instantiation without the 'new' keyword
2685
+ if( !this.preventDefault )
2686
+ return new jQuery.Event(src);
2687
+
2688
+ // Event object
2689
+ if( src && src.type ){
2690
+ this.originalEvent = src;
2691
+ this.type = src.type;
2692
+ // Event type
2693
+ }else
2694
+ this.type = src;
2695
+
2696
+ // timeStamp is buggy for some events on Firefox(#3843)
2697
+ // So we won't rely on the native value
2698
+ this.timeStamp = now();
2699
+
2700
+ // Mark it as fixed
2701
+ this[expando] = true;
2702
+ };
2191
2703
 
2192
- handler: function(event) {
2193
- // If we actually just moused on to a sub-element, ignore it
2194
- if ( withinElement(event, this) ) return true;
2195
- // Execute the right handlers by setting the event type to mouseenter
2196
- event.type = "mouseenter";
2197
- return jQuery.event.handle.apply(this, arguments);
2198
- }
2199
- },
2704
+ function returnFalse(){
2705
+ return false;
2706
+ }
2707
+ function returnTrue(){
2708
+ return true;
2709
+ }
2200
2710
 
2201
- mouseleave: {
2202
- setup: function() {
2203
- if ( jQuery.browser.msie ) return false;
2204
- jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
2205
- return true;
2206
- },
2711
+ // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2712
+ // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2713
+ jQuery.Event.prototype = {
2714
+ preventDefault: function() {
2715
+ this.isDefaultPrevented = returnTrue;
2207
2716
 
2208
- teardown: function() {
2209
- if ( jQuery.browser.msie ) return false;
2210
- jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
2211
- return true;
2212
- },
2717
+ var e = this.originalEvent;
2718
+ if( !e )
2719
+ return;
2720
+ // if preventDefault exists run it on the original event
2721
+ if (e.preventDefault)
2722
+ e.preventDefault();
2723
+ // otherwise set the returnValue property of the original event to false (IE)
2724
+ e.returnValue = false;
2725
+ },
2726
+ stopPropagation: function() {
2727
+ this.isPropagationStopped = returnTrue;
2213
2728
 
2214
- handler: function(event) {
2215
- // If we actually just moused on to a sub-element, ignore it
2216
- if ( withinElement(event, this) ) return true;
2217
- // Execute the right handlers by setting the event type to mouseleave
2218
- event.type = "mouseleave";
2219
- return jQuery.event.handle.apply(this, arguments);
2220
- }
2221
- }
2729
+ var e = this.originalEvent;
2730
+ if( !e )
2731
+ return;
2732
+ // if stopPropagation exists run it on the original event
2733
+ if (e.stopPropagation)
2734
+ e.stopPropagation();
2735
+ // otherwise set the cancelBubble property of the original event to true (IE)
2736
+ e.cancelBubble = true;
2737
+ },
2738
+ stopImmediatePropagation:function(){
2739
+ this.isImmediatePropagationStopped = returnTrue;
2740
+ this.stopPropagation();
2741
+ },
2742
+ isDefaultPrevented: returnFalse,
2743
+ isPropagationStopped: returnFalse,
2744
+ isImmediatePropagationStopped: returnFalse
2745
+ };
2746
+ // Checks if an event happened on an element within another element
2747
+ // Used in jQuery.event.special.mouseenter and mouseleave handlers
2748
+ var withinElement = function(event) {
2749
+ // Check if mouse(over|out) are still within the same parent element
2750
+ var parent = event.relatedTarget;
2751
+ // Traverse up the tree
2752
+ while ( parent && parent != this )
2753
+ try { parent = parent.parentNode; }
2754
+ catch(e) { parent = this; }
2755
+
2756
+ if( parent != this ){
2757
+ // set the correct event type
2758
+ event.type = event.data;
2759
+ // handle event if we actually just moused on to a non sub-element
2760
+ jQuery.event.handle.apply( this, arguments );
2222
2761
  }
2223
2762
  };
2763
+
2764
+ jQuery.each({
2765
+ mouseover: 'mouseenter',
2766
+ mouseout: 'mouseleave'
2767
+ }, function( orig, fix ){
2768
+ jQuery.event.special[ fix ] = {
2769
+ setup: function(){
2770
+ jQuery.event.add( this, orig, withinElement, fix );
2771
+ },
2772
+ teardown: function(){
2773
+ jQuery.event.remove( this, orig, withinElement );
2774
+ }
2775
+ };
2776
+ });
2224
2777
 
2225
2778
  jQuery.fn.extend({
2226
2779
  bind: function( type, data, fn ) {
@@ -2245,14 +2798,20 @@ jQuery.fn.extend({
2245
2798
  });
2246
2799
  },
2247
2800
 
2248
- trigger: function( type, data, fn ) {
2801
+ trigger: function( type, data ) {
2249
2802
  return this.each(function(){
2250
- jQuery.event.trigger( type, data, this, true, fn );
2803
+ jQuery.event.trigger( type, data, this );
2251
2804
  });
2252
2805
  },
2253
2806
 
2254
- triggerHandler: function( type, data, fn ) {
2255
- return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
2807
+ triggerHandler: function( type, data ) {
2808
+ if( this[0] ){
2809
+ var event = jQuery.Event(type);
2810
+ event.preventDefault();
2811
+ event.stopPropagation();
2812
+ jQuery.event.trigger( event, data, this[0] );
2813
+ return event.result;
2814
+ }
2256
2815
  },
2257
2816
 
2258
2817
  toggle: function( fn ) {
@@ -2276,7 +2835,7 @@ jQuery.fn.extend({
2276
2835
  },
2277
2836
 
2278
2837
  hover: function(fnOver, fnOut) {
2279
- return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
2838
+ return this.mouseenter(fnOver).mouseleave(fnOut);
2280
2839
  },
2281
2840
 
2282
2841
  ready: function(fn) {
@@ -2291,12 +2850,51 @@ jQuery.fn.extend({
2291
2850
  // Otherwise, remember the function for later
2292
2851
  else
2293
2852
  // Add the function to the wait list
2294
- jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
2853
+ jQuery.readyList.push( fn );
2854
+
2855
+ return this;
2856
+ },
2857
+
2858
+ live: function( type, fn ){
2859
+ var proxy = jQuery.event.proxy( fn );
2860
+ proxy.guid += this.selector + type;
2861
+
2862
+ jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
2295
2863
 
2864
+ return this;
2865
+ },
2866
+
2867
+ die: function( type, fn ){
2868
+ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
2296
2869
  return this;
2297
2870
  }
2298
2871
  });
2299
2872
 
2873
+ function liveHandler( event ){
2874
+ var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
2875
+ stop = true,
2876
+ elems = [];
2877
+
2878
+ jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
2879
+ if ( check.test(fn.type) ) {
2880
+ var elem = jQuery(event.target).closest(fn.data)[0];
2881
+ if ( elem )
2882
+ elems.push({ elem: elem, fn: fn });
2883
+ }
2884
+ });
2885
+
2886
+ jQuery.each(elems, function(){
2887
+ if ( this.fn.call(this.elem, event, this.fn.data) === false )
2888
+ stop = false;
2889
+ });
2890
+
2891
+ return stop;
2892
+ }
2893
+
2894
+ function liveConvert(type, selector){
2895
+ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
2896
+ }
2897
+
2300
2898
  jQuery.extend({
2301
2899
  isReady: false,
2302
2900
  readyList: [],
@@ -2311,7 +2909,7 @@ jQuery.extend({
2311
2909
  if ( jQuery.readyList ) {
2312
2910
  // Execute all of them
2313
2911
  jQuery.each( jQuery.readyList, function(){
2314
- this.call( document );
2912
+ this.call( document, jQuery );
2315
2913
  });
2316
2914
 
2317
2915
  // Reset the list of functions
@@ -2330,53 +2928,39 @@ function bindReady(){
2330
2928
  if ( readyBound ) return;
2331
2929
  readyBound = true;
2332
2930
 
2333
- // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
2334
- if ( document.addEventListener && !jQuery.browser.opera)
2931
+ // Mozilla, Opera and webkit nightlies currently support this event
2932
+ if ( document.addEventListener ) {
2335
2933
  // Use the handy event callback
2336
- document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
2337
-
2338
- // If IE is used and is not in a frame
2339
- // Continually check to see if the document is ready
2340
- if ( jQuery.browser.msie && window == top ) (function(){
2341
- if (jQuery.isReady) return;
2342
- try {
2343
- // If IE is used, use the trick by Diego Perini
2344
- // http://javascript.nwbox.com/IEContentLoaded/
2345
- document.documentElement.doScroll("left");
2346
- } catch( error ) {
2347
- setTimeout( arguments.callee, 0 );
2348
- return;
2349
- }
2350
- // and execute any waiting functions
2351
- jQuery.ready();
2352
- })();
2353
-
2354
- if ( jQuery.browser.opera )
2355
- document.addEventListener( "DOMContentLoaded", function () {
2356
- if (jQuery.isReady) return;
2357
- for (var i = 0; i < document.styleSheets.length; i++)
2358
- if (document.styleSheets[i].disabled) {
2359
- setTimeout( arguments.callee, 0 );
2360
- return;
2361
- }
2362
- // and execute any waiting functions
2934
+ document.addEventListener( "DOMContentLoaded", function(){
2935
+ document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
2363
2936
  jQuery.ready();
2364
- }, false);
2365
-
2366
- if ( jQuery.browser.safari ) {
2367
- var numStyles;
2368
- (function(){
2369
- if (jQuery.isReady) return;
2370
- if ( document.readyState != "loaded" && document.readyState != "complete" ) {
2371
- setTimeout( arguments.callee, 0 );
2372
- return;
2937
+ }, false );
2938
+
2939
+ // If IE event model is used
2940
+ } else if ( document.attachEvent ) {
2941
+ // ensure firing before onload,
2942
+ // maybe late but safe also for iframes
2943
+ document.attachEvent("onreadystatechange", function(){
2944
+ if ( document.readyState === "complete" ) {
2945
+ document.detachEvent( "onreadystatechange", arguments.callee );
2946
+ jQuery.ready();
2373
2947
  }
2374
- if ( numStyles === undefined )
2375
- numStyles = jQuery("style, link[rel=stylesheet]").length;
2376
- if ( document.styleSheets.length != numStyles ) {
2948
+ });
2949
+
2950
+ // If IE and not an iframe
2951
+ // continually check to see if the document is ready
2952
+ if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){
2953
+ if ( jQuery.isReady ) return;
2954
+
2955
+ try {
2956
+ // If IE is used, use the trick by Diego Perini
2957
+ // http://javascript.nwbox.com/IEContentLoaded/
2958
+ document.documentElement.doScroll("left");
2959
+ } catch( error ) {
2377
2960
  setTimeout( arguments.callee, 0 );
2378
2961
  return;
2379
2962
  }
2963
+
2380
2964
  // and execute any waiting functions
2381
2965
  jQuery.ready();
2382
2966
  })();
@@ -2387,8 +2971,8 @@ function bindReady(){
2387
2971
  }
2388
2972
 
2389
2973
  jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
2390
- "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
2391
- "submit,keydown,keypress,keyup,error").split(","), function(i, name){
2974
+ "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
2975
+ "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
2392
2976
 
2393
2977
  // Handle event binding
2394
2978
  jQuery.fn[name] = function(fn){
@@ -2396,29 +2980,134 @@ jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
2396
2980
  };
2397
2981
  });
2398
2982
 
2399
- // Checks if an event happened on an element within another element
2400
- // Used in jQuery.event.special.mouseenter and mouseleave handlers
2401
- var withinElement = function(event, elem) {
2402
- // Check if mouse(over|out) are still within the same parent element
2403
- var parent = event.relatedTarget;
2404
- // Traverse up the tree
2405
- while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
2406
- // Return true if we actually just moused on to a sub-element
2407
- return parent == elem;
2408
- };
2409
-
2410
2983
  // Prevent memory leaks in IE
2411
2984
  // And prevent errors on refresh with events like mouseover in other browsers
2412
2985
  // Window isn't included so as not to unbind existing unload events
2413
- jQuery(window).bind("unload", function() {
2414
- jQuery("*").add(document).unbind();
2415
- });
2986
+ jQuery( window ).bind( 'unload', function(){
2987
+ for ( var id in jQuery.cache )
2988
+ // Skip the window
2989
+ if ( id != 1 && jQuery.cache[ id ].handle )
2990
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
2991
+ });
2992
+ (function(){
2993
+
2994
+ jQuery.support = {};
2995
+
2996
+ var root = document.documentElement,
2997
+ script = document.createElement("script"),
2998
+ div = document.createElement("div"),
2999
+ id = "script" + (new Date).getTime();
3000
+
3001
+ div.style.display = "none";
3002
+ div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
3003
+
3004
+ var all = div.getElementsByTagName("*"),
3005
+ a = div.getElementsByTagName("a")[0];
3006
+
3007
+ // Can't get basic test support
3008
+ if ( !all || !all.length || !a ) {
3009
+ return;
3010
+ }
3011
+
3012
+ jQuery.support = {
3013
+ // IE strips leading whitespace when .innerHTML is used
3014
+ leadingWhitespace: div.firstChild.nodeType == 3,
3015
+
3016
+ // Make sure that tbody elements aren't automatically inserted
3017
+ // IE will insert them into empty tables
3018
+ tbody: !div.getElementsByTagName("tbody").length,
3019
+
3020
+ // Make sure that you can get all elements in an <object> element
3021
+ // IE 7 always returns no results
3022
+ objectAll: !!div.getElementsByTagName("object")[0]
3023
+ .getElementsByTagName("*").length,
3024
+
3025
+ // Make sure that link elements get serialized correctly by innerHTML
3026
+ // This requires a wrapper element in IE
3027
+ htmlSerialize: !!div.getElementsByTagName("link").length,
3028
+
3029
+ // Get the style information from getAttribute
3030
+ // (IE uses .cssText insted)
3031
+ style: /red/.test( a.getAttribute("style") ),
3032
+
3033
+ // Make sure that URLs aren't manipulated
3034
+ // (IE normalizes it by default)
3035
+ hrefNormalized: a.getAttribute("href") === "/a",
3036
+
3037
+ // Make sure that element opacity exists
3038
+ // (IE uses filter instead)
3039
+ opacity: a.style.opacity === "0.5",
3040
+
3041
+ // Verify style float existence
3042
+ // (IE uses styleFloat instead of cssFloat)
3043
+ cssFloat: !!a.style.cssFloat,
3044
+
3045
+ // Will be defined later
3046
+ scriptEval: false,
3047
+ noCloneEvent: true,
3048
+ boxModel: null
3049
+ };
3050
+
3051
+ script.type = "text/javascript";
3052
+ try {
3053
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
3054
+ } catch(e){}
3055
+
3056
+ root.insertBefore( script, root.firstChild );
3057
+
3058
+ // Make sure that the execution of code works by injecting a script
3059
+ // tag with appendChild/createTextNode
3060
+ // (IE doesn't support this, fails, and uses .text instead)
3061
+ if ( window[ id ] ) {
3062
+ jQuery.support.scriptEval = true;
3063
+ delete window[ id ];
3064
+ }
3065
+
3066
+ root.removeChild( script );
3067
+
3068
+ if ( div.attachEvent && div.fireEvent ) {
3069
+ div.attachEvent("onclick", function(){
3070
+ // Cloning a node shouldn't copy over any
3071
+ // bound event handlers (IE does this)
3072
+ jQuery.support.noCloneEvent = false;
3073
+ div.detachEvent("onclick", arguments.callee);
3074
+ });
3075
+ div.cloneNode(true).fireEvent("onclick");
3076
+ }
3077
+
3078
+ // Figure out if the W3C box model works as expected
3079
+ // document.body must exist before we can do this
3080
+ jQuery(function(){
3081
+ var div = document.createElement("div");
3082
+ div.style.width = "1px";
3083
+ div.style.paddingLeft = "1px";
3084
+
3085
+ document.body.appendChild( div );
3086
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
3087
+ document.body.removeChild( div );
3088
+ });
3089
+ })();
3090
+
3091
+ var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
3092
+
3093
+ jQuery.props = {
3094
+ "for": "htmlFor",
3095
+ "class": "className",
3096
+ "float": styleFloat,
3097
+ cssFloat: styleFloat,
3098
+ styleFloat: styleFloat,
3099
+ readonly: "readOnly",
3100
+ maxlength: "maxLength",
3101
+ cellspacing: "cellSpacing",
3102
+ rowspan: "rowSpan",
3103
+ tabindex: "tabIndex"
3104
+ };
2416
3105
  jQuery.fn.extend({
2417
3106
  // Keep a copy of the old load
2418
3107
  _load: jQuery.fn.load,
2419
3108
 
2420
3109
  load: function( url, params, callback ) {
2421
- if ( typeof url != 'string' )
3110
+ if ( typeof url !== "string" )
2422
3111
  return this._load( url );
2423
3112
 
2424
3113
  var off = url.indexOf(" ");
@@ -2427,8 +3116,6 @@ jQuery.fn.extend({
2427
3116
  url = url.slice(0, off);
2428
3117
  }
2429
3118
 
2430
- callback = callback || function(){};
2431
-
2432
3119
  // Default to a GET request
2433
3120
  var type = "GET";
2434
3121
 
@@ -2441,7 +3128,7 @@ jQuery.fn.extend({
2441
3128
  params = null;
2442
3129
 
2443
3130
  // Otherwise, build a param string
2444
- } else {
3131
+ } else if( typeof params === "object" ) {
2445
3132
  params = jQuery.param( params );
2446
3133
  type = "POST";
2447
3134
  }
@@ -2471,7 +3158,8 @@ jQuery.fn.extend({
2471
3158
  // If not, just inject the full result
2472
3159
  res.responseText );
2473
3160
 
2474
- self.each( callback, [res.responseText, status, res] );
3161
+ if( callback )
3162
+ self.each( callback, [res.responseText, status, res] );
2475
3163
  }
2476
3164
  });
2477
3165
  return this;
@@ -2482,8 +3170,7 @@ jQuery.fn.extend({
2482
3170
  },
2483
3171
  serializeArray: function() {
2484
3172
  return this.map(function(){
2485
- return jQuery.nodeName(this, "form") ?
2486
- jQuery.makeArray(this.elements) : this;
3173
+ return this.elements ? jQuery.makeArray(this.elements) : this;
2487
3174
  })
2488
3175
  .filter(function(){
2489
3176
  return this.name && !this.disabled &&
@@ -2493,7 +3180,7 @@ jQuery.fn.extend({
2493
3180
  .map(function(i, elem){
2494
3181
  var val = jQuery(this).val();
2495
3182
  return val == null ? null :
2496
- val.constructor == Array ?
3183
+ jQuery.isArray(val) ?
2497
3184
  jQuery.map( val, function(val, i){
2498
3185
  return {name: elem.name, value: val};
2499
3186
  }) :
@@ -2512,6 +3199,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
2512
3199
  var jsc = now();
2513
3200
 
2514
3201
  jQuery.extend({
3202
+
2515
3203
  get: function( url, data, callback, type ) {
2516
3204
  // shift arguments if data argument was ommited
2517
3205
  if ( jQuery.isFunction( data ) ) {
@@ -2559,13 +3247,21 @@ jQuery.extend({
2559
3247
  url: location.href,
2560
3248
  global: true,
2561
3249
  type: "GET",
2562
- timeout: 0,
2563
3250
  contentType: "application/x-www-form-urlencoded",
2564
3251
  processData: true,
2565
3252
  async: true,
3253
+ /*
3254
+ timeout: 0,
2566
3255
  data: null,
2567
3256
  username: null,
2568
3257
  password: null,
3258
+ */
3259
+ // Create the request object; Microsoft failed to properly
3260
+ // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
3261
+ // This function can be overriden by calling jQuery.ajaxSetup
3262
+ xhr:function(){
3263
+ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
3264
+ },
2569
3265
  accepts: {
2570
3266
  xml: "application/xml, text/xml",
2571
3267
  html: "text/html",
@@ -2588,7 +3284,7 @@ jQuery.extend({
2588
3284
  type = s.type.toUpperCase();
2589
3285
 
2590
3286
  // convert data if not already a string
2591
- if ( s.data && s.processData && typeof s.data != "string" )
3287
+ if ( s.data && s.processData && typeof s.data !== "string" )
2592
3288
  s.data = jQuery.param(s.data);
2593
3289
 
2594
3290
  // Handle JSONP Parameter Callbacks
@@ -2651,12 +3347,13 @@ jQuery.extend({
2651
3347
  jQuery.event.trigger( "ajaxStart" );
2652
3348
 
2653
3349
  // Matches an absolute URL, and saves the domain
2654
- var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
3350
+ var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
2655
3351
 
2656
3352
  // If we're requesting a remote document
2657
3353
  // and trying to load JSON or Script with a GET
2658
- if ( s.dataType == "script" && type == "GET"
2659
- && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
3354
+ if ( s.dataType == "script" && type == "GET" && parts
3355
+ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
3356
+
2660
3357
  var head = document.getElementsByTagName("head")[0];
2661
3358
  var script = document.createElement("script");
2662
3359
  script.src = s.url;
@@ -2687,9 +3384,8 @@ jQuery.extend({
2687
3384
 
2688
3385
  var requestDone = false;
2689
3386
 
2690
- // Create the request object; Microsoft failed to properly
2691
- // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
2692
- var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
3387
+ // Create the request object
3388
+ var xhr = s.xhr();
2693
3389
 
2694
3390
  // Open the socket
2695
3391
  // Passing null username, generates a login popup on Opera (#2865)
@@ -2718,10 +3414,11 @@ jQuery.extend({
2718
3414
  s.accepts._default );
2719
3415
  } catch(e){}
2720
3416
 
2721
- // Allow custom headers/mimetypes
3417
+ // Allow custom headers/mimetypes and early abort
2722
3418
  if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
2723
- // cleanup active request counter
2724
- s.global && jQuery.active--;
3419
+ // Handle the global AJAX counter
3420
+ if ( s.global && ! --jQuery.active )
3421
+ jQuery.event.trigger( "ajaxStop" );
2725
3422
  // close opended socket
2726
3423
  xhr.abort();
2727
3424
  return false;
@@ -2732,8 +3429,18 @@ jQuery.extend({
2732
3429
 
2733
3430
  // Wait for a response to come back
2734
3431
  var onreadystatechange = function(isTimeout){
3432
+ // The request was aborted, clear the interval and decrement jQuery.active
3433
+ if (xhr.readyState == 0) {
3434
+ if (ival) {
3435
+ // clear poll interval
3436
+ clearInterval(ival);
3437
+ ival = null;
3438
+ // Handle the global AJAX counter
3439
+ if ( s.global && ! --jQuery.active )
3440
+ jQuery.event.trigger( "ajaxStop" );
3441
+ }
2735
3442
  // The transfer is complete and the data is available, or the request timed out
2736
- if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
3443
+ } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
2737
3444
  requestDone = true;
2738
3445
 
2739
3446
  // clear poll interval
@@ -2742,16 +3449,16 @@ jQuery.extend({
2742
3449
  ival = null;
2743
3450
  }
2744
3451
 
2745
- status = isTimeout == "timeout" && "timeout" ||
2746
- !jQuery.httpSuccess( xhr ) && "error" ||
2747
- s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
3452
+ status = isTimeout == "timeout" ? "timeout" :
3453
+ !jQuery.httpSuccess( xhr ) ? "error" :
3454
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
2748
3455
  "success";
2749
3456
 
2750
3457
  if ( status == "success" ) {
2751
3458
  // Watch for, and catch, XML document parse errors
2752
3459
  try {
2753
3460
  // process the data (runs the xml through httpData regardless of callback)
2754
- data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
3461
+ data = jQuery.httpData( xhr, s.dataType, s );
2755
3462
  } catch(e) {
2756
3463
  status = "parsererror";
2757
3464
  }
@@ -2777,6 +3484,9 @@ jQuery.extend({
2777
3484
  // Fire the complete handlers
2778
3485
  complete();
2779
3486
 
3487
+ if ( isTimeout )
3488
+ xhr.abort();
3489
+
2780
3490
  // Stop memory leaks
2781
3491
  if ( s.async )
2782
3492
  xhr = null;
@@ -2791,13 +3501,8 @@ jQuery.extend({
2791
3501
  if ( s.timeout > 0 )
2792
3502
  setTimeout(function(){
2793
3503
  // Check to see if the request is still happening
2794
- if ( xhr ) {
2795
- // Cancel the request
2796
- xhr.abort();
2797
-
2798
- if( !requestDone )
2799
- onreadystatechange( "timeout" );
2800
- }
3504
+ if ( xhr && !requestDone )
3505
+ onreadystatechange( "timeout" );
2801
3506
  }, s.timeout);
2802
3507
  }
2803
3508
 
@@ -2857,8 +3562,7 @@ jQuery.extend({
2857
3562
  try {
2858
3563
  // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
2859
3564
  return !xhr.status && location.protocol == "file:" ||
2860
- ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
2861
- jQuery.browser.safari && xhr.status == undefined;
3565
+ ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
2862
3566
  } catch(e){}
2863
3567
  return false;
2864
3568
  },
@@ -2869,13 +3573,12 @@ jQuery.extend({
2869
3573
  var xhrRes = xhr.getResponseHeader("Last-Modified");
2870
3574
 
2871
3575
  // Firefox always returns 200. check Last-Modified date
2872
- return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
2873
- jQuery.browser.safari && xhr.status == undefined;
3576
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
2874
3577
  } catch(e){}
2875
3578
  return false;
2876
3579
  },
2877
3580
 
2878
- httpData: function( xhr, type, filter ) {
3581
+ httpData: function( xhr, type, s ) {
2879
3582
  var ct = xhr.getResponseHeader("content-type"),
2880
3583
  xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
2881
3584
  data = xml ? xhr.responseXML : xhr.responseText;
@@ -2884,31 +3587,40 @@ jQuery.extend({
2884
3587
  throw "parsererror";
2885
3588
 
2886
3589
  // Allow a pre-filtering function to sanitize the response
2887
- if( filter )
2888
- data = filter( data, type );
3590
+ // s != null is checked to keep backwards compatibility
3591
+ if( s && s.dataFilter )
3592
+ data = s.dataFilter( data, type );
2889
3593
 
2890
- // If the type is "script", eval it in global context
2891
- if ( type == "script" )
2892
- jQuery.globalEval( data );
3594
+ // The filter can actually parse the response
3595
+ if( typeof data === "string" ){
2893
3596
 
2894
- // Get the JavaScript object, if JSON is used.
2895
- if ( type == "json" )
2896
- data = eval("(" + data + ")");
3597
+ // If the type is "script", eval it in global context
3598
+ if ( type == "script" )
3599
+ jQuery.globalEval( data );
2897
3600
 
3601
+ // Get the JavaScript object, if JSON is used.
3602
+ if ( type == "json" )
3603
+ data = window["eval"]("(" + data + ")");
3604
+ }
3605
+
2898
3606
  return data;
2899
3607
  },
2900
3608
 
2901
3609
  // Serialize an array of form elements or a set of
2902
3610
  // key/values into a query string
2903
3611
  param: function( a ) {
2904
- var s = [];
3612
+ var s = [ ];
3613
+
3614
+ function add( key, value ){
3615
+ s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
3616
+ };
2905
3617
 
2906
3618
  // If an array was passed in, assume that it is an array
2907
3619
  // of form elements
2908
- if ( a.constructor == Array || a.jquery )
3620
+ if ( jQuery.isArray(a) || a.jquery )
2909
3621
  // Serialize the form elements
2910
3622
  jQuery.each( a, function(){
2911
- s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
3623
+ add( this.name, this.value );
2912
3624
  });
2913
3625
 
2914
3626
  // Otherwise, assume that it's an object of key/value pairs
@@ -2916,83 +3628,100 @@ jQuery.extend({
2916
3628
  // Serialize the key/values
2917
3629
  for ( var j in a )
2918
3630
  // If the value is an array then the key names need to be repeated
2919
- if ( a[j] && a[j].constructor == Array )
3631
+ if ( jQuery.isArray(a[j]) )
2920
3632
  jQuery.each( a[j], function(){
2921
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
3633
+ add( j, this );
2922
3634
  });
2923
3635
  else
2924
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
3636
+ add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
2925
3637
 
2926
3638
  // Return the resulting serialization
2927
3639
  return s.join("&").replace(/%20/g, "+");
2928
3640
  }
2929
3641
 
2930
3642
  });
3643
+ var elemdisplay = {},
3644
+ timerId,
3645
+ fxAttrs = [
3646
+ // height animations
3647
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
3648
+ // width animations
3649
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
3650
+ // opacity animations
3651
+ [ "opacity" ]
3652
+ ];
3653
+
3654
+ function genFx( type, num ){
3655
+ var obj = {};
3656
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
3657
+ obj[ this ] = type;
3658
+ });
3659
+ return obj;
3660
+ }
3661
+
2931
3662
  jQuery.fn.extend({
2932
3663
  show: function(speed,callback){
2933
- return speed ?
2934
- this.animate({
2935
- height: "show", width: "show", opacity: "show"
2936
- }, speed, callback) :
2937
-
2938
- this.filter(":hidden").each(function(){
2939
- this.style.display = this.oldblock || "";
2940
- if ( jQuery.css(this,"display") == "none" ) {
2941
- var elem = jQuery("<" + this.tagName + " />").appendTo("body");
2942
- this.style.display = elem.css("display");
2943
- // handle an edge condition where css is - div { display:none; } or similar
2944
- if (this.style.display == "none")
2945
- this.style.display = "block";
2946
- elem.remove();
3664
+ if ( speed ) {
3665
+ return this.animate( genFx("show", 3), speed, callback);
3666
+ } else {
3667
+ for ( var i = 0, l = this.length; i < l; i++ ){
3668
+ var old = jQuery.data(this[i], "olddisplay");
3669
+
3670
+ this[i].style.display = old || "";
3671
+
3672
+ if ( jQuery.css(this[i], "display") === "none" ) {
3673
+ var tagName = this[i].tagName, display;
3674
+
3675
+ if ( elemdisplay[ tagName ] ) {
3676
+ display = elemdisplay[ tagName ];
3677
+ } else {
3678
+ var elem = jQuery("<" + tagName + " />").appendTo("body");
3679
+
3680
+ display = elem.css("display");
3681
+ if ( display === "none" )
3682
+ display = "block";
3683
+
3684
+ elem.remove();
3685
+
3686
+ elemdisplay[ tagName ] = display;
3687
+ }
3688
+
3689
+ this[i].style.display = jQuery.data(this[i], "olddisplay", display);
2947
3690
  }
2948
- }).end();
3691
+ }
3692
+
3693
+ return this;
3694
+ }
2949
3695
  },
2950
3696
 
2951
3697
  hide: function(speed,callback){
2952
- return speed ?
2953
- this.animate({
2954
- height: "hide", width: "hide", opacity: "hide"
2955
- }, speed, callback) :
2956
-
2957
- this.filter(":visible").each(function(){
2958
- this.oldblock = this.oldblock || jQuery.css(this,"display");
2959
- this.style.display = "none";
2960
- }).end();
3698
+ if ( speed ) {
3699
+ return this.animate( genFx("hide", 3), speed, callback);
3700
+ } else {
3701
+ for ( var i = 0, l = this.length; i < l; i++ ){
3702
+ var old = jQuery.data(this[i], "olddisplay");
3703
+ if ( !old && old !== "none" )
3704
+ jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
3705
+ this[i].style.display = "none";
3706
+ }
3707
+ return this;
3708
+ }
2961
3709
  },
2962
3710
 
2963
3711
  // Save the old toggle function
2964
3712
  _toggle: jQuery.fn.toggle,
2965
3713
 
2966
3714
  toggle: function( fn, fn2 ){
3715
+ var bool = typeof fn === "boolean";
3716
+
2967
3717
  return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
2968
3718
  this._toggle.apply( this, arguments ) :
2969
- fn ?
2970
- this.animate({
2971
- height: "toggle", width: "toggle", opacity: "toggle"
2972
- }, fn, fn2) :
3719
+ fn == null || bool ?
2973
3720
  this.each(function(){
2974
- jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
2975
- });
2976
- },
2977
-
2978
- slideDown: function(speed,callback){
2979
- return this.animate({height: "show"}, speed, callback);
2980
- },
2981
-
2982
- slideUp: function(speed,callback){
2983
- return this.animate({height: "hide"}, speed, callback);
2984
- },
2985
-
2986
- slideToggle: function(speed, callback){
2987
- return this.animate({height: "toggle"}, speed, callback);
2988
- },
2989
-
2990
- fadeIn: function(speed, callback){
2991
- return this.animate({opacity: "show"}, speed, callback);
2992
- },
2993
-
2994
- fadeOut: function(speed, callback){
2995
- return this.animate({opacity: "hide"}, speed, callback);
3721
+ var state = bool ? fn : jQuery(this).is(":hidden");
3722
+ jQuery(this)[ state ? "show" : "hide" ]();
3723
+ }) :
3724
+ this.animate(genFx("toggle", 3), fn, fn2);
2996
3725
  },
2997
3726
 
2998
3727
  fadeTo: function(speed,to,callback){
@@ -3003,17 +3732,16 @@ jQuery.fn.extend({
3003
3732
  var optall = jQuery.speed(speed, easing, callback);
3004
3733
 
3005
3734
  return this[ optall.queue === false ? "each" : "queue" ](function(){
3006
- if ( this.nodeType != 1)
3007
- return false;
3008
-
3735
+
3009
3736
  var opt = jQuery.extend({}, optall), p,
3010
- hidden = jQuery(this).is(":hidden"), self = this;
3011
-
3737
+ hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
3738
+ self = this;
3739
+
3012
3740
  for ( p in prop ) {
3013
3741
  if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
3014
3742
  return opt.complete.call(this);
3015
3743
 
3016
- if ( p == "height" || p == "width" ) {
3744
+ if ( ( p == "height" || p == "width" ) && this.style ) {
3017
3745
  // Store display property
3018
3746
  opt.display = jQuery.css(this, "display");
3019
3747
 
@@ -3062,27 +3790,6 @@ jQuery.fn.extend({
3062
3790
  });
3063
3791
  },
3064
3792
 
3065
- queue: function(type, fn){
3066
- if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
3067
- fn = type;
3068
- type = "fx";
3069
- }
3070
-
3071
- if ( !type || (typeof type == "string" && !fn) )
3072
- return queue( this[0], type );
3073
-
3074
- return this.each(function(){
3075
- if ( fn.constructor == Array )
3076
- queue(this, type, fn);
3077
- else {
3078
- queue(this, type).push( fn );
3079
-
3080
- if ( queue(this, type).length == 1 )
3081
- fn.call(this);
3082
- }
3083
- });
3084
- },
3085
-
3086
3793
  stop: function(clearQueue, gotoEnd){
3087
3794
  var timers = jQuery.timers;
3088
3795
 
@@ -3109,46 +3816,31 @@ jQuery.fn.extend({
3109
3816
 
3110
3817
  });
3111
3818
 
3112
- var queue = function( elem, type, array ) {
3113
- if ( elem ){
3114
-
3115
- type = type || "fx";
3116
-
3117
- var q = jQuery.data( elem, type + "queue" );
3118
-
3119
- if ( !q || array )
3120
- q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
3121
-
3122
- }
3123
- return q;
3124
- };
3125
-
3126
- jQuery.fn.dequeue = function(type){
3127
- type = type || "fx";
3128
-
3129
- return this.each(function(){
3130
- var q = queue(this, type);
3131
-
3132
- q.shift();
3133
-
3134
- if ( q.length )
3135
- q[0].call( this );
3136
- });
3137
- };
3819
+ // Generate shortcuts for custom animations
3820
+ jQuery.each({
3821
+ slideDown: genFx("show", 1),
3822
+ slideUp: genFx("hide", 1),
3823
+ slideToggle: genFx("toggle", 1),
3824
+ fadeIn: { opacity: "show" },
3825
+ fadeOut: { opacity: "hide" }
3826
+ }, function( name, props ){
3827
+ jQuery.fn[ name ] = function( speed, callback ){
3828
+ return this.animate( props, speed, callback );
3829
+ };
3830
+ });
3138
3831
 
3139
3832
  jQuery.extend({
3140
3833
 
3141
3834
  speed: function(speed, easing, fn) {
3142
- var opt = speed && speed.constructor == Object ? speed : {
3835
+ var opt = typeof speed === "object" ? speed : {
3143
3836
  complete: fn || !fn && easing ||
3144
3837
  jQuery.isFunction( speed ) && speed,
3145
3838
  duration: speed,
3146
- easing: fn && easing || easing && easing.constructor != Function && easing
3839
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
3147
3840
  };
3148
3841
 
3149
- opt.duration = (opt.duration && opt.duration.constructor == Number ?
3150
- opt.duration :
3151
- jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
3842
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
3843
+ jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
3152
3844
 
3153
3845
  // Queueing
3154
3846
  opt.old = opt.complete;
@@ -3172,7 +3864,6 @@ jQuery.extend({
3172
3864
  },
3173
3865
 
3174
3866
  timers: [],
3175
- timerId: null,
3176
3867
 
3177
3868
  fx: function( elem, options, prop ){
3178
3869
  this.options = options;
@@ -3195,13 +3886,13 @@ jQuery.fx.prototype = {
3195
3886
  (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
3196
3887
 
3197
3888
  // Set display property to block for height/width animations
3198
- if ( this.prop == "height" || this.prop == "width" )
3889
+ if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
3199
3890
  this.elem.style.display = "block";
3200
3891
  },
3201
3892
 
3202
3893
  // Get the current size
3203
3894
  cur: function(force){
3204
- if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
3895
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
3205
3896
  return this.elem[ this.prop ];
3206
3897
 
3207
3898
  var r = parseFloat(jQuery.css(this.elem, this.prop, force));
@@ -3216,7 +3907,6 @@ jQuery.fx.prototype = {
3216
3907
  this.unit = unit || this.unit || "px";
3217
3908
  this.now = this.start;
3218
3909
  this.pos = this.state = 0;
3219
- this.update();
3220
3910
 
3221
3911
  var self = this;
3222
3912
  function t(gotoEnd){
@@ -3225,10 +3915,8 @@ jQuery.fx.prototype = {
3225
3915
 
3226
3916
  t.elem = this.elem;
3227
3917
 
3228
- jQuery.timers.push(t);
3229
-
3230
- if ( jQuery.timerId == null ) {
3231
- jQuery.timerId = setInterval(function(){
3918
+ if ( t() && jQuery.timers.push(t) == 1 ) {
3919
+ timerId = setInterval(function(){
3232
3920
  var timers = jQuery.timers;
3233
3921
 
3234
3922
  for ( var i = 0; i < timers.length; i++ )
@@ -3236,8 +3924,7 @@ jQuery.fx.prototype = {
3236
3924
  timers.splice(i--, 1);
3237
3925
 
3238
3926
  if ( !timers.length ) {
3239
- clearInterval( jQuery.timerId );
3240
- jQuery.timerId = null;
3927
+ clearInterval( timerId );
3241
3928
  }
3242
3929
  }, 13);
3243
3930
  }
@@ -3250,12 +3937,9 @@ jQuery.fx.prototype = {
3250
3937
  this.options.show = true;
3251
3938
 
3252
3939
  // Begin the animation
3253
- this.custom(0, this.cur());
3254
-
3255
3940
  // Make sure that we start at a small width/height to avoid any
3256
3941
  // flash of content
3257
- if ( this.prop == "width" || this.prop == "height" )
3258
- this.elem.style[this.prop] = "1px";
3942
+ this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
3259
3943
 
3260
3944
  // Start by showing the element
3261
3945
  jQuery(this.elem).show();
@@ -3275,7 +3959,7 @@ jQuery.fx.prototype = {
3275
3959
  step: function(gotoEnd){
3276
3960
  var t = now();
3277
3961
 
3278
- if ( gotoEnd || t > this.options.duration + this.startTime ) {
3962
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
3279
3963
  this.now = this.end;
3280
3964
  this.pos = this.state = 1;
3281
3965
  this.update();
@@ -3300,17 +3984,16 @@ jQuery.fx.prototype = {
3300
3984
 
3301
3985
  // Hide the element if the "hide" operation was done
3302
3986
  if ( this.options.hide )
3303
- this.elem.style.display = "none";
3987
+ jQuery(this.elem).hide();
3304
3988
 
3305
3989
  // Reset the properties, if the item has been hidden or shown
3306
3990
  if ( this.options.hide || this.options.show )
3307
3991
  for ( var p in this.options.curAnim )
3308
3992
  jQuery.attr(this.elem.style, p, this.options.orig[p]);
3309
- }
3310
-
3311
- if ( done )
3993
+
3312
3994
  // Execute the complete function
3313
3995
  this.options.complete.call( this.elem );
3996
+ }
3314
3997
 
3315
3998
  return false;
3316
3999
  } else {
@@ -3335,124 +4018,106 @@ jQuery.extend( jQuery.fx, {
3335
4018
  slow: 600,
3336
4019
  fast: 200,
3337
4020
  // Default speed
3338
- def: 400
4021
+ _default: 400
3339
4022
  },
3340
4023
  step: {
3341
- scrollLeft: function(fx){
3342
- fx.elem.scrollLeft = fx.now;
3343
- },
3344
-
3345
- scrollTop: function(fx){
3346
- fx.elem.scrollTop = fx.now;
3347
- },
3348
4024
 
3349
4025
  opacity: function(fx){
3350
4026
  jQuery.attr(fx.elem.style, "opacity", fx.now);
3351
4027
  },
3352
4028
 
3353
4029
  _default: function(fx){
3354
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
4030
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
4031
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
4032
+ else
4033
+ fx.elem[ fx.prop ] = fx.now;
3355
4034
  }
3356
4035
  }
3357
4036
  });
3358
- // The Offset Method
3359
- // Originally By Brandon Aaron, part of the Dimension Plugin
3360
- // http://jquery.com/plugins/project/dimensions
3361
- jQuery.fn.offset = function() {
3362
- var left = 0, top = 0, elem = this[0], results;
3363
-
3364
- if ( elem ) with ( jQuery.browser ) {
3365
- var parent = elem.parentNode,
3366
- offsetChild = elem,
3367
- offsetParent = elem.offsetParent,
3368
- doc = elem.ownerDocument,
3369
- safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
3370
- css = jQuery.curCSS,
3371
- fixed = css(elem, "position") == "fixed";
3372
-
3373
- // Use getBoundingClientRect if available
3374
- if ( elem.getBoundingClientRect ) {
3375
- var box = elem.getBoundingClientRect();
3376
-
3377
- // Add the document scroll offsets
3378
- add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
3379
- box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
3380
-
3381
- // IE adds the HTML element's border, by default it is medium which is 2px
3382
- // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
3383
- // IE 7 standards mode, the border is always 2px
3384
- // This border/offset is typically represented by the clientLeft and clientTop properties
3385
- // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
3386
- // Therefore this method will be off by 2px in IE while in quirksmode
3387
- add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
3388
-
3389
- // Otherwise loop through the offsetParents and parentNodes
3390
- } else {
3391
-
3392
- // Initial element offsets
3393
- add( elem.offsetLeft, elem.offsetTop );
3394
-
3395
- // Get parent offsets
3396
- while ( offsetParent ) {
3397
- // Add offsetParent offsets
3398
- add( offsetParent.offsetLeft, offsetParent.offsetTop );
4037
+ if ( document.documentElement["getBoundingClientRect"] )
4038
+ jQuery.fn.offset = function() {
4039
+ if ( !this[0] ) return { top: 0, left: 0 };
4040
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
4041
+ var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
4042
+ clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
4043
+ top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
4044
+ left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
4045
+ return { top: top, left: left };
4046
+ };
4047
+ else
4048
+ jQuery.fn.offset = function() {
4049
+ if ( !this[0] ) return { top: 0, left: 0 };
4050
+ if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
4051
+ jQuery.offset.initialized || jQuery.offset.initialize();
4052
+
4053
+ var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
4054
+ doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
4055
+ body = doc.body, defaultView = doc.defaultView,
4056
+ prevComputedStyle = defaultView.getComputedStyle(elem, null),
4057
+ top = elem.offsetTop, left = elem.offsetLeft;
4058
+
4059
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
4060
+ computedStyle = defaultView.getComputedStyle(elem, null);
4061
+ top -= elem.scrollTop, left -= elem.scrollLeft;
4062
+ if ( elem === offsetParent ) {
4063
+ top += elem.offsetTop, left += elem.offsetLeft;
4064
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
4065
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
4066
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
4067
+ prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
4068
+ }
4069
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
4070
+ top += parseInt( computedStyle.borderTopWidth, 10) || 0,
4071
+ left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
4072
+ prevComputedStyle = computedStyle;
4073
+ }
3399
4074
 
3400
- // Mozilla and Safari > 2 does not include the border on offset parents
3401
- // However Mozilla adds the border for table or table cells
3402
- if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
3403
- border( offsetParent );
4075
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
4076
+ top += body.offsetTop,
4077
+ left += body.offsetLeft;
3404
4078
 
3405
- // Add the document scroll offsets if position is fixed on any offsetParent
3406
- if ( !fixed && css(offsetParent, "position") == "fixed" )
3407
- fixed = true;
4079
+ if ( prevComputedStyle.position === "fixed" )
4080
+ top += Math.max(docElem.scrollTop, body.scrollTop),
4081
+ left += Math.max(docElem.scrollLeft, body.scrollLeft);
3408
4082
 
3409
- // Set offsetChild to previous offsetParent unless it is the body element
3410
- offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
3411
- // Get next offsetParent
3412
- offsetParent = offsetParent.offsetParent;
3413
- }
4083
+ return { top: top, left: left };
4084
+ };
3414
4085
 
3415
- // Get parent scroll offsets
3416
- while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
3417
- // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
3418
- if ( !/^inline|table.*$/i.test(css(parent, "display")) )
3419
- // Subtract parent scroll offsets
3420
- add( -parent.scrollLeft, -parent.scrollTop );
4086
+ jQuery.offset = {
4087
+ initialize: function() {
4088
+ if ( this.initialized ) return;
4089
+ var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
4090
+ html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
3421
4091
 
3422
- // Mozilla does not add the border for a parent that has overflow != visible
3423
- if ( mozilla && css(parent, "overflow") != "visible" )
3424
- border( parent );
4092
+ rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
4093
+ for ( prop in rules ) container.style[prop] = rules[prop];
3425
4094
 
3426
- // Get next parent
3427
- parent = parent.parentNode;
3428
- }
4095
+ container.innerHTML = html;
4096
+ body.insertBefore(container, body.firstChild);
4097
+ innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
3429
4098
 
3430
- // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
3431
- // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
3432
- if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
3433
- (mozilla && css(offsetChild, "position") != "absolute") )
3434
- add( -doc.body.offsetLeft, -doc.body.offsetTop );
4099
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
4100
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
3435
4101
 
3436
- // Add the document scroll offsets if position is fixed
3437
- if ( fixed )
3438
- add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
3439
- Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
3440
- }
4102
+ innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
4103
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
3441
4104
 
3442
- // Return an object with top and left properties
3443
- results = { top: top, left: left };
3444
- }
4105
+ body.style.marginTop = '1px';
4106
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
4107
+ body.style.marginTop = bodyMarginTop;
3445
4108
 
3446
- function border(elem) {
3447
- add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
3448
- }
4109
+ body.removeChild(container);
4110
+ this.initialized = true;
4111
+ },
3449
4112
 
3450
- function add(l, t) {
3451
- left += parseInt(l, 10) || 0;
3452
- top += parseInt(t, 10) || 0;
4113
+ bodyOffset: function(body) {
4114
+ jQuery.offset.initialized || jQuery.offset.initialize();
4115
+ var top = body.offsetTop, left = body.offsetLeft;
4116
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
4117
+ top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
4118
+ left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
4119
+ return { top: top, left: left };
3453
4120
  }
3454
-
3455
- return results;
3456
4121
  };
3457
4122
 
3458
4123
 
@@ -3471,11 +4136,11 @@ jQuery.fn.extend({
3471
4136
  // Subtract element margins
3472
4137
  // note: when an element has margin: auto the offsetLeft and marginLeft
3473
4138
  // are the same in Safari causing offset.left to incorrectly be 0
3474
- offset.top -= num( this, 'marginTop' );
4139
+ offset.top -= num( this, 'marginTop' );
3475
4140
  offset.left -= num( this, 'marginLeft' );
3476
4141
 
3477
4142
  // Add offsetParent borders
3478
- parentOffset.top += num( offsetParent, 'borderTopWidth' );
4143
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
3479
4144
  parentOffset.left += num( offsetParent, 'borderLeftWidth' );
3480
4145
 
3481
4146
  // Subtract the two offsets
@@ -3489,7 +4154,7 @@ jQuery.fn.extend({
3489
4154
  },
3490
4155
 
3491
4156
  offsetParent: function() {
3492
- var offsetParent = this[0].offsetParent;
4157
+ var offsetParent = this[0].offsetParent || document.body;
3493
4158
  while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
3494
4159
  offsetParent = offsetParent.offsetParent;
3495
4160
  return jQuery(offsetParent);
@@ -3502,9 +4167,9 @@ jQuery.each( ['Left', 'Top'], function(i, name) {
3502
4167
  var method = 'scroll' + name;
3503
4168
 
3504
4169
  jQuery.fn[ method ] = function(val) {
3505
- if (!this[0]) return;
4170
+ if (!this[0]) return null;
3506
4171
 
3507
- return val != undefined ?
4172
+ return val !== undefined ?
3508
4173
 
3509
4174
  // Set the scroll offset
3510
4175
  this.each(function() {
@@ -3545,5 +4210,32 @@ jQuery.each([ "Height", "Width" ], function(i, name){
3545
4210
  (margin ?
3546
4211
  num(this, "margin" + tl) + num(this, "margin" + br) : 0);
3547
4212
  };
4213
+
4214
+ var type = name.toLowerCase();
4215
+
4216
+ jQuery.fn[ type ] = function( size ) {
4217
+ // Get window width or height
4218
+ return this[0] == window ?
4219
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
4220
+ document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
4221
+ document.body[ "client" + name ] :
4222
+
4223
+ // Get document width or height
4224
+ this[0] == document ?
4225
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
4226
+ Math.max(
4227
+ document.documentElement["client" + name],
4228
+ document.body["scroll" + name], document.documentElement["scroll" + name],
4229
+ document.body["offset" + name], document.documentElement["offset" + name]
4230
+ ) :
4231
+
4232
+ // Get or set width or height on the element
4233
+ size === undefined ?
4234
+ // Get width or height on the element
4235
+ (this.length ? jQuery.css( this[0], type ) : null) :
4236
+
4237
+ // Set the width or height on the element (default to pixels if value is unitless)
4238
+ this.css( type, typeof size === "string" ? size : size + "px" );
4239
+ };
3548
4240
 
3549
4241
  });})();