merb_screw_unit 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ GEM_EMAIL = "ykatz@engineyard.com"
18
18
 
19
19
  GEM_NAME = "merb_screw_unit"
20
20
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
21
- GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.7") + PKG_BUILD
21
+ GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.8") + PKG_BUILD
22
22
 
23
23
  RELEASE_NAME = "REL #{GEM_VERSION}"
24
24
 
@@ -36,8 +36,8 @@ spec = Gem::Specification.new do |s|
36
36
  s.author = GEM_AUTHOR
37
37
  s.email = GEM_EMAIL
38
38
  s.homepage = PROJECT_URL
39
- s.add_dependency('merb-core', '>= 0.9.7')
40
- s.add_dependency('merb-slices', '>= 0.9.7')
39
+ s.add_dependency('merb-core', '>= 0.9.8')
40
+ s.add_dependency('merb-slices', '>= 0.9.8')
41
41
  s.require_path = 'lib'
42
42
  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec,app,public,stubs}/**/*")
43
43
  end
@@ -46,25 +46,34 @@ Rake::GemPackageTask.new(spec) do |pkg|
46
46
  pkg.gem_spec = spec
47
47
  end
48
48
 
49
- desc "create a gemspec file"
50
- task :make_spec do
51
- File.open("#{NAME}.gemspec", "w") do |file|
52
- file.puts spec.to_ruby
53
- end
49
+ desc "Install the gem"
50
+ task :install do
51
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
54
52
  end
55
53
 
56
- ##############################################################################
57
- # Installation
58
- ##############################################################################
54
+ desc "Uninstall the gem"
55
+ task :uninstall do
56
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
57
+ end
59
58
 
60
- desc "Install the gem"
61
- task :install => [:package] do
62
- sh install_command(GEM_NAME, GEM_VERSION)
59
+ desc "Create a gemspec file"
60
+ task :gemspec do
61
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
62
+ file.puts spec.to_ruby
63
+ end
63
64
  end
64
65
 
65
- namespace :jruby do
66
- "Run :package and install the resulting .gem with jruby"
67
- task :install => :package do
68
- sh jinstall_command(GEM_NAME, GEM_VERSION)
66
+ desc "Run all examples (or a specific spec with TASK=xxxx)"
67
+ Spec::Rake::SpecTask.new('spec') do |t|
68
+ t.spec_opts = ["-cfs"]
69
+ t.spec_files = begin
70
+ if ENV["TASK"]
71
+ ENV["TASK"].split(',').map { |task| "spec/**/#{task}_spec.rb" }
72
+ else
73
+ FileList['spec/**/*_spec.rb']
74
+ end
69
75
  end
70
76
  end
77
+
78
+ desc 'Default: run spec examples'
79
+ task :default => 'spec'
@@ -1,37 +1,34 @@
1
1
  (function(){
2
2
  /*
3
- * jQuery 1.2.3 - New Wave Javascript
3
+ * jQuery 1.2.6 - New Wave Javascript
4
4
  *
5
5
  * Copyright (c) 2008 John Resig (jquery.com)
6
6
  * Dual licensed under the MIT (MIT-LICENSE.txt)
7
7
  * and GPL (GPL-LICENSE.txt) licenses.
8
8
  *
9
- * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
10
- * $Rev: 4663 $
9
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
10
+ * $Rev: 5685 $
11
11
  */
12
12
 
13
13
  // Map over jQuery in case of overwrite
14
- if ( window.jQuery )
15
- var _jQuery = window.jQuery;
14
+ var _jQuery = window.jQuery,
15
+ // Map over the $ in case of overwrite
16
+ _$ = window.$;
16
17
 
17
- var jQuery = window.jQuery = function( selector, context ) {
18
+ var jQuery = window.jQuery = window.$ = function( selector, context ) {
18
19
  // The jQuery object is actually just the init constructor 'enhanced'
19
- return new jQuery.prototype.init( selector, context );
20
+ return new jQuery.fn.init( selector, context );
20
21
  };
21
22
 
22
- // Map over the $ in case of overwrite
23
- if ( window.$ )
24
- var _$ = window.$;
25
-
26
- // Map the jQuery namespace to the '$' one
27
- window.$ = jQuery;
28
-
29
23
  // A simple way to check for HTML strings or ID strings
30
24
  // (both of which we optimize for)
31
- var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
25
+ var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
32
26
 
33
27
  // Is it a simple selector
34
- var isSimple = /^.[^:#\[\.]*$/;
28
+ isSimple = /^.[^:#\[\.]*$/,
29
+
30
+ // Will speed up references to undefined, and allows munging its name.
31
+ undefined;
35
32
 
36
33
  jQuery.fn = jQuery.prototype = {
37
34
  init: function( selector, context ) {
@@ -43,9 +40,9 @@ jQuery.fn = jQuery.prototype = {
43
40
  this[0] = selector;
44
41
  this.length = 1;
45
42
  return this;
46
-
43
+ }
47
44
  // Handle HTML strings
48
- } else if ( typeof selector == "string" ) {
45
+ if ( typeof selector == "string" ) {
49
46
  // Are we dealing with HTML string or an ID?
50
47
  var match = quickExpr.exec( selector );
51
48
 
@@ -61,53 +58,39 @@ jQuery.fn = jQuery.prototype = {
61
58
  var elem = document.getElementById( match[3] );
62
59
 
63
60
  // Make sure an element was located
64
- if ( elem )
61
+ if ( elem ){
65
62
  // Handle the case where IE and Opera return items
66
63
  // by name instead of ID
67
64
  if ( elem.id != match[3] )
68
65
  return jQuery().find( selector );
69
66
 
70
67
  // Otherwise, we inject the element directly into the jQuery object
71
- else {
72
- this[0] = elem;
73
- this.length = 1;
74
- return this;
75
- }
76
-
77
- else
78
- selector = [];
68
+ return jQuery( elem );
69
+ }
70
+ selector = [];
79
71
  }
80
72
 
81
73
  // HANDLE: $(expr, [context])
82
74
  // (which is just equivalent to: $(content).find(expr)
83
75
  } else
84
- return new jQuery( context ).find( selector );
76
+ return jQuery( context ).find( selector );
85
77
 
86
78
  // HANDLE: $(function)
87
79
  // Shortcut for document ready
88
80
  } else if ( jQuery.isFunction( selector ) )
89
- return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
81
+ return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
90
82
 
91
- return this.setArray(
92
- // HANDLE: $(array)
93
- selector.constructor == Array && selector ||
94
-
95
- // HANDLE: $(arraylike)
96
- // Watch for when an array-like object, contains DOM nodes, is passed in as the selector
97
- (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
98
-
99
- // HANDLE: $(*)
100
- [ selector ] );
83
+ return this.setArray(jQuery.makeArray(selector));
101
84
  },
102
-
85
+
103
86
  // The current version of jQuery being used
104
- jquery: "1.2.3",
87
+ jquery: "1.2.6",
105
88
 
106
89
  // The number of elements contained in the matched element set
107
90
  size: function() {
108
91
  return this.length;
109
92
  },
110
-
93
+
111
94
  // The number of elements contained in the matched element set
112
95
  length: 0,
113
96
 
@@ -122,7 +105,7 @@ jQuery.fn = jQuery.prototype = {
122
105
  // Return just the object
123
106
  this[ num ];
124
107
  },
125
-
108
+
126
109
  // Take an array of elements and push it onto the stack
127
110
  // (returning the new matched element set)
128
111
  pushStack: function( elems ) {
@@ -135,7 +118,7 @@ jQuery.fn = jQuery.prototype = {
135
118
  // Return the newly-formed element set
136
119
  return ret;
137
120
  },
138
-
121
+
139
122
  // Force the current matched set of elements to become
140
123
  // the specified array of elements (destroying the stack in the process)
141
124
  // You should use pushStack() in order to do this, but maintain the stack
@@ -144,7 +127,7 @@ jQuery.fn = jQuery.prototype = {
144
127
  // is a super-fast way to populate an object with array-like properties
145
128
  this.length = 0;
146
129
  Array.prototype.push.apply( this, elems );
147
-
130
+
148
131
  return this;
149
132
  },
150
133
 
@@ -155,33 +138,31 @@ jQuery.fn = jQuery.prototype = {
155
138
  return jQuery.each( this, callback, args );
156
139
  },
157
140
 
158
- // Determine the position of an element within
141
+ // Determine the position of an element within
159
142
  // the matched set of elements
160
143
  index: function( elem ) {
161
144
  var ret = -1;
162
145
 
163
146
  // Locate the position of the desired element
164
- this.each(function(i){
165
- if ( this == elem )
166
- ret = i;
167
- });
168
-
169
- return ret;
147
+ return jQuery.inArray(
148
+ // If it receives a jQuery object, the first element is used
149
+ elem && elem.jquery ? elem[0] : elem
150
+ , this );
170
151
  },
171
152
 
172
153
  attr: function( name, value, type ) {
173
154
  var options = name;
174
-
155
+
175
156
  // Look for the case where we're accessing a style value
176
157
  if ( name.constructor == String )
177
- if ( value == undefined )
178
- return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
158
+ if ( value === undefined )
159
+ return this[0] && jQuery[ type || "attr" ]( this[0], name );
179
160
 
180
161
  else {
181
162
  options = {};
182
163
  options[ name ] = value;
183
164
  }
184
-
165
+
185
166
  // Check to see if we're setting style values
186
167
  return this.each(function(i){
187
168
  // Set all the styles
@@ -264,7 +245,7 @@ jQuery.fn = jQuery.prototype = {
264
245
  this.insertBefore( elem, this.firstChild );
265
246
  });
266
247
  },
267
-
248
+
268
249
  before: function() {
269
250
  return this.domManip(arguments, false, false, function(elem){
270
251
  this.parentNode.insertBefore( elem, this );
@@ -299,8 +280,8 @@ jQuery.fn = jQuery.prototype = {
299
280
  // using cloneNode. Calling detachEvent on the
300
281
  // clone will also remove the events from the orignal
301
282
  // In order to get around this, we use innerHTML.
302
- // Unfortunately, this means some modifications to
303
- // attributes in IE that are actually only stored
283
+ // Unfortunately, this means some modifications to
284
+ // attributes in IE that are actually only stored
304
285
  // as properties will not be copied (such as the
305
286
  // the name attribute on an input).
306
287
  var clone = this.cloneNode(true),
@@ -318,7 +299,7 @@ jQuery.fn = jQuery.prototype = {
318
299
  if ( this[ expando ] != undefined )
319
300
  this[ expando ] = null;
320
301
  });
321
-
302
+
322
303
  // Copy the events from the original to the clone
323
304
  if ( events === true )
324
305
  this.find("*").andSelf().each(function(i){
@@ -360,24 +341,22 @@ jQuery.fn = jQuery.prototype = {
360
341
  },
361
342
 
362
343
  add: function( selector ) {
363
- return !selector ? this : this.pushStack( jQuery.merge(
344
+ return this.pushStack( jQuery.unique( jQuery.merge(
364
345
  this.get(),
365
- selector.constructor == String ?
366
- jQuery( selector ).get() :
367
- selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
368
- selector : [selector] ) );
346
+ typeof selector == 'string' ?
347
+ jQuery( selector ) :
348
+ jQuery.makeArray( selector )
349
+ )));
369
350
  },
370
351
 
371
352
  is: function( selector ) {
372
- return selector ?
373
- jQuery.multiFilter( selector, this ).length > 0 :
374
- false;
353
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
375
354
  },
376
355
 
377
356
  hasClass: function( selector ) {
378
357
  return this.is( "." + selector );
379
358
  },
380
-
359
+
381
360
  val: function( value ) {
382
361
  if ( value == undefined ) {
383
362
 
@@ -390,7 +369,7 @@ jQuery.fn = jQuery.prototype = {
390
369
  values = [],
391
370
  options = elem.options,
392
371
  one = elem.type == "select-one";
393
-
372
+
394
373
  // Nothing was selected
395
374
  if ( index < 0 )
396
375
  return null;
@@ -402,18 +381,18 @@ jQuery.fn = jQuery.prototype = {
402
381
  if ( option.selected ) {
403
382
  // Get the specifc value for the option
404
383
  value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
405
-
384
+
406
385
  // We don't need an array for one selects
407
386
  if ( one )
408
387
  return value;
409
-
388
+
410
389
  // Multi-Selects return an array
411
390
  values.push( value );
412
391
  }
413
392
  }
414
-
393
+
415
394
  return values;
416
-
395
+
417
396
  // Everything else, we just grab the value
418
397
  } else
419
398
  return (this[0].value || "").replace(/\r/g, "");
@@ -423,6 +402,9 @@ jQuery.fn = jQuery.prototype = {
423
402
  return undefined;
424
403
  }
425
404
 
405
+ if( value.constructor == Number )
406
+ value += '';
407
+
426
408
  return this.each(function(){
427
409
  if ( this.nodeType != 1 )
428
410
  return;
@@ -432,9 +414,7 @@ jQuery.fn = jQuery.prototype = {
432
414
  jQuery.inArray(this.name, value) >= 0);
433
415
 
434
416
  else if ( jQuery.nodeName( this, "select" ) ) {
435
- var values = value.constructor == Array ?
436
- value :
437
- [ value ];
417
+ var values = jQuery.makeArray(value);
438
418
 
439
419
  jQuery( "option", this ).each(function(){
440
420
  this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
@@ -448,10 +428,10 @@ jQuery.fn = jQuery.prototype = {
448
428
  this.value = value;
449
429
  });
450
430
  },
451
-
431
+
452
432
  html: function( value ) {
453
433
  return value == undefined ?
454
- (this.length ?
434
+ (this[0] ?
455
435
  this[0].innerHTML :
456
436
  null) :
457
437
  this.empty().append( value );
@@ -483,13 +463,13 @@ jQuery.fn = jQuery.prototype = {
483
463
  var parts = key.split(".");
484
464
  parts[1] = parts[1] ? "." + parts[1] : "";
485
465
 
486
- if ( value == null ) {
466
+ if ( value === undefined ) {
487
467
  var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
488
-
489
- if ( data == undefined && this.length )
468
+
469
+ if ( data === undefined && this.length )
490
470
  data = jQuery.data( this[0], key );
491
471
 
492
- return data == null && parts[1] ?
472
+ return data === undefined && parts[1] ?
493
473
  this.data( parts[0] ) :
494
474
  data;
495
475
  } else
@@ -503,9 +483,9 @@ jQuery.fn = jQuery.prototype = {
503
483
  jQuery.removeData( this, key );
504
484
  });
505
485
  },
506
-
486
+
507
487
  domManip: function( args, table, reverse, callback ) {
508
- var clone = this.length > 1, elems;
488
+ var clone = this.length > 1, elems;
509
489
 
510
490
  return this.each(function(){
511
491
  if ( !elems ) {
@@ -528,9 +508,9 @@ jQuery.fn = jQuery.prototype = {
528
508
  this;
529
509
 
530
510
  // execute all scripts after the elements have been injected
531
- if ( jQuery.nodeName( elem, "script" ) ) {
511
+ if ( jQuery.nodeName( elem, "script" ) )
532
512
  scripts = scripts.add( elem );
533
- } else {
513
+ else {
534
514
  // Remove any inner scripts for later evaluation
535
515
  if ( elem.nodeType == 1 )
536
516
  scripts = scripts.add( jQuery( "script", elem ).remove() );
@@ -546,7 +526,7 @@ jQuery.fn = jQuery.prototype = {
546
526
  };
547
527
 
548
528
  // Give the init function the jQuery prototype for later instantiation
549
- jQuery.prototype.init.prototype = jQuery.prototype;
529
+ jQuery.fn.init.prototype = jQuery.fn;
550
530
 
551
531
  function evalScript( i, elem ) {
552
532
  if ( elem.src )
@@ -563,6 +543,10 @@ function evalScript( i, elem ) {
563
543
  elem.parentNode.removeChild( elem );
564
544
  }
565
545
 
546
+ function now(){
547
+ return +new Date;
548
+ }
549
+
566
550
  jQuery.extend = jQuery.fn.extend = function() {
567
551
  // copy reference to target object
568
552
  var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
@@ -580,9 +564,9 @@ jQuery.extend = jQuery.fn.extend = function() {
580
564
  target = {};
581
565
 
582
566
  // extend jQuery itself if only one argument is passed
583
- if ( length == 1 ) {
567
+ if ( length == i ) {
584
568
  target = this;
585
- i = 0;
569
+ --i;
586
570
  }
587
571
 
588
572
  for ( ; i < length; i++ )
@@ -590,17 +574,22 @@ jQuery.extend = jQuery.fn.extend = function() {
590
574
  if ( (options = arguments[ i ]) != null )
591
575
  // Extend the base object
592
576
  for ( var name in options ) {
577
+ var src = target[ name ], copy = options[ name ];
578
+
593
579
  // Prevent never-ending loop
594
- if ( target === options[ name ] )
580
+ if ( target === copy )
595
581
  continue;
596
582
 
597
583
  // Recurse if we're merging object values
598
- if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType )
599
- target[ name ] = jQuery.extend( target[ name ], options[ name ] );
584
+ if ( deep && copy && typeof copy == "object" && !copy.nodeType )
585
+ target[ name ] = jQuery.extend( deep,
586
+ // Never move original objects, clone them
587
+ src || ( copy.length != null ? [ ] : { } )
588
+ , copy );
600
589
 
601
590
  // Don't bring in undefined values
602
- else if ( options[ name ] != undefined )
603
- target[ name ] = options[ name ];
591
+ else if ( copy !== undefined )
592
+ target[ name ] = copy;
604
593
 
605
594
  }
606
595
 
@@ -608,10 +597,11 @@ jQuery.extend = jQuery.fn.extend = function() {
608
597
  return target;
609
598
  };
610
599
 
611
- var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
612
-
613
- // exclude the following css properties to add px
614
- var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
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,
603
+ // cache defaultView
604
+ defaultView = document.defaultView || {};
615
605
 
616
606
  jQuery.extend({
617
607
  noConflict: function( deep ) {
@@ -625,10 +615,10 @@ jQuery.extend({
625
615
 
626
616
  // See test/unit/core.js for details concerning this function.
627
617
  isFunction: function( fn ) {
628
- return !!fn && typeof fn != "string" && !fn.nodeName &&
629
- fn.constructor != Array && /function/i.test( fn + "" );
618
+ return !!fn && typeof fn != "string" && !fn.nodeName &&
619
+ fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
630
620
  },
631
-
621
+
632
622
  // check if an element is in a (or is an) XML document
633
623
  isXMLDoc: function( elem ) {
634
624
  return elem.documentElement && !elem.body ||
@@ -651,7 +641,9 @@ jQuery.extend({
651
641
  else
652
642
  script.appendChild( document.createTextNode( data ) );
653
643
 
654
- head.appendChild( script );
644
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
645
+ // This arises when a base node is used (#2709).
646
+ head.insertBefore( script, head.firstChild );
655
647
  head.removeChild( script );
656
648
  }
657
649
  },
@@ -659,9 +651,9 @@ jQuery.extend({
659
651
  nodeName: function( elem, name ) {
660
652
  return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
661
653
  },
662
-
654
+
663
655
  cache: {},
664
-
656
+
665
657
  data: function( elem, name, data ) {
666
658
  elem = elem == window ?
667
659
  windowData :
@@ -670,24 +662,24 @@ jQuery.extend({
670
662
  var id = elem[ expando ];
671
663
 
672
664
  // Compute a unique ID for the element
673
- if ( !id )
665
+ if ( !id )
674
666
  id = elem[ expando ] = ++uuid;
675
667
 
676
668
  // Only generate the data cache if we're
677
669
  // trying to access or manipulate it
678
670
  if ( name && !jQuery.cache[ id ] )
679
671
  jQuery.cache[ id ] = {};
680
-
672
+
681
673
  // Prevent overriding the named cache with undefined values
682
- if ( data != undefined )
674
+ if ( data !== undefined )
683
675
  jQuery.cache[ id ][ name ] = data;
684
-
685
- // Return the named cache data, or the ID for the element
676
+
677
+ // Return the named cache data, or the ID for the element
686
678
  return name ?
687
679
  jQuery.cache[ id ][ name ] :
688
680
  id;
689
681
  },
690
-
682
+
691
683
  removeData: function( elem, name ) {
692
684
  elem = elem == window ?
693
685
  windowData :
@@ -730,39 +722,41 @@ jQuery.extend({
730
722
 
731
723
  // args is for internal usage only
732
724
  each: function( object, callback, args ) {
725
+ var name, i = 0, length = object.length;
726
+
733
727
  if ( args ) {
734
- if ( object.length == undefined ) {
735
- for ( var name in object )
728
+ if ( length == undefined ) {
729
+ for ( name in object )
736
730
  if ( callback.apply( object[ name ], args ) === false )
737
731
  break;
738
732
  } else
739
- for ( var i = 0, length = object.length; i < length; i++ )
740
- if ( callback.apply( object[ i ], args ) === false )
733
+ for ( ; i < length; )
734
+ if ( callback.apply( object[ i++ ], args ) === false )
741
735
  break;
742
736
 
743
737
  // A special, fast, case for the most common use of each
744
738
  } else {
745
- if ( object.length == undefined ) {
746
- for ( var name in object )
739
+ if ( length == undefined ) {
740
+ for ( name in object )
747
741
  if ( callback.call( object[ name ], name, object[ name ] ) === false )
748
742
  break;
749
743
  } else
750
- for ( var i = 0, length = object.length, value = object[0];
744
+ for ( var value = object[0];
751
745
  i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
752
746
  }
753
747
 
754
748
  return object;
755
749
  },
756
-
750
+
757
751
  prop: function( elem, value, type, i, name ) {
758
- // Handle executable functions
759
- if ( jQuery.isFunction( value ) )
760
- value = value.call( elem, i );
761
-
762
- // Handle passing in a number to a CSS property
763
- return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
764
- value + "px" :
765
- value;
752
+ // Handle executable functions
753
+ if ( jQuery.isFunction( value ) )
754
+ value = value.call( elem, i );
755
+
756
+ // Handle passing in a number to a CSS property
757
+ return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
758
+ value + "px" :
759
+ value;
766
760
  },
767
761
 
768
762
  className: {
@@ -779,12 +773,12 @@ jQuery.extend({
779
773
  if (elem.nodeType == 1)
780
774
  elem.className = classNames != undefined ?
781
775
  jQuery.grep(elem.className.split(/\s+/), function(className){
782
- return !jQuery.className.has( classNames, className );
776
+ return !jQuery.className.has( classNames, className );
783
777
  }).join(" ") :
784
778
  "";
785
779
  },
786
780
 
787
- // internal only, use is(".class")
781
+ // internal only, use hasClass("class")
788
782
  has: function( elem, className ) {
789
783
  return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
790
784
  }
@@ -809,7 +803,7 @@ jQuery.extend({
809
803
  css: function( elem, name, force ) {
810
804
  if ( name == "width" || name == "height" ) {
811
805
  var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
812
-
806
+
813
807
  function getWH() {
814
808
  val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
815
809
  var padding = 0, border = 0;
@@ -819,33 +813,34 @@ jQuery.extend({
819
813
  });
820
814
  val -= Math.round(padding + border);
821
815
  }
822
-
816
+
823
817
  if ( jQuery(elem).is(":visible") )
824
818
  getWH();
825
819
  else
826
820
  jQuery.swap( elem, props, getWH );
827
-
821
+
828
822
  return Math.max(0, val);
829
823
  }
830
-
824
+
831
825
  return jQuery.curCSS( elem, name, force );
832
826
  },
833
827
 
834
828
  curCSS: function( elem, name, force ) {
835
- var ret;
829
+ var ret, style = elem.style;
836
830
 
837
831
  // A helper method for determining if an element's values are broken
838
832
  function color( elem ) {
839
833
  if ( !jQuery.browser.safari )
840
834
  return false;
841
835
 
842
- var ret = document.defaultView.getComputedStyle( elem, null );
836
+ // defaultView is cached
837
+ var ret = defaultView.getComputedStyle( elem, null );
843
838
  return !ret || ret.getPropertyValue("color") == "";
844
839
  }
845
840
 
846
841
  // We need to handle opacity special in IE
847
842
  if ( name == "opacity" && jQuery.browser.msie ) {
848
- ret = jQuery.attr( elem.style, "opacity" );
843
+ ret = jQuery.attr( style, "opacity" );
849
844
 
850
845
  return ret == "" ?
851
846
  "1" :
@@ -853,19 +848,19 @@ jQuery.extend({
853
848
  }
854
849
  // Opera sometimes will give the wrong display answer, this fixes it, see #2037
855
850
  if ( jQuery.browser.opera && name == "display" ) {
856
- var save = elem.style.outline;
857
- elem.style.outline = "0 solid black";
858
- elem.style.outline = save;
851
+ var save = style.outline;
852
+ style.outline = "0 solid black";
853
+ style.outline = save;
859
854
  }
860
-
855
+
861
856
  // Make sure we're using the right name for getting the float value
862
857
  if ( name.match( /float/i ) )
863
858
  name = styleFloat;
864
859
 
865
- if ( !force && elem.style && elem.style[ name ] )
866
- ret = elem.style[ name ];
860
+ if ( !force && style && style[ name ] )
861
+ ret = style[ name ];
867
862
 
868
- else if ( document.defaultView && document.defaultView.getComputedStyle ) {
863
+ else if ( defaultView.getComputedStyle ) {
869
864
 
870
865
  // Only "float" is needed here
871
866
  if ( name.match( /float/i ) )
@@ -873,23 +868,23 @@ jQuery.extend({
873
868
 
874
869
  name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
875
870
 
876
- var getComputedStyle = document.defaultView.getComputedStyle( elem, null );
871
+ var computedStyle = defaultView.getComputedStyle( elem, null );
877
872
 
878
- if ( getComputedStyle && !color( elem ) )
879
- ret = getComputedStyle.getPropertyValue( name );
873
+ if ( computedStyle && !color( elem ) )
874
+ ret = computedStyle.getPropertyValue( name );
880
875
 
881
876
  // If the element isn't reporting its values properly in Safari
882
877
  // then some display: none elements are involved
883
878
  else {
884
- var swap = [], stack = [];
879
+ var swap = [], stack = [], a = elem, i = 0;
885
880
 
886
881
  // Locate all of the parent display: none elements
887
- for ( var a = elem; a && color(a); a = a.parentNode )
882
+ for ( ; a && color(a); a = a.parentNode )
888
883
  stack.unshift(a);
889
884
 
890
885
  // Go through and make them visible, but in reverse
891
886
  // (It would be better if we knew the exact display type that they had)
892
- for ( var i = 0; i < stack.length; i++ )
887
+ for ( ; i < stack.length; i++ )
893
888
  if ( color( stack[ i ] ) ) {
894
889
  swap[ i ] = stack[ i ].style.display;
895
890
  stack[ i ].style.display = "block";
@@ -899,10 +894,10 @@ jQuery.extend({
899
894
  // one special, otherwise get the value
900
895
  ret = name == "display" && swap[ stack.length - 1 ] != null ?
901
896
  "none" :
902
- ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || "";
897
+ ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
903
898
 
904
899
  // Finally, revert the display styles back
905
- for ( var i = 0; i < swap.length; i++ )
900
+ for ( i = 0; i < swap.length; i++ )
906
901
  if ( swap[ i ] != null )
907
902
  stack[ i ].style.display = swap[ i ];
908
903
  }
@@ -925,27 +920,27 @@ jQuery.extend({
925
920
  // but a number that has a weird ending, we need to convert it to pixels
926
921
  if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
927
922
  // Remember the original values
928
- var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left;
923
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
929
924
 
930
925
  // Put in the new values to get a computed value out
931
926
  elem.runtimeStyle.left = elem.currentStyle.left;
932
- elem.style.left = ret || 0;
933
- ret = elem.style.pixelLeft + "px";
927
+ style.left = ret || 0;
928
+ ret = style.pixelLeft + "px";
934
929
 
935
930
  // Revert the changed values
936
- elem.style.left = style;
937
- elem.runtimeStyle.left = runtimeStyle;
931
+ style.left = left;
932
+ elem.runtimeStyle.left = rsLeft;
938
933
  }
939
934
  }
940
935
 
941
936
  return ret;
942
937
  },
943
-
938
+
944
939
  clean: function( elems, context ) {
945
940
  var ret = [];
946
941
  context = context || document;
947
942
  // !context.createElement fails in IE with an error but returns typeof 'object'
948
- if (typeof context.createElement == 'undefined')
943
+ if (typeof context.createElement == 'undefined')
949
944
  context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
950
945
 
951
946
  jQuery.each(elems, function(i, elem){
@@ -953,8 +948,8 @@ jQuery.extend({
953
948
  return;
954
949
 
955
950
  if ( elem.constructor == Number )
956
- elem = elem.toString();
957
-
951
+ elem += '';
952
+
958
953
  // Convert html string into DOM nodes
959
954
  if ( typeof elem == "string" ) {
960
955
  // Fix "XHTML"-style tags in all browsers
@@ -971,58 +966,58 @@ jQuery.extend({
971
966
  // option or optgroup
972
967
  !tags.indexOf("<opt") &&
973
968
  [ 1, "<select multiple='multiple'>", "</select>" ] ||
974
-
969
+
975
970
  !tags.indexOf("<leg") &&
976
971
  [ 1, "<fieldset>", "</fieldset>" ] ||
977
-
972
+
978
973
  tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
979
974
  [ 1, "<table>", "</table>" ] ||
980
-
975
+
981
976
  !tags.indexOf("<tr") &&
982
977
  [ 2, "<table><tbody>", "</tbody></table>" ] ||
983
-
984
- // <thead> matched above
978
+
979
+ // <thead> matched above
985
980
  (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
986
981
  [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
987
-
982
+
988
983
  !tags.indexOf("<col") &&
989
984
  [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
990
985
 
991
986
  // IE can't serialize <link> and <script> tags normally
992
987
  jQuery.browser.msie &&
993
988
  [ 1, "div<div>", "</div>" ] ||
994
-
989
+
995
990
  [ 0, "", "" ];
996
991
 
997
992
  // Go to html and back, then peel off extra wrappers
998
993
  div.innerHTML = wrap[1] + elem + wrap[2];
999
-
994
+
1000
995
  // Move to the right depth
1001
996
  while ( wrap[0]-- )
1002
997
  div = div.lastChild;
1003
-
998
+
1004
999
  // Remove IE's autoinserted <tbody> from table fragments
1005
1000
  if ( jQuery.browser.msie ) {
1006
-
1001
+
1007
1002
  // String was a <table>, *may* have spurious <tbody>
1008
1003
  var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
1009
1004
  div.firstChild && div.firstChild.childNodes :
1010
-
1005
+
1011
1006
  // String was a bare <thead> or <tfoot>
1012
1007
  wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
1013
1008
  div.childNodes :
1014
1009
  [];
1015
-
1010
+
1016
1011
  for ( var j = tbody.length - 1; j >= 0 ; --j )
1017
1012
  if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
1018
1013
  tbody[ j ].parentNode.removeChild( tbody[ j ] );
1019
-
1020
- // IE completely kills leading whitespace when innerHTML is used
1021
- if ( /^\s/.test( elem ) )
1014
+
1015
+ // IE completely kills leading whitespace when innerHTML is used
1016
+ if ( /^\s/.test( elem ) )
1022
1017
  div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
1023
-
1018
+
1024
1019
  }
1025
-
1020
+
1026
1021
  elem = jQuery.makeArray( div.childNodes );
1027
1022
  }
1028
1023
 
@@ -1039,81 +1034,94 @@ jQuery.extend({
1039
1034
 
1040
1035
  return ret;
1041
1036
  },
1042
-
1037
+
1043
1038
  attr: function( elem, name, value ) {
1044
1039
  // don't set attributes on text and comment nodes
1045
1040
  if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
1046
1041
  return undefined;
1047
1042
 
1048
- var fix = jQuery.isXMLDoc( elem ) ?
1049
- {} :
1050
- jQuery.props;
1043
+ var notxml = !jQuery.isXMLDoc( elem ),
1044
+ // Whether we are setting (or getting)
1045
+ set = value !== undefined,
1046
+ msie = jQuery.browser.msie;
1051
1047
 
1052
- // Safari mis-reports the default selected property of a hidden option
1053
- // Accessing the parent's selectedIndex property fixes it
1054
- if ( name == "selected" && jQuery.browser.safari )
1055
- elem.parentNode.selectedIndex;
1056
-
1057
- // Certain attributes only work when accessed via the old DOM 0 way
1058
- if ( fix[ name ] ) {
1059
- if ( value != undefined )
1060
- elem[ fix[ name ] ] = value;
1048
+ // Try to normalize/fix the name
1049
+ name = notxml && jQuery.props[ name ] || name;
1061
1050
 
1062
- return elem[ fix[ name ] ];
1051
+ // Only do all the following if this is a node (faster for style)
1052
+ // IE elem.getAttribute passes even for style
1053
+ if ( elem.tagName ) {
1063
1054
 
1064
- } else if ( jQuery.browser.msie && name == "style" )
1065
- return jQuery.attr( elem.style, "cssText", value );
1055
+ // These attributes require special treatment
1056
+ var special = /href|src|style/.test( name );
1066
1057
 
1067
- else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") )
1068
- return elem.getAttributeNode( name ).nodeValue;
1058
+ // Safari mis-reports the default selected property of a hidden option
1059
+ // Accessing the parent's selectedIndex property fixes it
1060
+ if ( name == "selected" && jQuery.browser.safari )
1061
+ elem.parentNode.selectedIndex;
1069
1062
 
1070
- // IE elem.getAttribute passes even for style
1071
- else if ( elem.tagName ) {
1063
+ // If applicable, access the attribute via the DOM 0 way
1064
+ if ( name in elem && notxml && !special ) {
1065
+ if ( set ){
1066
+ // We can't allow the type property to be changed (since it causes problems in IE)
1067
+ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
1068
+ throw "type property can't be changed";
1072
1069
 
1073
- if ( value != undefined ) {
1074
- // We can't allow the type property to be changed (since it causes problems in IE)
1075
- if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
1076
- throw "type property can't be changed";
1070
+ elem[ name ] = value;
1071
+ }
1072
+
1073
+ // browsers index elements by id/name on forms, give priority to attributes.
1074
+ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
1075
+ return elem.getAttributeNode( name ).nodeValue;
1076
+
1077
+ return elem[ name ];
1078
+ }
1077
1079
 
1080
+ if ( msie && notxml && name == "style" )
1081
+ return jQuery.attr( elem.style, "cssText", value );
1082
+
1083
+ if ( set )
1078
1084
  // convert the value to a string (all browsers do this but IE) see #1070
1079
1085
  elem.setAttribute( name, "" + value );
1080
- }
1081
1086
 
1082
- if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) )
1083
- return elem.getAttribute( name, 2 );
1087
+ var attr = msie && notxml && special
1088
+ // Some attributes require a special call on IE
1089
+ ? elem.getAttribute( name, 2 )
1090
+ : elem.getAttribute( name );
1084
1091
 
1085
- return elem.getAttribute( name );
1092
+ // Non-existent attributes return null, we normalize to undefined
1093
+ return attr === null ? undefined : attr;
1094
+ }
1086
1095
 
1087
1096
  // elem is actually elem.style ... set the style
1088
- } else {
1089
- // IE actually uses filters for opacity
1090
- if ( name == "opacity" && jQuery.browser.msie ) {
1091
- if ( value != undefined ) {
1092
- // IE has trouble with opacity if it does not have layout
1093
- // Force it by setting the zoom level
1094
- elem.zoom = 1;
1095
-
1096
- // Set the alpha filter to set the opacity
1097
- elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1098
- (parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1099
- }
1100
-
1101
- return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1102
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
1103
- "";
1104
- }
1105
1097
 
1106
- name = name.replace(/-([a-z])/ig, function(all, letter){
1107
- return letter.toUpperCase();
1108
- });
1098
+ // IE uses filters for opacity
1099
+ if ( msie && name == "opacity" ) {
1100
+ if ( set ) {
1101
+ // IE has trouble with opacity if it does not have layout
1102
+ // Force it by setting the zoom level
1103
+ elem.zoom = 1;
1109
1104
 
1110
- if ( value != undefined )
1111
- elem[ name ] = value;
1105
+ // Set the alpha filter to set the opacity
1106
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1107
+ (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1108
+ }
1112
1109
 
1113
- return elem[ name ];
1110
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1111
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
1112
+ "";
1114
1113
  }
1114
+
1115
+ name = name.replace(/-([a-z])/ig, function(all, letter){
1116
+ return letter.toUpperCase();
1117
+ });
1118
+
1119
+ if ( set )
1120
+ elem[ name ] = value;
1121
+
1122
+ return elem[ name ];
1115
1123
  },
1116
-
1124
+
1117
1125
  trim: function( text ) {
1118
1126
  return (text || "").replace( /^\s+|\s+$/g, "" );
1119
1127
  },
@@ -1121,19 +1129,23 @@ jQuery.extend({
1121
1129
  makeArray: function( array ) {
1122
1130
  var ret = [];
1123
1131
 
1124
- // Need to use typeof to fight Safari childNodes crashes
1125
- if ( typeof array != "array" )
1126
- for ( var i = 0, length = array.length; i < length; i++ )
1127
- ret.push( array[ i ] );
1128
- else
1129
- ret = array.slice( 0 );
1132
+ if( array != null ){
1133
+ var i = array.length;
1134
+ //the window, strings and functions also have 'length'
1135
+ if( i == null || array.split || array.setInterval || array.call )
1136
+ ret[0] = array;
1137
+ else
1138
+ while( i )
1139
+ ret[--i] = array[i];
1140
+ }
1130
1141
 
1131
1142
  return ret;
1132
1143
  },
1133
1144
 
1134
1145
  inArray: function( elem, array ) {
1135
1146
  for ( var i = 0, length = array.length; i < length; i++ )
1136
- if ( array[ i ] == elem )
1147
+ // Use === because on IE, window == document
1148
+ if ( array[ i ] === elem )
1137
1149
  return i;
1138
1150
 
1139
1151
  return -1;
@@ -1142,17 +1154,17 @@ jQuery.extend({
1142
1154
  merge: function( first, second ) {
1143
1155
  // We have to loop this way because IE & Opera overwrite the length
1144
1156
  // expando of getElementsByTagName
1145
-
1157
+ var i = 0, elem, pos = first.length;
1146
1158
  // Also, we need to make sure that the correct elements are being returned
1147
1159
  // (IE returns comment nodes in a '*' query)
1148
1160
  if ( jQuery.browser.msie ) {
1149
- for ( var i = 0; second[ i ]; i++ )
1150
- if ( second[ i ].nodeType != 8 )
1151
- first.push( second[ i ] );
1161
+ while ( elem = second[ i++ ] )
1162
+ if ( elem.nodeType != 8 )
1163
+ first[ pos++ ] = elem;
1152
1164
 
1153
1165
  } else
1154
- for ( var i = 0; second[ i ]; i++ )
1155
- first.push( second[ i ] );
1166
+ while ( elem = second[ i++ ] )
1167
+ first[ pos++ ] = elem;
1156
1168
 
1157
1169
  return first;
1158
1170
  },
@@ -1184,7 +1196,7 @@ jQuery.extend({
1184
1196
  // Go through the array, only saving the items
1185
1197
  // that pass the validator function
1186
1198
  for ( var i = 0, length = elems.length; i < length; i++ )
1187
- if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) )
1199
+ if ( !inv != !callback( elems[ i ], i ) )
1188
1200
  ret.push( elems[ i ] );
1189
1201
 
1190
1202
  return ret;
@@ -1198,15 +1210,11 @@ jQuery.extend({
1198
1210
  for ( var i = 0, length = elems.length; i < length; i++ ) {
1199
1211
  var value = callback( elems[ i ], i );
1200
1212
 
1201
- if ( value !== null && value != undefined ) {
1202
- if ( value.constructor != Array )
1203
- value = [ value ];
1204
-
1205
- ret = ret.concat( value );
1206
- }
1213
+ if ( value != null )
1214
+ ret[ ret.length ] = value;
1207
1215
  }
1208
1216
 
1209
- return ret;
1217
+ return ret.concat.apply( [], ret );
1210
1218
  }
1211
1219
  });
1212
1220
 
@@ -1224,29 +1232,20 @@ jQuery.browser = {
1224
1232
  var styleFloat = jQuery.browser.msie ?
1225
1233
  "styleFloat" :
1226
1234
  "cssFloat";
1227
-
1235
+
1228
1236
  jQuery.extend({
1229
1237
  // Check to see if the W3C box model is being used
1230
1238
  boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
1231
-
1239
+
1232
1240
  props: {
1233
1241
  "for": "htmlFor",
1234
1242
  "class": "className",
1235
1243
  "float": styleFloat,
1236
1244
  cssFloat: styleFloat,
1237
1245
  styleFloat: styleFloat,
1238
- innerHTML: "innerHTML",
1239
- className: "className",
1240
- value: "value",
1241
- disabled: "disabled",
1242
- checked: "checked",
1243
1246
  readonly: "readOnly",
1244
- selected: "selected",
1245
1247
  maxlength: "maxLength",
1246
- selectedIndex: "selectedIndex",
1247
- defaultValue: "defaultValue",
1248
- tagName: "tagName",
1249
- nodeName: "nodeName"
1248
+ cellspacing: "cellSpacing"
1250
1249
  }
1251
1250
  });
1252
1251
 
@@ -1291,7 +1290,7 @@ jQuery.each({
1291
1290
  jQuery.each({
1292
1291
  removeAttr: function( name ) {
1293
1292
  jQuery.attr( this, name, "" );
1294
- if (this.nodeType == 1)
1293
+ if (this.nodeType == 1)
1295
1294
  this.removeAttribute( name );
1296
1295
  },
1297
1296
 
@@ -1322,7 +1321,7 @@ jQuery.each({
1322
1321
  empty: function() {
1323
1322
  // Remove element nodes and prevent memory leaks
1324
1323
  jQuery( ">*", this ).remove();
1325
-
1324
+
1326
1325
  // Remove any remaining nodes
1327
1326
  while ( this.firstChild )
1328
1327
  this.removeChild( this.firstChild );
@@ -1335,25 +1334,25 @@ jQuery.each({
1335
1334
 
1336
1335
  jQuery.each([ "Height", "Width" ], function(i, name){
1337
1336
  var type = name.toLowerCase();
1338
-
1337
+
1339
1338
  jQuery.fn[ type ] = function( size ) {
1340
1339
  // Get window width or height
1341
1340
  return this[0] == window ?
1342
1341
  // Opera reports document.body.client[Width/Height] properly in both quirks and standards
1343
- jQuery.browser.opera && document.body[ "client" + name ] ||
1344
-
1342
+ jQuery.browser.opera && document.body[ "client" + name ] ||
1343
+
1345
1344
  // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
1346
1345
  jQuery.browser.safari && window[ "inner" + name ] ||
1347
-
1346
+
1348
1347
  // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
1349
1348
  document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
1350
-
1349
+
1351
1350
  // Get document width or height
1352
1351
  this[0] == document ?
1353
1352
  // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
1354
- Math.max(
1355
- Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
1356
- Math.max(document.body["offset" + name], document.documentElement["offset" + name])
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])
1357
1356
  ) :
1358
1357
 
1359
1358
  // Get or set width or height on the element
@@ -1366,7 +1365,10 @@ jQuery.each([ "Height", "Width" ], function(i, name){
1366
1365
  };
1367
1366
  });
1368
1367
 
1369
- var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
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 ?
1370
1372
  "(?:[\\w*_-]|\\\\.)" :
1371
1373
  "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
1372
1374
  quickChild = new RegExp("^>\\s*(" + chars + "+)"),
@@ -1432,7 +1434,7 @@ jQuery.extend({
1432
1434
  animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
1433
1435
  }
1434
1436
  },
1435
-
1437
+
1436
1438
  // The regular expressions that power the parsing engine
1437
1439
  parse: [
1438
1440
  // Match: [@value='test'], [@foo]
@@ -1441,7 +1443,7 @@ jQuery.extend({
1441
1443
  // Match: :contains('foo')
1442
1444
  /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
1443
1445
 
1444
- // Match: :even, :last-chlid, #id, .class
1446
+ // Match: :even, :last-child, #id, .class
1445
1447
  new RegExp("^([:.#]*)(" + chars + "+)")
1446
1448
  ],
1447
1449
 
@@ -1481,12 +1483,13 @@ jQuery.extend({
1481
1483
 
1482
1484
  t = jQuery.trim(t);
1483
1485
 
1484
- var foundToken = false;
1486
+ var foundToken = false,
1485
1487
 
1486
1488
  // An attempt at speeding up child selectors that
1487
1489
  // point to a specific element tag
1488
- var re = quickChild;
1489
- var m = re.exec(t);
1490
+ re = quickChild,
1491
+
1492
+ m = re.exec(t);
1490
1493
 
1491
1494
  if ( m ) {
1492
1495
  nodeName = m[1].toUpperCase();
@@ -1518,12 +1521,12 @@ jQuery.extend({
1518
1521
  var id = jQuery.data(n);
1519
1522
 
1520
1523
  if ( m == "~" && merge[id] ) break;
1521
-
1524
+
1522
1525
  if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
1523
1526
  if ( m == "~" ) merge[id] = true;
1524
1527
  r.push( n );
1525
1528
  }
1526
-
1529
+
1527
1530
  if ( m == "+" ) break;
1528
1531
  }
1529
1532
  }
@@ -1557,7 +1560,7 @@ jQuery.extend({
1557
1560
  // Optimize for the case nodeName#idName
1558
1561
  var re2 = quickID;
1559
1562
  var m = re2.exec(t);
1560
-
1563
+
1561
1564
  // Re-organize the results, so that they're consistent
1562
1565
  if ( m ) {
1563
1566
  m = [ 0, m[2], m[3], m[1] ];
@@ -1577,7 +1580,7 @@ jQuery.extend({
1577
1580
  if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
1578
1581
  // Optimization for HTML document case
1579
1582
  var oid = elem.getElementById(m[2]);
1580
-
1583
+
1581
1584
  // Do a quick check for the existence of the actual ID attribute
1582
1585
  // to avoid selecting by the name attribute in IE
1583
1586
  // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
@@ -1699,10 +1702,10 @@ jQuery.extend({
1699
1702
 
1700
1703
  else if ( m[1] == "[" ) {
1701
1704
  var tmp = [], type = m[3];
1702
-
1705
+
1703
1706
  for ( var i = 0, rl = r.length; i < rl; i++ ) {
1704
1707
  var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
1705
-
1708
+
1706
1709
  if ( z == null || /href|src|selected/.test(m[2]) )
1707
1710
  z = jQuery.attr(a,m[2]) || '';
1708
1711
 
@@ -1714,7 +1717,7 @@ jQuery.extend({
1714
1717
  (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
1715
1718
  tmp.push( a );
1716
1719
  }
1717
-
1720
+
1718
1721
  r = tmp;
1719
1722
 
1720
1723
  // We can get a speed boost by handling nth-child here
@@ -1726,7 +1729,7 @@ jQuery.extend({
1726
1729
  !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
1727
1730
  // calculate the numbers (first)n+(last) including if they are negative
1728
1731
  first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
1729
-
1732
+
1730
1733
  // loop through all the elements left in the jQuery object
1731
1734
  for ( var i = 0, rl = r.length; i < rl; i++ ) {
1732
1735
  var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
@@ -1777,8 +1780,8 @@ jQuery.extend({
1777
1780
  },
1778
1781
 
1779
1782
  dir: function( elem, dir ){
1780
- var matched = [];
1781
- var cur = elem[dir];
1783
+ var matched = [],
1784
+ cur = elem[dir];
1782
1785
  while ( cur && cur != document ) {
1783
1786
  if ( cur.nodeType == 1 )
1784
1787
  matched.push( cur );
@@ -1786,7 +1789,7 @@ jQuery.extend({
1786
1789
  }
1787
1790
  return matched;
1788
1791
  },
1789
-
1792
+
1790
1793
  nth: function(cur,result,dir,elem){
1791
1794
  result = result || 1;
1792
1795
  var num = 0;
@@ -1797,22 +1800,21 @@ jQuery.extend({
1797
1800
 
1798
1801
  return cur;
1799
1802
  },
1800
-
1803
+
1801
1804
  sibling: function( n, elem ) {
1802
1805
  var r = [];
1803
1806
 
1804
1807
  for ( ; n; n = n.nextSibling ) {
1805
- if ( n.nodeType == 1 && (!elem || n != elem) )
1808
+ if ( n.nodeType == 1 && n != elem )
1806
1809
  r.push( n );
1807
1810
  }
1808
1811
 
1809
1812
  return r;
1810
1813
  }
1811
1814
  });
1812
-
1813
1815
  /*
1814
1816
  * A number of helper functions used for managing events.
1815
- * Many of the ideas behind this code orignated from
1817
+ * Many of the ideas behind this code orignated from
1816
1818
  * Dean Edwards' addEvent library.
1817
1819
  */
1818
1820
  jQuery.event = {
@@ -1825,85 +1827,75 @@ jQuery.event = {
1825
1827
 
1826
1828
  // For whatever reason, IE has trouble passing the window object
1827
1829
  // around, causing it to be cloned in the process
1828
- if ( jQuery.browser.msie && elem.setInterval != undefined )
1830
+ if ( jQuery.browser.msie && elem.setInterval )
1829
1831
  elem = window;
1830
1832
 
1831
1833
  // Make sure that the function being executed has a unique ID
1832
1834
  if ( !handler.guid )
1833
1835
  handler.guid = this.guid++;
1834
-
1835
- // if data is passed, bind to handler
1836
- if( data != undefined ) {
1837
- // Create temporary function pointer to original handler
1838
- var fn = handler;
1839
-
1840
- // Create unique handler function, wrapped around original handler
1841
- handler = function() {
1842
- // Pass arguments and context to original handler
1843
- return fn.apply(this, arguments);
1844
- };
1845
1836
 
1846
- // Store data in unique handler
1847
- handler.data = data;
1837
+ // if data is passed, bind to handler
1838
+ if( data != undefined ) {
1839
+ // Create temporary function pointer to original handler
1840
+ var fn = handler;
1841
+
1842
+ // 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
+ });
1848
1847
 
1849
- // Set the guid of unique handler to the same of original handler, so it can be removed
1850
- handler.guid = fn.guid;
1848
+ // Store data in unique handler
1849
+ handler.data = data;
1851
1850
  }
1852
1851
 
1853
1852
  // Init the element's event structure
1854
1853
  var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
1855
1854
  handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
1856
- // returned undefined or false
1857
- var val;
1858
-
1859
1855
  // Handle the second event of a trigger and when
1860
- // an event is called after a page has unload
1861
- if ( typeof jQuery == "undefined" || jQuery.event.triggered )
1862
- return val;
1863
-
1864
- val = jQuery.event.handle.apply(arguments.callee.elem, arguments);
1865
-
1866
- return val;
1856
+ // 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);
1867
1859
  });
1868
1860
  // Add elem as a property of the handle function
1869
1861
  // This is to prevent a memory leak with non-native
1870
1862
  // event in IE.
1871
1863
  handle.elem = elem;
1872
-
1873
- // Handle multiple events seperated by a space
1874
- // jQuery(...).bind("mouseover mouseout", fn);
1875
- jQuery.each(types.split(/\s+/), function(index, type) {
1876
- // Namespaced event handlers
1877
- var parts = type.split(".");
1878
- type = parts[0];
1879
- handler.type = parts[1];
1880
-
1881
- // Get the current list of functions bound to this event
1882
- var handlers = events[type];
1883
-
1884
- // Init the event handler queue
1885
- if (!handlers) {
1886
- handlers = events[type] = {};
1887
-
1888
- // Check for a special event handler
1889
- // Only use addEventListener/attachEvent if the special
1890
- // events handler returns false
1891
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
1892
- // Bind the global event handler to the element
1893
- if (elem.addEventListener)
1894
- elem.addEventListener(type, handle, false);
1895
- else if (elem.attachEvent)
1896
- elem.attachEvent("on" + type, handle);
1897
- }
1864
+
1865
+ // Handle multiple events separated by a space
1866
+ // jQuery(...).bind("mouseover mouseout", fn);
1867
+ jQuery.each(types.split(/\s+/), function(index, type) {
1868
+ // Namespaced event handlers
1869
+ var parts = type.split(".");
1870
+ type = parts[0];
1871
+ handler.type = parts[1];
1872
+
1873
+ // Get the current list of functions bound to this event
1874
+ var handlers = events[type];
1875
+
1876
+ // Init the event handler queue
1877
+ if (!handlers) {
1878
+ handlers = events[type] = {};
1879
+
1880
+ // Check for a special event handler
1881
+ // Only use addEventListener/attachEvent if the special
1882
+ // events handler returns false
1883
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
1884
+ // Bind the global event handler to the element
1885
+ if (elem.addEventListener)
1886
+ elem.addEventListener(type, handle, false);
1887
+ else if (elem.attachEvent)
1888
+ elem.attachEvent("on" + type, handle);
1898
1889
  }
1890
+ }
1899
1891
 
1900
- // Add the function to the element's handler list
1901
- handlers[handler.guid] = handler;
1892
+ // Add the function to the element's handler list
1893
+ handlers[handler.guid] = handler;
1894
+
1895
+ // Keep track of which events have been used, for global triggering
1896
+ jQuery.event.global[type] = true;
1897
+ });
1902
1898
 
1903
- // Keep track of which events have been used, for global triggering
1904
- jQuery.event.global[type] = true;
1905
- });
1906
-
1907
1899
  // Nullify elem to prevent memory leaks in IE
1908
1900
  elem = null;
1909
1901
  },
@@ -1930,19 +1922,19 @@ jQuery.event = {
1930
1922
  handler = types.handler;
1931
1923
  types = types.type;
1932
1924
  }
1933
-
1925
+
1934
1926
  // Handle multiple events seperated by a space
1935
1927
  // jQuery(...).unbind("mouseover mouseout", fn);
1936
1928
  jQuery.each(types.split(/\s+/), function(index, type){
1937
1929
  // Namespaced event handlers
1938
1930
  var parts = type.split(".");
1939
1931
  type = parts[0];
1940
-
1932
+
1941
1933
  if ( events[type] ) {
1942
1934
  // remove the given handler for the given type
1943
1935
  if ( handler )
1944
1936
  delete events[type][handler.guid];
1945
-
1937
+
1946
1938
  // remove all handlers for the given type
1947
1939
  else
1948
1940
  for ( handler in events[type] )
@@ -1979,7 +1971,7 @@ jQuery.event = {
1979
1971
 
1980
1972
  trigger: function(type, data, elem, donative, extra) {
1981
1973
  // Clone the incoming data, if any
1982
- data = jQuery.makeArray(data || []);
1974
+ data = jQuery.makeArray(data);
1983
1975
 
1984
1976
  if ( type.indexOf("!") >= 0 ) {
1985
1977
  type = type.slice(0, -1);
@@ -2001,22 +1993,31 @@ jQuery.event = {
2001
1993
  var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
2002
1994
  // Check to see if we need to provide a fake event, or not
2003
1995
  event = !data[0] || !data[0].preventDefault;
2004
-
1996
+
2005
1997
  // Pass along a fake event
2006
- if ( event )
2007
- data.unshift( this.fix({ type: type, target: elem }) );
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
+ }
2008
2008
 
2009
2009
  // Enforce the right trigger type
2010
2010
  data[0].type = type;
2011
2011
  if ( exclusive )
2012
2012
  data[0].exclusive = true;
2013
2013
 
2014
- // Trigger the event
2015
- if ( jQuery.isFunction( jQuery.data(elem, "handle") ) )
2016
- val = jQuery.data(elem, "handle").apply( elem, data );
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 );
2017
2018
 
2018
- // Handle triggering native .onfoo handlers
2019
- if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
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 )
2020
2021
  val = false;
2021
2022
 
2022
2023
  // Extra functions don't get the custom event object
@@ -2049,28 +2050,30 @@ jQuery.event = {
2049
2050
 
2050
2051
  handle: function(event) {
2051
2052
  // returned undefined or false
2052
- var val;
2053
+ var val, ret, namespace, all, handlers;
2053
2054
 
2054
- // Empty object is for triggered events with no data
2055
- event = jQuery.event.fix( event || window.event || {} );
2055
+ event = arguments[0] = jQuery.event.fix( event || window.event );
2056
2056
 
2057
2057
  // Namespaced event handlers
2058
- var parts = event.type.split(".");
2059
- event.type = parts[0];
2058
+ namespace = event.type.split(".");
2059
+ event.type = namespace[0];
2060
+ namespace = namespace[1];
2061
+ // Cache this now, all = true means, any handler
2062
+ all = !namespace && !event.exclusive;
2060
2063
 
2061
- var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
2062
- args.unshift( event );
2064
+ handlers = ( jQuery.data(this, "events") || {} )[event.type];
2063
2065
 
2064
2066
  for ( var j in handlers ) {
2065
2067
  var handler = handlers[j];
2066
- // Pass in a reference to the handler function itself
2067
- // So that we can later remove it
2068
- args[0].handler = handler;
2069
- args[0].data = handler.data;
2070
2068
 
2071
2069
  // Filter the functions by class
2072
- if ( !parts[1] && !event.exclusive || handler.type == parts[1] ) {
2073
- var ret = handler.apply( this, args );
2070
+ if ( all || handler.type == namespace ) {
2071
+ // Pass in a reference to the handler function itself
2072
+ // So that we can later remove it
2073
+ event.handler = handler;
2074
+ event.data = handler.data;
2075
+
2076
+ ret = handler.apply( this, arguments );
2074
2077
 
2075
2078
  if ( val !== false )
2076
2079
  val = ret;
@@ -2082,21 +2085,25 @@ jQuery.event = {
2082
2085
  }
2083
2086
  }
2084
2087
 
2085
- // Clean up added properties in IE to prevent memory leak
2086
- if (jQuery.browser.msie)
2087
- event.target = event.preventDefault = event.stopPropagation =
2088
- event.handler = event.data = null;
2089
-
2090
2088
  return val;
2091
2089
  },
2092
2090
 
2093
2091
  fix: function(event) {
2094
- // store a copy of the original event object
2095
- // and clone to set read-only properties
2092
+ if ( event[expando] == true )
2093
+ return event;
2094
+
2095
+ // store a copy of the original event object
2096
+ // and "clone" to set read-only properties
2096
2097
  var originalEvent = event;
2097
- event = jQuery.extend({}, originalEvent);
2098
-
2099
- // add preventDefault and stopPropagation since
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
2100
2107
  // they will not work on the clone
2101
2108
  event.preventDefault = function() {
2102
2109
  // if preventDefault exists run it on the original event
@@ -2112,14 +2119,17 @@ jQuery.event = {
2112
2119
  // otherwise set the cancelBubble property of the original event to true (IE)
2113
2120
  originalEvent.cancelBubble = true;
2114
2121
  };
2115
-
2122
+
2123
+ // Fix timeStamp
2124
+ event.timeStamp = event.timeStamp || now();
2125
+
2116
2126
  // Fix target property, if necessary
2117
2127
  if ( !event.target )
2118
2128
  event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
2119
-
2129
+
2120
2130
  // check if target is a textnode (safari)
2121
2131
  if ( event.target.nodeType == 3 )
2122
- event.target = originalEvent.target.parentNode;
2132
+ event.target = event.target.parentNode;
2123
2133
 
2124
2134
  // Add relatedTarget, if necessary
2125
2135
  if ( !event.relatedTarget && event.fromElement )
@@ -2131,11 +2141,11 @@ jQuery.event = {
2131
2141
  event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
2132
2142
  event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
2133
2143
  }
2134
-
2144
+
2135
2145
  // Add which for key events
2136
2146
  if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
2137
2147
  event.which = event.charCode || event.keyCode;
2138
-
2148
+
2139
2149
  // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
2140
2150
  if ( !event.metaKey && event.ctrlKey )
2141
2151
  event.metaKey = event.ctrlKey;
@@ -2144,10 +2154,17 @@ jQuery.event = {
2144
2154
  // Note: button is not normalized, so don't use it
2145
2155
  if ( !event.which && event.button )
2146
2156
  event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
2147
-
2157
+
2148
2158
  return event;
2149
2159
  },
2150
-
2160
+
2161
+ proxy: function( fn, proxy ){
2162
+ // Set the guid of unique handler to the same of original handler, so it can be removed
2163
+ proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
2164
+ // So proxy can be declared as an argument
2165
+ return proxy;
2166
+ },
2167
+
2151
2168
  special: {
2152
2169
  ready: {
2153
2170
  setup: function() {
@@ -2155,50 +2172,50 @@ jQuery.event = {
2155
2172
  bindReady();
2156
2173
  return;
2157
2174
  },
2158
-
2175
+
2159
2176
  teardown: function() { return; }
2160
2177
  },
2161
-
2178
+
2162
2179
  mouseenter: {
2163
2180
  setup: function() {
2164
2181
  if ( jQuery.browser.msie ) return false;
2165
2182
  jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
2166
2183
  return true;
2167
2184
  },
2168
-
2185
+
2169
2186
  teardown: function() {
2170
2187
  if ( jQuery.browser.msie ) return false;
2171
2188
  jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
2172
2189
  return true;
2173
2190
  },
2174
-
2191
+
2175
2192
  handler: function(event) {
2176
2193
  // If we actually just moused on to a sub-element, ignore it
2177
2194
  if ( withinElement(event, this) ) return true;
2178
2195
  // Execute the right handlers by setting the event type to mouseenter
2179
- arguments[0].type = "mouseenter";
2196
+ event.type = "mouseenter";
2180
2197
  return jQuery.event.handle.apply(this, arguments);
2181
2198
  }
2182
2199
  },
2183
-
2200
+
2184
2201
  mouseleave: {
2185
2202
  setup: function() {
2186
2203
  if ( jQuery.browser.msie ) return false;
2187
2204
  jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
2188
2205
  return true;
2189
2206
  },
2190
-
2207
+
2191
2208
  teardown: function() {
2192
2209
  if ( jQuery.browser.msie ) return false;
2193
2210
  jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
2194
2211
  return true;
2195
2212
  },
2196
-
2213
+
2197
2214
  handler: function(event) {
2198
2215
  // If we actually just moused on to a sub-element, ignore it
2199
2216
  if ( withinElement(event, this) ) return true;
2200
2217
  // Execute the right handlers by setting the event type to mouseleave
2201
- arguments[0].type = "mouseleave";
2218
+ event.type = "mouseleave";
2202
2219
  return jQuery.event.handle.apply(this, arguments);
2203
2220
  }
2204
2221
  }
@@ -2211,13 +2228,14 @@ jQuery.fn.extend({
2211
2228
  jQuery.event.add( this, type, fn || data, fn && data );
2212
2229
  });
2213
2230
  },
2214
-
2231
+
2215
2232
  one: function( type, data, fn ) {
2233
+ var one = jQuery.event.proxy( fn || data, function(event) {
2234
+ jQuery(this).unbind(event, one);
2235
+ return (fn || data).apply( this, arguments );
2236
+ });
2216
2237
  return this.each(function(){
2217
- jQuery.event.add( this, type, function(event) {
2218
- jQuery(this).unbind(event);
2219
- return (fn || data).apply( this, arguments);
2220
- }, fn && data);
2238
+ jQuery.event.add( this, type, one, fn && data);
2221
2239
  });
2222
2240
  },
2223
2241
 
@@ -2234,31 +2252,33 @@ jQuery.fn.extend({
2234
2252
  },
2235
2253
 
2236
2254
  triggerHandler: function( type, data, fn ) {
2237
- if ( this[0] )
2238
- return jQuery.event.trigger( type, data, this[0], false, fn );
2239
- return undefined;
2255
+ return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
2240
2256
  },
2241
2257
 
2242
- toggle: function() {
2258
+ toggle: function( fn ) {
2243
2259
  // Save reference to arguments for access in closure
2244
- var args = arguments;
2260
+ var args = arguments, i = 1;
2245
2261
 
2246
- return this.click(function(event) {
2262
+ // link all the functions, so any of them can unbind this click handler
2263
+ while( i < args.length )
2264
+ jQuery.event.proxy( fn, args[i++] );
2265
+
2266
+ return this.click( jQuery.event.proxy( fn, function(event) {
2247
2267
  // Figure out which function to execute
2248
- this.lastToggle = 0 == this.lastToggle ? 1 : 0;
2249
-
2268
+ this.lastToggle = ( this.lastToggle || 0 ) % i;
2269
+
2250
2270
  // Make sure that clicks stop
2251
2271
  event.preventDefault();
2252
-
2272
+
2253
2273
  // and execute the function
2254
- return args[this.lastToggle].apply( this, arguments ) || false;
2255
- });
2274
+ return args[ this.lastToggle++ ].apply( this, arguments ) || false;
2275
+ }));
2256
2276
  },
2257
2277
 
2258
2278
  hover: function(fnOver, fnOut) {
2259
2279
  return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
2260
2280
  },
2261
-
2281
+
2262
2282
  ready: function(fn) {
2263
2283
  // Attach the listeners
2264
2284
  bindReady();
@@ -2267,12 +2287,12 @@ jQuery.fn.extend({
2267
2287
  if ( jQuery.isReady )
2268
2288
  // Execute the function immediately
2269
2289
  fn.call( document, jQuery );
2270
-
2290
+
2271
2291
  // Otherwise, remember the function for later
2272
2292
  else
2273
2293
  // Add the function to the wait list
2274
2294
  jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
2275
-
2295
+
2276
2296
  return this;
2277
2297
  }
2278
2298
  });
@@ -2282,22 +2302,22 @@ jQuery.extend({
2282
2302
  readyList: [],
2283
2303
  // Handle when the DOM is ready
2284
2304
  ready: function() {
2285
- // Make sure that the DOM is not already load
2305
+ // Make sure that the DOM is not already loaded
2286
2306
  if ( !jQuery.isReady ) {
2287
2307
  // Remember that the DOM is ready
2288
2308
  jQuery.isReady = true;
2289
-
2309
+
2290
2310
  // If there are functions bound, to execute
2291
2311
  if ( jQuery.readyList ) {
2292
2312
  // Execute all of them
2293
2313
  jQuery.each( jQuery.readyList, function(){
2294
- this.apply( document );
2314
+ this.call( document );
2295
2315
  });
2296
-
2316
+
2297
2317
  // Reset the list of functions
2298
2318
  jQuery.readyList = null;
2299
2319
  }
2300
-
2320
+
2301
2321
  // Trigger any bound ready events
2302
2322
  jQuery(document).triggerHandler("ready");
2303
2323
  }
@@ -2314,7 +2334,7 @@ function bindReady(){
2314
2334
  if ( document.addEventListener && !jQuery.browser.opera)
2315
2335
  // Use the handy event callback
2316
2336
  document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
2317
-
2337
+
2318
2338
  // If IE is used and is not in a frame
2319
2339
  // Continually check to see if the document is ready
2320
2340
  if ( jQuery.browser.msie && window == top ) (function(){
@@ -2347,7 +2367,7 @@ function bindReady(){
2347
2367
  var numStyles;
2348
2368
  (function(){
2349
2369
  if (jQuery.isReady) return;
2350
- if ( document.readyState != "load" && document.readyState != "complete" ) {
2370
+ if ( document.readyState != "loaded" && document.readyState != "complete" ) {
2351
2371
  setTimeout( arguments.callee, 0 );
2352
2372
  return;
2353
2373
  }
@@ -2367,9 +2387,9 @@ function bindReady(){
2367
2387
  }
2368
2388
 
2369
2389
  jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
2370
- "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
2390
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
2371
2391
  "submit,keydown,keypress,keyup,error").split(","), function(i, name){
2372
-
2392
+
2373
2393
  // Handle event binding
2374
2394
  jQuery.fn[name] = function(fn){
2375
2395
  return fn ? this.bind(name, fn) : this.trigger(name);
@@ -2394,9 +2414,12 @@ jQuery(window).bind("unload", function() {
2394
2414
  jQuery("*").add(document).unbind();
2395
2415
  });
2396
2416
  jQuery.fn.extend({
2417
+ // Keep a copy of the old load
2418
+ _load: jQuery.fn.load,
2419
+
2397
2420
  load: function( url, params, callback ) {
2398
- if ( jQuery.isFunction( url ) )
2399
- return this.bind("load", url);
2421
+ if ( typeof url != 'string' )
2422
+ return this._load( url );
2400
2423
 
2401
2424
  var off = url.indexOf(" ");
2402
2425
  if ( off >= 0 ) {
@@ -2463,8 +2486,8 @@ jQuery.fn.extend({
2463
2486
  jQuery.makeArray(this.elements) : this;
2464
2487
  })
2465
2488
  .filter(function(){
2466
- return this.name && !this.disabled &&
2467
- (this.checked || /select|textarea/i.test(this.nodeName) ||
2489
+ return this.name && !this.disabled &&
2490
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
2468
2491
  /text|hidden|password/i.test(this.type));
2469
2492
  })
2470
2493
  .map(function(i, elem){
@@ -2486,7 +2509,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
2486
2509
  };
2487
2510
  });
2488
2511
 
2489
- var jsc = (new Date).getTime();
2512
+ var jsc = now();
2490
2513
 
2491
2514
  jQuery.extend({
2492
2515
  get: function( url, data, callback, type ) {
@@ -2495,7 +2518,7 @@ jQuery.extend({
2495
2518
  callback = data;
2496
2519
  data = null;
2497
2520
  }
2498
-
2521
+
2499
2522
  return jQuery.ajax({
2500
2523
  type: "GET",
2501
2524
  url: url,
@@ -2533,6 +2556,7 @@ jQuery.extend({
2533
2556
  },
2534
2557
 
2535
2558
  ajaxSettings: {
2559
+ url: location.href,
2536
2560
  global: true,
2537
2561
  type: "GET",
2538
2562
  timeout: 0,
@@ -2551,24 +2575,25 @@ jQuery.extend({
2551
2575
  _default: "*/*"
2552
2576
  }
2553
2577
  },
2554
-
2578
+
2555
2579
  // Last-Modified header cache for next request
2556
2580
  lastModified: {},
2557
2581
 
2558
2582
  ajax: function( s ) {
2559
- var jsonp, jsre = /=\?(&|$)/g, status, data;
2560
-
2561
2583
  // Extend the settings, but re-extend 's' so that it can be
2562
2584
  // checked again later (in the test suite, specifically)
2563
2585
  s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
2564
2586
 
2587
+ var jsonp, jsre = /=\?(&|$)/g, status, data,
2588
+ type = s.type.toUpperCase();
2589
+
2565
2590
  // convert data if not already a string
2566
2591
  if ( s.data && s.processData && typeof s.data != "string" )
2567
2592
  s.data = jQuery.param(s.data);
2568
2593
 
2569
2594
  // Handle JSONP Parameter Callbacks
2570
2595
  if ( s.dataType == "jsonp" ) {
2571
- if ( s.type.toLowerCase() == "get" ) {
2596
+ if ( type == "GET" ) {
2572
2597
  if ( !s.url.match(jsre) )
2573
2598
  s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
2574
2599
  } else if ( !s.data || !s.data.match(jsre) )
@@ -2605,8 +2630,8 @@ jQuery.extend({
2605
2630
  if ( s.dataType == "script" && s.cache == null )
2606
2631
  s.cache = false;
2607
2632
 
2608
- if ( s.cache === false && s.type.toLowerCase() == "get" ) {
2609
- var ts = (new Date()).getTime();
2633
+ if ( s.cache === false && type == "GET" ) {
2634
+ var ts = now();
2610
2635
  // try replacing _= if it is there
2611
2636
  var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
2612
2637
  // if nothing was replaced, add timestamp to the end
@@ -2614,7 +2639,7 @@ jQuery.extend({
2614
2639
  }
2615
2640
 
2616
2641
  // If data is available, append data to url for get requests
2617
- if ( s.data && s.type.toLowerCase() == "get" ) {
2642
+ if ( s.data && type == "GET" ) {
2618
2643
  s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
2619
2644
 
2620
2645
  // IE likes to send both get and post data, prevent this
@@ -2625,9 +2650,13 @@ jQuery.extend({
2625
2650
  if ( s.global && ! jQuery.active++ )
2626
2651
  jQuery.event.trigger( "ajaxStart" );
2627
2652
 
2653
+ // Matches an absolute URL, and saves the domain
2654
+ var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
2655
+
2628
2656
  // If we're requesting a remote document
2629
2657
  // and trying to load JSON or Script with a GET
2630
- if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" && s.type.toLowerCase() == "get" ) {
2658
+ if ( s.dataType == "script" && type == "GET"
2659
+ && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
2631
2660
  var head = document.getElementsByTagName("head")[0];
2632
2661
  var script = document.createElement("script");
2633
2662
  script.src = s.url;
@@ -2640,8 +2669,8 @@ jQuery.extend({
2640
2669
 
2641
2670
  // Attach handlers for all browsers
2642
2671
  script.onload = script.onreadystatechange = function(){
2643
- if ( !done && (!this.readyState ||
2644
- this.readyState == "load" || this.readyState == "complete") ) {
2672
+ if ( !done && (!this.readyState ||
2673
+ this.readyState == "loaded" || this.readyState == "complete") ) {
2645
2674
  done = true;
2646
2675
  success();
2647
2676
  complete();
@@ -2660,60 +2689,69 @@ jQuery.extend({
2660
2689
 
2661
2690
  // Create the request object; Microsoft failed to properly
2662
2691
  // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
2663
- var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
2692
+ var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
2664
2693
 
2665
2694
  // Open the socket
2666
- xml.open(s.type, s.url, s.async, s.username, s.password);
2695
+ // Passing null username, generates a login popup on Opera (#2865)
2696
+ if( s.username )
2697
+ xhr.open(type, s.url, s.async, s.username, s.password);
2698
+ else
2699
+ xhr.open(type, s.url, s.async);
2667
2700
 
2668
2701
  // Need an extra try/catch for cross domain requests in Firefox 3
2669
2702
  try {
2670
2703
  // Set the correct header, if data is being sent
2671
2704
  if ( s.data )
2672
- xml.setRequestHeader("Content-Type", s.contentType);
2705
+ xhr.setRequestHeader("Content-Type", s.contentType);
2673
2706
 
2674
2707
  // Set the If-Modified-Since header, if ifModified mode.
2675
2708
  if ( s.ifModified )
2676
- xml.setRequestHeader("If-Modified-Since",
2709
+ xhr.setRequestHeader("If-Modified-Since",
2677
2710
  jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
2678
2711
 
2679
2712
  // Set header so the called script knows that it's an XMLHttpRequest
2680
- xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
2713
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
2681
2714
 
2682
2715
  // Set the Accepts header for the server, depending on the dataType
2683
- xml.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
2716
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
2684
2717
  s.accepts[ s.dataType ] + ", */*" :
2685
2718
  s.accepts._default );
2686
2719
  } catch(e){}
2687
2720
 
2688
2721
  // Allow custom headers/mimetypes
2689
- if ( s.beforeSend )
2690
- s.beforeSend(xml);
2691
-
2722
+ if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
2723
+ // cleanup active request counter
2724
+ s.global && jQuery.active--;
2725
+ // close opended socket
2726
+ xhr.abort();
2727
+ return false;
2728
+ }
2729
+
2692
2730
  if ( s.global )
2693
- jQuery.event.trigger("ajaxSend", [xml, s]);
2731
+ jQuery.event.trigger("ajaxSend", [xhr, s]);
2694
2732
 
2695
2733
  // Wait for a response to come back
2696
2734
  var onreadystatechange = function(isTimeout){
2697
2735
  // The transfer is complete and the data is available, or the request timed out
2698
- if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
2736
+ if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
2699
2737
  requestDone = true;
2700
-
2738
+
2701
2739
  // clear poll interval
2702
2740
  if (ival) {
2703
2741
  clearInterval(ival);
2704
2742
  ival = null;
2705
2743
  }
2706
-
2744
+
2707
2745
  status = isTimeout == "timeout" && "timeout" ||
2708
- !jQuery.httpSuccess( xml ) && "error" ||
2709
- s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
2746
+ !jQuery.httpSuccess( xhr ) && "error" ||
2747
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
2710
2748
  "success";
2711
2749
 
2712
2750
  if ( status == "success" ) {
2713
2751
  // Watch for, and catch, XML document parse errors
2714
2752
  try {
2715
2753
  // process the data (runs the xml through httpData regardless of callback)
2716
- data = jQuery.httpData( xml, s.dataType );
2754
+ data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
2717
2755
  } catch(e) {
2718
2756
  status = "parsererror";
2719
2757
  }
@@ -2724,52 +2762,52 @@ jQuery.extend({
2724
2762
  // Cache Last-Modified header, if ifModified mode.
2725
2763
  var modRes;
2726
2764
  try {
2727
- modRes = xml.getResponseHeader("Last-Modified");
2765
+ modRes = xhr.getResponseHeader("Last-Modified");
2728
2766
  } catch(e) {} // swallow exception thrown by FF if header is not available
2729
-
2767
+
2730
2768
  if ( s.ifModified && modRes )
2731
2769
  jQuery.lastModified[s.url] = modRes;
2732
2770
 
2733
2771
  // JSONP handles its own success callback
2734
2772
  if ( !jsonp )
2735
- success();
2773
+ success();
2736
2774
  } else
2737
- jQuery.handleError(s, xml, status);
2775
+ jQuery.handleError(s, xhr, status);
2738
2776
 
2739
2777
  // Fire the complete handlers
2740
2778
  complete();
2741
2779
 
2742
2780
  // Stop memory leaks
2743
2781
  if ( s.async )
2744
- xml = null;
2782
+ xhr = null;
2745
2783
  }
2746
2784
  };
2747
-
2785
+
2748
2786
  if ( s.async ) {
2749
2787
  // don't attach the handler to the request, just poll it instead
2750
- var ival = setInterval(onreadystatechange, 13);
2788
+ var ival = setInterval(onreadystatechange, 13);
2751
2789
 
2752
2790
  // Timeout checker
2753
2791
  if ( s.timeout > 0 )
2754
2792
  setTimeout(function(){
2755
2793
  // Check to see if the request is still happening
2756
- if ( xml ) {
2794
+ if ( xhr ) {
2757
2795
  // Cancel the request
2758
- xml.abort();
2759
-
2796
+ xhr.abort();
2797
+
2760
2798
  if( !requestDone )
2761
2799
  onreadystatechange( "timeout" );
2762
2800
  }
2763
2801
  }, s.timeout);
2764
2802
  }
2765
-
2803
+
2766
2804
  // Send the data
2767
2805
  try {
2768
- xml.send(s.data);
2806
+ xhr.send(s.data);
2769
2807
  } catch(e) {
2770
- jQuery.handleError(s, xml, null, e);
2808
+ jQuery.handleError(s, xhr, null, e);
2771
2809
  }
2772
-
2810
+
2773
2811
  // firefox 1.5 doesn't fire statechange for sync requests
2774
2812
  if ( !s.async )
2775
2813
  onreadystatechange();
@@ -2781,70 +2819,74 @@ jQuery.extend({
2781
2819
 
2782
2820
  // Fire the global callback
2783
2821
  if ( s.global )
2784
- jQuery.event.trigger( "ajaxSuccess", [xml, s] );
2822
+ jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
2785
2823
  }
2786
2824
 
2787
2825
  function complete(){
2788
2826
  // Process result
2789
2827
  if ( s.complete )
2790
- s.complete(xml, status);
2828
+ s.complete(xhr, status);
2791
2829
 
2792
2830
  // The request was completed
2793
2831
  if ( s.global )
2794
- jQuery.event.trigger( "ajaxComplete", [xml, s] );
2832
+ jQuery.event.trigger( "ajaxComplete", [xhr, s] );
2795
2833
 
2796
2834
  // Handle the global AJAX counter
2797
2835
  if ( s.global && ! --jQuery.active )
2798
2836
  jQuery.event.trigger( "ajaxStop" );
2799
2837
  }
2800
-
2838
+
2801
2839
  // return XMLHttpRequest to allow aborting the request etc.
2802
- return xml;
2840
+ return xhr;
2803
2841
  },
2804
2842
 
2805
- handleError: function( s, xml, status, e ) {
2843
+ handleError: function( s, xhr, status, e ) {
2806
2844
  // If a local callback was specified, fire it
2807
- if ( s.error ) s.error( xml, status, e );
2845
+ if ( s.error ) s.error( xhr, status, e );
2808
2846
 
2809
2847
  // Fire the global callback
2810
2848
  if ( s.global )
2811
- jQuery.event.trigger( "ajaxError", [xml, s, e] );
2849
+ jQuery.event.trigger( "ajaxError", [xhr, s, e] );
2812
2850
  },
2813
2851
 
2814
2852
  // Counter for holding the number of active queries
2815
2853
  active: 0,
2816
2854
 
2817
2855
  // Determines if an XMLHttpRequest was successful or not
2818
- httpSuccess: function( r ) {
2856
+ httpSuccess: function( xhr ) {
2819
2857
  try {
2820
2858
  // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
2821
- return !r.status && location.protocol == "file:" ||
2822
- ( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 ||
2823
- jQuery.browser.safari && r.status == undefined;
2859
+ 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;
2824
2862
  } catch(e){}
2825
2863
  return false;
2826
2864
  },
2827
2865
 
2828
2866
  // Determines if an XMLHttpRequest returns NotModified
2829
- httpNotModified: function( xml, url ) {
2867
+ httpNotModified: function( xhr, url ) {
2830
2868
  try {
2831
- var xmlRes = xml.getResponseHeader("Last-Modified");
2869
+ var xhrRes = xhr.getResponseHeader("Last-Modified");
2832
2870
 
2833
2871
  // Firefox always returns 200. check Last-Modified date
2834
- return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
2835
- jQuery.browser.safari && xml.status == undefined;
2872
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
2873
+ jQuery.browser.safari && xhr.status == undefined;
2836
2874
  } catch(e){}
2837
2875
  return false;
2838
2876
  },
2839
2877
 
2840
- httpData: function( r, type ) {
2841
- var ct = r.getResponseHeader("content-type");
2842
- var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
2843
- var data = xml ? r.responseXML : r.responseText;
2878
+ httpData: function( xhr, type, filter ) {
2879
+ var ct = xhr.getResponseHeader("content-type"),
2880
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
2881
+ data = xml ? xhr.responseXML : xhr.responseText;
2844
2882
 
2845
2883
  if ( xml && data.documentElement.tagName == "parsererror" )
2846
2884
  throw "parsererror";
2847
2885
 
2886
+ // Allow a pre-filtering function to sanitize the response
2887
+ if( filter )
2888
+ data = filter( data, type );
2889
+
2848
2890
  // If the type is "script", eval it in global context
2849
2891
  if ( type == "script" )
2850
2892
  jQuery.globalEval( data );
@@ -2879,7 +2921,7 @@ jQuery.extend({
2879
2921
  s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
2880
2922
  });
2881
2923
  else
2882
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
2924
+ s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
2883
2925
 
2884
2926
  // Return the resulting serialization
2885
2927
  return s.join("&").replace(/%20/g, "+");
@@ -2892,7 +2934,7 @@ jQuery.fn.extend({
2892
2934
  this.animate({
2893
2935
  height: "show", width: "show", opacity: "show"
2894
2936
  }, speed, callback) :
2895
-
2937
+
2896
2938
  this.filter(":hidden").each(function(){
2897
2939
  this.style.display = this.oldblock || "";
2898
2940
  if ( jQuery.css(this,"display") == "none" ) {
@@ -2905,13 +2947,13 @@ jQuery.fn.extend({
2905
2947
  }
2906
2948
  }).end();
2907
2949
  },
2908
-
2950
+
2909
2951
  hide: function(speed,callback){
2910
2952
  return speed ?
2911
2953
  this.animate({
2912
2954
  height: "hide", width: "hide", opacity: "hide"
2913
2955
  }, speed, callback) :
2914
-
2956
+
2915
2957
  this.filter(":visible").each(function(){
2916
2958
  this.oldblock = this.oldblock || jQuery.css(this,"display");
2917
2959
  this.style.display = "none";
@@ -2920,10 +2962,10 @@ jQuery.fn.extend({
2920
2962
 
2921
2963
  // Save the old toggle function
2922
2964
  _toggle: jQuery.fn.toggle,
2923
-
2965
+
2924
2966
  toggle: function( fn, fn2 ){
2925
2967
  return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
2926
- this._toggle( fn, fn2 ) :
2968
+ this._toggle.apply( this, arguments ) :
2927
2969
  fn ?
2928
2970
  this.animate({
2929
2971
  height: "toggle", width: "toggle", opacity: "toggle"
@@ -2932,11 +2974,11 @@ jQuery.fn.extend({
2932
2974
  jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
2933
2975
  });
2934
2976
  },
2935
-
2977
+
2936
2978
  slideDown: function(speed,callback){
2937
2979
  return this.animate({height: "show"}, speed, callback);
2938
2980
  },
2939
-
2981
+
2940
2982
  slideUp: function(speed,callback){
2941
2983
  return this.animate({height: "hide"}, speed, callback);
2942
2984
  },
@@ -2944,19 +2986,19 @@ jQuery.fn.extend({
2944
2986
  slideToggle: function(speed, callback){
2945
2987
  return this.animate({height: "toggle"}, speed, callback);
2946
2988
  },
2947
-
2989
+
2948
2990
  fadeIn: function(speed, callback){
2949
2991
  return this.animate({opacity: "show"}, speed, callback);
2950
2992
  },
2951
-
2993
+
2952
2994
  fadeOut: function(speed, callback){
2953
2995
  return this.animate({opacity: "hide"}, speed, callback);
2954
2996
  },
2955
-
2997
+
2956
2998
  fadeTo: function(speed,to,callback){
2957
2999
  return this.animate({opacity: to}, speed, callback);
2958
3000
  },
2959
-
3001
+
2960
3002
  animate: function( prop, speed, easing, callback ) {
2961
3003
  var optall = jQuery.speed(speed, easing, callback);
2962
3004
 
@@ -2964,12 +3006,12 @@ jQuery.fn.extend({
2964
3006
  if ( this.nodeType != 1)
2965
3007
  return false;
2966
3008
 
2967
- var opt = jQuery.extend({}, optall);
2968
- var hidden = jQuery(this).is(":hidden"), self = this;
2969
-
2970
- for ( var p in prop ) {
3009
+ var opt = jQuery.extend({}, optall), p,
3010
+ hidden = jQuery(this).is(":hidden"), self = this;
3011
+
3012
+ for ( p in prop ) {
2971
3013
  if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
2972
- return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
3014
+ return opt.complete.call(this);
2973
3015
 
2974
3016
  if ( p == "height" || p == "width" ) {
2975
3017
  // Store display property
@@ -2984,7 +3026,7 @@ jQuery.fn.extend({
2984
3026
  this.style.overflow = "hidden";
2985
3027
 
2986
3028
  opt.curAnim = jQuery.extend({}, prop);
2987
-
3029
+
2988
3030
  jQuery.each( prop, function(name, val){
2989
3031
  var e = new jQuery.fx( self, opt, name );
2990
3032
 
@@ -3019,7 +3061,7 @@ jQuery.fn.extend({
3019
3061
  return true;
3020
3062
  });
3021
3063
  },
3022
-
3064
+
3023
3065
  queue: function(type, fn){
3024
3066
  if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
3025
3067
  fn = type;
@@ -3034,9 +3076,9 @@ jQuery.fn.extend({
3034
3076
  queue(this, type, fn);
3035
3077
  else {
3036
3078
  queue(this, type).push( fn );
3037
-
3079
+
3038
3080
  if ( queue(this, type).length == 1 )
3039
- fn.apply(this);
3081
+ fn.call(this);
3040
3082
  }
3041
3083
  });
3042
3084
  },
@@ -3068,17 +3110,16 @@ jQuery.fn.extend({
3068
3110
  });
3069
3111
 
3070
3112
  var queue = function( elem, type, array ) {
3071
- if ( !elem )
3072
- return undefined;
3113
+ if ( elem ){
3073
3114
 
3074
- type = type || "fx";
3115
+ type = type || "fx";
3075
3116
 
3076
- var q = jQuery.data( elem, type + "queue" );
3117
+ var q = jQuery.data( elem, type + "queue" );
3077
3118
 
3078
- if ( !q || array )
3079
- q = jQuery.data( elem, type + "queue",
3080
- array ? jQuery.makeArray(array) : [] );
3119
+ if ( !q || array )
3120
+ q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
3081
3121
 
3122
+ }
3082
3123
  return q;
3083
3124
  };
3084
3125
 
@@ -3091,36 +3132,36 @@ jQuery.fn.dequeue = function(type){
3091
3132
  q.shift();
3092
3133
 
3093
3134
  if ( q.length )
3094
- q[0].apply( this );
3135
+ q[0].call( this );
3095
3136
  });
3096
3137
  };
3097
3138
 
3098
3139
  jQuery.extend({
3099
-
3140
+
3100
3141
  speed: function(speed, easing, fn) {
3101
3142
  var opt = speed && speed.constructor == Object ? speed : {
3102
- complete: fn || !fn && easing ||
3143
+ complete: fn || !fn && easing ||
3103
3144
  jQuery.isFunction( speed ) && speed,
3104
3145
  duration: speed,
3105
3146
  easing: fn && easing || easing && easing.constructor != Function && easing
3106
3147
  };
3107
3148
 
3108
- opt.duration = (opt.duration && opt.duration.constructor == Number ?
3109
- opt.duration :
3110
- { slow: 600, fast: 200 }[opt.duration]) || 400;
3111
-
3149
+ opt.duration = (opt.duration && opt.duration.constructor == Number ?
3150
+ opt.duration :
3151
+ jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
3152
+
3112
3153
  // Queueing
3113
3154
  opt.old = opt.complete;
3114
3155
  opt.complete = function(){
3115
3156
  if ( opt.queue !== false )
3116
3157
  jQuery(this).dequeue();
3117
3158
  if ( jQuery.isFunction( opt.old ) )
3118
- opt.old.apply( this );
3159
+ opt.old.call( this );
3119
3160
  };
3120
-
3161
+