middleman 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/CHANGELOG +5 -0
  2. data/lib/middleman.rb +17 -11
  3. data/lib/middleman/base.rb +5 -0
  4. data/lib/middleman/core_extensions/sprockets.rb +14 -9
  5. data/lib/middleman/guard.rb +0 -1
  6. data/lib/middleman/templates/default/source/layout.erb +2 -2
  7. data/lib/middleman/templates/html5/source/404.html +33 -27
  8. data/lib/middleman/templates/html5/source/README.md +388 -0
  9. data/lib/middleman/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
  10. data/lib/middleman/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
  11. data/lib/middleman/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
  12. data/lib/middleman/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
  13. data/lib/middleman/templates/html5/source/apple-touch-icon.png +0 -0
  14. data/lib/middleman/templates/html5/source/crossdomain.xml +8 -8
  15. data/lib/middleman/templates/html5/source/css/style.css +192 -160
  16. data/lib/middleman/templates/html5/source/favicon.ico +0 -0
  17. data/lib/middleman/templates/html5/source/humans.txt +27 -27
  18. data/lib/middleman/templates/html5/source/img/.gitignore +0 -0
  19. data/lib/middleman/templates/html5/source/index.html +37 -38
  20. data/lib/middleman/templates/html5/source/js/libs/{jquery-1.5.1.js → jquery-1.6.2.js} +1850 -1185
  21. data/lib/middleman/templates/html5/source/js/libs/jquery-1.6.2.min.js +18 -0
  22. data/lib/middleman/templates/html5/source/js/libs/modernizr-2.0.6.min.js +4 -0
  23. data/lib/middleman/templates/html5/source/js/mylibs/.gitignore +0 -0
  24. data/lib/middleman/templates/html5/source/js/plugins.js +8 -3
  25. data/lib/middleman/templates/html5/source/js/script.js +1 -19
  26. data/lib/middleman/templates/html5/source/robots.txt +0 -0
  27. data/lib/middleman/templates/html5/source/test/index.html +17 -17
  28. data/lib/middleman/templates/html5/source/test/tests.js +3 -6
  29. data/lib/middleman/version.rb +1 -1
  30. data/middleman.gemspec +24 -21
  31. metadata +11 -14
  32. data/lib/middleman/templates/html5/source/css/handheld.css +0 -8
  33. data/lib/middleman/templates/html5/source/js/libs/dd_belatedpng.js +0 -13
  34. data/lib/middleman/templates/html5/source/js/libs/jquery-1.5.1.min.js +0 -16
  35. data/lib/middleman/templates/html5/source/js/libs/modernizr-1.7.min.js +0 -2
@@ -4,40 +4,40 @@
4
4
 
5
5
  /* TEAM */
6
6
  <your title>: <your name>
7
- Site:
8
- Twitter:
9
- Location:
7
+ Site:
8
+ Twitter:
9
+ Location:
10
10
 
11
11
  /* THANKS */
12
- Names (& URL):
12
+ Names (& URL):
13
13
 
14
14
  /* SITE */
15
15
  Standards: HTML5, CSS3
16
16
  Components: Modernizr, jQuery
17
17
  Software:
18
-
19
18
 
20
-
21
- -o/-
22
- +oo//-
23
- :ooo+//:
24
- -ooooo///-
25
- /oooooo//:
26
- :ooooooo+//-
27
- -+oooooooo///-
28
- -://////////////+oooooooooo++////////////::
29
- :+ooooooooooooooooooooooooooooooooooooo+:::-
19
+
20
+
21
+ -o/-
22
+ +oo//-
23
+ :ooo+//:
24
+ -ooooo///-
25
+ /oooooo//:
26
+ :ooooooo+//-
27
+ -+oooooooo///-
28
+ -://////////////+oooooooooo++////////////::
29
+ :+ooooooooooooooooooooooooooooooooooooo+:::-
30
30
  -/+ooooooooooooooooooooooooooooooo+/::////:-
31
31
  -:+oooooooooooooooooooooooooooo/::///////:-
32
- --/+ooooooooooooooooooooo+::://////:-
33
- -:+ooooooooooooooooo+:://////:--
34
- /ooooooooooooooooo+//////:-
35
- -ooooooooooooooooooo////-
36
- /ooooooooo+oooooooooo//:
37
- :ooooooo+/::/+oooooooo+//-
38
- -oooooo/::///////+oooooo///-
39
- /ooo+::://////:---:/+oooo//:
40
- -o+/::///////:- -:/+o+//-
41
- :-:///////:- -:/://
42
- -////:- --//:
43
- -- -:
32
+ --/+ooooooooooooooooooooo+::://////:-
33
+ -:+ooooooooooooooooo+:://////:--
34
+ /ooooooooooooooooo+//////:-
35
+ -ooooooooooooooooooo////-
36
+ /ooooooooo+oooooooooo//:
37
+ :ooooooo+/::/+oooooooo+//-
38
+ -oooooo/::///////+oooooo///-
39
+ /ooo+::://////:---:/+oooo//:
40
+ -o+/::///////:- -:/+o+//-
41
+ :-:///////:- -:/://
42
+ -////:- --//:
43
+ -- -:
@@ -1,14 +1,15 @@
1
1
  <!doctype html>
2
2
  <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3
- <!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
4
- <!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
5
- <!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
6
- <!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
3
+ <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
4
+ <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
5
+ <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
6
+ <!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
7
+ <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
7
8
  <head>
8
9
  <meta charset="utf-8">
9
10
 
10
- <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
11
- Remove this if you use the .htaccess -->
11
+ <!-- Use the .htaccess and remove these lines to avoid edge case issues.
12
+ More info: h5bp.com/b/378 -->
12
13
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
13
14
 
14
15
  <title></title>
@@ -16,22 +17,18 @@
16
17
  <meta name="author" content="">
17
18
 
18
19
  <!-- Mobile viewport optimized: j.mp/bplateviewport -->
19
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
20
+ <meta name="viewport" content="width=device-width,initial-scale=1">
20
21
 
21
- <!-- Place favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
22
- <link rel="shortcut icon" href="/favicon.ico">
23
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
22
+ <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
24
23
 
24
+ <link rel="stylesheet" href="css/style.css">
25
+
26
+ <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
25
27
 
26
- <!-- CSS: implied media="all" -->
27
- <link rel="stylesheet" href="css/style.css?v=2">
28
-
29
- <!-- Uncomment if you are specifically targeting less enabled mobile browsers
30
- <link rel="stylesheet" media="handheld" href="css/handheld.css?v=2"> -->
31
-
32
- <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
33
- <script src="js/libs/modernizr-1.7.min.js"></script>
34
-
28
+ <!-- All JavaScript at the bottom, except this Modernizr build incl. Respond.js
29
+ Respond is a polyfill for min/max-width media queries. Modernizr enables HTML5 elements & feature detects;
30
+ for optimal performance, create your own custom Modernizr build: www.modernizr.com/download/ -->
31
+ <script src="js/libs/modernizr-2.0.6.min.js"></script>
35
32
  </head>
36
33
 
37
34
  <body>
@@ -51,30 +48,32 @@
51
48
 
52
49
  <!-- JavaScript at the bottom for fast page loading -->
53
50
 
54
- <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
55
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
56
- <script>window.jQuery || document.write("<script src='js/libs/jquery-1.5.1.min.js'>\x3C/script>")</script>
51
+ <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
52
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
53
+ <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
57
54
 
58
55
 
59
- <!-- scripts concatenated and minified via ant build script-->
60
- <script src="js/plugins.js"></script>
61
- <script src="js/script.js"></script>
62
- <!-- end scripts-->
56
+ <!-- scripts concatenated and minified via build script -->
57
+ <script defer src="js/plugins.js"></script>
58
+ <script defer src="js/script.js"></script>
59
+ <!-- end scripts -->
63
60
 
64
61
 
65
- <!--[if lt IE 7 ]>
66
- <script src="js/libs/dd_belatedpng.js"></script>
67
- <script>DD_belatedPNG.fix("img, .png_bg"); // Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb </script>
68
- <![endif]-->
69
-
70
-
71
- <!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
62
+ <!-- Change UA-XXXXX-X to be your site's ID -->
72
63
  <script>
73
- var _gaq=[["_setAccount","UA-XXXXX-X"],["_trackPageview"]];
74
- (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
75
- g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
76
- s.parentNode.insertBefore(g,s)}(document,"script"));
64
+ window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
65
+ Modernizr.load({
66
+ load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
67
+ });
77
68
  </script>
78
69
 
70
+
71
+ <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
72
+ chromium.org/developers/how-tos/chrome-frame-getting-started -->
73
+ <!--[if lt IE 7 ]>
74
+ <script defer src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
75
+ <script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
76
+ <![endif]-->
77
+
79
78
  </body>
80
- </html>
79
+ </html>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.5.1
2
+ * jQuery JavaScript Library v1.6.2
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Copyright 2011, John Resig
@@ -11,12 +11,14 @@
11
11
  * Copyright 2011, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date: Wed Feb 23 13:55:29 2011 -0500
14
+ * Date: Thu Jun 30 14:16:56 2011 -0400
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
18
18
  // Use the correct document accordingly with window argument (sandbox)
19
- var document = window.document;
19
+ var document = window.document,
20
+ navigator = window.navigator,
21
+ location = window.location;
20
22
  var jQuery = (function() {
21
23
 
22
24
  // Define a local copy of jQuery
@@ -36,7 +38,7 @@ var jQuery = function( selector, context ) {
36
38
 
37
39
  // A simple way to check for HTML strings or ID strings
38
40
  // (both of which we optimize for)
39
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
41
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
40
42
 
41
43
  // Check if a string has a non-whitespace character in it
42
44
  rnotwhite = /\S/,
@@ -63,21 +65,23 @@ var jQuery = function( selector, context ) {
63
65
  rmsie = /(msie) ([\w.]+)/,
64
66
  rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
65
67
 
68
+ // Matches dashed string for camelizing
69
+ rdashAlpha = /-([a-z])/ig,
70
+
71
+ // Used by jQuery.camelCase as callback to replace()
72
+ fcamelCase = function( all, letter ) {
73
+ return letter.toUpperCase();
74
+ },
75
+
66
76
  // Keep a UserAgent string for use with jQuery.browser
67
77
  userAgent = navigator.userAgent,
68
78
 
69
79
  // For matching the engine and version of the browser
70
80
  browserMatch,
71
81
 
72
- // Has the ready events already been bound?
73
- readyBound = false,
74
-
75
82
  // The deferred used on DOM ready
76
83
  readyList,
77
84
 
78
- // Promise methods
79
- promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
80
-
81
85
  // The ready event handler
82
86
  DOMContentLoaded,
83
87
 
@@ -113,7 +117,7 @@ jQuery.fn = jQuery.prototype = {
113
117
  if ( selector === "body" && !context && document.body ) {
114
118
  this.context = document;
115
119
  this[0] = document.body;
116
- this.selector = "body";
120
+ this.selector = selector;
117
121
  this.length = 1;
118
122
  return this;
119
123
  }
@@ -121,7 +125,13 @@ jQuery.fn = jQuery.prototype = {
121
125
  // Handle HTML strings
122
126
  if ( typeof selector === "string" ) {
123
127
  // Are we dealing with HTML string or an ID?
124
- match = quickExpr.exec( selector );
128
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
129
+ // Assume that strings that start and end with <> are HTML and skip the regex check
130
+ match = [ null, selector, null ];
131
+
132
+ } else {
133
+ match = quickExpr.exec( selector );
134
+ }
125
135
 
126
136
  // Verify a match, and that no context was specified for #id
127
137
  if ( match && (match[1] || !context) ) {
@@ -202,7 +212,7 @@ jQuery.fn = jQuery.prototype = {
202
212
  selector: "",
203
213
 
204
214
  // The current version of jQuery being used
205
- jquery: "1.5.1",
215
+ jquery: "1.6.2",
206
216
 
207
217
  // The default length of a jQuery object is 0
208
218
  length: 0,
@@ -378,9 +388,11 @@ jQuery.extend = jQuery.fn.extend = function() {
378
388
 
379
389
  jQuery.extend({
380
390
  noConflict: function( deep ) {
381
- window.$ = _$;
391
+ if ( window.$ === jQuery ) {
392
+ window.$ = _$;
393
+ }
382
394
 
383
- if ( deep ) {
395
+ if ( deep && window.jQuery === jQuery ) {
384
396
  window.jQuery = _jQuery;
385
397
  }
386
398
 
@@ -394,15 +406,19 @@ jQuery.extend({
394
406
  // the ready event fires. See #6781
395
407
  readyWait: 1,
396
408
 
397
- // Handle when the DOM is ready
398
- ready: function( wait ) {
399
- // A third-party is pushing the ready event forwards
400
- if ( wait === true ) {
401
- jQuery.readyWait--;
409
+ // Hold (or release) the ready event
410
+ holdReady: function( hold ) {
411
+ if ( hold ) {
412
+ jQuery.readyWait++;
413
+ } else {
414
+ jQuery.ready( true );
402
415
  }
416
+ },
403
417
 
404
- // Make sure that the DOM is not already loaded
405
- if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
418
+ // Handle when the DOM is ready
419
+ ready: function( wait ) {
420
+ // Either a released hold or an DOMready/load event and not yet ready
421
+ if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
406
422
  // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
407
423
  if ( !document.body ) {
408
424
  return setTimeout( jQuery.ready, 1 );
@@ -427,11 +443,11 @@ jQuery.extend({
427
443
  },
428
444
 
429
445
  bindReady: function() {
430
- if ( readyBound ) {
446
+ if ( readyList ) {
431
447
  return;
432
448
  }
433
449
 
434
- readyBound = true;
450
+ readyList = jQuery._Deferred();
435
451
 
436
452
  // Catch cases where $(document).ready() is called after the
437
453
  // browser event has already occurred.
@@ -452,7 +468,7 @@ jQuery.extend({
452
468
  } else if ( document.attachEvent ) {
453
469
  // ensure firing before onload,
454
470
  // maybe late but safe also for iframes
455
- document.attachEvent("onreadystatechange", DOMContentLoaded);
471
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
456
472
 
457
473
  // A fallback to window.onload, that will always work
458
474
  window.attachEvent( "onload", jQuery.ready );
@@ -540,20 +556,21 @@ jQuery.extend({
540
556
  // Make sure leading/trailing whitespace is removed (IE can't handle it)
541
557
  data = jQuery.trim( data );
542
558
 
559
+ // Attempt to parse using the native JSON parser first
560
+ if ( window.JSON && window.JSON.parse ) {
561
+ return window.JSON.parse( data );
562
+ }
563
+
543
564
  // Make sure the incoming data is actual JSON
544
565
  // Logic borrowed from http://json.org/json2.js
545
- if ( rvalidchars.test(data.replace(rvalidescape, "@")
546
- .replace(rvalidtokens, "]")
547
- .replace(rvalidbraces, "")) ) {
566
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
567
+ .replace( rvalidtokens, "]" )
568
+ .replace( rvalidbraces, "")) ) {
548
569
 
549
- // Try to use the native JSON parser first
550
- return window.JSON && window.JSON.parse ?
551
- window.JSON.parse( data ) :
552
- (new Function("return " + data))();
570
+ return (new Function( "return " + data ))();
553
571
 
554
- } else {
555
- jQuery.error( "Invalid JSON: " + data );
556
572
  }
573
+ jQuery.error( "Invalid JSON: " + data );
557
574
  },
558
575
 
559
576
  // Cross-browser xml parsing
@@ -580,27 +597,26 @@ jQuery.extend({
580
597
 
581
598
  noop: function() {},
582
599
 
583
- // Evalulates a script in a global context
600
+ // Evaluates a script in a global context
601
+ // Workarounds based on findings by Jim Driscoll
602
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
584
603
  globalEval: function( data ) {
585
- if ( data && rnotwhite.test(data) ) {
586
- // Inspired by code by Andrea Giammarchi
587
- // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
588
- var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
589
- script = document.createElement( "script" );
590
-
591
- if ( jQuery.support.scriptEval() ) {
592
- script.appendChild( document.createTextNode( data ) );
593
- } else {
594
- script.text = data;
595
- }
596
-
597
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
598
- // This arises when a base node is used (#2709).
599
- head.insertBefore( script, head.firstChild );
600
- head.removeChild( script );
604
+ if ( data && rnotwhite.test( data ) ) {
605
+ // We use execScript on Internet Explorer
606
+ // We use an anonymous function so that context is window
607
+ // rather than jQuery in Firefox
608
+ ( window.execScript || function( data ) {
609
+ window[ "eval" ].call( window, data );
610
+ } )( data );
601
611
  }
602
612
  },
603
613
 
614
+ // Converts a dashed string to camelCased string;
615
+ // Used by both the css and data modules
616
+ camelCase: function( string ) {
617
+ return string.replace( rdashAlpha, fcamelCase );
618
+ },
619
+
604
620
  nodeName: function( elem, name ) {
605
621
  return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
606
622
  },
@@ -609,7 +625,7 @@ jQuery.extend({
609
625
  each: function( object, callback, args ) {
610
626
  var name, i = 0,
611
627
  length = object.length,
612
- isObj = length === undefined || jQuery.isFunction(object);
628
+ isObj = length === undefined || jQuery.isFunction( object );
613
629
 
614
630
  if ( args ) {
615
631
  if ( isObj ) {
@@ -635,8 +651,11 @@ jQuery.extend({
635
651
  }
636
652
  }
637
653
  } else {
638
- for ( var value = object[0];
639
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
654
+ for ( ; i < length; ) {
655
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
656
+ break;
657
+ }
658
+ }
640
659
  }
641
660
  }
642
661
 
@@ -667,7 +686,7 @@ jQuery.extend({
667
686
  // The extra typeof function check is to prevent crashes
668
687
  // in Safari 2 (See: #3039)
669
688
  // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
670
- var type = jQuery.type(array);
689
+ var type = jQuery.type( array );
671
690
 
672
691
  if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
673
692
  push.call( ret, array );
@@ -680,8 +699,9 @@ jQuery.extend({
680
699
  },
681
700
 
682
701
  inArray: function( elem, array ) {
683
- if ( array.indexOf ) {
684
- return array.indexOf( elem );
702
+
703
+ if ( indexOf ) {
704
+ return indexOf.call( array, elem );
685
705
  }
686
706
 
687
707
  for ( var i = 0, length = array.length; i < length; i++ ) {
@@ -731,15 +751,30 @@ jQuery.extend({
731
751
 
732
752
  // arg is for internal usage only
733
753
  map: function( elems, callback, arg ) {
734
- var ret = [], value;
754
+ var value, key, ret = [],
755
+ i = 0,
756
+ length = elems.length,
757
+ // jquery objects are treated as arrays
758
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
735
759
 
736
760
  // Go through the array, translating each of the items to their
737
- // new value (or values).
738
- for ( var i = 0, length = elems.length; i < length; i++ ) {
739
- value = callback( elems[ i ], i, arg );
761
+ if ( isArray ) {
762
+ for ( ; i < length; i++ ) {
763
+ value = callback( elems[ i ], i, arg );
764
+
765
+ if ( value != null ) {
766
+ ret[ ret.length ] = value;
767
+ }
768
+ }
769
+
770
+ // Go through every key on the object,
771
+ } else {
772
+ for ( key in elems ) {
773
+ value = callback( elems[ key ], key, arg );
740
774
 
741
- if ( value != null ) {
742
- ret[ ret.length ] = value;
775
+ if ( value != null ) {
776
+ ret[ ret.length ] = value;
777
+ }
743
778
  }
744
779
  }
745
780
 
@@ -750,36 +785,35 @@ jQuery.extend({
750
785
  // A global GUID counter for objects
751
786
  guid: 1,
752
787
 
753
- proxy: function( fn, proxy, thisObject ) {
754
- if ( arguments.length === 2 ) {
755
- if ( typeof proxy === "string" ) {
756
- thisObject = fn;
757
- fn = thisObject[ proxy ];
758
- proxy = undefined;
788
+ // Bind a function to a context, optionally partially applying any
789
+ // arguments.
790
+ proxy: function( fn, context ) {
791
+ if ( typeof context === "string" ) {
792
+ var tmp = fn[ context ];
793
+ context = fn;
794
+ fn = tmp;
795
+ }
759
796
 
760
- } else if ( proxy && !jQuery.isFunction( proxy ) ) {
761
- thisObject = proxy;
762
- proxy = undefined;
763
- }
797
+ // Quick check to determine if target is callable, in the spec
798
+ // this throws a TypeError, but we will just return undefined.
799
+ if ( !jQuery.isFunction( fn ) ) {
800
+ return undefined;
764
801
  }
765
802
 
766
- if ( !proxy && fn ) {
803
+ // Simulated bind
804
+ var args = slice.call( arguments, 2 ),
767
805
  proxy = function() {
768
- return fn.apply( thisObject || this, arguments );
806
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );
769
807
  };
770
- }
771
808
 
772
809
  // Set the guid of unique handler to the same of original handler, so it can be removed
773
- if ( fn ) {
774
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
775
- }
810
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
776
811
 
777
- // So proxy can be declared as an argument
778
812
  return proxy;
779
813
  },
780
814
 
781
815
  // Mutifunctional method to get and set values to a collection
782
- // The value/s can be optionally by executed if its a function
816
+ // The value/s can optionally be executed if it's a function
783
817
  access: function( elems, key, value, exec, fn, pass ) {
784
818
  var length = elems.length;
785
819
 
@@ -811,6 +845,116 @@ jQuery.extend({
811
845
  return (new Date()).getTime();
812
846
  },
813
847
 
848
+ // Use of jQuery.browser is frowned upon.
849
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
850
+ uaMatch: function( ua ) {
851
+ ua = ua.toLowerCase();
852
+
853
+ var match = rwebkit.exec( ua ) ||
854
+ ropera.exec( ua ) ||
855
+ rmsie.exec( ua ) ||
856
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
857
+ [];
858
+
859
+ return { browser: match[1] || "", version: match[2] || "0" };
860
+ },
861
+
862
+ sub: function() {
863
+ function jQuerySub( selector, context ) {
864
+ return new jQuerySub.fn.init( selector, context );
865
+ }
866
+ jQuery.extend( true, jQuerySub, this );
867
+ jQuerySub.superclass = this;
868
+ jQuerySub.fn = jQuerySub.prototype = this();
869
+ jQuerySub.fn.constructor = jQuerySub;
870
+ jQuerySub.sub = this.sub;
871
+ jQuerySub.fn.init = function init( selector, context ) {
872
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
873
+ context = jQuerySub( context );
874
+ }
875
+
876
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
877
+ };
878
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
879
+ var rootjQuerySub = jQuerySub(document);
880
+ return jQuerySub;
881
+ },
882
+
883
+ browser: {}
884
+ });
885
+
886
+ // Populate the class2type map
887
+ jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
888
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
889
+ });
890
+
891
+ browserMatch = jQuery.uaMatch( userAgent );
892
+ if ( browserMatch.browser ) {
893
+ jQuery.browser[ browserMatch.browser ] = true;
894
+ jQuery.browser.version = browserMatch.version;
895
+ }
896
+
897
+ // Deprecated, use jQuery.browser.webkit instead
898
+ if ( jQuery.browser.webkit ) {
899
+ jQuery.browser.safari = true;
900
+ }
901
+
902
+ // IE doesn't match non-breaking spaces with \s
903
+ if ( rnotwhite.test( "\xA0" ) ) {
904
+ trimLeft = /^[\s\xA0]+/;
905
+ trimRight = /[\s\xA0]+$/;
906
+ }
907
+
908
+ // All jQuery objects should point back to these
909
+ rootjQuery = jQuery(document);
910
+
911
+ // Cleanup functions for the document ready method
912
+ if ( document.addEventListener ) {
913
+ DOMContentLoaded = function() {
914
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
915
+ jQuery.ready();
916
+ };
917
+
918
+ } else if ( document.attachEvent ) {
919
+ DOMContentLoaded = function() {
920
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
921
+ if ( document.readyState === "complete" ) {
922
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
923
+ jQuery.ready();
924
+ }
925
+ };
926
+ }
927
+
928
+ // The DOM ready check for Internet Explorer
929
+ function doScrollCheck() {
930
+ if ( jQuery.isReady ) {
931
+ return;
932
+ }
933
+
934
+ try {
935
+ // If IE is used, use the trick by Diego Perini
936
+ // http://javascript.nwbox.com/IEContentLoaded/
937
+ document.documentElement.doScroll("left");
938
+ } catch(e) {
939
+ setTimeout( doScrollCheck, 1 );
940
+ return;
941
+ }
942
+
943
+ // and execute any waiting functions
944
+ jQuery.ready();
945
+ }
946
+
947
+ return jQuery;
948
+
949
+ })();
950
+
951
+
952
+ var // Promise methods
953
+ promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
954
+ // Static reference to slice
955
+ sliceDeferred = [].slice;
956
+
957
+ jQuery.extend({
814
958
  // Create a simple deferred (one callbacks list)
815
959
  _Deferred: function() {
816
960
  var // callbacks list
@@ -856,18 +1000,14 @@ jQuery.extend({
856
1000
  // resolve with given context and args
857
1001
  resolveWith: function( context, args ) {
858
1002
  if ( !cancelled && !fired && !firing ) {
1003
+ // make sure args are available (#8421)
1004
+ args = args || [];
859
1005
  firing = 1;
860
1006
  try {
861
1007
  while( callbacks[ 0 ] ) {
862
1008
  callbacks.shift().apply( context, args );
863
1009
  }
864
1010
  }
865
- // We have to add a catch block for
866
- // IE prior to 8 or else the finally
867
- // block will never get executed
868
- catch (e) {
869
- throw e;
870
- }
871
1011
  finally {
872
1012
  fired = [ context, args ];
873
1013
  firing = 0;
@@ -878,7 +1018,7 @@ jQuery.extend({
878
1018
 
879
1019
  // resolve with this as context and given arguments
880
1020
  resolve: function() {
881
- deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );
1021
+ deferred.resolveWith( this, arguments );
882
1022
  return this;
883
1023
  },
884
1024
 
@@ -909,10 +1049,37 @@ jQuery.extend({
909
1049
  deferred.done( doneCallbacks ).fail( failCallbacks );
910
1050
  return this;
911
1051
  },
1052
+ always: function() {
1053
+ return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
1054
+ },
912
1055
  fail: failDeferred.done,
913
1056
  rejectWith: failDeferred.resolveWith,
914
1057
  reject: failDeferred.resolve,
915
1058
  isRejected: failDeferred.isResolved,
1059
+ pipe: function( fnDone, fnFail ) {
1060
+ return jQuery.Deferred(function( newDefer ) {
1061
+ jQuery.each( {
1062
+ done: [ fnDone, "resolve" ],
1063
+ fail: [ fnFail, "reject" ]
1064
+ }, function( handler, data ) {
1065
+ var fn = data[ 0 ],
1066
+ action = data[ 1 ],
1067
+ returned;
1068
+ if ( jQuery.isFunction( fn ) ) {
1069
+ deferred[ handler ](function() {
1070
+ returned = fn.apply( this, arguments );
1071
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
1072
+ returned.promise().then( newDefer.resolve, newDefer.reject );
1073
+ } else {
1074
+ newDefer[ action ]( returned );
1075
+ }
1076
+ });
1077
+ } else {
1078
+ deferred[ handler ]( newDefer[ action ] );
1079
+ }
1080
+ });
1081
+ }).promise();
1082
+ },
916
1083
  // Get a promise for this deferred
917
1084
  // If obj is provided, the promise aspect is added to the object
918
1085
  promise: function( obj ) {
@@ -928,7 +1095,7 @@ jQuery.extend({
928
1095
  }
929
1096
  return obj;
930
1097
  }
931
- } );
1098
+ });
932
1099
  // Make sure only one callback list will be used
933
1100
  deferred.done( failDeferred.cancel ).fail( deferred.cancel );
934
1101
  // Unexpose cancel
@@ -941,194 +1108,103 @@ jQuery.extend({
941
1108
  },
942
1109
 
943
1110
  // Deferred helper
944
- when: function( object ) {
945
- var lastIndex = arguments.length,
946
- deferred = lastIndex <= 1 && object && jQuery.isFunction( object.promise ) ?
947
- object :
948
- jQuery.Deferred(),
949
- promise = deferred.promise();
950
-
951
- if ( lastIndex > 1 ) {
952
- var array = slice.call( arguments, 0 ),
953
- count = lastIndex,
954
- iCallback = function( index ) {
955
- return function( value ) {
956
- array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
957
- if ( !( --count ) ) {
958
- deferred.resolveWith( promise, array );
959
- }
960
- };
961
- };
962
- while( ( lastIndex-- ) ) {
963
- object = array[ lastIndex ];
964
- if ( object && jQuery.isFunction( object.promise ) ) {
965
- object.promise().then( iCallback(lastIndex), deferred.reject );
1111
+ when: function( firstParam ) {
1112
+ var args = arguments,
1113
+ i = 0,
1114
+ length = args.length,
1115
+ count = length,
1116
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
1117
+ firstParam :
1118
+ jQuery.Deferred();
1119
+ function resolveFunc( i ) {
1120
+ return function( value ) {
1121
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1122
+ if ( !( --count ) ) {
1123
+ // Strange bug in FF4:
1124
+ // Values changed onto the arguments object sometimes end up as undefined values
1125
+ // outside the $.when method. Cloning the object into a fresh array solves the issue
1126
+ deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
1127
+ }
1128
+ };
1129
+ }
1130
+ if ( length > 1 ) {
1131
+ for( ; i < length; i++ ) {
1132
+ if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
1133
+ args[ i ].promise().then( resolveFunc(i), deferred.reject );
966
1134
  } else {
967
1135
  --count;
968
1136
  }
969
1137
  }
970
1138
  if ( !count ) {
971
- deferred.resolveWith( promise, array );
972
- }
973
- } else if ( deferred !== object ) {
974
- deferred.resolve( object );
975
- }
976
- return promise;
977
- },
978
-
979
- // Use of jQuery.browser is frowned upon.
980
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
981
- uaMatch: function( ua ) {
982
- ua = ua.toLowerCase();
983
-
984
- var match = rwebkit.exec( ua ) ||
985
- ropera.exec( ua ) ||
986
- rmsie.exec( ua ) ||
987
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
988
- [];
989
-
990
- return { browser: match[1] || "", version: match[2] || "0" };
991
- },
992
-
993
- sub: function() {
994
- function jQuerySubclass( selector, context ) {
995
- return new jQuerySubclass.fn.init( selector, context );
996
- }
997
- jQuery.extend( true, jQuerySubclass, this );
998
- jQuerySubclass.superclass = this;
999
- jQuerySubclass.fn = jQuerySubclass.prototype = this();
1000
- jQuerySubclass.fn.constructor = jQuerySubclass;
1001
- jQuerySubclass.subclass = this.subclass;
1002
- jQuerySubclass.fn.init = function init( selector, context ) {
1003
- if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
1004
- context = jQuerySubclass(context);
1139
+ deferred.resolveWith( deferred, args );
1005
1140
  }
1006
-
1007
- return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
1008
- };
1009
- jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
1010
- var rootjQuerySubclass = jQuerySubclass(document);
1011
- return jQuerySubclass;
1012
- },
1013
-
1014
- browser: {}
1015
- });
1016
-
1017
- // Create readyList deferred
1018
- readyList = jQuery._Deferred();
1019
-
1020
- // Populate the class2type map
1021
- jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
1022
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
1023
- });
1024
-
1025
- browserMatch = jQuery.uaMatch( userAgent );
1026
- if ( browserMatch.browser ) {
1027
- jQuery.browser[ browserMatch.browser ] = true;
1028
- jQuery.browser.version = browserMatch.version;
1029
- }
1030
-
1031
- // Deprecated, use jQuery.browser.webkit instead
1032
- if ( jQuery.browser.webkit ) {
1033
- jQuery.browser.safari = true;
1034
- }
1035
-
1036
- if ( indexOf ) {
1037
- jQuery.inArray = function( elem, array ) {
1038
- return indexOf.call( array, elem );
1039
- };
1040
- }
1041
-
1042
- // IE doesn't match non-breaking spaces with \s
1043
- if ( rnotwhite.test( "\xA0" ) ) {
1044
- trimLeft = /^[\s\xA0]+/;
1045
- trimRight = /[\s\xA0]+$/;
1046
- }
1047
-
1048
- // All jQuery objects should point back to these
1049
- rootjQuery = jQuery(document);
1050
-
1051
- // Cleanup functions for the document ready method
1052
- if ( document.addEventListener ) {
1053
- DOMContentLoaded = function() {
1054
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
1055
- jQuery.ready();
1056
- };
1057
-
1058
- } else if ( document.attachEvent ) {
1059
- DOMContentLoaded = function() {
1060
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
1061
- if ( document.readyState === "complete" ) {
1062
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
1063
- jQuery.ready();
1141
+ } else if ( deferred !== firstParam ) {
1142
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
1064
1143
  }
1065
- };
1066
- }
1067
-
1068
- // The DOM ready check for Internet Explorer
1069
- function doScrollCheck() {
1070
- if ( jQuery.isReady ) {
1071
- return;
1072
- }
1073
-
1074
- try {
1075
- // If IE is used, use the trick by Diego Perini
1076
- // http://javascript.nwbox.com/IEContentLoaded/
1077
- document.documentElement.doScroll("left");
1078
- } catch(e) {
1079
- setTimeout( doScrollCheck, 1 );
1080
- return;
1144
+ return deferred.promise();
1081
1145
  }
1146
+ });
1082
1147
 
1083
- // and execute any waiting functions
1084
- jQuery.ready();
1085
- }
1086
-
1087
- // Expose jQuery to the global object
1088
- return jQuery;
1089
-
1090
- })();
1091
-
1092
-
1093
- (function() {
1094
1148
 
1095
- jQuery.support = {};
1096
1149
 
1097
- var div = document.createElement("div");
1150
+ jQuery.support = (function() {
1151
+
1152
+ var div = document.createElement( "div" ),
1153
+ documentElement = document.documentElement,
1154
+ all,
1155
+ a,
1156
+ select,
1157
+ opt,
1158
+ input,
1159
+ marginDiv,
1160
+ support,
1161
+ fragment,
1162
+ body,
1163
+ testElementParent,
1164
+ testElement,
1165
+ testElementStyle,
1166
+ tds,
1167
+ events,
1168
+ eventName,
1169
+ i,
1170
+ isSupported;
1098
1171
 
1099
- div.style.display = "none";
1100
- div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
1172
+ // Preliminary tests
1173
+ div.setAttribute("className", "t");
1174
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
1101
1175
 
1102
- var all = div.getElementsByTagName("*"),
1103
- a = div.getElementsByTagName("a")[0],
1104
- select = document.createElement("select"),
1105
- opt = select.appendChild( document.createElement("option") ),
1106
- input = div.getElementsByTagName("input")[0];
1176
+ all = div.getElementsByTagName( "*" );
1177
+ a = div.getElementsByTagName( "a" )[ 0 ];
1107
1178
 
1108
1179
  // Can't get basic test support
1109
1180
  if ( !all || !all.length || !a ) {
1110
- return;
1181
+ return {};
1111
1182
  }
1112
1183
 
1113
- jQuery.support = {
1184
+ // First batch of supports tests
1185
+ select = document.createElement( "select" );
1186
+ opt = select.appendChild( document.createElement("option") );
1187
+ input = div.getElementsByTagName( "input" )[ 0 ];
1188
+
1189
+ support = {
1114
1190
  // IE strips leading whitespace when .innerHTML is used
1115
- leadingWhitespace: div.firstChild.nodeType === 3,
1191
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
1116
1192
 
1117
1193
  // Make sure that tbody elements aren't automatically inserted
1118
1194
  // IE will insert them into empty tables
1119
- tbody: !div.getElementsByTagName("tbody").length,
1195
+ tbody: !div.getElementsByTagName( "tbody" ).length,
1120
1196
 
1121
1197
  // Make sure that link elements get serialized correctly by innerHTML
1122
1198
  // This requires a wrapper element in IE
1123
- htmlSerialize: !!div.getElementsByTagName("link").length,
1199
+ htmlSerialize: !!div.getElementsByTagName( "link" ).length,
1124
1200
 
1125
1201
  // Get the style information from getAttribute
1126
- // (IE uses .cssText insted)
1127
- style: /red/.test( a.getAttribute("style") ),
1202
+ // (IE uses .cssText instead)
1203
+ style: /top/.test( a.getAttribute("style") ),
1128
1204
 
1129
1205
  // Make sure that URLs aren't manipulated
1130
1206
  // (IE normalizes it by default)
1131
- hrefNormalized: a.getAttribute("href") === "/a",
1207
+ hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
1132
1208
 
1133
1209
  // Make sure that element opacity exists
1134
1210
  // (IE uses filter instead)
@@ -1142,180 +1218,193 @@ return jQuery;
1142
1218
  // Make sure that if no value is specified for a checkbox
1143
1219
  // that it defaults to "on".
1144
1220
  // (WebKit defaults to "" instead)
1145
- checkOn: input.value === "on",
1221
+ checkOn: ( input.value === "on" ),
1146
1222
 
1147
1223
  // Make sure that a selected-by-default option has a working selected property.
1148
1224
  // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1149
1225
  optSelected: opt.selected,
1150
1226
 
1227
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1228
+ getSetAttribute: div.className !== "t",
1229
+
1151
1230
  // Will be defined later
1231
+ submitBubbles: true,
1232
+ changeBubbles: true,
1233
+ focusinBubbles: false,
1152
1234
  deleteExpando: true,
1153
- optDisabled: false,
1154
- checkClone: false,
1155
1235
  noCloneEvent: true,
1156
- noCloneChecked: true,
1157
- boxModel: null,
1158
1236
  inlineBlockNeedsLayout: false,
1159
1237
  shrinkWrapBlocks: false,
1160
- reliableHiddenOffsets: true
1238
+ reliableMarginRight: true
1161
1239
  };
1162
1240
 
1241
+ // Make sure checked status is properly cloned
1163
1242
  input.checked = true;
1164
- jQuery.support.noCloneChecked = input.cloneNode( true ).checked;
1243
+ support.noCloneChecked = input.cloneNode( true ).checked;
1165
1244
 
1166
1245
  // Make sure that the options inside disabled selects aren't marked as disabled
1167
- // (WebKit marks them as diabled)
1246
+ // (WebKit marks them as disabled)
1168
1247
  select.disabled = true;
1169
- jQuery.support.optDisabled = !opt.disabled;
1170
-
1171
- var _scriptEval = null;
1172
- jQuery.support.scriptEval = function() {
1173
- if ( _scriptEval === null ) {
1174
- var root = document.documentElement,
1175
- script = document.createElement("script"),
1176
- id = "script" + jQuery.now();
1177
-
1178
- try {
1179
- script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
1180
- } catch(e) {}
1181
-
1182
- root.insertBefore( script, root.firstChild );
1183
-
1184
- // Make sure that the execution of code works by injecting a script
1185
- // tag with appendChild/createTextNode
1186
- // (IE doesn't support this, fails, and uses .text instead)
1187
- if ( window[ id ] ) {
1188
- _scriptEval = true;
1189
- delete window[ id ];
1190
- } else {
1191
- _scriptEval = false;
1192
- }
1193
-
1194
- root.removeChild( script );
1195
- // release memory in IE
1196
- root = script = id = null;
1197
- }
1198
-
1199
- return _scriptEval;
1200
- };
1248
+ support.optDisabled = !opt.disabled;
1201
1249
 
1202
1250
  // Test to see if it's possible to delete an expando from an element
1203
1251
  // Fails in Internet Explorer
1204
1252
  try {
1205
1253
  delete div.test;
1206
-
1207
- } catch(e) {
1208
- jQuery.support.deleteExpando = false;
1254
+ } catch( e ) {
1255
+ support.deleteExpando = false;
1209
1256
  }
1210
1257
 
1211
1258
  if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1212
- div.attachEvent("onclick", function click() {
1259
+ div.attachEvent( "onclick", function() {
1213
1260
  // Cloning a node shouldn't copy over any
1214
1261
  // bound event handlers (IE does this)
1215
- jQuery.support.noCloneEvent = false;
1216
- div.detachEvent("onclick", click);
1262
+ support.noCloneEvent = false;
1217
1263
  });
1218
- div.cloneNode(true).fireEvent("onclick");
1264
+ div.cloneNode( true ).fireEvent( "onclick" );
1219
1265
  }
1220
1266
 
1221
- div = document.createElement("div");
1222
- div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
1267
+ // Check if a radio maintains it's value
1268
+ // after being appended to the DOM
1269
+ input = document.createElement("input");
1270
+ input.value = "t";
1271
+ input.setAttribute("type", "radio");
1272
+ support.radioValue = input.value === "t";
1223
1273
 
1224
- var fragment = document.createDocumentFragment();
1274
+ input.setAttribute("checked", "checked");
1275
+ div.appendChild( input );
1276
+ fragment = document.createDocumentFragment();
1225
1277
  fragment.appendChild( div.firstChild );
1226
1278
 
1227
1279
  // WebKit doesn't clone checked state correctly in fragments
1228
- jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
1280
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1281
+
1282
+ div.innerHTML = "";
1229
1283
 
1230
1284
  // Figure out if the W3C box model works as expected
1231
- // document.body must exist before we can do this
1232
- jQuery(function() {
1233
- var div = document.createElement("div"),
1234
- body = document.getElementsByTagName("body")[0];
1285
+ div.style.width = div.style.paddingLeft = "1px";
1286
+
1287
+ body = document.getElementsByTagName( "body" )[ 0 ];
1288
+ // We use our own, invisible, body unless the body is already present
1289
+ // in which case we use a div (#9239)
1290
+ testElement = document.createElement( body ? "div" : "body" );
1291
+ testElementStyle = {
1292
+ visibility: "hidden",
1293
+ width: 0,
1294
+ height: 0,
1295
+ border: 0,
1296
+ margin: 0
1297
+ };
1298
+ if ( body ) {
1299
+ jQuery.extend( testElementStyle, {
1300
+ position: "absolute",
1301
+ left: -1000,
1302
+ top: -1000
1303
+ });
1304
+ }
1305
+ for ( i in testElementStyle ) {
1306
+ testElement.style[ i ] = testElementStyle[ i ];
1307
+ }
1308
+ testElement.appendChild( div );
1309
+ testElementParent = body || documentElement;
1310
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
1311
+
1312
+ // Check if a disconnected checkbox will retain its checked
1313
+ // value of true after appended to the DOM (IE6/7)
1314
+ support.appendChecked = input.checked;
1315
+
1316
+ support.boxModel = div.offsetWidth === 2;
1317
+
1318
+ if ( "zoom" in div.style ) {
1319
+ // Check if natively block-level elements act like inline-block
1320
+ // elements when setting their display to 'inline' and giving
1321
+ // them layout
1322
+ // (IE < 8 does this)
1323
+ div.style.display = "inline";
1324
+ div.style.zoom = 1;
1325
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
1326
+
1327
+ // Check if elements with layout shrink-wrap their children
1328
+ // (IE 6 does this)
1329
+ div.style.display = "";
1330
+ div.innerHTML = "<div style='width:4px;'></div>";
1331
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
1332
+ }
1235
1333
 
1236
- // Frameset documents with no body should not run this code
1237
- if ( !body ) {
1238
- return;
1239
- }
1334
+ div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1335
+ tds = div.getElementsByTagName( "td" );
1336
+
1337
+ // Check if table cells still have offsetWidth/Height when they are set
1338
+ // to display:none and there are still other visible table cells in a
1339
+ // table row; if so, offsetWidth/Height are not reliable for use when
1340
+ // determining if an element has been hidden directly using
1341
+ // display:none (it is still safe to use offsets if a parent element is
1342
+ // hidden; don safety goggles and see bug #4512 for more information).
1343
+ // (only IE 8 fails this test)
1344
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
1345
+
1346
+ tds[ 0 ].style.display = "";
1347
+ tds[ 1 ].style.display = "none";
1348
+
1349
+ // Check if empty table cells still have offsetWidth/Height
1350
+ // (IE < 8 fail this test)
1351
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1352
+ div.innerHTML = "";
1353
+
1354
+ // Check if div with explicit width and no margin-right incorrectly
1355
+ // gets computed margin-right based on width of container. For more
1356
+ // info see bug #3333
1357
+ // Fails in WebKit before Feb 2011 nightlies
1358
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1359
+ if ( document.defaultView && document.defaultView.getComputedStyle ) {
1360
+ marginDiv = document.createElement( "div" );
1361
+ marginDiv.style.width = "0";
1362
+ marginDiv.style.marginRight = "0";
1363
+ div.appendChild( marginDiv );
1364
+ support.reliableMarginRight =
1365
+ ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
1366
+ }
1240
1367
 
1241
- div.style.width = div.style.paddingLeft = "1px";
1242
- body.appendChild( div );
1243
- jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
1244
-
1245
- if ( "zoom" in div.style ) {
1246
- // Check if natively block-level elements act like inline-block
1247
- // elements when setting their display to 'inline' and giving
1248
- // them layout
1249
- // (IE < 8 does this)
1250
- div.style.display = "inline";
1251
- div.style.zoom = 1;
1252
- jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
1253
-
1254
- // Check if elements with layout shrink-wrap their children
1255
- // (IE 6 does this)
1256
- div.style.display = "";
1257
- div.innerHTML = "<div style='width:4px;'></div>";
1258
- jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
1259
- }
1260
-
1261
- div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1262
- var tds = div.getElementsByTagName("td");
1263
-
1264
- // Check if table cells still have offsetWidth/Height when they are set
1265
- // to display:none and there are still other visible table cells in a
1266
- // table row; if so, offsetWidth/Height are not reliable for use when
1267
- // determining if an element has been hidden directly using
1268
- // display:none (it is still safe to use offsets if a parent element is
1269
- // hidden; don safety goggles and see bug #4512 for more information).
1270
- // (only IE 8 fails this test)
1271
- jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
1272
-
1273
- tds[0].style.display = "";
1274
- tds[1].style.display = "none";
1275
-
1276
- // Check if empty table cells still have offsetWidth/Height
1277
- // (IE < 8 fail this test)
1278
- jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1279
- div.innerHTML = "";
1280
-
1281
- body.removeChild( div ).style.display = "none";
1282
- div = tds = null;
1283
- });
1368
+ // Remove the body element we added
1369
+ testElement.innerHTML = "";
1370
+ testElementParent.removeChild( testElement );
1284
1371
 
1285
1372
  // Technique from Juriy Zaytsev
1286
1373
  // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
1287
- var eventSupported = function( eventName ) {
1288
- var el = document.createElement("div");
1289
- eventName = "on" + eventName;
1290
-
1291
- // We only care about the case where non-standard event systems
1292
- // are used, namely in IE. Short-circuiting here helps us to
1293
- // avoid an eval call (in setAttribute) which can cause CSP
1294
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1295
- if ( !el.attachEvent ) {
1296
- return true;
1374
+ // We only care about the case where non-standard event systems
1375
+ // are used, namely in IE. Short-circuiting here helps us to
1376
+ // avoid an eval call (in setAttribute) which can cause CSP
1377
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1378
+ if ( div.attachEvent ) {
1379
+ for( i in {
1380
+ submit: 1,
1381
+ change: 1,
1382
+ focusin: 1
1383
+ } ) {
1384
+ eventName = "on" + i;
1385
+ isSupported = ( eventName in div );
1386
+ if ( !isSupported ) {
1387
+ div.setAttribute( eventName, "return;" );
1388
+ isSupported = ( typeof div[ eventName ] === "function" );
1389
+ }
1390
+ support[ i + "Bubbles" ] = isSupported;
1297
1391
  }
1392
+ }
1298
1393
 
1299
- var isSupported = (eventName in el);
1300
- if ( !isSupported ) {
1301
- el.setAttribute(eventName, "return;");
1302
- isSupported = typeof el[eventName] === "function";
1303
- }
1304
- el = null;
1394
+ // Null connected elements to avoid leaks in IE
1395
+ testElement = fragment = select = opt = body = marginDiv = div = input = null;
1305
1396
 
1306
- return isSupported;
1307
- };
1397
+ return support;
1398
+ })();
1308
1399
 
1309
- jQuery.support.submitBubbles = eventSupported("submit");
1310
- jQuery.support.changeBubbles = eventSupported("change");
1400
+ // Keep track of boxModel
1401
+ jQuery.boxModel = jQuery.support.boxModel;
1311
1402
 
1312
- // release memory in IE
1313
- div = all = a = null;
1314
- })();
1315
1403
 
1316
1404
 
1317
1405
 
1318
- var rbrace = /^(?:\{.*\}|\[.*\])$/;
1406
+ var rbrace = /^(?:\{.*\}|\[.*\])$/,
1407
+ rmultiDash = /([a-z])([A-Z])/g;
1319
1408
 
1320
1409
  jQuery.extend({
1321
1410
  cache: {},
@@ -1412,7 +1501,7 @@ jQuery.extend({
1412
1501
  }
1413
1502
 
1414
1503
  if ( data !== undefined ) {
1415
- thisCache[ name ] = data;
1504
+ thisCache[ jQuery.camelCase( name ) ] = data;
1416
1505
  }
1417
1506
 
1418
1507
  // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
@@ -1422,7 +1511,10 @@ jQuery.extend({
1422
1511
  return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1423
1512
  }
1424
1513
 
1425
- return getByName ? thisCache[ name ] : thisCache;
1514
+ return getByName ?
1515
+ // Check for both converted-to-camel and non-converted data property names
1516
+ thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
1517
+ thisCache;
1426
1518
  },
1427
1519
 
1428
1520
  removeData: function( elem, name, pvt /* Internal Use Only */ ) {
@@ -1538,12 +1630,13 @@ jQuery.fn.extend({
1538
1630
  data = jQuery.data( this[0] );
1539
1631
 
1540
1632
  if ( this[0].nodeType === 1 ) {
1541
- var attr = this[0].attributes, name;
1633
+ var attr = this[0].attributes, name;
1542
1634
  for ( var i = 0, l = attr.length; i < l; i++ ) {
1543
1635
  name = attr[i].name;
1544
1636
 
1545
1637
  if ( name.indexOf( "data-" ) === 0 ) {
1546
- name = name.substr( 5 );
1638
+ name = jQuery.camelCase( name.substring(5) );
1639
+
1547
1640
  dataAttr( this[0], name, data[ name ] );
1548
1641
  }
1549
1642
  }
@@ -1597,7 +1690,9 @@ function dataAttr( elem, key, data ) {
1597
1690
  // If nothing was found internally, try to fetch any
1598
1691
  // data from the HTML5 data-* attribute
1599
1692
  if ( data === undefined && elem.nodeType === 1 ) {
1600
- data = elem.getAttribute( "data-" + key );
1693
+ var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
1694
+
1695
+ data = elem.getAttribute( name );
1601
1696
 
1602
1697
  if ( typeof data === "string" ) {
1603
1698
  try {
@@ -1636,35 +1731,76 @@ function isEmptyDataObject( obj ) {
1636
1731
 
1637
1732
 
1638
1733
 
1639
- jQuery.extend({
1640
- queue: function( elem, type, data ) {
1641
- if ( !elem ) {
1642
- return;
1643
- }
1734
+ function handleQueueMarkDefer( elem, type, src ) {
1735
+ var deferDataKey = type + "defer",
1736
+ queueDataKey = type + "queue",
1737
+ markDataKey = type + "mark",
1738
+ defer = jQuery.data( elem, deferDataKey, undefined, true );
1739
+ if ( defer &&
1740
+ ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
1741
+ ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
1742
+ // Give room for hard-coded callbacks to fire first
1743
+ // and eventually mark/queue something else on the element
1744
+ setTimeout( function() {
1745
+ if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
1746
+ !jQuery.data( elem, markDataKey, undefined, true ) ) {
1747
+ jQuery.removeData( elem, deferDataKey, true );
1748
+ defer.resolve();
1749
+ }
1750
+ }, 0 );
1751
+ }
1752
+ }
1644
1753
 
1645
- type = (type || "fx") + "queue";
1646
- var q = jQuery._data( elem, type );
1754
+ jQuery.extend({
1647
1755
 
1648
- // Speed up dequeue by getting out quickly if this is just a lookup
1649
- if ( !data ) {
1650
- return q || [];
1756
+ _mark: function( elem, type ) {
1757
+ if ( elem ) {
1758
+ type = (type || "fx") + "mark";
1759
+ jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
1651
1760
  }
1761
+ },
1652
1762
 
1653
- if ( !q || jQuery.isArray(data) ) {
1654
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
1655
-
1656
- } else {
1657
- q.push( data );
1763
+ _unmark: function( force, elem, type ) {
1764
+ if ( force !== true ) {
1765
+ type = elem;
1766
+ elem = force;
1767
+ force = false;
1658
1768
  }
1769
+ if ( elem ) {
1770
+ type = type || "fx";
1771
+ var key = type + "mark",
1772
+ count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
1773
+ if ( count ) {
1774
+ jQuery.data( elem, key, count, true );
1775
+ } else {
1776
+ jQuery.removeData( elem, key, true );
1777
+ handleQueueMarkDefer( elem, type, "mark" );
1778
+ }
1779
+ }
1780
+ },
1659
1781
 
1660
- return q;
1782
+ queue: function( elem, type, data ) {
1783
+ if ( elem ) {
1784
+ type = (type || "fx") + "queue";
1785
+ var q = jQuery.data( elem, type, undefined, true );
1786
+ // Speed up dequeue by getting out quickly if this is just a lookup
1787
+ if ( data ) {
1788
+ if ( !q || jQuery.isArray(data) ) {
1789
+ q = jQuery.data( elem, type, jQuery.makeArray(data), true );
1790
+ } else {
1791
+ q.push( data );
1792
+ }
1793
+ }
1794
+ return q || [];
1795
+ }
1661
1796
  },
1662
1797
 
1663
1798
  dequeue: function( elem, type ) {
1664
1799
  type = type || "fx";
1665
1800
 
1666
1801
  var queue = jQuery.queue( elem, type ),
1667
- fn = queue.shift();
1802
+ fn = queue.shift(),
1803
+ defer;
1668
1804
 
1669
1805
  // If the fx queue is dequeued, always remove the progress sentinel
1670
1806
  if ( fn === "inprogress" ) {
@@ -1685,6 +1821,7 @@ jQuery.extend({
1685
1821
 
1686
1822
  if ( !queue.length ) {
1687
1823
  jQuery.removeData( elem, type + "queue", true );
1824
+ handleQueueMarkDefer( elem, type, "queue" );
1688
1825
  }
1689
1826
  }
1690
1827
  });
@@ -1699,7 +1836,7 @@ jQuery.fn.extend({
1699
1836
  if ( data === undefined ) {
1700
1837
  return jQuery.queue( this[0], type );
1701
1838
  }
1702
- return this.each(function( i ) {
1839
+ return this.each(function() {
1703
1840
  var queue = jQuery.queue( this, type, data );
1704
1841
 
1705
1842
  if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -1712,7 +1849,6 @@ jQuery.fn.extend({
1712
1849
  jQuery.dequeue( this, type );
1713
1850
  });
1714
1851
  },
1715
-
1716
1852
  // Based off of the plugin by Clint Helfers, with permission.
1717
1853
  // http://blindsignals.com/index.php/2009/07/jquery-delay/
1718
1854
  delay: function( time, type ) {
@@ -1726,9 +1862,41 @@ jQuery.fn.extend({
1726
1862
  }, time );
1727
1863
  });
1728
1864
  },
1729
-
1730
1865
  clearQueue: function( type ) {
1731
1866
  return this.queue( type || "fx", [] );
1867
+ },
1868
+ // Get a promise resolved when queues of a certain type
1869
+ // are emptied (fx is the type by default)
1870
+ promise: function( type, object ) {
1871
+ if ( typeof type !== "string" ) {
1872
+ object = type;
1873
+ type = undefined;
1874
+ }
1875
+ type = type || "fx";
1876
+ var defer = jQuery.Deferred(),
1877
+ elements = this,
1878
+ i = elements.length,
1879
+ count = 1,
1880
+ deferDataKey = type + "defer",
1881
+ queueDataKey = type + "queue",
1882
+ markDataKey = type + "mark",
1883
+ tmp;
1884
+ function resolve() {
1885
+ if ( !( --count ) ) {
1886
+ defer.resolveWith( elements, [ elements ] );
1887
+ }
1888
+ }
1889
+ while( i-- ) {
1890
+ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
1891
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
1892
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
1893
+ jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
1894
+ count++;
1895
+ tmp.done( resolve );
1896
+ }
1897
+ }
1898
+ resolve();
1899
+ return defer.promise();
1732
1900
  }
1733
1901
  });
1734
1902
 
@@ -1736,66 +1904,67 @@ jQuery.fn.extend({
1736
1904
 
1737
1905
 
1738
1906
  var rclass = /[\n\t\r]/g,
1739
- rspaces = /\s+/,
1907
+ rspace = /\s+/,
1740
1908
  rreturn = /\r/g,
1741
- rspecialurl = /^(?:href|src|style)$/,
1742
1909
  rtype = /^(?:button|input)$/i,
1743
1910
  rfocusable = /^(?:button|input|object|select|textarea)$/i,
1744
1911
  rclickable = /^a(?:rea)?$/i,
1745
- rradiocheck = /^(?:radio|checkbox)$/i;
1746
-
1747
- jQuery.props = {
1748
- "for": "htmlFor",
1749
- "class": "className",
1750
- readonly: "readOnly",
1751
- maxlength: "maxLength",
1752
- cellspacing: "cellSpacing",
1753
- rowspan: "rowSpan",
1754
- colspan: "colSpan",
1755
- tabindex: "tabIndex",
1756
- usemap: "useMap",
1757
- frameborder: "frameBorder"
1758
- };
1912
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
1913
+ rinvalidChar = /\:|^on/,
1914
+ formHook, boolHook;
1759
1915
 
1760
1916
  jQuery.fn.extend({
1761
1917
  attr: function( name, value ) {
1762
1918
  return jQuery.access( this, name, value, true, jQuery.attr );
1763
1919
  },
1764
1920
 
1765
- removeAttr: function( name, fn ) {
1766
- return this.each(function(){
1767
- jQuery.attr( this, name, "" );
1768
- if ( this.nodeType === 1 ) {
1769
- this.removeAttribute( name );
1770
- }
1921
+ removeAttr: function( name ) {
1922
+ return this.each(function() {
1923
+ jQuery.removeAttr( this, name );
1924
+ });
1925
+ },
1926
+
1927
+ prop: function( name, value ) {
1928
+ return jQuery.access( this, name, value, true, jQuery.prop );
1929
+ },
1930
+
1931
+ removeProp: function( name ) {
1932
+ name = jQuery.propFix[ name ] || name;
1933
+ return this.each(function() {
1934
+ // try/catch handles cases where IE balks (such as removing a property on window)
1935
+ try {
1936
+ this[ name ] = undefined;
1937
+ delete this[ name ];
1938
+ } catch( e ) {}
1771
1939
  });
1772
1940
  },
1773
1941
 
1774
1942
  addClass: function( value ) {
1775
- if ( jQuery.isFunction(value) ) {
1776
- return this.each(function(i) {
1777
- var self = jQuery(this);
1778
- self.addClass( value.call(this, i, self.attr("class")) );
1943
+ var classNames, i, l, elem,
1944
+ setClass, c, cl;
1945
+
1946
+ if ( jQuery.isFunction( value ) ) {
1947
+ return this.each(function( j ) {
1948
+ jQuery( this ).addClass( value.call(this, j, this.className) );
1779
1949
  });
1780
1950
  }
1781
1951
 
1782
1952
  if ( value && typeof value === "string" ) {
1783
- var classNames = (value || "").split( rspaces );
1953
+ classNames = value.split( rspace );
1784
1954
 
1785
- for ( var i = 0, l = this.length; i < l; i++ ) {
1786
- var elem = this[i];
1955
+ for ( i = 0, l = this.length; i < l; i++ ) {
1956
+ elem = this[ i ];
1787
1957
 
1788
1958
  if ( elem.nodeType === 1 ) {
1789
- if ( !elem.className ) {
1959
+ if ( !elem.className && classNames.length === 1 ) {
1790
1960
  elem.className = value;
1791
1961
 
1792
1962
  } else {
1793
- var className = " " + elem.className + " ",
1794
- setClass = elem.className;
1963
+ setClass = " " + elem.className + " ";
1795
1964
 
1796
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1797
- if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1798
- setClass += " " + classNames[c];
1965
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
1966
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
1967
+ setClass += classNames[ c ] + " ";
1799
1968
  }
1800
1969
  }
1801
1970
  elem.className = jQuery.trim( setClass );
@@ -1808,24 +1977,25 @@ jQuery.fn.extend({
1808
1977
  },
1809
1978
 
1810
1979
  removeClass: function( value ) {
1811
- if ( jQuery.isFunction(value) ) {
1812
- return this.each(function(i) {
1813
- var self = jQuery(this);
1814
- self.removeClass( value.call(this, i, self.attr("class")) );
1980
+ var classNames, i, l, elem, className, c, cl;
1981
+
1982
+ if ( jQuery.isFunction( value ) ) {
1983
+ return this.each(function( j ) {
1984
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
1815
1985
  });
1816
1986
  }
1817
1987
 
1818
1988
  if ( (value && typeof value === "string") || value === undefined ) {
1819
- var classNames = (value || "").split( rspaces );
1989
+ classNames = (value || "").split( rspace );
1820
1990
 
1821
- for ( var i = 0, l = this.length; i < l; i++ ) {
1822
- var elem = this[i];
1991
+ for ( i = 0, l = this.length; i < l; i++ ) {
1992
+ elem = this[ i ];
1823
1993
 
1824
1994
  if ( elem.nodeType === 1 && elem.className ) {
1825
1995
  if ( value ) {
1826
- var className = (" " + elem.className + " ").replace(rclass, " ");
1827
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1828
- className = className.replace(" " + classNames[c] + " ", " ");
1996
+ className = (" " + elem.className + " ").replace( rclass, " " );
1997
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
1998
+ className = className.replace(" " + classNames[ c ] + " ", " ");
1829
1999
  }
1830
2000
  elem.className = jQuery.trim( className );
1831
2001
 
@@ -1844,9 +2014,8 @@ jQuery.fn.extend({
1844
2014
  isBool = typeof stateVal === "boolean";
1845
2015
 
1846
2016
  if ( jQuery.isFunction( value ) ) {
1847
- return this.each(function(i) {
1848
- var self = jQuery(this);
1849
- self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
2017
+ return this.each(function( i ) {
2018
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
1850
2019
  });
1851
2020
  }
1852
2021
 
@@ -1857,7 +2026,7 @@ jQuery.fn.extend({
1857
2026
  i = 0,
1858
2027
  self = jQuery( this ),
1859
2028
  state = stateVal,
1860
- classNames = value.split( rspaces );
2029
+ classNames = value.split( rspace );
1861
2030
 
1862
2031
  while ( (className = classNames[ i++ ]) ) {
1863
2032
  // check each className given, space seperated list
@@ -1889,82 +2058,42 @@ jQuery.fn.extend({
1889
2058
  },
1890
2059
 
1891
2060
  val: function( value ) {
2061
+ var hooks, ret,
2062
+ elem = this[0];
2063
+
1892
2064
  if ( !arguments.length ) {
1893
- var elem = this[0];
1894
-
1895
2065
  if ( elem ) {
1896
- if ( jQuery.nodeName( elem, "option" ) ) {
1897
- // attributes.value is undefined in Blackberry 4.7 but
1898
- // uses .value. See #6932
1899
- var val = elem.attributes.value;
1900
- return !val || val.specified ? elem.value : elem.text;
1901
- }
1902
-
1903
- // We need to handle select boxes special
1904
- if ( jQuery.nodeName( elem, "select" ) ) {
1905
- var index = elem.selectedIndex,
1906
- values = [],
1907
- options = elem.options,
1908
- one = elem.type === "select-one";
1909
-
1910
- // Nothing was selected
1911
- if ( index < 0 ) {
1912
- return null;
1913
- }
1914
-
1915
- // Loop through all the selected options
1916
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
1917
- var option = options[ i ];
1918
-
1919
- // Don't return options that are disabled or in a disabled optgroup
1920
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
1921
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
1922
-
1923
- // Get the specific value for the option
1924
- value = jQuery(option).val();
1925
-
1926
- // We don't need an array for one selects
1927
- if ( one ) {
1928
- return value;
1929
- }
1930
-
1931
- // Multi-Selects return an array
1932
- values.push( value );
1933
- }
1934
- }
1935
-
1936
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
1937
- if ( one && !values.length && options.length ) {
1938
- return jQuery( options[ index ] ).val();
1939
- }
2066
+ hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
1940
2067
 
1941
- return values;
2068
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
2069
+ return ret;
1942
2070
  }
1943
2071
 
1944
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
1945
- if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
1946
- return elem.getAttribute("value") === null ? "on" : elem.value;
1947
- }
1948
-
1949
- // Everything else, we just grab the value
1950
- return (elem.value || "").replace(rreturn, "");
2072
+ ret = elem.value;
1951
2073
 
2074
+ return typeof ret === "string" ?
2075
+ // handle most common string cases
2076
+ ret.replace(rreturn, "") :
2077
+ // handle cases where value is null/undef or number
2078
+ ret == null ? "" : ret;
1952
2079
  }
1953
2080
 
1954
2081
  return undefined;
1955
2082
  }
1956
2083
 
1957
- var isFunction = jQuery.isFunction(value);
2084
+ var isFunction = jQuery.isFunction( value );
1958
2085
 
1959
- return this.each(function(i) {
1960
- var self = jQuery(this), val = value;
2086
+ return this.each(function( i ) {
2087
+ var self = jQuery(this), val;
1961
2088
 
1962
2089
  if ( this.nodeType !== 1 ) {
1963
2090
  return;
1964
2091
  }
1965
2092
 
1966
2093
  if ( isFunction ) {
1967
- val = value.call(this, i, self.val());
2094
+ val = value.call( this, i, self.val() );
2095
+ } else {
2096
+ val = value;
1968
2097
  }
1969
2098
 
1970
2099
  // Treat null/undefined as ""; convert numbers to string
@@ -1972,34 +2101,89 @@ jQuery.fn.extend({
1972
2101
  val = "";
1973
2102
  } else if ( typeof val === "number" ) {
1974
2103
  val += "";
1975
- } else if ( jQuery.isArray(val) ) {
1976
- val = jQuery.map(val, function (value) {
2104
+ } else if ( jQuery.isArray( val ) ) {
2105
+ val = jQuery.map(val, function ( value ) {
1977
2106
  return value == null ? "" : value + "";
1978
2107
  });
1979
2108
  }
1980
2109
 
1981
- if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
1982
- this.checked = jQuery.inArray( self.val(), val ) >= 0;
2110
+ hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
2111
+
2112
+ // If set returns undefined, fall back to normal setting
2113
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
2114
+ this.value = val;
2115
+ }
2116
+ });
2117
+ }
2118
+ });
2119
+
2120
+ jQuery.extend({
2121
+ valHooks: {
2122
+ option: {
2123
+ get: function( elem ) {
2124
+ // attributes.value is undefined in Blackberry 4.7 but
2125
+ // uses .value. See #6932
2126
+ var val = elem.attributes.value;
2127
+ return !val || val.specified ? elem.value : elem.text;
2128
+ }
2129
+ },
2130
+ select: {
2131
+ get: function( elem ) {
2132
+ var value,
2133
+ index = elem.selectedIndex,
2134
+ values = [],
2135
+ options = elem.options,
2136
+ one = elem.type === "select-one";
2137
+
2138
+ // Nothing was selected
2139
+ if ( index < 0 ) {
2140
+ return null;
2141
+ }
2142
+
2143
+ // Loop through all the selected options
2144
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
2145
+ var option = options[ i ];
2146
+
2147
+ // Don't return options that are disabled or in a disabled optgroup
2148
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
2149
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
2150
+
2151
+ // Get the specific value for the option
2152
+ value = jQuery( option ).val();
1983
2153
 
1984
- } else if ( jQuery.nodeName( this, "select" ) ) {
1985
- var values = jQuery.makeArray(val);
2154
+ // We don't need an array for one selects
2155
+ if ( one ) {
2156
+ return value;
2157
+ }
2158
+
2159
+ // Multi-Selects return an array
2160
+ values.push( value );
2161
+ }
2162
+ }
2163
+
2164
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
2165
+ if ( one && !values.length && options.length ) {
2166
+ return jQuery( options[ index ] ).val();
2167
+ }
2168
+
2169
+ return values;
2170
+ },
1986
2171
 
1987
- jQuery( "option", this ).each(function() {
2172
+ set: function( elem, value ) {
2173
+ var values = jQuery.makeArray( value );
2174
+
2175
+ jQuery(elem).find("option").each(function() {
1988
2176
  this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
1989
2177
  });
1990
2178
 
1991
2179
  if ( !values.length ) {
1992
- this.selectedIndex = -1;
2180
+ elem.selectedIndex = -1;
1993
2181
  }
1994
-
1995
- } else {
1996
- this.value = val;
2182
+ return values;
1997
2183
  }
1998
- });
1999
- }
2000
- });
2184
+ }
2185
+ },
2001
2186
 
2002
- jQuery.extend({
2003
2187
  attrFn: {
2004
2188
  val: true,
2005
2189
  css: true,
@@ -2010,115 +2194,340 @@ jQuery.extend({
2010
2194
  height: true,
2011
2195
  offset: true
2012
2196
  },
2013
-
2197
+
2198
+ attrFix: {
2199
+ // Always normalize to ensure hook usage
2200
+ tabindex: "tabIndex"
2201
+ },
2202
+
2014
2203
  attr: function( elem, name, value, pass ) {
2204
+ var nType = elem.nodeType;
2205
+
2015
2206
  // don't get/set attributes on text, comment and attribute nodes
2016
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
2207
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2017
2208
  return undefined;
2018
2209
  }
2019
2210
 
2020
2211
  if ( pass && name in jQuery.attrFn ) {
2021
- return jQuery(elem)[name](value);
2212
+ return jQuery( elem )[ name ]( value );
2022
2213
  }
2023
2214
 
2024
- var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
2025
- // Whether we are setting (or getting)
2026
- set = value !== undefined;
2215
+ // Fallback to prop when attributes are not supported
2216
+ if ( !("getAttribute" in elem) ) {
2217
+ return jQuery.prop( elem, name, value );
2218
+ }
2027
2219
 
2028
- // Try to normalize/fix the name
2029
- name = notxml && jQuery.props[ name ] || name;
2220
+ var ret, hooks,
2221
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2030
2222
 
2031
- // Only do all the following if this is a node (faster for style)
2032
- if ( elem.nodeType === 1 ) {
2033
- // These attributes require special treatment
2034
- var special = rspecialurl.test( name );
2035
-
2036
- // Safari mis-reports the default selected property of an option
2037
- // Accessing the parent's selectedIndex property fixes it
2038
- if ( name === "selected" && !jQuery.support.optSelected ) {
2039
- var parent = elem.parentNode;
2040
- if ( parent ) {
2041
- parent.selectedIndex;
2042
-
2043
- // Make sure that it also works with optgroups, see #5701
2044
- if ( parent.parentNode ) {
2045
- parent.parentNode.selectedIndex;
2046
- }
2223
+ // Normalize the name if needed
2224
+ if ( notxml ) {
2225
+ name = jQuery.attrFix[ name ] || name;
2226
+
2227
+ hooks = jQuery.attrHooks[ name ];
2228
+
2229
+ if ( !hooks ) {
2230
+ // Use boolHook for boolean attributes
2231
+ if ( rboolean.test( name ) ) {
2232
+
2233
+ hooks = boolHook;
2234
+
2235
+ // Use formHook for forms and if the name contains certain characters
2236
+ } else if ( formHook && name !== "className" &&
2237
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
2238
+
2239
+ hooks = formHook;
2047
2240
  }
2048
2241
  }
2242
+ }
2049
2243
 
2050
- // If applicable, access the attribute via the DOM 0 way
2051
- // 'in' checks fail in Blackberry 4.7 #6931
2052
- if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
2053
- if ( set ) {
2054
- // We can't allow the type property to be changed (since it causes problems in IE)
2055
- if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
2056
- jQuery.error( "type property can't be changed" );
2057
- }
2244
+ if ( value !== undefined ) {
2058
2245
 
2059
- if ( value === null ) {
2060
- if ( elem.nodeType === 1 ) {
2061
- elem.removeAttribute( name );
2062
- }
2246
+ if ( value === null ) {
2247
+ jQuery.removeAttr( elem, name );
2248
+ return undefined;
2063
2249
 
2064
- } else {
2065
- elem[ name ] = value;
2066
- }
2067
- }
2250
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
2251
+ return ret;
2068
2252
 
2069
- // browsers index elements by id/name on forms, give priority to attributes.
2070
- if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
2071
- return elem.getAttributeNode( name ).nodeValue;
2072
- }
2253
+ } else {
2254
+ elem.setAttribute( name, "" + value );
2255
+ return value;
2256
+ }
2257
+
2258
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
2259
+ return ret;
2260
+
2261
+ } else {
2262
+
2263
+ ret = elem.getAttribute( name );
2264
+
2265
+ // Non-existent attributes return null, we normalize to undefined
2266
+ return ret === null ?
2267
+ undefined :
2268
+ ret;
2269
+ }
2270
+ },
2271
+
2272
+ removeAttr: function( elem, name ) {
2273
+ var propName;
2274
+ if ( elem.nodeType === 1 ) {
2275
+ name = jQuery.attrFix[ name ] || name;
2276
+
2277
+ if ( jQuery.support.getSetAttribute ) {
2278
+ // Use removeAttribute in browsers that support it
2279
+ elem.removeAttribute( name );
2280
+ } else {
2281
+ jQuery.attr( elem, name, "" );
2282
+ elem.removeAttributeNode( elem.getAttributeNode( name ) );
2283
+ }
2284
+
2285
+ // Set corresponding property to false for boolean attributes
2286
+ if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
2287
+ elem[ propName ] = false;
2288
+ }
2289
+ }
2290
+ },
2073
2291
 
2292
+ attrHooks: {
2293
+ type: {
2294
+ set: function( elem, value ) {
2295
+ // We can't allow the type property to be changed (since it causes problems in IE)
2296
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
2297
+ jQuery.error( "type property can't be changed" );
2298
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
2299
+ // Setting the type on a radio button after the value resets the value in IE6-9
2300
+ // Reset value to it's default in case type is set after value
2301
+ // This is for element creation
2302
+ var val = elem.value;
2303
+ elem.setAttribute( "type", value );
2304
+ if ( val ) {
2305
+ elem.value = val;
2306
+ }
2307
+ return value;
2308
+ }
2309
+ }
2310
+ },
2311
+ tabIndex: {
2312
+ get: function( elem ) {
2074
2313
  // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2075
2314
  // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2076
- if ( name === "tabIndex" ) {
2077
- var attributeNode = elem.getAttributeNode( "tabIndex" );
2315
+ var attributeNode = elem.getAttributeNode("tabIndex");
2078
2316
 
2079
- return attributeNode && attributeNode.specified ?
2080
- attributeNode.value :
2081
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2082
- 0 :
2083
- undefined;
2317
+ return attributeNode && attributeNode.specified ?
2318
+ parseInt( attributeNode.value, 10 ) :
2319
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2320
+ 0 :
2321
+ undefined;
2322
+ }
2323
+ },
2324
+ // Use the value property for back compat
2325
+ // Use the formHook for button elements in IE6/7 (#1954)
2326
+ value: {
2327
+ get: function( elem, name ) {
2328
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2329
+ return formHook.get( elem, name );
2330
+ }
2331
+ return name in elem ?
2332
+ elem.value :
2333
+ null;
2334
+ },
2335
+ set: function( elem, value, name ) {
2336
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2337
+ return formHook.set( elem, value, name );
2084
2338
  }
2339
+ // Does not return so that setAttribute is also used
2340
+ elem.value = value;
2341
+ }
2342
+ }
2343
+ },
2344
+
2345
+ propFix: {
2346
+ tabindex: "tabIndex",
2347
+ readonly: "readOnly",
2348
+ "for": "htmlFor",
2349
+ "class": "className",
2350
+ maxlength: "maxLength",
2351
+ cellspacing: "cellSpacing",
2352
+ cellpadding: "cellPadding",
2353
+ rowspan: "rowSpan",
2354
+ colspan: "colSpan",
2355
+ usemap: "useMap",
2356
+ frameborder: "frameBorder",
2357
+ contenteditable: "contentEditable"
2358
+ },
2359
+
2360
+ prop: function( elem, name, value ) {
2361
+ var nType = elem.nodeType;
2362
+
2363
+ // don't get/set properties on text, comment and attribute nodes
2364
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2365
+ return undefined;
2366
+ }
2367
+
2368
+ var ret, hooks,
2369
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2085
2370
 
2371
+ if ( notxml ) {
2372
+ // Fix name and attach hooks
2373
+ name = jQuery.propFix[ name ] || name;
2374
+ hooks = jQuery.propHooks[ name ];
2375
+ }
2376
+
2377
+ if ( value !== undefined ) {
2378
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2379
+ return ret;
2380
+
2381
+ } else {
2382
+ return (elem[ name ] = value);
2383
+ }
2384
+
2385
+ } else {
2386
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
2387
+ return ret;
2388
+
2389
+ } else {
2086
2390
  return elem[ name ];
2087
2391
  }
2392
+ }
2393
+ },
2394
+
2395
+ propHooks: {}
2396
+ });
2397
+
2398
+ // Hook for boolean attributes
2399
+ boolHook = {
2400
+ get: function( elem, name ) {
2401
+ // Align boolean attributes with corresponding properties
2402
+ return jQuery.prop( elem, name ) ?
2403
+ name.toLowerCase() :
2404
+ undefined;
2405
+ },
2406
+ set: function( elem, value, name ) {
2407
+ var propName;
2408
+ if ( value === false ) {
2409
+ // Remove boolean attributes when set to false
2410
+ jQuery.removeAttr( elem, name );
2411
+ } else {
2412
+ // value is true since we know at this point it's type boolean and not false
2413
+ // Set boolean attributes to the same name and set the DOM property
2414
+ propName = jQuery.propFix[ name ] || name;
2415
+ if ( propName in elem ) {
2416
+ // Only set the IDL specifically if it already exists on the element
2417
+ elem[ propName ] = true;
2418
+ }
2088
2419
 
2089
- if ( !jQuery.support.style && notxml && name === "style" ) {
2090
- if ( set ) {
2091
- elem.style.cssText = "" + value;
2092
- }
2420
+ elem.setAttribute( name, name.toLowerCase() );
2421
+ }
2422
+ return name;
2423
+ }
2424
+ };
2425
+
2426
+ // IE6/7 do not support getting/setting some attributes with get/setAttribute
2427
+ if ( !jQuery.support.getSetAttribute ) {
2093
2428
 
2094
- return elem.style.cssText;
2429
+ // propFix is more comprehensive and contains all fixes
2430
+ jQuery.attrFix = jQuery.propFix;
2431
+
2432
+ // Use this for any attribute on a form in IE6/7
2433
+ formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
2434
+ get: function( elem, name ) {
2435
+ var ret;
2436
+ ret = elem.getAttributeNode( name );
2437
+ // Return undefined if nodeValue is empty string
2438
+ return ret && ret.nodeValue !== "" ?
2439
+ ret.nodeValue :
2440
+ undefined;
2441
+ },
2442
+ set: function( elem, value, name ) {
2443
+ // Check form objects in IE (multiple bugs related)
2444
+ // Only use nodeValue if the attribute node exists on the form
2445
+ var ret = elem.getAttributeNode( name );
2446
+ if ( ret ) {
2447
+ ret.nodeValue = value;
2448
+ return value;
2095
2449
  }
2450
+ }
2451
+ };
2096
2452
 
2097
- if ( set ) {
2098
- // convert the value to a string (all browsers do this but IE) see #1070
2099
- elem.setAttribute( name, "" + value );
2453
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
2454
+ // This is for removals
2455
+ jQuery.each([ "width", "height" ], function( i, name ) {
2456
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2457
+ set: function( elem, value ) {
2458
+ if ( value === "" ) {
2459
+ elem.setAttribute( name, "auto" );
2460
+ return value;
2461
+ }
2100
2462
  }
2463
+ });
2464
+ });
2465
+ }
2101
2466
 
2102
- // Ensure that missing attributes return undefined
2103
- // Blackberry 4.7 returns "" from getAttribute #6938
2104
- if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
2105
- return undefined;
2467
+
2468
+ // Some attributes require a special call on IE
2469
+ if ( !jQuery.support.hrefNormalized ) {
2470
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
2471
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2472
+ get: function( elem ) {
2473
+ var ret = elem.getAttribute( name, 2 );
2474
+ return ret === null ? undefined : ret;
2106
2475
  }
2476
+ });
2477
+ });
2478
+ }
2107
2479
 
2108
- var attr = !jQuery.support.hrefNormalized && notxml && special ?
2109
- // Some attributes require a special call on IE
2110
- elem.getAttribute( name, 2 ) :
2111
- elem.getAttribute( name );
2480
+ if ( !jQuery.support.style ) {
2481
+ jQuery.attrHooks.style = {
2482
+ get: function( elem ) {
2483
+ // Return undefined in the case of empty string
2484
+ // Normalize to lowercase since IE uppercases css property names
2485
+ return elem.style.cssText.toLowerCase() || undefined;
2486
+ },
2487
+ set: function( elem, value ) {
2488
+ return (elem.style.cssText = "" + value);
2489
+ }
2490
+ };
2491
+ }
2112
2492
 
2113
- // Non-existent attributes return null, we normalize to undefined
2114
- return attr === null ? undefined : attr;
2493
+ // Safari mis-reports the default selected property of an option
2494
+ // Accessing the parent's selectedIndex property fixes it
2495
+ if ( !jQuery.support.optSelected ) {
2496
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
2497
+ get: function( elem ) {
2498
+ var parent = elem.parentNode;
2499
+
2500
+ if ( parent ) {
2501
+ parent.selectedIndex;
2502
+
2503
+ // Make sure that it also works with optgroups, see #5701
2504
+ if ( parent.parentNode ) {
2505
+ parent.parentNode.selectedIndex;
2506
+ }
2507
+ }
2115
2508
  }
2116
- // Handle everything which isn't a DOM element node
2117
- if ( set ) {
2118
- elem[ name ] = value;
2509
+ });
2510
+ }
2511
+
2512
+ // Radios and checkboxes getter/setter
2513
+ if ( !jQuery.support.checkOn ) {
2514
+ jQuery.each([ "radio", "checkbox" ], function() {
2515
+ jQuery.valHooks[ this ] = {
2516
+ get: function( elem ) {
2517
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
2518
+ return elem.getAttribute("value") === null ? "on" : elem.value;
2519
+ }
2520
+ };
2521
+ });
2522
+ }
2523
+ jQuery.each([ "radio", "checkbox" ], function() {
2524
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
2525
+ set: function( elem, value ) {
2526
+ if ( jQuery.isArray( value ) ) {
2527
+ return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
2528
+ }
2119
2529
  }
2120
- return elem[ name ];
2121
- }
2530
+ });
2122
2531
  });
2123
2532
 
2124
2533
 
@@ -2127,7 +2536,7 @@ jQuery.extend({
2127
2536
  var rnamespaces = /\.(.*)$/,
2128
2537
  rformElems = /^(?:textarea|input|select)$/i,
2129
2538
  rperiod = /\./g,
2130
- rspace = / /g,
2539
+ rspaces = / /g,
2131
2540
  rescape = /[^\w\s.|`]/g,
2132
2541
  fcleanup = function( nm ) {
2133
2542
  return nm.replace(rescape, "\\$&");
@@ -2147,17 +2556,6 @@ jQuery.event = {
2147
2556
  return;
2148
2557
  }
2149
2558
 
2150
- // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6)
2151
- // Minor release fix for bug #8018
2152
- try {
2153
- // For whatever reason, IE has trouble passing the window object
2154
- // around, causing it to be cloned in the process
2155
- if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
2156
- elem = window;
2157
- }
2158
- }
2159
- catch ( e ) {}
2160
-
2161
2559
  if ( handler === false ) {
2162
2560
  handler = returnFalse;
2163
2561
  } else if ( !handler ) {
@@ -2194,10 +2592,10 @@ jQuery.event = {
2194
2592
  }
2195
2593
 
2196
2594
  if ( !eventHandle ) {
2197
- elemData.handle = eventHandle = function() {
2198
- // Handle the second event of a trigger and when
2199
- // an event is called after a page has unloaded
2200
- return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
2595
+ elemData.handle = eventHandle = function( e ) {
2596
+ // Discard the second event of a jQuery.event.trigger() and
2597
+ // when an event is called after a page has unloaded
2598
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
2201
2599
  jQuery.event.handle.apply( eventHandle.elem, arguments ) :
2202
2600
  undefined;
2203
2601
  };
@@ -2267,7 +2665,7 @@ jQuery.event = {
2267
2665
  // Add the function to the element's handler list
2268
2666
  handlers.push( handleObj );
2269
2667
 
2270
- // Keep track of which events have been used, for global triggering
2668
+ // Keep track of which events have been used, for event optimization
2271
2669
  jQuery.event.global[ type ] = true;
2272
2670
  }
2273
2671
 
@@ -2400,182 +2798,185 @@ jQuery.event = {
2400
2798
  }
2401
2799
  }
2402
2800
  },
2801
+
2802
+ // Events that are safe to short-circuit if no handlers are attached.
2803
+ // Native DOM events should not be added, they may have inline handlers.
2804
+ customEvent: {
2805
+ "getData": true,
2806
+ "setData": true,
2807
+ "changeData": true
2808
+ },
2403
2809
 
2404
- // bubbling is internal
2405
- trigger: function( event, data, elem /*, bubbling */ ) {
2810
+ trigger: function( event, data, elem, onlyHandlers ) {
2406
2811
  // Event object or event type
2407
2812
  var type = event.type || event,
2408
- bubbling = arguments[3];
2813
+ namespaces = [],
2814
+ exclusive;
2409
2815
 
2410
- if ( !bubbling ) {
2411
- event = typeof event === "object" ?
2412
- // jQuery.Event object
2413
- event[ jQuery.expando ] ? event :
2414
- // Object literal
2415
- jQuery.extend( jQuery.Event(type), event ) :
2416
- // Just the event type (string)
2417
- jQuery.Event(type);
2816
+ if ( type.indexOf("!") >= 0 ) {
2817
+ // Exclusive events trigger only for the exact event (no namespaces)
2818
+ type = type.slice(0, -1);
2819
+ exclusive = true;
2820
+ }
2418
2821
 
2419
- if ( type.indexOf("!") >= 0 ) {
2420
- event.type = type = type.slice(0, -1);
2421
- event.exclusive = true;
2422
- }
2822
+ if ( type.indexOf(".") >= 0 ) {
2823
+ // Namespaced trigger; create a regexp to match event type in handle()
2824
+ namespaces = type.split(".");
2825
+ type = namespaces.shift();
2826
+ namespaces.sort();
2827
+ }
2423
2828
 
2424
- // Handle a global trigger
2425
- if ( !elem ) {
2426
- // Don't bubble custom events when global (to avoid too much overhead)
2427
- event.stopPropagation();
2428
-
2429
- // Only trigger if we've ever bound an event for it
2430
- if ( jQuery.event.global[ type ] ) {
2431
- // XXX This code smells terrible. event.js should not be directly
2432
- // inspecting the data cache
2433
- jQuery.each( jQuery.cache, function() {
2434
- // internalKey variable is just used to make it easier to find
2435
- // and potentially change this stuff later; currently it just
2436
- // points to jQuery.expando
2437
- var internalKey = jQuery.expando,
2438
- internalCache = this[ internalKey ];
2439
- if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
2440
- jQuery.event.trigger( event, data, internalCache.handle.elem );
2441
- }
2442
- });
2443
- }
2444
- }
2829
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
2830
+ // No jQuery handlers for this event type, and it can't have inline handlers
2831
+ return;
2832
+ }
2445
2833
 
2446
- // Handle triggering a single element
2834
+ // Caller can pass in an Event, Object, or just an event type string
2835
+ event = typeof event === "object" ?
2836
+ // jQuery.Event object
2837
+ event[ jQuery.expando ] ? event :
2838
+ // Object literal
2839
+ new jQuery.Event( type, event ) :
2840
+ // Just the event type (string)
2841
+ new jQuery.Event( type );
2447
2842
 
2448
- // don't do events on text and comment nodes
2449
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
2450
- return undefined;
2451
- }
2843
+ event.type = type;
2844
+ event.exclusive = exclusive;
2845
+ event.namespace = namespaces.join(".");
2846
+ event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
2847
+
2848
+ // triggerHandler() and global events don't bubble or run the default action
2849
+ if ( onlyHandlers || !elem ) {
2850
+ event.preventDefault();
2851
+ event.stopPropagation();
2852
+ }
2452
2853
 
2453
- // Clean up in case it is reused
2454
- event.result = undefined;
2455
- event.target = elem;
2854
+ // Handle a global trigger
2855
+ if ( !elem ) {
2856
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
2857
+ jQuery.each( jQuery.cache, function() {
2858
+ // internalKey variable is just used to make it easier to find
2859
+ // and potentially change this stuff later; currently it just
2860
+ // points to jQuery.expando
2861
+ var internalKey = jQuery.expando,
2862
+ internalCache = this[ internalKey ];
2863
+ if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
2864
+ jQuery.event.trigger( event, data, internalCache.handle.elem );
2865
+ }
2866
+ });
2867
+ return;
2868
+ }
2456
2869
 
2457
- // Clone the incoming data, if any
2458
- data = jQuery.makeArray( data );
2459
- data.unshift( event );
2870
+ // Don't do events on text and comment nodes
2871
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2872
+ return;
2460
2873
  }
2461
2874
 
2462
- event.currentTarget = elem;
2875
+ // Clean up the event in case it is being reused
2876
+ event.result = undefined;
2877
+ event.target = elem;
2463
2878
 
2464
- // Trigger the event, it is assumed that "handle" is a function
2465
- var handle = jQuery._data( elem, "handle" );
2879
+ // Clone any incoming data and prepend the event, creating the handler arg list
2880
+ data = data != null ? jQuery.makeArray( data ) : [];
2881
+ data.unshift( event );
2466
2882
 
2467
- if ( handle ) {
2468
- handle.apply( elem, data );
2469
- }
2883
+ var cur = elem,
2884
+ // IE doesn't like method names with a colon (#3533, #8272)
2885
+ ontype = type.indexOf(":") < 0 ? "on" + type : "";
2470
2886
 
2471
- var parent = elem.parentNode || elem.ownerDocument;
2887
+ // Fire event on the current element, then bubble up the DOM tree
2888
+ do {
2889
+ var handle = jQuery._data( cur, "handle" );
2472
2890
 
2473
- // Trigger an inline bound script
2474
- try {
2475
- if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
2476
- if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
2477
- event.result = false;
2478
- event.preventDefault();
2479
- }
2891
+ event.currentTarget = cur;
2892
+ if ( handle ) {
2893
+ handle.apply( cur, data );
2480
2894
  }
2481
2895
 
2482
- // prevent IE from throwing an error for some elements with some event types, see #3533
2483
- } catch (inlineError) {}
2896
+ // Trigger an inline bound script
2897
+ if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
2898
+ event.result = false;
2899
+ event.preventDefault();
2900
+ }
2484
2901
 
2485
- if ( !event.isPropagationStopped() && parent ) {
2486
- jQuery.event.trigger( event, data, parent, true );
2902
+ // Bubble up to document, then to window
2903
+ cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
2904
+ } while ( cur && !event.isPropagationStopped() );
2487
2905
 
2488
- } else if ( !event.isDefaultPrevented() ) {
2906
+ // If nobody prevented the default action, do it now
2907
+ if ( !event.isDefaultPrevented() ) {
2489
2908
  var old,
2490
- target = event.target,
2491
- targetType = type.replace( rnamespaces, "" ),
2492
- isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
2493
- special = jQuery.event.special[ targetType ] || {};
2909
+ special = jQuery.event.special[ type ] || {};
2494
2910
 
2495
- if ( (!special._default || special._default.call( elem, event ) === false) &&
2496
- !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
2911
+ if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
2912
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
2497
2913
 
2914
+ // Call a native DOM method on the target with the same name name as the event.
2915
+ // Can't use an .isFunction)() check here because IE6/7 fails that test.
2916
+ // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
2498
2917
  try {
2499
- if ( target[ targetType ] ) {
2500
- // Make sure that we don't accidentally re-trigger the onFOO events
2501
- old = target[ "on" + targetType ];
2918
+ if ( ontype && elem[ type ] ) {
2919
+ // Don't re-trigger an onFOO event when we call its FOO() method
2920
+ old = elem[ ontype ];
2502
2921
 
2503
2922
  if ( old ) {
2504
- target[ "on" + targetType ] = null;
2923
+ elem[ ontype ] = null;
2505
2924
  }
2506
2925
 
2507
- jQuery.event.triggered = true;
2508
- target[ targetType ]();
2926
+ jQuery.event.triggered = type;
2927
+ elem[ type ]();
2509
2928
  }
2510
-
2511
- // prevent IE from throwing an error for some elements with some event types, see #3533
2512
- } catch (triggerError) {}
2929
+ } catch ( ieError ) {}
2513
2930
 
2514
2931
  if ( old ) {
2515
- target[ "on" + targetType ] = old;
2932
+ elem[ ontype ] = old;
2516
2933
  }
2517
2934
 
2518
- jQuery.event.triggered = false;
2935
+ jQuery.event.triggered = undefined;
2519
2936
  }
2520
2937
  }
2938
+
2939
+ return event.result;
2521
2940
  },
2522
2941
 
2523
2942
  handle: function( event ) {
2524
- var all, handlers, namespaces, namespace_re, events,
2525
- namespace_sort = [],
2526
- args = jQuery.makeArray( arguments );
2527
-
2528
- event = args[0] = jQuery.event.fix( event || window.event );
2943
+ event = jQuery.event.fix( event || window.event );
2944
+ // Snapshot the handlers list since a called handler may add/remove events.
2945
+ var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
2946
+ run_all = !event.exclusive && !event.namespace,
2947
+ args = Array.prototype.slice.call( arguments, 0 );
2948
+
2949
+ // Use the fix-ed Event rather than the (read-only) native event
2950
+ args[0] = event;
2529
2951
  event.currentTarget = this;
2530
2952
 
2531
- // Namespaced event handlers
2532
- all = event.type.indexOf(".") < 0 && !event.exclusive;
2533
-
2534
- if ( !all ) {
2535
- namespaces = event.type.split(".");
2536
- event.type = namespaces.shift();
2537
- namespace_sort = namespaces.slice(0).sort();
2538
- namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
2539
- }
2540
-
2541
- event.namespace = event.namespace || namespace_sort.join(".");
2542
-
2543
- events = jQuery._data(this, "events");
2544
-
2545
- handlers = (events || {})[ event.type ];
2546
-
2547
- if ( events && handlers ) {
2548
- // Clone the handlers to prevent manipulation
2549
- handlers = handlers.slice(0);
2550
-
2551
- for ( var j = 0, l = handlers.length; j < l; j++ ) {
2552
- var handleObj = handlers[ j ];
2553
-
2554
- // Filter the functions by class
2555
- if ( all || namespace_re.test( handleObj.namespace ) ) {
2556
- // Pass in a reference to the handler function itself
2557
- // So that we can later remove it
2558
- event.handler = handleObj.handler;
2559
- event.data = handleObj.data;
2560
- event.handleObj = handleObj;
2561
-
2562
- var ret = handleObj.handler.apply( this, args );
2563
-
2564
- if ( ret !== undefined ) {
2565
- event.result = ret;
2566
- if ( ret === false ) {
2567
- event.preventDefault();
2568
- event.stopPropagation();
2569
- }
2953
+ for ( var j = 0, l = handlers.length; j < l; j++ ) {
2954
+ var handleObj = handlers[ j ];
2955
+
2956
+ // Triggered event must 1) be non-exclusive and have no namespace, or
2957
+ // 2) have namespace(s) a subset or equal to those in the bound event.
2958
+ if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
2959
+ // Pass in a reference to the handler function itself
2960
+ // So that we can later remove it
2961
+ event.handler = handleObj.handler;
2962
+ event.data = handleObj.data;
2963
+ event.handleObj = handleObj;
2964
+
2965
+ var ret = handleObj.handler.apply( this, args );
2966
+
2967
+ if ( ret !== undefined ) {
2968
+ event.result = ret;
2969
+ if ( ret === false ) {
2970
+ event.preventDefault();
2971
+ event.stopPropagation();
2570
2972
  }
2973
+ }
2571
2974
 
2572
- if ( event.isImmediatePropagationStopped() ) {
2573
- break;
2574
- }
2975
+ if ( event.isImmediatePropagationStopped() ) {
2976
+ break;
2575
2977
  }
2576
2978
  }
2577
2979
  }
2578
-
2579
2980
  return event.result;
2580
2981
  },
2581
2982
 
@@ -2614,8 +3015,9 @@ jQuery.event = {
2614
3015
 
2615
3016
  // Calculate pageX/Y if missing and clientX/Y available
2616
3017
  if ( event.pageX == null && event.clientX != null ) {
2617
- var doc = document.documentElement,
2618
- body = document.body;
3018
+ var eventDocument = event.target.ownerDocument || document,
3019
+ doc = eventDocument.documentElement,
3020
+ body = eventDocument.body;
2619
3021
 
2620
3022
  event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
2621
3023
  event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
@@ -2694,10 +3096,10 @@ jQuery.removeEvent = document.removeEventListener ?
2694
3096
  }
2695
3097
  };
2696
3098
 
2697
- jQuery.Event = function( src ) {
3099
+ jQuery.Event = function( src, props ) {
2698
3100
  // Allow instantiation without the 'new' keyword
2699
3101
  if ( !this.preventDefault ) {
2700
- return new jQuery.Event( src );
3102
+ return new jQuery.Event( src, props );
2701
3103
  }
2702
3104
 
2703
3105
  // Event object
@@ -2715,6 +3117,11 @@ jQuery.Event = function( src ) {
2715
3117
  this.type = src;
2716
3118
  }
2717
3119
 
3120
+ // Put explicitly provided properties onto the event object
3121
+ if ( props ) {
3122
+ jQuery.extend( this, props );
3123
+ }
3124
+
2718
3125
  // timeStamp is buggy for some events on Firefox(#3843)
2719
3126
  // So we won't rely on the native value
2720
3127
  this.timeStamp = jQuery.now();
@@ -2776,33 +3183,27 @@ jQuery.Event.prototype = {
2776
3183
  // Checks if an event happened on an element within another element
2777
3184
  // Used in jQuery.event.special.mouseenter and mouseleave handlers
2778
3185
  var withinElement = function( event ) {
3186
+
2779
3187
  // Check if mouse(over|out) are still within the same parent element
2780
- var parent = event.relatedTarget;
3188
+ var related = event.relatedTarget,
3189
+ inside = false,
3190
+ eventType = event.type;
2781
3191
 
2782
- // Firefox sometimes assigns relatedTarget a XUL element
2783
- // which we cannot access the parentNode property of
2784
- try {
3192
+ event.type = event.data;
2785
3193
 
2786
- // Chrome does something similar, the parentNode property
2787
- // can be accessed but is null.
2788
- if ( parent !== document && !parent.parentNode ) {
2789
- return;
2790
- }
2791
- // Traverse up the tree
2792
- while ( parent && parent !== this ) {
2793
- parent = parent.parentNode;
3194
+ if ( related !== this ) {
3195
+
3196
+ if ( related ) {
3197
+ inside = jQuery.contains( this, related );
2794
3198
  }
2795
3199
 
2796
- if ( parent !== this ) {
2797
- // set the correct event type
2798
- event.type = event.data;
3200
+ if ( !inside ) {
2799
3201
 
2800
- // handle event if we actually just moused on to a non sub-element
2801
3202
  jQuery.event.handle.apply( this, arguments );
2802
- }
2803
3203
 
2804
- // assuming we've left the element since we most likely mousedover a xul element
2805
- } catch(e) { }
3204
+ event.type = eventType;
3205
+ }
3206
+ }
2806
3207
  },
2807
3208
 
2808
3209
  // In case of event delegation, we only need to rename the event.type,
@@ -2832,7 +3233,7 @@ if ( !jQuery.support.submitBubbles ) {
2832
3233
 
2833
3234
  jQuery.event.special.submit = {
2834
3235
  setup: function( data, namespaces ) {
2835
- if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
3236
+ if ( !jQuery.nodeName( this, "form" ) ) {
2836
3237
  jQuery.event.add(this, "click.specialSubmit", function( e ) {
2837
3238
  var elem = e.target,
2838
3239
  type = elem.type;
@@ -2881,7 +3282,7 @@ if ( !jQuery.support.changeBubbles ) {
2881
3282
  }).join("-") :
2882
3283
  "";
2883
3284
 
2884
- } else if ( elem.nodeName.toLowerCase() === "select" ) {
3285
+ } else if ( jQuery.nodeName( elem, "select" ) ) {
2885
3286
  val = elem.selectedIndex;
2886
3287
  }
2887
3288
 
@@ -2921,9 +3322,9 @@ if ( !jQuery.support.changeBubbles ) {
2921
3322
  beforedeactivate: testChange,
2922
3323
 
2923
3324
  click: function( e ) {
2924
- var elem = e.target, type = elem.type;
3325
+ var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
2925
3326
 
2926
- if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
3327
+ if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
2927
3328
  testChange.call( this, e );
2928
3329
  }
2929
3330
  },
@@ -2931,9 +3332,9 @@ if ( !jQuery.support.changeBubbles ) {
2931
3332
  // Change has to be called before submit
2932
3333
  // Keydown will be called before keypress, which is used in submit-event delegation
2933
3334
  keydown: function( e ) {
2934
- var elem = e.target, type = elem.type;
3335
+ var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
2935
3336
 
2936
- if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
3337
+ if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
2937
3338
  (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
2938
3339
  type === "select-multiple" ) {
2939
3340
  testChange.call( this, e );
@@ -2990,27 +3391,43 @@ function trigger( type, elem, args ) {
2990
3391
  }
2991
3392
 
2992
3393
  // Create "bubbling" focus and blur events
2993
- if ( document.addEventListener ) {
3394
+ if ( !jQuery.support.focusinBubbles ) {
2994
3395
  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3396
+
3397
+ // Attach a single capturing handler while someone wants focusin/focusout
3398
+ var attaches = 0;
3399
+
2995
3400
  jQuery.event.special[ fix ] = {
2996
3401
  setup: function() {
2997
- this.addEventListener( orig, handler, true );
3402
+ if ( attaches++ === 0 ) {
3403
+ document.addEventListener( orig, handler, true );
3404
+ }
2998
3405
  },
2999
3406
  teardown: function() {
3000
- this.removeEventListener( orig, handler, true );
3407
+ if ( --attaches === 0 ) {
3408
+ document.removeEventListener( orig, handler, true );
3409
+ }
3001
3410
  }
3002
3411
  };
3003
3412
 
3004
- function handler( e ) {
3005
- e = jQuery.event.fix( e );
3413
+ function handler( donor ) {
3414
+ // Donor event is always a native one; fix it and switch its type.
3415
+ // Let focusin/out handler cancel the donor focus/blur event.
3416
+ var e = jQuery.event.fix( donor );
3006
3417
  e.type = fix;
3007
- return jQuery.event.handle.call( this, e );
3418
+ e.originalEvent = {};
3419
+ jQuery.event.trigger( e, null, e.target );
3420
+ if ( e.isDefaultPrevented() ) {
3421
+ donor.preventDefault();
3422
+ }
3008
3423
  }
3009
3424
  });
3010
3425
  }
3011
3426
 
3012
3427
  jQuery.each(["bind", "one"], function( i, name ) {
3013
3428
  jQuery.fn[ name ] = function( type, data, fn ) {
3429
+ var handler;
3430
+
3014
3431
  // Handle object literals
3015
3432
  if ( typeof type === "object" ) {
3016
3433
  for ( var key in type ) {
@@ -3019,15 +3436,20 @@ jQuery.each(["bind", "one"], function( i, name ) {
3019
3436
  return this;
3020
3437
  }
3021
3438
 
3022
- if ( jQuery.isFunction( data ) || data === false ) {
3439
+ if ( arguments.length === 2 || data === false ) {
3023
3440
  fn = data;
3024
3441
  data = undefined;
3025
3442
  }
3026
3443
 
3027
- var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
3028
- jQuery( this ).unbind( event, handler );
3029
- return fn.apply( this, arguments );
3030
- }) : fn;
3444
+ if ( name === "one" ) {
3445
+ handler = function( event ) {
3446
+ jQuery( this ).unbind( event, handler );
3447
+ return fn.apply( this, arguments );
3448
+ };
3449
+ handler.guid = fn.guid || jQuery.guid++;
3450
+ } else {
3451
+ handler = fn;
3452
+ }
3031
3453
 
3032
3454
  if ( type === "unload" && name !== "one" ) {
3033
3455
  this.one( type, data, fn );
@@ -3065,7 +3487,7 @@ jQuery.fn.extend({
3065
3487
 
3066
3488
  undelegate: function( selector, types, fn ) {
3067
3489
  if ( arguments.length === 0 ) {
3068
- return this.unbind( "live" );
3490
+ return this.unbind( "live" );
3069
3491
 
3070
3492
  } else {
3071
3493
  return this.die( types, null, fn, selector );
@@ -3080,35 +3502,34 @@ jQuery.fn.extend({
3080
3502
 
3081
3503
  triggerHandler: function( type, data ) {
3082
3504
  if ( this[0] ) {
3083
- var event = jQuery.Event( type );
3084
- event.preventDefault();
3085
- event.stopPropagation();
3086
- jQuery.event.trigger( event, data, this[0] );
3087
- return event.result;
3505
+ return jQuery.event.trigger( type, data, this[0], true );
3088
3506
  }
3089
3507
  },
3090
3508
 
3091
3509
  toggle: function( fn ) {
3092
3510
  // Save reference to arguments for access in closure
3093
3511
  var args = arguments,
3094
- i = 1;
3512
+ guid = fn.guid || jQuery.guid++,
3513
+ i = 0,
3514
+ toggler = function( event ) {
3515
+ // Figure out which function to execute
3516
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3517
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3518
+
3519
+ // Make sure that clicks stop
3520
+ event.preventDefault();
3521
+
3522
+ // and execute the function
3523
+ return args[ lastToggle ].apply( this, arguments ) || false;
3524
+ };
3095
3525
 
3096
3526
  // link all the functions, so any of them can unbind this click handler
3527
+ toggler.guid = guid;
3097
3528
  while ( i < args.length ) {
3098
- jQuery.proxy( fn, args[ i++ ] );
3529
+ args[ i++ ].guid = guid;
3099
3530
  }
3100
3531
 
3101
- return this.click( jQuery.proxy( fn, function( event ) {
3102
- // Figure out which function to execute
3103
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3104
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3105
-
3106
- // Make sure that clicks stop
3107
- event.preventDefault();
3108
-
3109
- // and execute the function
3110
- return args[ lastToggle ].apply( this, arguments ) || false;
3111
- }));
3532
+ return this.click( toggler );
3112
3533
  },
3113
3534
 
3114
3535
  hover: function( fnOver, fnOut ) {
@@ -3137,8 +3558,16 @@ jQuery.each(["live", "die"], function( i, name ) {
3137
3558
  return this;
3138
3559
  }
3139
3560
 
3140
- if ( jQuery.isFunction( data ) ) {
3141
- fn = data;
3561
+ if ( name === "die" && !types &&
3562
+ origSelector && origSelector.charAt(0) === "." ) {
3563
+
3564
+ context.unbind( origSelector );
3565
+
3566
+ return this;
3567
+ }
3568
+
3569
+ if ( data === false || jQuery.isFunction( data ) ) {
3570
+ fn = data || returnFalse;
3142
3571
  data = undefined;
3143
3572
  }
3144
3573
 
@@ -3160,7 +3589,7 @@ jQuery.each(["live", "die"], function( i, name ) {
3160
3589
 
3161
3590
  preType = type;
3162
3591
 
3163
- if ( type === "focus" || type === "blur" ) {
3592
+ if ( liveMap[ type ] ) {
3164
3593
  types.push( liveMap[ type ] + namespaces );
3165
3594
  type = type + namespaces;
3166
3595
 
@@ -3231,6 +3660,11 @@ function liveHandler( event ) {
3231
3660
  if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
3232
3661
  event.type = handleObj.preType;
3233
3662
  related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
3663
+
3664
+ // Make sure not to accidentally match a child element with the same selector
3665
+ if ( related && jQuery.contains( elem, related ) ) {
3666
+ related = elem;
3667
+ }
3234
3668
  }
3235
3669
 
3236
3670
  if ( !related || related !== elem ) {
@@ -3269,7 +3703,7 @@ function liveHandler( event ) {
3269
3703
  }
3270
3704
 
3271
3705
  function liveConvert( type, selector ) {
3272
- return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
3706
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
3273
3707
  }
3274
3708
 
3275
3709
  jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
@@ -3294,6 +3728,7 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
3294
3728
  });
3295
3729
 
3296
3730
 
3731
+
3297
3732
  /*!
3298
3733
  * Sizzle CSS Selector Engine
3299
3734
  * Copyright 2011, The Dojo Foundation
@@ -3918,43 +4353,53 @@ var Expr = Sizzle.selectors = {
3918
4353
  },
3919
4354
 
3920
4355
  text: function( elem ) {
4356
+ var attr = elem.getAttribute( "type" ), type = elem.type;
3921
4357
  // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
3922
4358
  // use getAttribute instead to test this case
3923
- return "text" === elem.getAttribute( 'type' );
4359
+ return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
3924
4360
  },
4361
+
3925
4362
  radio: function( elem ) {
3926
- return "radio" === elem.type;
4363
+ return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
3927
4364
  },
3928
4365
 
3929
4366
  checkbox: function( elem ) {
3930
- return "checkbox" === elem.type;
4367
+ return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
3931
4368
  },
3932
4369
 
3933
4370
  file: function( elem ) {
3934
- return "file" === elem.type;
4371
+ return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
3935
4372
  },
4373
+
3936
4374
  password: function( elem ) {
3937
- return "password" === elem.type;
4375
+ return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
3938
4376
  },
3939
4377
 
3940
4378
  submit: function( elem ) {
3941
- return "submit" === elem.type;
4379
+ var name = elem.nodeName.toLowerCase();
4380
+ return (name === "input" || name === "button") && "submit" === elem.type;
3942
4381
  },
3943
4382
 
3944
4383
  image: function( elem ) {
3945
- return "image" === elem.type;
4384
+ return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
3946
4385
  },
3947
4386
 
3948
4387
  reset: function( elem ) {
3949
- return "reset" === elem.type;
4388
+ var name = elem.nodeName.toLowerCase();
4389
+ return (name === "input" || name === "button") && "reset" === elem.type;
3950
4390
  },
3951
4391
 
3952
4392
  button: function( elem ) {
3953
- return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
4393
+ var name = elem.nodeName.toLowerCase();
4394
+ return name === "input" && "button" === elem.type || name === "button";
3954
4395
  },
3955
4396
 
3956
4397
  input: function( elem ) {
3957
4398
  return (/input|select|textarea|button/i).test( elem.nodeName );
4399
+ },
4400
+
4401
+ focus: function( elem ) {
4402
+ return elem === elem.ownerDocument.activeElement;
3958
4403
  }
3959
4404
  },
3960
4405
  setFilters: {
@@ -4207,6 +4652,16 @@ if ( document.documentElement.compareDocumentPosition ) {
4207
4652
 
4208
4653
  } else {
4209
4654
  sortOrder = function( a, b ) {
4655
+ // The nodes are identical, we can exit early
4656
+ if ( a === b ) {
4657
+ hasDuplicate = true;
4658
+ return 0;
4659
+
4660
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
4661
+ } else if ( a.sourceIndex && b.sourceIndex ) {
4662
+ return a.sourceIndex - b.sourceIndex;
4663
+ }
4664
+
4210
4665
  var al, bl,
4211
4666
  ap = [],
4212
4667
  bp = [],
@@ -4214,13 +4669,8 @@ if ( document.documentElement.compareDocumentPosition ) {
4214
4669
  bup = b.parentNode,
4215
4670
  cur = aup;
4216
4671
 
4217
- // The nodes are identical, we can exit early
4218
- if ( a === b ) {
4219
- hasDuplicate = true;
4220
- return 0;
4221
-
4222
4672
  // If the nodes are siblings (or identical) we can do a quick check
4223
- } else if ( aup === bup ) {
4673
+ if ( aup === bup ) {
4224
4674
  return siblingCheck( a, b );
4225
4675
 
4226
4676
  // If no parents were found then the nodes are disconnected
@@ -4496,19 +4946,23 @@ if ( document.querySelectorAll ) {
4496
4946
 
4497
4947
  (function(){
4498
4948
  var html = document.documentElement,
4499
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
4500
- pseudoWorks = false;
4949
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
4501
4950
 
4502
- try {
4503
- // This should fail with an exception
4504
- // Gecko does not error, returns false instead
4505
- matches.call( document.documentElement, "[test!='']:sizzle" );
4951
+ if ( matches ) {
4952
+ // Check to see if it's possible to do matchesSelector
4953
+ // on a disconnected node (IE 9 fails this)
4954
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
4955
+ pseudoWorks = false;
4956
+
4957
+ try {
4958
+ // This should fail with an exception
4959
+ // Gecko does not error, returns false instead
4960
+ matches.call( document.documentElement, "[test!='']:sizzle" );
4506
4961
 
4507
- } catch( pseudoError ) {
4508
- pseudoWorks = true;
4509
- }
4962
+ } catch( pseudoError ) {
4963
+ pseudoWorks = true;
4964
+ }
4510
4965
 
4511
- if ( matches ) {
4512
4966
  Sizzle.matchesSelector = function( node, expr ) {
4513
4967
  // Make sure that attribute selectors are quoted
4514
4968
  expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
@@ -4516,7 +4970,15 @@ if ( document.querySelectorAll ) {
4516
4970
  if ( !Sizzle.isXML( node ) ) {
4517
4971
  try {
4518
4972
  if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4519
- return matches.call( node, expr );
4973
+ var ret = matches.call( node, expr );
4974
+
4975
+ // IE 9's matchesSelector returns false on disconnected nodes
4976
+ if ( ret || !disconnectedMatch ||
4977
+ // As well, disconnected nodes are said to be in a document
4978
+ // fragment in IE 9, so check for that
4979
+ node.document && node.document.nodeType !== 11 ) {
4980
+ return ret;
4981
+ }
4520
4982
  }
4521
4983
  } catch(e) {}
4522
4984
  }
@@ -4705,17 +5167,30 @@ var runtil = /Until$/,
4705
5167
 
4706
5168
  jQuery.fn.extend({
4707
5169
  find: function( selector ) {
5170
+ var self = this,
5171
+ i, l;
5172
+
5173
+ if ( typeof selector !== "string" ) {
5174
+ return jQuery( selector ).filter(function() {
5175
+ for ( i = 0, l = self.length; i < l; i++ ) {
5176
+ if ( jQuery.contains( self[ i ], this ) ) {
5177
+ return true;
5178
+ }
5179
+ }
5180
+ });
5181
+ }
5182
+
4708
5183
  var ret = this.pushStack( "", "find", selector ),
4709
- length = 0;
5184
+ length, n, r;
4710
5185
 
4711
- for ( var i = 0, l = this.length; i < l; i++ ) {
5186
+ for ( i = 0, l = this.length; i < l; i++ ) {
4712
5187
  length = ret.length;
4713
5188
  jQuery.find( selector, this[i], ret );
4714
5189
 
4715
5190
  if ( i > 0 ) {
4716
5191
  // Make sure that the results are unique
4717
- for ( var n = length; n < ret.length; n++ ) {
4718
- for ( var r = 0; r < length; r++ ) {
5192
+ for ( n = length; n < ret.length; n++ ) {
5193
+ for ( r = 0; r < length; r++ ) {
4719
5194
  if ( ret[r] === ret[n] ) {
4720
5195
  ret.splice(n--, 1);
4721
5196
  break;
@@ -4748,12 +5223,15 @@ jQuery.fn.extend({
4748
5223
  },
4749
5224
 
4750
5225
  is: function( selector ) {
4751
- return !!selector && jQuery.filter( selector, this ).length > 0;
5226
+ return !!selector && ( typeof selector === "string" ?
5227
+ jQuery.filter( selector, this ).length > 0 :
5228
+ this.filter( selector ).length > 0 );
4752
5229
  },
4753
5230
 
4754
5231
  closest: function( selectors, context ) {
4755
5232
  var ret = [], i, l, cur = this[0];
4756
-
5233
+
5234
+ // Array
4757
5235
  if ( jQuery.isArray( selectors ) ) {
4758
5236
  var match, selector,
4759
5237
  matches = {},
@@ -4763,8 +5241,8 @@ jQuery.fn.extend({
4763
5241
  for ( i = 0, l = selectors.length; i < l; i++ ) {
4764
5242
  selector = selectors[i];
4765
5243
 
4766
- if ( !matches[selector] ) {
4767
- matches[selector] = jQuery.expr.match.POS.test( selector ) ?
5244
+ if ( !matches[ selector ] ) {
5245
+ matches[ selector ] = POS.test( selector ) ?
4768
5246
  jQuery( selector, context || this.context ) :
4769
5247
  selector;
4770
5248
  }
@@ -4772,9 +5250,9 @@ jQuery.fn.extend({
4772
5250
 
4773
5251
  while ( cur && cur.ownerDocument && cur !== context ) {
4774
5252
  for ( selector in matches ) {
4775
- match = matches[selector];
5253
+ match = matches[ selector ];
4776
5254
 
4777
- if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
5255
+ if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
4778
5256
  ret.push({ selector: selector, elem: cur, level: level });
4779
5257
  }
4780
5258
  }
@@ -4787,8 +5265,10 @@ jQuery.fn.extend({
4787
5265
  return ret;
4788
5266
  }
4789
5267
 
4790
- var pos = POS.test( selectors ) ?
4791
- jQuery( selectors, context || this.context ) : null;
5268
+ // String
5269
+ var pos = POS.test( selectors ) || typeof selectors !== "string" ?
5270
+ jQuery( selectors, context || this.context ) :
5271
+ 0;
4792
5272
 
4793
5273
  for ( i = 0, l = this.length; i < l; i++ ) {
4794
5274
  cur = this[i];
@@ -4800,14 +5280,14 @@ jQuery.fn.extend({
4800
5280
 
4801
5281
  } else {
4802
5282
  cur = cur.parentNode;
4803
- if ( !cur || !cur.ownerDocument || cur === context ) {
5283
+ if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
4804
5284
  break;
4805
5285
  }
4806
5286
  }
4807
5287
  }
4808
5288
  }
4809
5289
 
4810
- ret = ret.length > 1 ? jQuery.unique(ret) : ret;
5290
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
4811
5291
 
4812
5292
  return this.pushStack( ret, "closest", selectors );
4813
5293
  },
@@ -4830,7 +5310,7 @@ jQuery.fn.extend({
4830
5310
  add: function( selector, context ) {
4831
5311
  var set = typeof selector === "string" ?
4832
5312
  jQuery( selector, context ) :
4833
- jQuery.makeArray( selector ),
5313
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
4834
5314
  all = jQuery.merge( this.get(), set );
4835
5315
 
4836
5316
  return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
@@ -4968,6 +5448,11 @@ jQuery.extend({
4968
5448
 
4969
5449
  // Implement the identical functionality for filter and not
4970
5450
  function winnow( elements, qualifier, keep ) {
5451
+
5452
+ // Can't pass null or undefined to indexOf in Firefox 4
5453
+ // Set to 0 to skip string check
5454
+ qualifier = qualifier || 0;
5455
+
4971
5456
  if ( jQuery.isFunction( qualifier ) ) {
4972
5457
  return jQuery.grep(elements, function( elem, i ) {
4973
5458
  var retVal = !!qualifier.call( elem, i, elem );
@@ -5008,6 +5493,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
5008
5493
  rnocache = /<(?:script|object|embed|option|style)/i,
5009
5494
  // checked="checked" or checked
5010
5495
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5496
+ rscriptType = /\/(java|ecma)script/i,
5497
+ rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
5011
5498
  wrapMap = {
5012
5499
  option: [ 1, "<select multiple='multiple'>", "</select>" ],
5013
5500
  legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -5068,7 +5555,7 @@ jQuery.fn.extend({
5068
5555
  }
5069
5556
 
5070
5557
  return elem;
5071
- }).append(this);
5558
+ }).append( this );
5072
5559
  }
5073
5560
 
5074
5561
  return this;
@@ -5260,7 +5747,9 @@ jQuery.fn.extend({
5260
5747
  }
5261
5748
  });
5262
5749
  } else {
5263
- return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
5750
+ return this.length ?
5751
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
5752
+ this;
5264
5753
  }
5265
5754
  },
5266
5755
 
@@ -5374,21 +5863,27 @@ function cloneCopyEvent( src, dest ) {
5374
5863
  }
5375
5864
  }
5376
5865
 
5377
- function cloneFixAttributes(src, dest) {
5866
+ function cloneFixAttributes( src, dest ) {
5867
+ var nodeName;
5868
+
5378
5869
  // We do not need to do anything for non-Elements
5379
5870
  if ( dest.nodeType !== 1 ) {
5380
5871
  return;
5381
5872
  }
5382
5873
 
5383
- var nodeName = dest.nodeName.toLowerCase();
5384
-
5385
5874
  // clearAttributes removes the attributes, which we don't want,
5386
5875
  // but also removes the attachEvent events, which we *do* want
5387
- dest.clearAttributes();
5876
+ if ( dest.clearAttributes ) {
5877
+ dest.clearAttributes();
5878
+ }
5388
5879
 
5389
5880
  // mergeAttributes, in contrast, only merges back on the
5390
5881
  // original attributes, not the events
5391
- dest.mergeAttributes(src);
5882
+ if ( dest.mergeAttributes ) {
5883
+ dest.mergeAttributes( src );
5884
+ }
5885
+
5886
+ nodeName = dest.nodeName.toLowerCase();
5392
5887
 
5393
5888
  // IE6-8 fail to clone children inside object elements that use
5394
5889
  // the proprietary classid attribute value (rather than the type
@@ -5427,8 +5922,21 @@ function cloneFixAttributes(src, dest) {
5427
5922
  }
5428
5923
 
5429
5924
  jQuery.buildFragment = function( args, nodes, scripts ) {
5430
- var fragment, cacheable, cacheresults,
5431
- doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
5925
+ var fragment, cacheable, cacheresults, doc;
5926
+
5927
+ // nodes may contain either an explicit document object,
5928
+ // a jQuery collection or context object.
5929
+ // If nodes[0] contains a valid object to assign to doc
5930
+ if ( nodes && nodes[0] ) {
5931
+ doc = nodes[0].ownerDocument || nodes[0];
5932
+ }
5933
+
5934
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
5935
+ // Chrome and Firefox seem to allow this to occur and will throw exception
5936
+ // Fixes #8950
5937
+ if ( !doc.createDocumentFragment ) {
5938
+ doc = document;
5939
+ }
5432
5940
 
5433
5941
  // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5434
5942
  // Cloning options loses the selected state, so don't cache them
@@ -5438,11 +5946,10 @@ jQuery.buildFragment = function( args, nodes, scripts ) {
5438
5946
  args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
5439
5947
 
5440
5948
  cacheable = true;
5949
+
5441
5950
  cacheresults = jQuery.fragments[ args[0] ];
5442
- if ( cacheresults ) {
5443
- if ( cacheresults !== 1 ) {
5444
- fragment = cacheresults;
5445
- }
5951
+ if ( cacheresults && cacheresults !== 1 ) {
5952
+ fragment = cacheresults;
5446
5953
  }
5447
5954
  }
5448
5955
 
@@ -5491,7 +5998,7 @@ jQuery.each({
5491
5998
  function getAll( elem ) {
5492
5999
  if ( "getElementsByTagName" in elem ) {
5493
6000
  return elem.getElementsByTagName( "*" );
5494
-
6001
+
5495
6002
  } else if ( "querySelectorAll" in elem ) {
5496
6003
  return elem.querySelectorAll( "*" );
5497
6004
 
@@ -5500,6 +6007,21 @@ function getAll( elem ) {
5500
6007
  }
5501
6008
  }
5502
6009
 
6010
+ // Used in clean, fixes the defaultChecked property
6011
+ function fixDefaultChecked( elem ) {
6012
+ if ( elem.type === "checkbox" || elem.type === "radio" ) {
6013
+ elem.defaultChecked = elem.checked;
6014
+ }
6015
+ }
6016
+ // Finds all inputs and passes them to fixDefaultChecked
6017
+ function findInputs( elem ) {
6018
+ if ( jQuery.nodeName( elem, "input" ) ) {
6019
+ fixDefaultChecked( elem );
6020
+ } else if ( "getElementsByTagName" in elem ) {
6021
+ jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
6022
+ }
6023
+ }
6024
+
5503
6025
  jQuery.extend({
5504
6026
  clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5505
6027
  var clone = elem.cloneNode(true),
@@ -5544,10 +6066,15 @@ jQuery.extend({
5544
6066
  }
5545
6067
  }
5546
6068
 
6069
+ srcElements = destElements = null;
6070
+
5547
6071
  // Return the cloned set
5548
6072
  return clone;
5549
- },
6073
+ },
6074
+
5550
6075
  clean: function( elems, context, fragment, scripts ) {
6076
+ var checkScriptType;
6077
+
5551
6078
  context = context || document;
5552
6079
 
5553
6080
  // !context.createElement fails in IE with an error but returns typeof 'object'
@@ -5555,7 +6082,7 @@ jQuery.extend({
5555
6082
  context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
5556
6083
  }
5557
6084
 
5558
- var ret = [];
6085
+ var ret = [], j;
5559
6086
 
5560
6087
  for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
5561
6088
  if ( typeof elem === "number" ) {
@@ -5567,54 +6094,67 @@ jQuery.extend({
5567
6094
  }
5568
6095
 
5569
6096
  // Convert html string into DOM nodes
5570
- if ( typeof elem === "string" && !rhtml.test( elem ) ) {
5571
- elem = context.createTextNode( elem );
5572
-
5573
- } else if ( typeof elem === "string" ) {
5574
- // Fix "XHTML"-style tags in all browsers
5575
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
6097
+ if ( typeof elem === "string" ) {
6098
+ if ( !rhtml.test( elem ) ) {
6099
+ elem = context.createTextNode( elem );
6100
+ } else {
6101
+ // Fix "XHTML"-style tags in all browsers
6102
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
5576
6103
 
5577
- // Trim whitespace, otherwise indexOf won't work as expected
5578
- var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
5579
- wrap = wrapMap[ tag ] || wrapMap._default,
5580
- depth = wrap[0],
5581
- div = context.createElement("div");
6104
+ // Trim whitespace, otherwise indexOf won't work as expected
6105
+ var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
6106
+ wrap = wrapMap[ tag ] || wrapMap._default,
6107
+ depth = wrap[0],
6108
+ div = context.createElement("div");
5582
6109
 
5583
- // Go to html and back, then peel off extra wrappers
5584
- div.innerHTML = wrap[1] + elem + wrap[2];
6110
+ // Go to html and back, then peel off extra wrappers
6111
+ div.innerHTML = wrap[1] + elem + wrap[2];
5585
6112
 
5586
- // Move to the right depth
5587
- while ( depth-- ) {
5588
- div = div.lastChild;
5589
- }
6113
+ // Move to the right depth
6114
+ while ( depth-- ) {
6115
+ div = div.lastChild;
6116
+ }
5590
6117
 
5591
- // Remove IE's autoinserted <tbody> from table fragments
5592
- if ( !jQuery.support.tbody ) {
6118
+ // Remove IE's autoinserted <tbody> from table fragments
6119
+ if ( !jQuery.support.tbody ) {
5593
6120
 
5594
- // String was a <table>, *may* have spurious <tbody>
5595
- var hasBody = rtbody.test(elem),
5596
- tbody = tag === "table" && !hasBody ?
5597
- div.firstChild && div.firstChild.childNodes :
6121
+ // String was a <table>, *may* have spurious <tbody>
6122
+ var hasBody = rtbody.test(elem),
6123
+ tbody = tag === "table" && !hasBody ?
6124
+ div.firstChild && div.firstChild.childNodes :
5598
6125
 
5599
- // String was a bare <thead> or <tfoot>
5600
- wrap[1] === "<table>" && !hasBody ?
5601
- div.childNodes :
5602
- [];
6126
+ // String was a bare <thead> or <tfoot>
6127
+ wrap[1] === "<table>" && !hasBody ?
6128
+ div.childNodes :
6129
+ [];
5603
6130
 
5604
- for ( var j = tbody.length - 1; j >= 0 ; --j ) {
5605
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
5606
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
6131
+ for ( j = tbody.length - 1; j >= 0 ; --j ) {
6132
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
6133
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
6134
+ }
5607
6135
  }
5608
6136
  }
5609
6137
 
5610
- }
6138
+ // IE completely kills leading whitespace when innerHTML is used
6139
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
6140
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
6141
+ }
5611
6142
 
5612
- // IE completely kills leading whitespace when innerHTML is used
5613
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5614
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
6143
+ elem = div.childNodes;
5615
6144
  }
6145
+ }
5616
6146
 
5617
- elem = div.childNodes;
6147
+ // Resets defaultChecked for any radios and checkboxes
6148
+ // about to be appended to the DOM in IE 6/7 (#8060)
6149
+ var len;
6150
+ if ( !jQuery.support.appendChecked ) {
6151
+ if ( elem[0] && typeof (len = elem.length) === "number" ) {
6152
+ for ( j = 0; j < len; j++ ) {
6153
+ findInputs( elem[j] );
6154
+ }
6155
+ } else {
6156
+ findInputs( elem );
6157
+ }
5618
6158
  }
5619
6159
 
5620
6160
  if ( elem.nodeType ) {
@@ -5625,13 +6165,18 @@ jQuery.extend({
5625
6165
  }
5626
6166
 
5627
6167
  if ( fragment ) {
6168
+ checkScriptType = function( elem ) {
6169
+ return !elem.type || rscriptType.test( elem.type );
6170
+ };
5628
6171
  for ( i = 0; ret[i]; i++ ) {
5629
6172
  if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
5630
6173
  scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5631
6174
 
5632
6175
  } else {
5633
6176
  if ( ret[i].nodeType === 1 ) {
5634
- ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
6177
+ var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
6178
+
6179
+ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
5635
6180
  }
5636
6181
  fragment.appendChild( ret[i] );
5637
6182
  }
@@ -5693,7 +6238,7 @@ function evalScript( i, elem ) {
5693
6238
  dataType: "script"
5694
6239
  });
5695
6240
  } else {
5696
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
6241
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
5697
6242
  }
5698
6243
 
5699
6244
  if ( elem.parentNode ) {
@@ -5703,13 +6248,14 @@ function evalScript( i, elem ) {
5703
6248
 
5704
6249
 
5705
6250
 
5706
-
5707
6251
  var ralpha = /alpha\([^)]*\)/i,
5708
6252
  ropacity = /opacity=([^)]*)/,
5709
- rdashAlpha = /-([a-z])/ig,
5710
- rupper = /([A-Z])/g,
6253
+ // fixed for IE9, see #8346
6254
+ rupper = /([A-Z]|^ms)/g,
5711
6255
  rnumpx = /^-?\d+(?:px)?$/i,
5712
6256
  rnum = /^-?\d/,
6257
+ rrelNum = /^[+\-]=/,
6258
+ rrelNumFilter = /[^+\-\.\de]+/g,
5713
6259
 
5714
6260
  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5715
6261
  cssWidth = [ "Left", "Right" ],
@@ -5717,11 +6263,7 @@ var ralpha = /alpha\([^)]*\)/i,
5717
6263
  curCSS,
5718
6264
 
5719
6265
  getComputedStyle,
5720
- currentStyle,
5721
-
5722
- fcamelCase = function( all, letter ) {
5723
- return letter.toUpperCase();
5724
- };
6266
+ currentStyle;
5725
6267
 
5726
6268
  jQuery.fn.css = function( name, value ) {
5727
6269
  // Setting 'undefined' is a no-op
@@ -5756,11 +6298,14 @@ jQuery.extend({
5756
6298
 
5757
6299
  // Exclude the following css properties to add px
5758
6300
  cssNumber: {
5759
- "zIndex": true,
6301
+ "fillOpacity": true,
5760
6302
  "fontWeight": true,
6303
+ "lineHeight": true,
5761
6304
  "opacity": true,
5762
- "zoom": true,
5763
- "lineHeight": true
6305
+ "orphans": true,
6306
+ "widows": true,
6307
+ "zIndex": true,
6308
+ "zoom": true
5764
6309
  },
5765
6310
 
5766
6311
  // Add in properties whose names you wish to fix before
@@ -5778,20 +6323,29 @@ jQuery.extend({
5778
6323
  }
5779
6324
 
5780
6325
  // Make sure that we're working with the right name
5781
- var ret, origName = jQuery.camelCase( name ),
6326
+ var ret, type, origName = jQuery.camelCase( name ),
5782
6327
  style = elem.style, hooks = jQuery.cssHooks[ origName ];
5783
6328
 
5784
6329
  name = jQuery.cssProps[ origName ] || origName;
5785
6330
 
5786
6331
  // Check if we're setting a value
5787
6332
  if ( value !== undefined ) {
6333
+ type = typeof value;
6334
+
5788
6335
  // Make sure that NaN and null values aren't set. See: #7116
5789
- if ( typeof value === "number" && isNaN( value ) || value == null ) {
6336
+ if ( type === "number" && isNaN( value ) || value == null ) {
5790
6337
  return;
5791
6338
  }
5792
6339
 
6340
+ // convert relative number strings (+= or -=) to relative numbers. #7345
6341
+ if ( type === "string" && rrelNum.test( value ) ) {
6342
+ value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
6343
+ // Fixes bug #9237
6344
+ type = "number";
6345
+ }
6346
+
5793
6347
  // If a number was passed in, add 'px' to the (except for certain CSS properties)
5794
- if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
6348
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
5795
6349
  value += "px";
5796
6350
  }
5797
6351
 
@@ -5816,11 +6370,17 @@ jQuery.extend({
5816
6370
  },
5817
6371
 
5818
6372
  css: function( elem, name, extra ) {
6373
+ var ret, hooks;
6374
+
5819
6375
  // Make sure that we're working with the right name
5820
- var ret, origName = jQuery.camelCase( name ),
5821
- hooks = jQuery.cssHooks[ origName ];
6376
+ name = jQuery.camelCase( name );
6377
+ hooks = jQuery.cssHooks[ name ];
6378
+ name = jQuery.cssProps[ name ] || name;
5822
6379
 
5823
- name = jQuery.cssProps[ origName ] || origName;
6380
+ // cssFloat needs a special treatment
6381
+ if ( name === "cssFloat" ) {
6382
+ name = "float";
6383
+ }
5824
6384
 
5825
6385
  // If a hook was provided get the computed value from there
5826
6386
  if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
@@ -5828,7 +6388,7 @@ jQuery.extend({
5828
6388
 
5829
6389
  // Otherwise, if a way to get the computed value exists, use that
5830
6390
  } else if ( curCSS ) {
5831
- return curCSS( elem, name, origName );
6391
+ return curCSS( elem, name );
5832
6392
  }
5833
6393
  },
5834
6394
 
@@ -5848,10 +6408,6 @@ jQuery.extend({
5848
6408
  for ( name in options ) {
5849
6409
  elem.style[ name ] = old[ name ];
5850
6410
  }
5851
- },
5852
-
5853
- camelCase: function( string ) {
5854
- return string.replace( rdashAlpha, fcamelCase );
5855
6411
  }
5856
6412
  });
5857
6413
 
@@ -5865,44 +6421,21 @@ jQuery.each(["height", "width"], function( i, name ) {
5865
6421
 
5866
6422
  if ( computed ) {
5867
6423
  if ( elem.offsetWidth !== 0 ) {
5868
- val = getWH( elem, name, extra );
5869
-
6424
+ return getWH( elem, name, extra );
5870
6425
  } else {
5871
6426
  jQuery.swap( elem, cssShow, function() {
5872
6427
  val = getWH( elem, name, extra );
5873
6428
  });
5874
6429
  }
5875
6430
 
5876
- if ( val <= 0 ) {
5877
- val = curCSS( elem, name, name );
5878
-
5879
- if ( val === "0px" && currentStyle ) {
5880
- val = currentStyle( elem, name, name );
5881
- }
5882
-
5883
- if ( val != null ) {
5884
- // Should return "auto" instead of 0, use 0 for
5885
- // temporary backwards-compat
5886
- return val === "" || val === "auto" ? "0px" : val;
5887
- }
5888
- }
5889
-
5890
- if ( val < 0 || val == null ) {
5891
- val = elem.style[ name ];
5892
-
5893
- // Should return "auto" instead of 0, use 0 for
5894
- // temporary backwards-compat
5895
- return val === "" || val === "auto" ? "0px" : val;
5896
- }
5897
-
5898
- return typeof val === "string" ? val : val + "px";
6431
+ return val;
5899
6432
  }
5900
6433
  },
5901
6434
 
5902
6435
  set: function( elem, value ) {
5903
6436
  if ( rnumpx.test( value ) ) {
5904
6437
  // ignore negative width and height values #1599
5905
- value = parseFloat(value);
6438
+ value = parseFloat( value );
5906
6439
 
5907
6440
  if ( value >= 0 ) {
5908
6441
  return value + "px";
@@ -5919,33 +6452,56 @@ if ( !jQuery.support.opacity ) {
5919
6452
  jQuery.cssHooks.opacity = {
5920
6453
  get: function( elem, computed ) {
5921
6454
  // IE uses filters for opacity
5922
- return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
5923
- (parseFloat(RegExp.$1) / 100) + "" :
6455
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6456
+ ( parseFloat( RegExp.$1 ) / 100 ) + "" :
5924
6457
  computed ? "1" : "";
5925
6458
  },
5926
6459
 
5927
6460
  set: function( elem, value ) {
5928
- var style = elem.style;
6461
+ var style = elem.style,
6462
+ currentStyle = elem.currentStyle;
5929
6463
 
5930
6464
  // IE has trouble with opacity if it does not have layout
5931
6465
  // Force it by setting the zoom level
5932
6466
  style.zoom = 1;
5933
6467
 
5934
6468
  // Set the alpha filter to set the opacity
5935
- var opacity = jQuery.isNaN(value) ?
6469
+ var opacity = jQuery.isNaN( value ) ?
5936
6470
  "" :
5937
6471
  "alpha(opacity=" + value * 100 + ")",
5938
- filter = style.filter || "";
6472
+ filter = currentStyle && currentStyle.filter || style.filter || "";
5939
6473
 
5940
- style.filter = ralpha.test(filter) ?
5941
- filter.replace(ralpha, opacity) :
5942
- style.filter + ' ' + opacity;
6474
+ style.filter = ralpha.test( filter ) ?
6475
+ filter.replace( ralpha, opacity ) :
6476
+ filter + " " + opacity;
5943
6477
  }
5944
6478
  };
5945
6479
  }
5946
6480
 
6481
+ jQuery(function() {
6482
+ // This hook cannot be added until DOM ready because the support test
6483
+ // for it is not run until after DOM ready
6484
+ if ( !jQuery.support.reliableMarginRight ) {
6485
+ jQuery.cssHooks.marginRight = {
6486
+ get: function( elem, computed ) {
6487
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6488
+ // Work around by temporarily setting element display to inline-block
6489
+ var ret;
6490
+ jQuery.swap( elem, { "display": "inline-block" }, function() {
6491
+ if ( computed ) {
6492
+ ret = curCSS( elem, "margin-right", "marginRight" );
6493
+ } else {
6494
+ ret = elem.style.marginRight;
6495
+ }
6496
+ });
6497
+ return ret;
6498
+ }
6499
+ };
6500
+ }
6501
+ });
6502
+
5947
6503
  if ( document.defaultView && document.defaultView.getComputedStyle ) {
5948
- getComputedStyle = function( elem, newName, name ) {
6504
+ getComputedStyle = function( elem, name ) {
5949
6505
  var ret, defaultView, computedStyle;
5950
6506
 
5951
6507
  name = name.replace( rupper, "-$1" ).toLowerCase();
@@ -6002,27 +6558,50 @@ if ( document.documentElement.currentStyle ) {
6002
6558
  curCSS = getComputedStyle || currentStyle;
6003
6559
 
6004
6560
  function getWH( elem, name, extra ) {
6005
- var which = name === "width" ? cssWidth : cssHeight,
6006
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
6007
6561
 
6008
- if ( extra === "border" ) {
6009
- return val;
6010
- }
6562
+ // Start with offset property
6563
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6564
+ which = name === "width" ? cssWidth : cssHeight;
6011
6565
 
6012
- jQuery.each( which, function() {
6013
- if ( !extra ) {
6014
- val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
6566
+ if ( val > 0 ) {
6567
+ if ( extra !== "border" ) {
6568
+ jQuery.each( which, function() {
6569
+ if ( !extra ) {
6570
+ val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
6571
+ }
6572
+ if ( extra === "margin" ) {
6573
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
6574
+ } else {
6575
+ val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
6576
+ }
6577
+ });
6015
6578
  }
6016
6579
 
6017
- if ( extra === "margin" ) {
6018
- val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
6580
+ return val + "px";
6581
+ }
6019
6582
 
6020
- } else {
6021
- val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
6022
- }
6023
- });
6583
+ // Fall back to computed then uncomputed css if necessary
6584
+ val = curCSS( elem, name, name );
6585
+ if ( val < 0 || val == null ) {
6586
+ val = elem.style[ name ] || 0;
6587
+ }
6588
+ // Normalize "", auto, and prepare for extra
6589
+ val = parseFloat( val ) || 0;
6590
+
6591
+ // Add padding, border, margin
6592
+ if ( extra ) {
6593
+ jQuery.each( which, function() {
6594
+ val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
6595
+ if ( extra !== "padding" ) {
6596
+ val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
6597
+ }
6598
+ if ( extra === "margin" ) {
6599
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
6600
+ }
6601
+ });
6602
+ }
6024
6603
 
6025
- return val;
6604
+ return val + "px";
6026
6605
  }
6027
6606
 
6028
6607
  if ( jQuery.expr && jQuery.expr.filters ) {
@@ -6048,7 +6627,7 @@ var r20 = /%20/g,
6048
6627
  rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
6049
6628
  rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6050
6629
  // #7653, #8125, #8152: local protocol detection
6051
- rlocalProtocol = /(?:^file|^widget|\-extension):$/,
6630
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
6052
6631
  rnoContent = /^(?:GET|HEAD)$/,
6053
6632
  rprotocol = /^\/\//,
6054
6633
  rquery = /\?/,
@@ -6056,11 +6635,7 @@ var r20 = /%20/g,
6056
6635
  rselectTextarea = /^(?:select|textarea)/i,
6057
6636
  rspacesAjax = /\s+/,
6058
6637
  rts = /([?&])_=[^&]*/,
6059
- rucHeaders = /(^|\-)([a-z])/g,
6060
- rucHeadersFunc = function( _, $1, $2 ) {
6061
- return $1 + $2.toUpperCase();
6062
- },
6063
- rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
6638
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
6064
6639
 
6065
6640
  // Keep a copy of the old load method
6066
6641
  _load = jQuery.fn.load,
@@ -6090,9 +6665,9 @@ var r20 = /%20/g,
6090
6665
  ajaxLocParts;
6091
6666
 
6092
6667
  // #8138, IE may throw an exception when accessing
6093
- // a field from document.location if document.domain has been set
6668
+ // a field from window.location if document.domain has been set
6094
6669
  try {
6095
- ajaxLocation = document.location.href;
6670
+ ajaxLocation = location.href;
6096
6671
  } catch( e ) {
6097
6672
  // Use the href attribute of an A element
6098
6673
  // since IE will modify it given document.location
@@ -6102,7 +6677,7 @@ try {
6102
6677
  }
6103
6678
 
6104
6679
  // Segment location into parts
6105
- ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
6680
+ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
6106
6681
 
6107
6682
  // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6108
6683
  function addToPrefiltersOrTransports( structure ) {
@@ -6140,7 +6715,7 @@ function addToPrefiltersOrTransports( structure ) {
6140
6715
  };
6141
6716
  }
6142
6717
 
6143
- //Base inspection function for prefilters and transports
6718
+ // Base inspection function for prefilters and transports
6144
6719
  function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
6145
6720
  dataType /* internal */, inspected /* internal */ ) {
6146
6721
 
@@ -6289,7 +6864,7 @@ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".sp
6289
6864
  jQuery.fn[ o ] = function( f ){
6290
6865
  return this.bind( o, f );
6291
6866
  };
6292
- } );
6867
+ });
6293
6868
 
6294
6869
  jQuery.each( [ "get", "post" ], function( i, method ) {
6295
6870
  jQuery[ method ] = function( url, data, callback, type ) {
@@ -6308,7 +6883,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
6308
6883
  dataType: type
6309
6884
  });
6310
6885
  };
6311
- } );
6886
+ });
6312
6887
 
6313
6888
  jQuery.extend({
6314
6889
 
@@ -6360,7 +6935,6 @@ jQuery.extend({
6360
6935
  cache: null,
6361
6936
  traditional: false,
6362
6937
  headers: {},
6363
- crossDomain: null,
6364
6938
  */
6365
6939
 
6366
6940
  accepts: {
@@ -6435,6 +7009,7 @@ jQuery.extend({
6435
7009
  ifModifiedKey,
6436
7010
  // Headers (they are sent all at once)
6437
7011
  requestHeaders = {},
7012
+ requestHeadersNames = {},
6438
7013
  // Response headers
6439
7014
  responseHeadersString,
6440
7015
  responseHeaders,
@@ -6458,7 +7033,9 @@ jQuery.extend({
6458
7033
  // Caches the header
6459
7034
  setRequestHeader: function( name, value ) {
6460
7035
  if ( !state ) {
6461
- requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value;
7036
+ var lname = name.toLowerCase();
7037
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
7038
+ requestHeaders[ name ] = value;
6462
7039
  }
6463
7040
  return this;
6464
7041
  },
@@ -6645,7 +7222,7 @@ jQuery.extend({
6645
7222
  s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
6646
7223
 
6647
7224
  // Determine if a cross-domain request is in order
6648
- if ( !s.crossDomain ) {
7225
+ if ( s.crossDomain == null ) {
6649
7226
  parts = rurl.exec( s.url.toLowerCase() );
6650
7227
  s.crossDomain = !!( parts &&
6651
7228
  ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
@@ -6706,24 +7283,27 @@ jQuery.extend({
6706
7283
 
6707
7284
  // Set the correct header, if data is being sent
6708
7285
  if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6709
- requestHeaders[ "Content-Type" ] = s.contentType;
7286
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
6710
7287
  }
6711
7288
 
6712
7289
  // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6713
7290
  if ( s.ifModified ) {
6714
7291
  ifModifiedKey = ifModifiedKey || s.url;
6715
7292
  if ( jQuery.lastModified[ ifModifiedKey ] ) {
6716
- requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ];
7293
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
6717
7294
  }
6718
7295
  if ( jQuery.etag[ ifModifiedKey ] ) {
6719
- requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ];
7296
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
6720
7297
  }
6721
7298
  }
6722
7299
 
6723
7300
  // Set the Accepts header for the server, depending on the dataType
6724
- requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6725
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
6726
- s.accepts[ "*" ];
7301
+ jqXHR.setRequestHeader(
7302
+ "Accept",
7303
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
7304
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
7305
+ s.accepts[ "*" ]
7306
+ );
6727
7307
 
6728
7308
  // Check for headers option
6729
7309
  for ( i in s.headers ) {
@@ -6799,7 +7379,7 @@ jQuery.extend({
6799
7379
  // Serialize the form elements
6800
7380
  jQuery.each( a, function() {
6801
7381
  add( this.name, this.value );
6802
- } );
7382
+ });
6803
7383
 
6804
7384
  } else {
6805
7385
  // If traditional, encode the "old" way (the way 1.3.2 or older
@@ -6815,7 +7395,7 @@ jQuery.extend({
6815
7395
  });
6816
7396
 
6817
7397
  function buildParams( prefix, obj, traditional, add ) {
6818
- if ( jQuery.isArray( obj ) && obj.length ) {
7398
+ if ( jQuery.isArray( obj ) ) {
6819
7399
  // Serialize array item.
6820
7400
  jQuery.each( obj, function( i, v ) {
6821
7401
  if ( traditional || rbracket.test( prefix ) ) {
@@ -6835,16 +7415,9 @@ function buildParams( prefix, obj, traditional, add ) {
6835
7415
  });
6836
7416
 
6837
7417
  } else if ( !traditional && obj != null && typeof obj === "object" ) {
6838
- // If we see an array here, it is empty and should be treated as an empty
6839
- // object
6840
- if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {
6841
- add( prefix, "" );
6842
-
6843
7418
  // Serialize object item.
6844
- } else {
6845
- for ( var name in obj ) {
6846
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6847
- }
7419
+ for ( var name in obj ) {
7420
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6848
7421
  }
6849
7422
 
6850
7423
  } else {
@@ -7024,7 +7597,7 @@ function ajaxConvert( s, response ) {
7024
7597
 
7025
7598
 
7026
7599
  var jsc = jQuery.now(),
7027
- jsre = /(\=)\?(&|$)|()\?\?()/i;
7600
+ jsre = /(\=)\?(&|$)|\?\?/i;
7028
7601
 
7029
7602
  // Default jsonp settings
7030
7603
  jQuery.ajaxSetup({
@@ -7037,13 +7610,12 @@ jQuery.ajaxSetup({
7037
7610
  // Detect, normalize options and install callbacks for jsonp requests
7038
7611
  jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7039
7612
 
7040
- var dataIsString = ( typeof s.data === "string" );
7613
+ var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
7614
+ ( typeof s.data === "string" );
7041
7615
 
7042
7616
  if ( s.dataTypes[ 0 ] === "jsonp" ||
7043
- originalSettings.jsonpCallback ||
7044
- originalSettings.jsonp != null ||
7045
7617
  s.jsonp !== false && ( jsre.test( s.url ) ||
7046
- dataIsString && jsre.test( s.data ) ) ) {
7618
+ inspectData && jsre.test( s.data ) ) ) {
7047
7619
 
7048
7620
  var responseContainer,
7049
7621
  jsonpCallback = s.jsonpCallback =
@@ -7051,20 +7623,12 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7051
7623
  previous = window[ jsonpCallback ],
7052
7624
  url = s.url,
7053
7625
  data = s.data,
7054
- replace = "$1" + jsonpCallback + "$2",
7055
- cleanUp = function() {
7056
- // Set callback back to previous value
7057
- window[ jsonpCallback ] = previous;
7058
- // Call if it was a function and we have a response
7059
- if ( responseContainer && jQuery.isFunction( previous ) ) {
7060
- window[ jsonpCallback ]( responseContainer[ 0 ] );
7061
- }
7062
- };
7626
+ replace = "$1" + jsonpCallback + "$2";
7063
7627
 
7064
7628
  if ( s.jsonp !== false ) {
7065
7629
  url = url.replace( jsre, replace );
7066
7630
  if ( s.url === url ) {
7067
- if ( dataIsString ) {
7631
+ if ( inspectData ) {
7068
7632
  data = data.replace( jsre, replace );
7069
7633
  }
7070
7634
  if ( s.data === data ) {
@@ -7082,8 +7646,15 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7082
7646
  responseContainer = [ response ];
7083
7647
  };
7084
7648
 
7085
- // Install cleanUp function
7086
- jqXHR.then( cleanUp, cleanUp );
7649
+ // Clean-up function
7650
+ jqXHR.always(function() {
7651
+ // Set callback back to previous value
7652
+ window[ jsonpCallback ] = previous;
7653
+ // Call if it was a function and we have a response
7654
+ if ( responseContainer && jQuery.isFunction( previous ) ) {
7655
+ window[ jsonpCallback ]( responseContainer[ 0 ] );
7656
+ }
7657
+ });
7087
7658
 
7088
7659
  // Use data converter to retrieve json after script execution
7089
7660
  s.converters["script json"] = function() {
@@ -7099,7 +7670,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7099
7670
  // Delegate to script
7100
7671
  return "script";
7101
7672
  }
7102
- } );
7673
+ });
7103
7674
 
7104
7675
 
7105
7676
 
@@ -7129,7 +7700,7 @@ jQuery.ajaxPrefilter( "script", function( s ) {
7129
7700
  s.type = "GET";
7130
7701
  s.global = false;
7131
7702
  }
7132
- } );
7703
+ });
7133
7704
 
7134
7705
  // Bind script tag hack transport
7135
7706
  jQuery.ajaxTransport( "script", function(s) {
@@ -7157,7 +7728,7 @@ jQuery.ajaxTransport( "script", function(s) {
7157
7728
  // Attach handlers for all browsers
7158
7729
  script.onload = script.onreadystatechange = function( _, isAbort ) {
7159
7730
 
7160
- if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
7731
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
7161
7732
 
7162
7733
  // Handle memory leak in IE
7163
7734
  script.onload = script.onreadystatechange = null;
@@ -7188,27 +7759,20 @@ jQuery.ajaxTransport( "script", function(s) {
7188
7759
  }
7189
7760
  };
7190
7761
  }
7191
- } );
7192
-
7193
-
7762
+ });
7194
7763
 
7195
7764
 
7196
- var // #5280: next active xhr id and list of active xhrs' callbacks
7197
- xhrId = jQuery.now(),
7198
- xhrCallbacks,
7199
7765
 
7200
- // XHR used to determine supports properties
7201
- testXHR;
7202
7766
 
7203
- // #5280: Internet Explorer will keep connections alive if we don't abort on unload
7204
- function xhrOnUnloadAbort() {
7205
- jQuery( window ).unload(function() {
7767
+ var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
7768
+ xhrOnUnloadAbort = window.ActiveXObject ? function() {
7206
7769
  // Abort all pending requests
7207
7770
  for ( var key in xhrCallbacks ) {
7208
7771
  xhrCallbacks[ key ]( 0, 1 );
7209
7772
  }
7210
- });
7211
- }
7773
+ } : false,
7774
+ xhrId = 0,
7775
+ xhrCallbacks;
7212
7776
 
7213
7777
  // Functions to create xhrs
7214
7778
  function createStandardXHR() {
@@ -7238,15 +7802,13 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
7238
7802
  // For all other browsers, use the standard XMLHttpRequest object
7239
7803
  createStandardXHR;
7240
7804
 
7241
- // Test if we can create an xhr object
7242
- testXHR = jQuery.ajaxSettings.xhr();
7243
- jQuery.support.ajax = !!testXHR;
7244
-
7245
- // Does this browser support crossDomain XHR requests
7246
- jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
7247
-
7248
- // No need for the temporary xhr anymore
7249
- testXHR = undefined;
7805
+ // Determine support properties
7806
+ (function( xhr ) {
7807
+ jQuery.extend( jQuery.support, {
7808
+ ajax: !!xhr,
7809
+ cors: !!xhr && ( "withCredentials" in xhr )
7810
+ });
7811
+ })( jQuery.ajaxSettings.xhr() );
7250
7812
 
7251
7813
  // Create transport if the browser can provide an xhr
7252
7814
  if ( jQuery.support.ajax ) {
@@ -7285,11 +7847,12 @@ if ( jQuery.support.ajax ) {
7285
7847
  xhr.overrideMimeType( s.mimeType );
7286
7848
  }
7287
7849
 
7288
- // Requested-With header
7289
- // Not set for crossDomain requests with no content
7290
- // (see why at http://trac.dojotoolkit.org/ticket/9486)
7291
- // Won't change header if already provided
7292
- if ( !( s.crossDomain && !s.hasContent ) && !headers["X-Requested-With"] ) {
7850
+ // X-Requested-With header
7851
+ // For cross-domain requests, seeing as conditions for a preflight are
7852
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
7853
+ // (it can always be set on a per-request basis or even using ajaxSetup)
7854
+ // For same-domain requests, won't change header if already provided.
7855
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
7293
7856
  headers[ "X-Requested-With" ] = "XMLHttpRequest";
7294
7857
  }
7295
7858
 
@@ -7328,7 +7891,9 @@ if ( jQuery.support.ajax ) {
7328
7891
  // Do not keep as active anymore
7329
7892
  if ( handle ) {
7330
7893
  xhr.onreadystatechange = jQuery.noop;
7331
- delete xhrCallbacks[ handle ];
7894
+ if ( xhrOnUnloadAbort ) {
7895
+ delete xhrCallbacks[ handle ];
7896
+ }
7332
7897
  }
7333
7898
 
7334
7899
  // If it's an abort
@@ -7389,15 +7954,18 @@ if ( jQuery.support.ajax ) {
7389
7954
  if ( !s.async || xhr.readyState === 4 ) {
7390
7955
  callback();
7391
7956
  } else {
7392
- // Create the active xhrs callbacks list if needed
7393
- // and attach the unload handler
7394
- if ( !xhrCallbacks ) {
7395
- xhrCallbacks = {};
7396
- xhrOnUnloadAbort();
7957
+ handle = ++xhrId;
7958
+ if ( xhrOnUnloadAbort ) {
7959
+ // Create the active xhrs callbacks list if needed
7960
+ // and attach the unload handler
7961
+ if ( !xhrCallbacks ) {
7962
+ xhrCallbacks = {};
7963
+ jQuery( window ).unload( xhrOnUnloadAbort );
7964
+ }
7965
+ // Add to list of active xhrs callbacks
7966
+ xhrCallbacks[ handle ] = callback;
7397
7967
  }
7398
- // Add to list of active xhrs callbacks
7399
- handle = xhrId++;
7400
- xhr.onreadystatechange = xhrCallbacks[ handle ] = callback;
7968
+ xhr.onreadystatechange = callback;
7401
7969
  }
7402
7970
  },
7403
7971
 
@@ -7415,6 +7983,7 @@ if ( jQuery.support.ajax ) {
7415
7983
 
7416
7984
 
7417
7985
  var elemdisplay = {},
7986
+ iframe, iframeDoc,
7418
7987
  rfxtypes = /^(?:toggle|show|hide)$/,
7419
7988
  rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
7420
7989
  timerId,
@@ -7425,7 +7994,11 @@ var elemdisplay = {},
7425
7994
  [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
7426
7995
  // opacity animations
7427
7996
  [ "opacity" ]
7428
- ];
7997
+ ],
7998
+ fxNow,
7999
+ requestAnimationFrame = window.webkitRequestAnimationFrame ||
8000
+ window.mozRequestAnimationFrame ||
8001
+ window.oRequestAnimationFrame;
7429
8002
 
7430
8003
  jQuery.fn.extend({
7431
8004
  show: function( speed, easing, callback ) {
@@ -7437,19 +8010,22 @@ jQuery.fn.extend({
7437
8010
  } else {
7438
8011
  for ( var i = 0, j = this.length; i < j; i++ ) {
7439
8012
  elem = this[i];
7440
- display = elem.style.display;
7441
8013
 
7442
- // Reset the inline display of this element to learn if it is
7443
- // being hidden by cascaded rules or not
7444
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
7445
- display = elem.style.display = "";
7446
- }
8014
+ if ( elem.style ) {
8015
+ display = elem.style.display;
7447
8016
 
7448
- // Set elements which have been overridden with display: none
7449
- // in a stylesheet to whatever the default browser style is
7450
- // for such an element
7451
- if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
7452
- jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
8017
+ // Reset the inline display of this element to learn if it is
8018
+ // being hidden by cascaded rules or not
8019
+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
8020
+ display = elem.style.display = "";
8021
+ }
8022
+
8023
+ // Set elements which have been overridden with display: none
8024
+ // in a stylesheet to whatever the default browser style is
8025
+ // for such an element
8026
+ if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
8027
+ jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
8028
+ }
7453
8029
  }
7454
8030
  }
7455
8031
 
@@ -7457,10 +8033,13 @@ jQuery.fn.extend({
7457
8033
  // to avoid the constant reflow
7458
8034
  for ( i = 0; i < j; i++ ) {
7459
8035
  elem = this[i];
7460
- display = elem.style.display;
7461
8036
 
7462
- if ( display === "" || display === "none" ) {
7463
- elem.style.display = jQuery._data(elem, "olddisplay") || "";
8037
+ if ( elem.style ) {
8038
+ display = elem.style.display;
8039
+
8040
+ if ( display === "" || display === "none" ) {
8041
+ elem.style.display = jQuery._data(elem, "olddisplay") || "";
8042
+ }
7464
8043
  }
7465
8044
  }
7466
8045
 
@@ -7474,17 +8053,21 @@ jQuery.fn.extend({
7474
8053
 
7475
8054
  } else {
7476
8055
  for ( var i = 0, j = this.length; i < j; i++ ) {
7477
- var display = jQuery.css( this[i], "display" );
8056
+ if ( this[i].style ) {
8057
+ var display = jQuery.css( this[i], "display" );
7478
8058
 
7479
- if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
7480
- jQuery._data( this[i], "olddisplay", display );
8059
+ if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
8060
+ jQuery._data( this[i], "olddisplay", display );
8061
+ }
7481
8062
  }
7482
8063
  }
7483
8064
 
7484
8065
  // Set the display of the elements in a second loop
7485
8066
  // to avoid the constant reflow
7486
8067
  for ( i = 0; i < j; i++ ) {
7487
- this[i].style.display = "none";
8068
+ if ( this[i].style ) {
8069
+ this[i].style.display = "none";
8070
+ }
7488
8071
  }
7489
8072
 
7490
8073
  return this;
@@ -7522,32 +8105,54 @@ jQuery.fn.extend({
7522
8105
  var optall = jQuery.speed(speed, easing, callback);
7523
8106
 
7524
8107
  if ( jQuery.isEmptyObject( prop ) ) {
7525
- return this.each( optall.complete );
8108
+ return this.each( optall.complete, [ false ] );
7526
8109
  }
7527
8110
 
8111
+ // Do not change referenced properties as per-property easing will be lost
8112
+ prop = jQuery.extend( {}, prop );
8113
+
7528
8114
  return this[ optall.queue === false ? "each" : "queue" ](function() {
7529
8115
  // XXX 'this' does not always have a nodeName when running the
7530
8116
  // test suite
7531
8117
 
7532
- var opt = jQuery.extend({}, optall), p,
8118
+ if ( optall.queue === false ) {
8119
+ jQuery._mark( this );
8120
+ }
8121
+
8122
+ var opt = jQuery.extend( {}, optall ),
7533
8123
  isElement = this.nodeType === 1,
7534
8124
  hidden = isElement && jQuery(this).is(":hidden"),
7535
- self = this;
8125
+ name, val, p,
8126
+ display, e,
8127
+ parts, start, end, unit;
8128
+
8129
+ // will store per property easing and be used to determine when an animation is complete
8130
+ opt.animatedProperties = {};
7536
8131
 
7537
8132
  for ( p in prop ) {
7538
- var name = jQuery.camelCase( p );
7539
8133
 
8134
+ // property name normalization
8135
+ name = jQuery.camelCase( p );
7540
8136
  if ( p !== name ) {
7541
8137
  prop[ name ] = prop[ p ];
7542
8138
  delete prop[ p ];
7543
- p = name;
7544
8139
  }
7545
8140
 
7546
- if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
7547
- return opt.complete.call(this);
8141
+ val = prop[ name ];
8142
+
8143
+ // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
8144
+ if ( jQuery.isArray( val ) ) {
8145
+ opt.animatedProperties[ name ] = val[ 1 ];
8146
+ val = prop[ name ] = val[ 0 ];
8147
+ } else {
8148
+ opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
8149
+ }
8150
+
8151
+ if ( val === "hide" && hidden || val === "show" && !hidden ) {
8152
+ return opt.complete.call( this );
7548
8153
  }
7549
8154
 
7550
- if ( isElement && ( p === "height" || p === "width" ) ) {
8155
+ if ( isElement && ( name === "height" || name === "width" ) ) {
7551
8156
  // Make sure that nothing sneaks out
7552
8157
  // Record all 3 overflow attributes because IE does not
7553
8158
  // change the overflow attribute when overflowX and
@@ -7563,7 +8168,7 @@ jQuery.fn.extend({
7563
8168
  this.style.display = "inline-block";
7564
8169
 
7565
8170
  } else {
7566
- var display = defaultDisplay(this.nodeName);
8171
+ display = defaultDisplay( this.nodeName );
7567
8172
 
7568
8173
  // inline-level elements accept inline-block;
7569
8174
  // block-level elements need to be inline with layout
@@ -7577,44 +8182,37 @@ jQuery.fn.extend({
7577
8182
  }
7578
8183
  }
7579
8184
  }
7580
-
7581
- if ( jQuery.isArray( prop[p] ) ) {
7582
- // Create (if needed) and add to specialEasing
7583
- (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
7584
- prop[p] = prop[p][0];
7585
- }
7586
8185
  }
7587
8186
 
7588
8187
  if ( opt.overflow != null ) {
7589
8188
  this.style.overflow = "hidden";
7590
8189
  }
7591
8190
 
7592
- opt.curAnim = jQuery.extend({}, prop);
7593
-
7594
- jQuery.each( prop, function( name, val ) {
7595
- var e = new jQuery.fx( self, opt, name );
8191
+ for ( p in prop ) {
8192
+ e = new jQuery.fx( this, opt, p );
8193
+ val = prop[ p ];
7596
8194
 
7597
8195
  if ( rfxtypes.test(val) ) {
7598
- e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
8196
+ e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
7599
8197
 
7600
8198
  } else {
7601
- var parts = rfxnum.exec(val),
7602
- start = e.cur();
8199
+ parts = rfxnum.exec( val );
8200
+ start = e.cur();
7603
8201
 
7604
8202
  if ( parts ) {
7605
- var end = parseFloat( parts[2] ),
7606
- unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
8203
+ end = parseFloat( parts[2] );
8204
+ unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
7607
8205
 
7608
8206
  // We need to compute starting value
7609
8207
  if ( unit !== "px" ) {
7610
- jQuery.style( self, name, (end || 1) + unit);
8208
+ jQuery.style( this, p, (end || 1) + unit);
7611
8209
  start = ((end || 1) / e.cur()) * start;
7612
- jQuery.style( self, name, start + unit);
8210
+ jQuery.style( this, p, start + unit);
7613
8211
  }
7614
8212
 
7615
8213
  // If a +=/-= token was provided, we're doing a relative animation
7616
8214
  if ( parts[1] ) {
7617
- end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
8215
+ end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
7618
8216
  }
7619
8217
 
7620
8218
  e.custom( start, end, unit );
@@ -7623,7 +8221,7 @@ jQuery.fn.extend({
7623
8221
  e.custom( start, val, "" );
7624
8222
  }
7625
8223
  }
7626
- });
8224
+ }
7627
8225
 
7628
8226
  // For JS strict compliance
7629
8227
  return true;
@@ -7631,15 +8229,18 @@ jQuery.fn.extend({
7631
8229
  },
7632
8230
 
7633
8231
  stop: function( clearQueue, gotoEnd ) {
7634
- var timers = jQuery.timers;
7635
-
7636
8232
  if ( clearQueue ) {
7637
8233
  this.queue([]);
7638
8234
  }
7639
8235
 
7640
8236
  this.each(function() {
7641
- // go in reverse order so anything added to the queue during the loop is ignored
7642
- for ( var i = timers.length - 1; i >= 0; i-- ) {
8237
+ var timers = jQuery.timers,
8238
+ i = timers.length;
8239
+ // clear marker counters if we know they won't be
8240
+ if ( !gotoEnd ) {
8241
+ jQuery._unmark( true, this );
8242
+ }
8243
+ while ( i-- ) {
7643
8244
  if ( timers[i].elem === this ) {
7644
8245
  if (gotoEnd) {
7645
8246
  // force the next step to be the last
@@ -7661,6 +8262,17 @@ jQuery.fn.extend({
7661
8262
 
7662
8263
  });
7663
8264
 
8265
+ // Animations created synchronously will run synchronously
8266
+ function createFxNow() {
8267
+ setTimeout( clearFxNow, 0 );
8268
+ return ( fxNow = jQuery.now() );
8269
+ }
8270
+
8271
+ function clearFxNow() {
8272
+ fxNow = undefined;
8273
+ }
8274
+
8275
+ // Generate parameters to create a standard animation
7664
8276
  function genFx( type, num ) {
7665
8277
  var obj = {};
7666
8278
 
@@ -7699,13 +8311,16 @@ jQuery.extend({
7699
8311
 
7700
8312
  // Queueing
7701
8313
  opt.old = opt.complete;
7702
- opt.complete = function() {
7703
- if ( opt.queue !== false ) {
7704
- jQuery(this).dequeue();
7705
- }
8314
+ opt.complete = function( noUnmark ) {
7706
8315
  if ( jQuery.isFunction( opt.old ) ) {
7707
8316
  opt.old.call( this );
7708
8317
  }
8318
+
8319
+ if ( opt.queue !== false ) {
8320
+ jQuery.dequeue( this );
8321
+ } else if ( noUnmark !== false ) {
8322
+ jQuery._unmark( this );
8323
+ }
7709
8324
  };
7710
8325
 
7711
8326
  return opt;
@@ -7727,9 +8342,7 @@ jQuery.extend({
7727
8342
  this.elem = elem;
7728
8343
  this.prop = prop;
7729
8344
 
7730
- if ( !options.orig ) {
7731
- options.orig = {};
7732
- }
8345
+ options.orig = options.orig || {};
7733
8346
  }
7734
8347
 
7735
8348
  });
@@ -7761,9 +8374,10 @@ jQuery.fx.prototype = {
7761
8374
  // Start an animation from one number to another
7762
8375
  custom: function( from, to, unit ) {
7763
8376
  var self = this,
7764
- fx = jQuery.fx;
8377
+ fx = jQuery.fx,
8378
+ raf;
7765
8379
 
7766
- this.startTime = jQuery.now();
8380
+ this.startTime = fxNow || createFxNow();
7767
8381
  this.start = from;
7768
8382
  this.end = to;
7769
8383
  this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
@@ -7777,7 +8391,20 @@ jQuery.fx.prototype = {
7777
8391
  t.elem = this.elem;
7778
8392
 
7779
8393
  if ( t() && jQuery.timers.push(t) && !timerId ) {
7780
- timerId = setInterval(fx.tick, fx.interval);
8394
+ // Use requestAnimationFrame instead of setInterval if available
8395
+ if ( requestAnimationFrame ) {
8396
+ timerId = true;
8397
+ raf = function() {
8398
+ // When timerId gets set to null at any point, this stops
8399
+ if ( timerId ) {
8400
+ requestAnimationFrame( raf );
8401
+ fx.tick();
8402
+ }
8403
+ };
8404
+ requestAnimationFrame( raf );
8405
+ } else {
8406
+ timerId = setInterval( fx.tick, fx.interval );
8407
+ }
7781
8408
  }
7782
8409
  },
7783
8410
 
@@ -7808,60 +8435,64 @@ jQuery.fx.prototype = {
7808
8435
 
7809
8436
  // Each step of an animation
7810
8437
  step: function( gotoEnd ) {
7811
- var t = jQuery.now(), done = true;
8438
+ var t = fxNow || createFxNow(),
8439
+ done = true,
8440
+ elem = this.elem,
8441
+ options = this.options,
8442
+ i, n;
7812
8443
 
7813
- if ( gotoEnd || t >= this.options.duration + this.startTime ) {
8444
+ if ( gotoEnd || t >= options.duration + this.startTime ) {
7814
8445
  this.now = this.end;
7815
8446
  this.pos = this.state = 1;
7816
8447
  this.update();
7817
8448
 
7818
- this.options.curAnim[ this.prop ] = true;
8449
+ options.animatedProperties[ this.prop ] = true;
7819
8450
 
7820
- for ( var i in this.options.curAnim ) {
7821
- if ( this.options.curAnim[i] !== true ) {
8451
+ for ( i in options.animatedProperties ) {
8452
+ if ( options.animatedProperties[i] !== true ) {
7822
8453
  done = false;
7823
8454
  }
7824
8455
  }
7825
8456
 
7826
8457
  if ( done ) {
7827
8458
  // Reset the overflow
7828
- if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
7829
- var elem = this.elem,
7830
- options = this.options;
8459
+ if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
7831
8460
 
7832
8461
  jQuery.each( [ "", "X", "Y" ], function (index, value) {
7833
8462
  elem.style[ "overflow" + value ] = options.overflow[index];
7834
- } );
8463
+ });
7835
8464
  }
7836
8465
 
7837
8466
  // Hide the element if the "hide" operation was done
7838
- if ( this.options.hide ) {
7839
- jQuery(this.elem).hide();
8467
+ if ( options.hide ) {
8468
+ jQuery(elem).hide();
7840
8469
  }
7841
8470
 
7842
8471
  // Reset the properties, if the item has been hidden or shown
7843
- if ( this.options.hide || this.options.show ) {
7844
- for ( var p in this.options.curAnim ) {
7845
- jQuery.style( this.elem, p, this.options.orig[p] );
8472
+ if ( options.hide || options.show ) {
8473
+ for ( var p in options.animatedProperties ) {
8474
+ jQuery.style( elem, p, options.orig[p] );
7846
8475
  }
7847
8476
  }
7848
8477
 
7849
8478
  // Execute the complete function
7850
- this.options.complete.call( this.elem );
8479
+ options.complete.call( elem );
7851
8480
  }
7852
8481
 
7853
8482
  return false;
7854
8483
 
7855
8484
  } else {
7856
- var n = t - this.startTime;
7857
- this.state = n / this.options.duration;
7858
-
7859
- // Perform the easing function, defaults to swing
7860
- var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
7861
- var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
7862
- this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
7863
- this.now = this.start + ((this.end - this.start) * this.pos);
8485
+ // classical easing cannot be used with an Infinity duration
8486
+ if ( options.duration == Infinity ) {
8487
+ this.now = t;
8488
+ } else {
8489
+ n = t - this.startTime;
8490
+ this.state = n / options.duration;
7864
8491
 
8492
+ // Perform the easing function, defaults to swing
8493
+ this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
8494
+ this.now = this.start + ((this.end - this.start) * this.pos);
8495
+ }
7865
8496
  // Perform the next step of the animation
7866
8497
  this.update();
7867
8498
  }
@@ -7872,9 +8503,7 @@ jQuery.fx.prototype = {
7872
8503
 
7873
8504
  jQuery.extend( jQuery.fx, {
7874
8505
  tick: function() {
7875
- var timers = jQuery.timers;
7876
-
7877
- for ( var i = 0; i < timers.length; i++ ) {
8506
+ for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
7878
8507
  if ( !timers[i]() ) {
7879
8508
  timers.splice(i--, 1);
7880
8509
  }
@@ -7922,17 +8551,47 @@ if ( jQuery.expr && jQuery.expr.filters ) {
7922
8551
  };
7923
8552
  }
7924
8553
 
8554
+ // Try to restore the default display value of an element
7925
8555
  function defaultDisplay( nodeName ) {
8556
+
7926
8557
  if ( !elemdisplay[ nodeName ] ) {
7927
- var elem = jQuery("<" + nodeName + ">").appendTo("body"),
7928
- display = elem.css("display");
8558
+
8559
+ var body = document.body,
8560
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
8561
+ display = elem.css( "display" );
7929
8562
 
7930
8563
  elem.remove();
7931
8564
 
8565
+ // If the simple way fails,
8566
+ // get element's real default display by attaching it to a temp iframe
7932
8567
  if ( display === "none" || display === "" ) {
7933
- display = "block";
8568
+ // No iframe to use yet, so create it
8569
+ if ( !iframe ) {
8570
+ iframe = document.createElement( "iframe" );
8571
+ iframe.frameBorder = iframe.width = iframe.height = 0;
8572
+ }
8573
+
8574
+ body.appendChild( iframe );
8575
+
8576
+ // Create a cacheable copy of the iframe document on first call.
8577
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
8578
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
8579
+ if ( !iframeDoc || !iframe.createElement ) {
8580
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
8581
+ iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
8582
+ iframeDoc.close();
8583
+ }
8584
+
8585
+ elem = iframeDoc.createElement( nodeName );
8586
+
8587
+ iframeDoc.body.appendChild( elem );
8588
+
8589
+ display = jQuery.css( elem, "display" );
8590
+
8591
+ body.removeChild( iframe );
7934
8592
  }
7935
8593
 
8594
+ // Store the correct default display
7936
8595
  elemdisplay[ nodeName ] = display;
7937
8596
  }
7938
8597
 
@@ -7979,8 +8638,8 @@ if ( "getBoundingClientRect" in document.documentElement ) {
7979
8638
  win = getWindow(doc),
7980
8639
  clientTop = docElem.clientTop || body.clientTop || 0,
7981
8640
  clientLeft = docElem.clientLeft || body.clientLeft || 0,
7982
- scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
7983
- scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
8641
+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
8642
+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
7984
8643
  top = box.top + scrollTop - clientTop,
7985
8644
  left = box.left + scrollLeft - clientLeft;
7986
8645
 
@@ -8093,7 +8752,6 @@ jQuery.offset = {
8093
8752
  this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
8094
8753
 
8095
8754
  body.removeChild( container );
8096
- body = container = innerDiv = checkDiv = table = td = null;
8097
8755
  jQuery.offset.initialize = jQuery.noop;
8098
8756
  },
8099
8757
 
@@ -8123,17 +8781,19 @@ jQuery.offset = {
8123
8781
  curOffset = curElem.offset(),
8124
8782
  curCSSTop = jQuery.css( elem, "top" ),
8125
8783
  curCSSLeft = jQuery.css( elem, "left" ),
8126
- calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
8784
+ calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
8127
8785
  props = {}, curPosition = {}, curTop, curLeft;
8128
8786
 
8129
- // need to be able to calculate position if either top or left is auto and position is absolute
8787
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
8130
8788
  if ( calculatePosition ) {
8131
8789
  curPosition = curElem.position();
8790
+ curTop = curPosition.top;
8791
+ curLeft = curPosition.left;
8792
+ } else {
8793
+ curTop = parseFloat( curCSSTop ) || 0;
8794
+ curLeft = parseFloat( curCSSLeft ) || 0;
8132
8795
  }
8133
8796
 
8134
- curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
8135
- curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
8136
-
8137
8797
  if ( jQuery.isFunction( options ) ) {
8138
8798
  options = options.call( elem, i, curOffset );
8139
8799
  }
@@ -8202,29 +8862,16 @@ jQuery.fn.extend({
8202
8862
  jQuery.each( ["Left", "Top"], function( i, name ) {
8203
8863
  var method = "scroll" + name;
8204
8864
 
8205
- jQuery.fn[ method ] = function(val) {
8206
- var elem = this[0], win;
8207
-
8208
- if ( !elem ) {
8209
- return null;
8210
- }
8865
+ jQuery.fn[ method ] = function( val ) {
8866
+ var elem, win;
8211
8867
 
8212
- if ( val !== undefined ) {
8213
- // Set the scroll offset
8214
- return this.each(function() {
8215
- win = getWindow( this );
8868
+ if ( val === undefined ) {
8869
+ elem = this[ 0 ];
8216
8870
 
8217
- if ( win ) {
8218
- win.scrollTo(
8219
- !i ? val : jQuery(win).scrollLeft(),
8220
- i ? val : jQuery(win).scrollTop()
8221
- );
8871
+ if ( !elem ) {
8872
+ return null;
8873
+ }
8222
8874
 
8223
- } else {
8224
- this[ method ] = val;
8225
- }
8226
- });
8227
- } else {
8228
8875
  win = getWindow( elem );
8229
8876
 
8230
8877
  // Return the scroll offset
@@ -8233,6 +8880,21 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
8233
8880
  win.document.body[ method ] :
8234
8881
  elem[ method ];
8235
8882
  }
8883
+
8884
+ // Set the scroll offset
8885
+ return this.each(function() {
8886
+ win = getWindow( this );
8887
+
8888
+ if ( win ) {
8889
+ win.scrollTo(
8890
+ !i ? val : jQuery( win ).scrollLeft(),
8891
+ i ? val : jQuery( win ).scrollTop()
8892
+ );
8893
+
8894
+ } else {
8895
+ this[ method ] = val;
8896
+ }
8897
+ });
8236
8898
  };
8237
8899
  });
8238
8900
 
@@ -8247,22 +8909,24 @@ function getWindow( elem ) {
8247
8909
 
8248
8910
 
8249
8911
 
8250
- // Create innerHeight, innerWidth, outerHeight and outerWidth methods
8912
+ // Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
8251
8913
  jQuery.each([ "Height", "Width" ], function( i, name ) {
8252
8914
 
8253
8915
  var type = name.toLowerCase();
8254
8916
 
8255
8917
  // innerHeight and innerWidth
8256
- jQuery.fn["inner" + name] = function() {
8257
- return this[0] ?
8258
- parseFloat( jQuery.css( this[0], type, "padding" ) ) :
8918
+ jQuery.fn[ "inner" + name ] = function() {
8919
+ var elem = this[0];
8920
+ return elem && elem.style ?
8921
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
8259
8922
  null;
8260
8923
  };
8261
8924
 
8262
8925
  // outerHeight and outerWidth
8263
- jQuery.fn["outer" + name] = function( margin ) {
8264
- return this[0] ?
8265
- parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
8926
+ jQuery.fn[ "outer" + name ] = function( margin ) {
8927
+ var elem = this[0];
8928
+ return elem && elem.style ?
8929
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
8266
8930
  null;
8267
8931
  };
8268
8932
 
@@ -8312,5 +8976,6 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
8312
8976
  });
8313
8977
 
8314
8978
 
8979
+ // Expose jQuery to the global object
8315
8980
  window.jQuery = window.$ = jQuery;
8316
- })(window);
8981
+ })(window);