r105612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105611‎ | r105612 | r105613 >
Date:23:42, 8 December 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 32879) Upgrade jQuery to 1.7.1

Tests in qunit still pass fine
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.js (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -100,6 +100,7 @@
101101 * Added new debugging toolbar, enabled with $wgDebugToolbar
102102 * Differences in the history page now uses slightly better colors for people
103103 perceiving colors differently. Colors comes from the French Wikipedia.
 104+* (bug 32879) Upgrade jQuery to 1.7.1
104105
105106 === Bug fixes in 1.19 ===
106107 * $wgUploadNavigationUrl should be used for file redlinks if.
Index: trunk/phase3/resources/jquery/jquery.js
@@ -1,5 +1,5 @@
22 /*!
3 - * jQuery JavaScript Library v1.6.4
 3+ * jQuery JavaScript Library v1.7.1
44 * http://jquery.com/
55 *
66 * Copyright 2011, John Resig
@@ -11,7 +11,7 @@
1212 * Copyright 2011, The Dojo Foundation
1313 * Released under the MIT, BSD, and GPL Licenses.
1414 *
15 - * Date: Mon Sep 12 18:54:48 2011 -0400
 15+ * Date: Mon Nov 21 21:11:03 2011 -0500
1616 */
1717 (function( window, undefined ) {
1818
@@ -47,9 +47,6 @@
4848 trimLeft = /^\s+/,
4949 trimRight = /\s+$/,
5050
51 - // Check for digits
52 - rdigit = /\d/,
53 -
5451 // Match a standalone tag
5552 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
5653
@@ -140,7 +137,7 @@
141138 // HANDLE: $(html) -> $(array)
142139 if ( match[1] ) {
143140 context = context instanceof jQuery ? context[0] : context;
144 - doc = (context ? context.ownerDocument || context : document);
 141+ doc = ( context ? context.ownerDocument || context : document );
145142
146143 // If a single string is passed in and it's a single tag
147144 // just do a createElement and skip the rest
@@ -157,7 +154,7 @@
158155
159156 } else {
160157 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
161 - selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
 158+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
162159 }
163160
164161 return jQuery.merge( this, selector );
@@ -187,7 +184,7 @@
188185
189186 // HANDLE: $(expr, $(...))
190187 } else if ( !context || context.jquery ) {
191 - return (context || rootjQuery).find( selector );
 188+ return ( context || rootjQuery ).find( selector );
192189
193190 // HANDLE: $(expr, context)
194191 // (which is just equivalent to: $(context).find(expr)
@@ -201,7 +198,7 @@
202199 return rootjQuery.ready( selector );
203200 }
204201
205 - if (selector.selector !== undefined) {
 202+ if ( selector.selector !== undefined ) {
206203 this.selector = selector.selector;
207204 this.context = selector.context;
208205 }
@@ -213,7 +210,7 @@
214211 selector: "",
215212
216213 // The current version of jQuery being used
217 - jquery: "1.6.4",
 214+ jquery: "1.7.1",
218215
219216 // The default length of a jQuery object is 0
220217 length: 0,
@@ -258,7 +255,7 @@
259256 ret.context = this.context;
260257
261258 if ( name === "find" ) {
262 - ret.selector = this.selector + (this.selector ? " " : "") + selector;
 259+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
263260 } else if ( name ) {
264261 ret.selector = this.selector + "." + name + "(" + selector + ")";
265262 }
@@ -279,15 +276,16 @@
280277 jQuery.bindReady();
281278
282279 // Add the callback
283 - readyList.done( fn );
 280+ readyList.add( fn );
284281
285282 return this;
286283 },
287284
288285 eq: function( i ) {
 286+ i = +i;
289287 return i === -1 ?
290288 this.slice( i ) :
291 - this.slice( i, +i + 1 );
 289+ this.slice( i, i + 1 );
292290 },
293291
294292 first: function() {
@@ -434,11 +432,11 @@
435433 }
436434
437435 // If there are functions bound, to execute
438 - readyList.resolveWith( document, [ jQuery ] );
 436+ readyList.fireWith( document, [ jQuery ] );
439437
440438 // Trigger any bound ready events
441439 if ( jQuery.fn.trigger ) {
442 - jQuery( document ).trigger( "ready" ).unbind( "ready" );
 440+ jQuery( document ).trigger( "ready" ).off( "ready" );
443441 }
444442 }
445443 },
@@ -448,7 +446,7 @@
449447 return;
450448 }
451449
452 - readyList = jQuery._Deferred();
 450+ readyList = jQuery.Callbacks( "once memory" );
453451
454452 // Catch cases where $(document).ready() is called after the
455453 // browser event has already occurred.
@@ -504,8 +502,8 @@
505503 return obj && typeof obj === "object" && "setInterval" in obj;
506504 },
507505
508 - isNaN: function( obj ) {
509 - return obj == null || !rdigit.test( obj ) || isNaN( obj );
 506+ isNumeric: function( obj ) {
 507+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
510508 },
511509
512510 type: function( obj ) {
@@ -551,7 +549,7 @@
552550 },
553551
554552 error: function( msg ) {
555 - throw msg;
 553+ throw new Error( msg );
556554 },
557555
558556 parseJSON: function( data ) {
@@ -573,7 +571,7 @@
574572 .replace( rvalidtokens, "]" )
575573 .replace( rvalidbraces, "")) ) {
576574
577 - return (new Function( "return " + data ))();
 575+ return ( new Function( "return " + data ) )();
578576
579577 }
580578 jQuery.error( "Invalid JSON: " + data );
@@ -688,8 +686,6 @@
689687
690688 if ( array != null ) {
691689 // The window, strings (and functions) also have 'length'
692 - // The extra typeof function check is to prevent crashes
693 - // in Safari 2 (See: #3039)
694690 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
695691 var type = jQuery.type( array );
696692
@@ -703,18 +699,22 @@
704700 return ret;
705701 },
706702
707 - inArray: function( elem, array ) {
708 - if ( !array ) {
709 - return -1;
710 - }
 703+ inArray: function( elem, array, i ) {
 704+ var len;
711705
712 - if ( indexOf ) {
713 - return indexOf.call( array, elem );
714 - }
 706+ if ( array ) {
 707+ if ( indexOf ) {
 708+ return indexOf.call( array, elem, i );
 709+ }
715710
716 - for ( var i = 0, length = array.length; i < length; i++ ) {
717 - if ( array[ i ] === elem ) {
718 - return i;
 711+ len = array.length;
 712+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
 713+
 714+ for ( ; i < len; i++ ) {
 715+ // Skip accessing in sparse arrays
 716+ if ( i in array && array[ i ] === elem ) {
 717+ return i;
 718+ }
719719 }
720720 }
721721
@@ -850,7 +850,7 @@
851851 },
852852
853853 now: function() {
854 - return (new Date()).getTime();
 854+ return ( new Date() ).getTime();
855855 },
856856
857857 // Use of jQuery.browser is frowned upon.
@@ -957,188 +957,360 @@
958958 })();
959959
960960
961 -var // Promise methods
962 - promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
963 - // Static reference to slice
964 - sliceDeferred = [].slice;
 961+// String to Object flags format cache
 962+var flagsCache = {};
965963
966 -jQuery.extend({
967 - // Create a simple deferred (one callbacks list)
968 - _Deferred: function() {
969 - var // callbacks list
970 - callbacks = [],
971 - // stored [ context , args ]
972 - fired,
973 - // to avoid firing when already doing so
974 - firing,
975 - // flag to know if the deferred has been cancelled
976 - cancelled,
977 - // the deferred itself
978 - deferred = {
 964+// Convert String-formatted flags into Object-formatted ones and store in cache
 965+function createFlags( flags ) {
 966+ var object = flagsCache[ flags ] = {},
 967+ i, length;
 968+ flags = flags.split( /\s+/ );
 969+ for ( i = 0, length = flags.length; i < length; i++ ) {
 970+ object[ flags[i] ] = true;
 971+ }
 972+ return object;
 973+}
979974
980 - // done( f1, f2, ...)
981 - done: function() {
982 - if ( !cancelled ) {
983 - var args = arguments,
984 - i,
985 - length,
986 - elem,
987 - type,
988 - _fired;
989 - if ( fired ) {
990 - _fired = fired;
991 - fired = 0;
992 - }
993 - for ( i = 0, length = args.length; i < length; i++ ) {
994 - elem = args[ i ];
995 - type = jQuery.type( elem );
996 - if ( type === "array" ) {
997 - deferred.done.apply( deferred, elem );
998 - } else if ( type === "function" ) {
999 - callbacks.push( elem );
 975+/*
 976+ * Create a callback list using the following parameters:
 977+ *
 978+ * flags: an optional list of space-separated flags that will change how
 979+ * the callback list behaves
 980+ *
 981+ * By default a callback list will act like an event callback list and can be
 982+ * "fired" multiple times.
 983+ *
 984+ * Possible flags:
 985+ *
 986+ * once: will ensure the callback list can only be fired once (like a Deferred)
 987+ *
 988+ * memory: will keep track of previous values and will call any callback added
 989+ * after the list has been fired right away with the latest "memorized"
 990+ * values (like a Deferred)
 991+ *
 992+ * unique: will ensure a callback can only be added once (no duplicate in the list)
 993+ *
 994+ * stopOnFalse: interrupt callings when a callback returns false
 995+ *
 996+ */
 997+jQuery.Callbacks = function( flags ) {
 998+
 999+ // Convert flags from String-formatted to Object-formatted
 1000+ // (we check in cache first)
 1001+ flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
 1002+
 1003+ var // Actual callback list
 1004+ list = [],
 1005+ // Stack of fire calls for repeatable lists
 1006+ stack = [],
 1007+ // Last fire value (for non-forgettable lists)
 1008+ memory,
 1009+ // Flag to know if list is currently firing
 1010+ firing,
 1011+ // First callback to fire (used internally by add and fireWith)
 1012+ firingStart,
 1013+ // End of the loop when firing
 1014+ firingLength,
 1015+ // Index of currently firing callback (modified by remove if needed)
 1016+ firingIndex,
 1017+ // Add one or several callbacks to the list
 1018+ add = function( args ) {
 1019+ var i,
 1020+ length,
 1021+ elem,
 1022+ type,
 1023+ actual;
 1024+ for ( i = 0, length = args.length; i < length; i++ ) {
 1025+ elem = args[ i ];
 1026+ type = jQuery.type( elem );
 1027+ if ( type === "array" ) {
 1028+ // Inspect recursively
 1029+ add( elem );
 1030+ } else if ( type === "function" ) {
 1031+ // Add if not in unique mode and callback is not in
 1032+ if ( !flags.unique || !self.has( elem ) ) {
 1033+ list.push( elem );
 1034+ }
 1035+ }
 1036+ }
 1037+ },
 1038+ // Fire callbacks
 1039+ fire = function( context, args ) {
 1040+ args = args || [];
 1041+ memory = !flags.memory || [ context, args ];
 1042+ firing = true;
 1043+ firingIndex = firingStart || 0;
 1044+ firingStart = 0;
 1045+ firingLength = list.length;
 1046+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
 1047+ if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
 1048+ memory = true; // Mark as halted
 1049+ break;
 1050+ }
 1051+ }
 1052+ firing = false;
 1053+ if ( list ) {
 1054+ if ( !flags.once ) {
 1055+ if ( stack && stack.length ) {
 1056+ memory = stack.shift();
 1057+ self.fireWith( memory[ 0 ], memory[ 1 ] );
 1058+ }
 1059+ } else if ( memory === true ) {
 1060+ self.disable();
 1061+ } else {
 1062+ list = [];
 1063+ }
 1064+ }
 1065+ },
 1066+ // Actual Callbacks object
 1067+ self = {
 1068+ // Add a callback or a collection of callbacks to the list
 1069+ add: function() {
 1070+ if ( list ) {
 1071+ var length = list.length;
 1072+ add( arguments );
 1073+ // Do we need to add the callbacks to the
 1074+ // current firing batch?
 1075+ if ( firing ) {
 1076+ firingLength = list.length;
 1077+ // With memory, if we're not firing then
 1078+ // we should call right away, unless previous
 1079+ // firing was halted (stopOnFalse)
 1080+ } else if ( memory && memory !== true ) {
 1081+ firingStart = length;
 1082+ fire( memory[ 0 ], memory[ 1 ] );
 1083+ }
 1084+ }
 1085+ return this;
 1086+ },
 1087+ // Remove a callback from the list
 1088+ remove: function() {
 1089+ if ( list ) {
 1090+ var args = arguments,
 1091+ argIndex = 0,
 1092+ argLength = args.length;
 1093+ for ( ; argIndex < argLength ; argIndex++ ) {
 1094+ for ( var i = 0; i < list.length; i++ ) {
 1095+ if ( args[ argIndex ] === list[ i ] ) {
 1096+ // Handle firingIndex and firingLength
 1097+ if ( firing ) {
 1098+ if ( i <= firingLength ) {
 1099+ firingLength--;
 1100+ if ( i <= firingIndex ) {
 1101+ firingIndex--;
 1102+ }
 1103+ }
 1104+ }
 1105+ // Remove the element
 1106+ list.splice( i--, 1 );
 1107+ // If we have some unicity property then
 1108+ // we only need to do this once
 1109+ if ( flags.unique ) {
 1110+ break;
 1111+ }
10001112 }
10011113 }
1002 - if ( _fired ) {
1003 - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
 1114+ }
 1115+ }
 1116+ return this;
 1117+ },
 1118+ // Control if a given callback is in the list
 1119+ has: function( fn ) {
 1120+ if ( list ) {
 1121+ var i = 0,
 1122+ length = list.length;
 1123+ for ( ; i < length; i++ ) {
 1124+ if ( fn === list[ i ] ) {
 1125+ return true;
10041126 }
10051127 }
1006 - return this;
1007 - },
1008 -
1009 - // resolve with given context and args
1010 - resolveWith: function( context, args ) {
1011 - if ( !cancelled && !fired && !firing ) {
1012 - // make sure args are available (#8421)
1013 - args = args || [];
1014 - firing = 1;
1015 - try {
1016 - while( callbacks[ 0 ] ) {
1017 - callbacks.shift().apply( context, args );
1018 - }
 1128+ }
 1129+ return false;
 1130+ },
 1131+ // Remove all callbacks from the list
 1132+ empty: function() {
 1133+ list = [];
 1134+ return this;
 1135+ },
 1136+ // Have the list do nothing anymore
 1137+ disable: function() {
 1138+ list = stack = memory = undefined;
 1139+ return this;
 1140+ },
 1141+ // Is it disabled?
 1142+ disabled: function() {
 1143+ return !list;
 1144+ },
 1145+ // Lock the list in its current state
 1146+ lock: function() {
 1147+ stack = undefined;
 1148+ if ( !memory || memory === true ) {
 1149+ self.disable();
 1150+ }
 1151+ return this;
 1152+ },
 1153+ // Is it locked?
 1154+ locked: function() {
 1155+ return !stack;
 1156+ },
 1157+ // Call all callbacks with the given context and arguments
 1158+ fireWith: function( context, args ) {
 1159+ if ( stack ) {
 1160+ if ( firing ) {
 1161+ if ( !flags.once ) {
 1162+ stack.push( [ context, args ] );
10191163 }
1020 - finally {
1021 - fired = [ context, args ];
1022 - firing = 0;
1023 - }
 1164+ } else if ( !( flags.once && memory ) ) {
 1165+ fire( context, args );
10241166 }
1025 - return this;
1026 - },
 1167+ }
 1168+ return this;
 1169+ },
 1170+ // Call all the callbacks with the given arguments
 1171+ fire: function() {
 1172+ self.fireWith( this, arguments );
 1173+ return this;
 1174+ },
 1175+ // To know if the callbacks have already been called at least once
 1176+ fired: function() {
 1177+ return !!memory;
 1178+ }
 1179+ };
10271180
1028 - // resolve with this as context and given arguments
1029 - resolve: function() {
1030 - deferred.resolveWith( this, arguments );
1031 - return this;
1032 - },
 1181+ return self;
 1182+};
10331183
1034 - // Has this deferred been resolved?
1035 - isResolved: function() {
1036 - return !!( firing || fired );
1037 - },
10381184
1039 - // Cancel
1040 - cancel: function() {
1041 - cancelled = 1;
1042 - callbacks = [];
1043 - return this;
1044 - }
1045 - };
10461185
1047 - return deferred;
1048 - },
10491186
1050 - // Full fledged deferred (two callbacks list)
 1187+var // Static reference to slice
 1188+ sliceDeferred = [].slice;
 1189+
 1190+jQuery.extend({
 1191+
10511192 Deferred: function( func ) {
1052 - var deferred = jQuery._Deferred(),
1053 - failDeferred = jQuery._Deferred(),
1054 - promise;
1055 - // Add errorDeferred methods, then and promise
1056 - jQuery.extend( deferred, {
1057 - then: function( doneCallbacks, failCallbacks ) {
1058 - deferred.done( doneCallbacks ).fail( failCallbacks );
1059 - return this;
 1193+ var doneList = jQuery.Callbacks( "once memory" ),
 1194+ failList = jQuery.Callbacks( "once memory" ),
 1195+ progressList = jQuery.Callbacks( "memory" ),
 1196+ state = "pending",
 1197+ lists = {
 1198+ resolve: doneList,
 1199+ reject: failList,
 1200+ notify: progressList
10601201 },
1061 - always: function() {
1062 - return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
1063 - },
1064 - fail: failDeferred.done,
1065 - rejectWith: failDeferred.resolveWith,
1066 - reject: failDeferred.resolve,
1067 - isRejected: failDeferred.isResolved,
1068 - pipe: function( fnDone, fnFail ) {
1069 - return jQuery.Deferred(function( newDefer ) {
1070 - jQuery.each( {
1071 - done: [ fnDone, "resolve" ],
1072 - fail: [ fnFail, "reject" ]
1073 - }, function( handler, data ) {
1074 - var fn = data[ 0 ],
1075 - action = data[ 1 ],
1076 - returned;
1077 - if ( jQuery.isFunction( fn ) ) {
1078 - deferred[ handler ](function() {
1079 - returned = fn.apply( this, arguments );
1080 - if ( returned && jQuery.isFunction( returned.promise ) ) {
1081 - returned.promise().then( newDefer.resolve, newDefer.reject );
1082 - } else {
1083 - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
1084 - }
1085 - });
1086 - } else {
1087 - deferred[ handler ]( newDefer[ action ] );
 1202+ promise = {
 1203+ done: doneList.add,
 1204+ fail: failList.add,
 1205+ progress: progressList.add,
 1206+
 1207+ state: function() {
 1208+ return state;
 1209+ },
 1210+
 1211+ // Deprecated
 1212+ isResolved: doneList.fired,
 1213+ isRejected: failList.fired,
 1214+
 1215+ then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
 1216+ deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
 1217+ return this;
 1218+ },
 1219+ always: function() {
 1220+ deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
 1221+ return this;
 1222+ },
 1223+ pipe: function( fnDone, fnFail, fnProgress ) {
 1224+ return jQuery.Deferred(function( newDefer ) {
 1225+ jQuery.each( {
 1226+ done: [ fnDone, "resolve" ],
 1227+ fail: [ fnFail, "reject" ],
 1228+ progress: [ fnProgress, "notify" ]
 1229+ }, function( handler, data ) {
 1230+ var fn = data[ 0 ],
 1231+ action = data[ 1 ],
 1232+ returned;
 1233+ if ( jQuery.isFunction( fn ) ) {
 1234+ deferred[ handler ](function() {
 1235+ returned = fn.apply( this, arguments );
 1236+ if ( returned && jQuery.isFunction( returned.promise ) ) {
 1237+ returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
 1238+ } else {
 1239+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
 1240+ }
 1241+ });
 1242+ } else {
 1243+ deferred[ handler ]( newDefer[ action ] );
 1244+ }
 1245+ });
 1246+ }).promise();
 1247+ },
 1248+ // Get a promise for this deferred
 1249+ // If obj is provided, the promise aspect is added to the object
 1250+ promise: function( obj ) {
 1251+ if ( obj == null ) {
 1252+ obj = promise;
 1253+ } else {
 1254+ for ( var key in promise ) {
 1255+ obj[ key ] = promise[ key ];
10881256 }
1089 - });
1090 - }).promise();
1091 - },
1092 - // Get a promise for this deferred
1093 - // If obj is provided, the promise aspect is added to the object
1094 - promise: function( obj ) {
1095 - if ( obj == null ) {
1096 - if ( promise ) {
1097 - return promise;
10981257 }
1099 - promise = obj = {};
 1258+ return obj;
11001259 }
1101 - var i = promiseMethods.length;
1102 - while( i-- ) {
1103 - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
1104 - }
1105 - return obj;
1106 - }
1107 - });
1108 - // Make sure only one callback list will be used
1109 - deferred.done( failDeferred.cancel ).fail( deferred.cancel );
1110 - // Unexpose cancel
1111 - delete deferred.cancel;
 1260+ },
 1261+ deferred = promise.promise({}),
 1262+ key;
 1263+
 1264+ for ( key in lists ) {
 1265+ deferred[ key ] = lists[ key ].fire;
 1266+ deferred[ key + "With" ] = lists[ key ].fireWith;
 1267+ }
 1268+
 1269+ // Handle state
 1270+ deferred.done( function() {
 1271+ state = "resolved";
 1272+ }, failList.disable, progressList.lock ).fail( function() {
 1273+ state = "rejected";
 1274+ }, doneList.disable, progressList.lock );
 1275+
11121276 // Call given func if any
11131277 if ( func ) {
11141278 func.call( deferred, deferred );
11151279 }
 1280+
 1281+ // All done!
11161282 return deferred;
11171283 },
11181284
11191285 // Deferred helper
11201286 when: function( firstParam ) {
1121 - var args = arguments,
 1287+ var args = sliceDeferred.call( arguments, 0 ),
11221288 i = 0,
11231289 length = args.length,
 1290+ pValues = new Array( length ),
11241291 count = length,
 1292+ pCount = length,
11251293 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
11261294 firstParam :
1127 - jQuery.Deferred();
 1295+ jQuery.Deferred(),
 1296+ promise = deferred.promise();
11281297 function resolveFunc( i ) {
11291298 return function( value ) {
11301299 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
11311300 if ( !( --count ) ) {
1132 - // Strange bug in FF4:
1133 - // Values changed onto the arguments object sometimes end up as undefined values
1134 - // outside the $.when method. Cloning the object into a fresh array solves the issue
1135 - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
 1301+ deferred.resolveWith( deferred, args );
11361302 }
11371303 };
11381304 }
 1305+ function progressFunc( i ) {
 1306+ return function( value ) {
 1307+ pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
 1308+ deferred.notifyWith( promise, pValues );
 1309+ };
 1310+ }
11391311 if ( length > 1 ) {
1140 - for( ; i < length; i++ ) {
1141 - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
1142 - args[ i ].promise().then( resolveFunc(i), deferred.reject );
 1312+ for ( ; i < length; i++ ) {
 1313+ if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
 1314+ args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
11431315 } else {
11441316 --count;
11451317 }
@@ -1149,39 +1321,35 @@
11501322 } else if ( deferred !== firstParam ) {
11511323 deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
11521324 }
1153 - return deferred.promise();
 1325+ return promise;
11541326 }
11551327 });
11561328
11571329
11581330
 1331+
11591332 jQuery.support = (function() {
11601333
1161 - var div = document.createElement( "div" ),
1162 - documentElement = document.documentElement,
 1334+ var support,
11631335 all,
11641336 a,
11651337 select,
11661338 opt,
11671339 input,
11681340 marginDiv,
1169 - support,
11701341 fragment,
1171 - body,
1172 - testElementParent,
1173 - testElement,
1174 - testElementStyle,
11751342 tds,
11761343 events,
11771344 eventName,
11781345 i,
1179 - isSupported;
 1346+ isSupported,
 1347+ div = document.createElement( "div" ),
 1348+ documentElement = document.documentElement;
11801349
11811350 // Preliminary tests
11821351 div.setAttribute("className", "t");
11831352 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
11841353
1185 -
11861354 all = div.getElementsByTagName( "*" );
11871355 a = div.getElementsByTagName( "a" )[ 0 ];
11881356
@@ -1201,11 +1369,11 @@
12021370
12031371 // Make sure that tbody elements aren't automatically inserted
12041372 // IE will insert them into empty tables
1205 - tbody: !div.getElementsByTagName( "tbody" ).length,
 1373+ tbody: !div.getElementsByTagName("tbody").length,
12061374
12071375 // Make sure that link elements get serialized correctly by innerHTML
12081376 // This requires a wrapper element in IE
1209 - htmlSerialize: !!div.getElementsByTagName( "link" ).length,
 1377+ htmlSerialize: !!div.getElementsByTagName("link").length,
12101378
12111379 // Get the style information from getAttribute
12121380 // (IE uses .cssText instead)
@@ -1213,12 +1381,12 @@
12141382
12151383 // Make sure that URLs aren't manipulated
12161384 // (IE normalizes it by default)
1217 - hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
 1385+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
12181386
12191387 // Make sure that element opacity exists
12201388 // (IE uses filter instead)
12211389 // Use a regex to work around a WebKit issue. See #5145
1222 - opacity: /^0.55$/.test( a.style.opacity ),
 1390+ opacity: /^0.55/.test( a.style.opacity ),
12231391
12241392 // Verify style float existence
12251393 // (IE uses styleFloat instead of cssFloat)
@@ -1236,6 +1404,13 @@
12371405 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
12381406 getSetAttribute: div.className !== "t",
12391407
 1408+ // Tests for enctype support on a form(#6743)
 1409+ enctype: !!document.createElement("form").enctype,
 1410+
 1411+ // Makes sure cloning an html5 element does not cause problems
 1412+ // Where outerHTML is undefined, this still works
 1413+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
 1414+
12401415 // Will be defined later
12411416 submitBubbles: true,
12421417 changeBubbles: true,
@@ -1273,7 +1448,7 @@
12741449 div.cloneNode( true ).fireEvent( "onclick" );
12751450 }
12761451
1277 - // Check if a radio maintains it's value
 1452+ // Check if a radio maintains its value
12781453 // after being appended to the DOM
12791454 input = document.createElement("input");
12801455 input.value = "t";
@@ -1283,82 +1458,18 @@
12841459 input.setAttribute("checked", "checked");
12851460 div.appendChild( input );
12861461 fragment = document.createDocumentFragment();
1287 - fragment.appendChild( div.firstChild );
 1462+ fragment.appendChild( div.lastChild );
12881463
12891464 // WebKit doesn't clone checked state correctly in fragments
12901465 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
12911466
1292 - div.innerHTML = "";
1293 -
1294 - // Figure out if the W3C box model works as expected
1295 - div.style.width = div.style.paddingLeft = "1px";
1296 -
1297 - body = document.getElementsByTagName( "body" )[ 0 ];
1298 - // We use our own, invisible, body unless the body is already present
1299 - // in which case we use a div (#9239)
1300 - testElement = document.createElement( body ? "div" : "body" );
1301 - testElementStyle = {
1302 - visibility: "hidden",
1303 - width: 0,
1304 - height: 0,
1305 - border: 0,
1306 - margin: 0,
1307 - background: "none"
1308 - };
1309 - if ( body ) {
1310 - jQuery.extend( testElementStyle, {
1311 - position: "absolute",
1312 - left: "-1000px",
1313 - top: "-1000px"
1314 - });
1315 - }
1316 - for ( i in testElementStyle ) {
1317 - testElement.style[ i ] = testElementStyle[ i ];
1318 - }
1319 - testElement.appendChild( div );
1320 - testElementParent = body || documentElement;
1321 - testElementParent.insertBefore( testElement, testElementParent.firstChild );
1322 -
13231467 // Check if a disconnected checkbox will retain its checked
13241468 // value of true after appended to the DOM (IE6/7)
13251469 support.appendChecked = input.checked;
13261470
1327 - support.boxModel = div.offsetWidth === 2;
 1471+ fragment.removeChild( input );
 1472+ fragment.appendChild( div );
13281473
1329 - if ( "zoom" in div.style ) {
1330 - // Check if natively block-level elements act like inline-block
1331 - // elements when setting their display to 'inline' and giving
1332 - // them layout
1333 - // (IE < 8 does this)
1334 - div.style.display = "inline";
1335 - div.style.zoom = 1;
1336 - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
1337 -
1338 - // Check if elements with layout shrink-wrap their children
1339 - // (IE 6 does this)
1340 - div.style.display = "";
1341 - div.innerHTML = "<div style='width:4px;'></div>";
1342 - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
1343 - }
1344 -
1345 - div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1346 - tds = div.getElementsByTagName( "td" );
1347 -
1348 - // Check if table cells still have offsetWidth/Height when they are set
1349 - // to display:none and there are still other visible table cells in a
1350 - // table row; if so, offsetWidth/Height are not reliable for use when
1351 - // determining if an element has been hidden directly using
1352 - // display:none (it is still safe to use offsets if a parent element is
1353 - // hidden; don safety goggles and see bug #4512 for more information).
1354 - // (only IE 8 fails this test)
1355 - isSupported = ( tds[ 0 ].offsetHeight === 0 );
1356 -
1357 - tds[ 0 ].style.display = "";
1358 - tds[ 1 ].style.display = "none";
1359 -
1360 - // Check if empty table cells still have offsetWidth/Height
1361 - // (IE < 8 fail this test)
1362 - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
13631474 div.innerHTML = "";
13641475
13651476 // Check if div with explicit width and no margin-right incorrectly
@@ -1366,21 +1477,18 @@
13671478 // info see bug #3333
13681479 // Fails in WebKit before Feb 2011 nightlies
13691480 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1370 - if ( document.defaultView && document.defaultView.getComputedStyle ) {
 1481+ if ( window.getComputedStyle ) {
13711482 marginDiv = document.createElement( "div" );
13721483 marginDiv.style.width = "0";
13731484 marginDiv.style.marginRight = "0";
 1485+ div.style.width = "2px";
13741486 div.appendChild( marginDiv );
13751487 support.reliableMarginRight =
1376 - ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
 1488+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
13771489 }
13781490
1379 - // Remove the body element we added
1380 - testElement.innerHTML = "";
1381 - testElementParent.removeChild( testElement );
1382 -
13831491 // Technique from Juriy Zaytsev
1384 - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
 1492+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
13851493 // We only care about the case where non-standard event systems
13861494 // are used, namely in IE. Short-circuiting here helps us to
13871495 // avoid an eval call (in setAttribute) which can cause CSP
@@ -1390,7 +1498,7 @@
13911499 submit: 1,
13921500 change: 1,
13931501 focusin: 1
1394 - } ) {
 1502+ }) {
13951503 eventName = "on" + i;
13961504 isSupported = ( eventName in div );
13971505 if ( !isSupported ) {
@@ -1401,18 +1509,114 @@
14021510 }
14031511 }
14041512
1405 - // Null connected elements to avoid leaks in IE
1406 - testElement = fragment = select = opt = body = marginDiv = div = input = null;
 1513+ fragment.removeChild( div );
14071514
 1515+ // Null elements to avoid leaks in IE
 1516+ fragment = select = opt = marginDiv = div = input = null;
 1517+
 1518+ // Run tests that need a body at doc ready
 1519+ jQuery(function() {
 1520+ var container, outer, inner, table, td, offsetSupport,
 1521+ conMarginTop, ptlm, vb, style, html,
 1522+ body = document.getElementsByTagName("body")[0];
 1523+
 1524+ if ( !body ) {
 1525+ // Return for frameset docs that don't have a body
 1526+ return;
 1527+ }
 1528+
 1529+ conMarginTop = 1;
 1530+ ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
 1531+ vb = "visibility:hidden;border:0;";
 1532+ style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
 1533+ html = "<div " + style + "><div></div></div>" +
 1534+ "<table " + style + " cellpadding='0' cellspacing='0'>" +
 1535+ "<tr><td></td></tr></table>";
 1536+
 1537+ container = document.createElement("div");
 1538+ container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
 1539+ body.insertBefore( container, body.firstChild );
 1540+
 1541+ // Construct the test element
 1542+ div = document.createElement("div");
 1543+ container.appendChild( div );
 1544+
 1545+ // Check if table cells still have offsetWidth/Height when they are set
 1546+ // to display:none and there are still other visible table cells in a
 1547+ // table row; if so, offsetWidth/Height are not reliable for use when
 1548+ // determining if an element has been hidden directly using
 1549+ // display:none (it is still safe to use offsets if a parent element is
 1550+ // hidden; don safety goggles and see bug #4512 for more information).
 1551+ // (only IE 8 fails this test)
 1552+ div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
 1553+ tds = div.getElementsByTagName( "td" );
 1554+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
 1555+
 1556+ tds[ 0 ].style.display = "";
 1557+ tds[ 1 ].style.display = "none";
 1558+
 1559+ // Check if empty table cells still have offsetWidth/Height
 1560+ // (IE <= 8 fail this test)
 1561+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
 1562+
 1563+ // Figure out if the W3C box model works as expected
 1564+ div.innerHTML = "";
 1565+ div.style.width = div.style.paddingLeft = "1px";
 1566+ jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
 1567+
 1568+ if ( typeof div.style.zoom !== "undefined" ) {
 1569+ // Check if natively block-level elements act like inline-block
 1570+ // elements when setting their display to 'inline' and giving
 1571+ // them layout
 1572+ // (IE < 8 does this)
 1573+ div.style.display = "inline";
 1574+ div.style.zoom = 1;
 1575+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
 1576+
 1577+ // Check if elements with layout shrink-wrap their children
 1578+ // (IE 6 does this)
 1579+ div.style.display = "";
 1580+ div.innerHTML = "<div style='width:4px;'></div>";
 1581+ support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
 1582+ }
 1583+
 1584+ div.style.cssText = ptlm + vb;
 1585+ div.innerHTML = html;
 1586+
 1587+ outer = div.firstChild;
 1588+ inner = outer.firstChild;
 1589+ td = outer.nextSibling.firstChild.firstChild;
 1590+
 1591+ offsetSupport = {
 1592+ doesNotAddBorder: ( inner.offsetTop !== 5 ),
 1593+ doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
 1594+ };
 1595+
 1596+ inner.style.position = "fixed";
 1597+ inner.style.top = "20px";
 1598+
 1599+ // safari subtracts parent border width here which is 5px
 1600+ offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
 1601+ inner.style.position = inner.style.top = "";
 1602+
 1603+ outer.style.overflow = "hidden";
 1604+ outer.style.position = "relative";
 1605+
 1606+ offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
 1607+ offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
 1608+
 1609+ body.removeChild( container );
 1610+ div = container = null;
 1611+
 1612+ jQuery.extend( support, offsetSupport );
 1613+ });
 1614+
14081615 return support;
14091616 })();
14101617
1411 -// Keep track of boxModel
1412 -jQuery.boxModel = jQuery.support.boxModel;
14131618
14141619
14151620
1416 -
14171621 var rbrace = /^(?:\{.*\}|\[.*\])$/,
14181622 rmultiDash = /([A-Z])/g;
14191623
@@ -1437,7 +1641,6 @@
14381642
14391643 hasData: function( elem ) {
14401644 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1441 -
14421645 return !!elem && !isEmptyDataObject( elem );
14431646 },
14441647
@@ -1446,7 +1649,7 @@
14471650 return;
14481651 }
14491652
1450 - var thisCache, ret,
 1653+ var privateCache, thisCache, ret,
14511654 internalKey = jQuery.expando,
14521655 getByName = typeof name === "string",
14531656
@@ -1460,11 +1663,12 @@
14611664
14621665 // Only defining an ID for JS objects if its cache already exists allows
14631666 // the code to shortcut on the same path as a DOM node with no cache
1464 - id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
 1667+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
 1668+ isEvents = name === "events";
14651669
14661670 // Avoid doing any more work than we need to when trying to get data on an
14671671 // object that has no data at all
1468 - if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
 1672+ if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
14691673 return;
14701674 }
14711675
@@ -1472,18 +1676,17 @@
14731677 // Only DOM nodes need a new unique ID for each element since their data
14741678 // ends up in the global cache
14751679 if ( isNode ) {
1476 - elem[ jQuery.expando ] = id = ++jQuery.uuid;
 1680+ elem[ internalKey ] = id = ++jQuery.uuid;
14771681 } else {
1478 - id = jQuery.expando;
 1682+ id = internalKey;
14791683 }
14801684 }
14811685
14821686 if ( !cache[ id ] ) {
14831687 cache[ id ] = {};
14841688
1485 - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1486 - // metadata on plain JS objects when the object is serialized using
1487 - // JSON.stringify
 1689+ // Avoids exposing jQuery metadata on plain JS objects when the object
 1690+ // is serialized using JSON.stringify
14881691 if ( !isNode ) {
14891692 cache[ id ].toJSON = jQuery.noop;
14901693 }
@@ -1493,34 +1696,33 @@
14941697 // shallow copied over onto the existing cache
14951698 if ( typeof name === "object" || typeof name === "function" ) {
14961699 if ( pvt ) {
1497 - cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
 1700+ cache[ id ] = jQuery.extend( cache[ id ], name );
14981701 } else {
1499 - cache[ id ] = jQuery.extend(cache[ id ], name);
 1702+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
15001703 }
15011704 }
15021705
1503 - thisCache = cache[ id ];
 1706+ privateCache = thisCache = cache[ id ];
15041707
1505 - // Internal jQuery data is stored in a separate object inside the object's data
 1708+ // jQuery data() is stored in a separate object inside the object's internal data
15061709 // cache in order to avoid key collisions between internal data and user-defined
1507 - // data
1508 - if ( pvt ) {
1509 - if ( !thisCache[ internalKey ] ) {
1510 - thisCache[ internalKey ] = {};
 1710+ // data.
 1711+ if ( !pvt ) {
 1712+ if ( !thisCache.data ) {
 1713+ thisCache.data = {};
15111714 }
15121715
1513 - thisCache = thisCache[ internalKey ];
 1716+ thisCache = thisCache.data;
15141717 }
15151718
15161719 if ( data !== undefined ) {
15171720 thisCache[ jQuery.camelCase( name ) ] = data;
15181721 }
15191722
1520 - // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
1521 - // not attempt to inspect the internal events object using jQuery.data, as this
1522 - // internal data object is undocumented and subject to change.
1523 - if ( name === "events" && !thisCache[name] ) {
1524 - return thisCache[ internalKey ] && thisCache[ internalKey ].events;
 1723+ // Users should not attempt to inspect the internal events object using jQuery.data,
 1724+ // it is undocumented and subject to change. But does anyone listen? No.
 1725+ if ( isEvents && !thisCache[ name ] ) {
 1726+ return privateCache.events;
15251727 }
15261728
15271729 // Check for both converted-to-camel and non-converted data property names
@@ -1548,7 +1750,7 @@
15491751 return;
15501752 }
15511753
1552 - var thisCache,
 1754+ var thisCache, i, l,
15531755
15541756 // Reference to internal data cache key
15551757 internalKey = jQuery.expando,
@@ -1559,7 +1761,7 @@
15601762 cache = isNode ? jQuery.cache : elem,
15611763
15621764 // See jQuery.data for more information
1563 - id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
 1765+ id = isNode ? elem[ internalKey ] : internalKey;
15641766
15651767 // If there is already no cache entry for this object, there is no
15661768 // purpose in continuing
@@ -1569,28 +1771,43 @@
15701772
15711773 if ( name ) {
15721774
1573 - thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
 1775+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
15741776
15751777 if ( thisCache ) {
15761778
1577 - // Support interoperable removal of hyphenated or camelcased keys
1578 - if ( !thisCache[ name ] ) {
1579 - name = jQuery.camelCase( name );
 1779+ // Support array or space separated string names for data keys
 1780+ if ( !jQuery.isArray( name ) ) {
 1781+
 1782+ // try the string as a key before any manipulation
 1783+ if ( name in thisCache ) {
 1784+ name = [ name ];
 1785+ } else {
 1786+
 1787+ // split the camel cased version by spaces unless a key with the spaces exists
 1788+ name = jQuery.camelCase( name );
 1789+ if ( name in thisCache ) {
 1790+ name = [ name ];
 1791+ } else {
 1792+ name = name.split( " " );
 1793+ }
 1794+ }
15801795 }
15811796
1582 - delete thisCache[ name ];
 1797+ for ( i = 0, l = name.length; i < l; i++ ) {
 1798+ delete thisCache[ name[i] ];
 1799+ }
15831800
15841801 // If there is no data left in the cache, we want to continue
15851802 // and let the cache object itself get destroyed
1586 - if ( !isEmptyDataObject(thisCache) ) {
 1803+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
15871804 return;
15881805 }
15891806 }
15901807 }
15911808
15921809 // See jQuery.data for more information
1593 - if ( pvt ) {
1594 - delete cache[ id ][ internalKey ];
 1810+ if ( !pvt ) {
 1811+ delete cache[ id ].data;
15951812
15961813 // Don't destroy the parent cache unless the internal data object
15971814 // had been the only thing left in it
@@ -1599,8 +1816,6 @@
16001817 }
16011818 }
16021819
1603 - var internalCache = cache[ id ][ internalKey ];
1604 -
16051820 // Browsers that fail expando deletion also refuse to delete expandos on
16061821 // the window, but it will allow it on all other JS objects; other browsers
16071822 // don't care
@@ -1611,32 +1826,18 @@
16121827 cache[ id ] = null;
16131828 }
16141829
1615 - // We destroyed the entire user cache at once because it's faster than
1616 - // iterating through each key, but we need to continue to persist internal
1617 - // data if it existed
1618 - if ( internalCache ) {
1619 - cache[ id ] = {};
1620 - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1621 - // metadata on plain JS objects when the object is serialized using
1622 - // JSON.stringify
1623 - if ( !isNode ) {
1624 - cache[ id ].toJSON = jQuery.noop;
1625 - }
1626 -
1627 - cache[ id ][ internalKey ] = internalCache;
1628 -
1629 - // Otherwise, we need to eliminate the expando on the node to avoid
 1830+ // We destroyed the cache and need to eliminate the expando on the node to avoid
16301831 // false lookups in the cache for entries that no longer exist
1631 - } else if ( isNode ) {
 1832+ if ( isNode ) {
16321833 // IE does not allow us to delete expando properties from nodes,
16331834 // nor does it have a removeAttribute function on Document nodes;
16341835 // we must handle all of these cases
16351836 if ( jQuery.support.deleteExpando ) {
1636 - delete elem[ jQuery.expando ];
 1837+ delete elem[ internalKey ];
16371838 } else if ( elem.removeAttribute ) {
1638 - elem.removeAttribute( jQuery.expando );
 1839+ elem.removeAttribute( internalKey );
16391840 } else {
1640 - elem[ jQuery.expando ] = null;
 1841+ elem[ internalKey ] = null;
16411842 }
16421843 }
16431844 },
@@ -1662,14 +1863,15 @@
16631864
16641865 jQuery.fn.extend({
16651866 data: function( key, value ) {
1666 - var data = null;
 1867+ var parts, attr, name,
 1868+ data = null;
16671869
16681870 if ( typeof key === "undefined" ) {
16691871 if ( this.length ) {
16701872 data = jQuery.data( this[0] );
16711873
1672 - if ( this[0].nodeType === 1 ) {
1673 - var attr = this[0].attributes, name;
 1874+ if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
 1875+ attr = this[0].attributes;
16741876 for ( var i = 0, l = attr.length; i < l; i++ ) {
16751877 name = attr[i].name;
16761878
@@ -1679,6 +1881,7 @@
16801882 dataAttr( this[0], name, data[ name ] );
16811883 }
16821884 }
 1885+ jQuery._data( this[0], "parsedAttrs", true );
16831886 }
16841887 }
16851888
@@ -1690,7 +1893,7 @@
16911894 });
16921895 }
16931896
1694 - var parts = key.split(".");
 1897+ parts = key.split(".");
16951898 parts[1] = parts[1] ? "." + parts[1] : "";
16961899
16971900 if ( value === undefined ) {
@@ -1708,12 +1911,12 @@
17091912
17101913 } else {
17111914 return this.each(function() {
1712 - var $this = jQuery( this ),
 1915+ var self = jQuery( this ),
17131916 args = [ parts[0], value ];
17141917
1715 - $this.triggerHandler( "setData" + parts[1] + "!", args );
 1918+ self.triggerHandler( "setData" + parts[1] + "!", args );
17161919 jQuery.data( this, key, value );
1717 - $this.triggerHandler( "changeData" + parts[1] + "!", args );
 1920+ self.triggerHandler( "changeData" + parts[1] + "!", args );
17181921 });
17191922 }
17201923 },
@@ -1739,7 +1942,7 @@
17401943 data = data === "true" ? true :
17411944 data === "false" ? false :
17421945 data === "null" ? null :
1743 - !jQuery.isNaN( data ) ? parseFloat( data ) :
 1946+ jQuery.isNumeric( data ) ? parseFloat( data ) :
17441947 rbrace.test( data ) ? jQuery.parseJSON( data ) :
17451948 data;
17461949 } catch( e ) {}
@@ -1755,11 +1958,14 @@
17561959 return data;
17571960 }
17581961
1759 -// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
1760 -// property to be considered empty objects; this property always exists in
1761 -// order to make sure JSON.stringify does not expose internal metadata
 1962+// checks a cache object for emptiness
17621963 function isEmptyDataObject( obj ) {
17631964 for ( var name in obj ) {
 1965+
 1966+ // if the public data object is empty, the private is still empty
 1967+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
 1968+ continue;
 1969+ }
17641970 if ( name !== "toJSON" ) {
17651971 return false;
17661972 }
@@ -1775,17 +1981,17 @@
17761982 var deferDataKey = type + "defer",
17771983 queueDataKey = type + "queue",
17781984 markDataKey = type + "mark",
1779 - defer = jQuery.data( elem, deferDataKey, undefined, true );
 1985+ defer = jQuery._data( elem, deferDataKey );
17801986 if ( defer &&
1781 - ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
1782 - ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
 1987+ ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
 1988+ ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
17831989 // Give room for hard-coded callbacks to fire first
17841990 // and eventually mark/queue something else on the element
17851991 setTimeout( function() {
1786 - if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
1787 - !jQuery.data( elem, markDataKey, undefined, true ) ) {
 1992+ if ( !jQuery._data( elem, queueDataKey ) &&
 1993+ !jQuery._data( elem, markDataKey ) ) {
17881994 jQuery.removeData( elem, deferDataKey, true );
1789 - defer.resolve();
 1995+ defer.fire();
17901996 }
17911997 }, 0 );
17921998 }
@@ -1795,8 +2001,8 @@
17962002
17972003 _mark: function( elem, type ) {
17982004 if ( elem ) {
1799 - type = (type || "fx") + "mark";
1800 - jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
 2005+ type = ( type || "fx" ) + "mark";
 2006+ jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
18012007 }
18022008 },
18032009
@@ -1809,9 +2015,9 @@
18102016 if ( elem ) {
18112017 type = type || "fx";
18122018 var key = type + "mark",
1813 - count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
 2019+ count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
18142020 if ( count ) {
1815 - jQuery.data( elem, key, count, true );
 2021+ jQuery._data( elem, key, count );
18162022 } else {
18172023 jQuery.removeData( elem, key, true );
18182024 handleQueueMarkDefer( elem, type, "mark" );
@@ -1820,13 +2026,15 @@
18212027 },
18222028
18232029 queue: function( elem, type, data ) {
 2030+ var q;
18242031 if ( elem ) {
1825 - type = (type || "fx") + "queue";
1826 - var q = jQuery.data( elem, type, undefined, true );
 2032+ type = ( type || "fx" ) + "queue";
 2033+ q = jQuery._data( elem, type );
 2034+
18272035 // Speed up dequeue by getting out quickly if this is just a lookup
18282036 if ( data ) {
18292037 if ( !q || jQuery.isArray(data) ) {
1830 - q = jQuery.data( elem, type, jQuery.makeArray(data), true );
 2038+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
18312039 } else {
18322040 q.push( data );
18332041 }
@@ -1840,7 +2048,7 @@
18412049
18422050 var queue = jQuery.queue( elem, type ),
18432051 fn = queue.shift(),
1844 - defer;
 2052+ hooks = {};
18452053
18462054 // If the fx queue is dequeued, always remove the progress sentinel
18472055 if ( fn === "inprogress" ) {
@@ -1851,16 +2059,17 @@
18522060 // Add a progress sentinel to prevent the fx queue from being
18532061 // automatically dequeued
18542062 if ( type === "fx" ) {
1855 - queue.unshift("inprogress");
 2063+ queue.unshift( "inprogress" );
18562064 }
18572065
1858 - fn.call(elem, function() {
1859 - jQuery.dequeue(elem, type);
1860 - });
 2066+ jQuery._data( elem, type + ".run", hooks );
 2067+ fn.call( elem, function() {
 2068+ jQuery.dequeue( elem, type );
 2069+ }, hooks );
18612070 }
18622071
18632072 if ( !queue.length ) {
1864 - jQuery.removeData( elem, type + "queue", true );
 2073+ jQuery.removeData( elem, type + "queue " + type + ".run", true );
18652074 handleQueueMarkDefer( elem, type, "queue" );
18662075 }
18672076 }
@@ -1892,14 +2101,14 @@
18932102 // Based off of the plugin by Clint Helfers, with permission.
18942103 // http://blindsignals.com/index.php/2009/07/jquery-delay/
18952104 delay: function( time, type ) {
1896 - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
 2105+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
18972106 type = type || "fx";
18982107
1899 - return this.queue( type, function() {
1900 - var elem = this;
1901 - setTimeout(function() {
1902 - jQuery.dequeue( elem, type );
1903 - }, time );
 2108+ return this.queue( type, function( next, hooks ) {
 2109+ var timeout = setTimeout( next, time );
 2110+ hooks.stop = function() {
 2111+ clearTimeout( timeout );
 2112+ };
19042113 });
19052114 },
19062115 clearQueue: function( type ) {
@@ -1930,9 +2139,9 @@
19312140 if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
19322141 ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
19332142 jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
1934 - jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
 2143+ jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
19352144 count++;
1936 - tmp.done( resolve );
 2145+ tmp.add( resolve );
19372146 }
19382147 }
19392148 resolve();
@@ -1950,7 +2159,8 @@
19512160 rfocusable = /^(?:button|input|object|select|textarea)$/i,
19522161 rclickable = /^a(?:rea)?$/i,
19532162 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
1954 - nodeHook, boolHook;
 2163+ getSetAttribute = jQuery.support.getSetAttribute,
 2164+ nodeHook, boolHook, fixSpecified;
19552165
19562166 jQuery.fn.extend({
19572167 attr: function( name, value ) {
@@ -1962,11 +2172,11 @@
19632173 jQuery.removeAttr( this, name );
19642174 });
19652175 },
1966 -
 2176+
19672177 prop: function( name, value ) {
19682178 return jQuery.access( this, name, value, true, jQuery.prop );
19692179 },
1970 -
 2180+
19712181 removeProp: function( name ) {
19722182 name = jQuery.propFix[ name ] || name;
19732183 return this.each(function() {
@@ -2025,7 +2235,7 @@
20262236 }
20272237
20282238 if ( (value && typeof value === "string") || value === undefined ) {
2029 - classNames = (value || "").split( rspace );
 2239+ classNames = ( value || "" ).split( rspace );
20302240
20312241 for ( i = 0, l = this.length; i < l; i++ ) {
20322242 elem = this[ i ];
@@ -2086,8 +2296,10 @@
20872297 },
20882298
20892299 hasClass: function( selector ) {
2090 - var className = " " + selector + " ";
2091 - for ( var i = 0, l = this.length; i < l; i++ ) {
 2300+ var className = " " + selector + " ",
 2301+ i = 0,
 2302+ l = this.length;
 2303+ for ( ; i < l; i++ ) {
20922304 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
20932305 return true;
20942306 }
@@ -2097,9 +2309,9 @@
20982310 },
20992311
21002312 val: function( value ) {
2101 - var hooks, ret,
 2313+ var hooks, ret, isFunction,
21022314 elem = this[0];
2103 -
 2315+
21042316 if ( !arguments.length ) {
21052317 if ( elem ) {
21062318 hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@@ -2110,17 +2322,17 @@
21112323
21122324 ret = elem.value;
21132325
2114 - return typeof ret === "string" ?
 2326+ return typeof ret === "string" ?
21152327 // handle most common string cases
2116 - ret.replace(rreturn, "") :
 2328+ ret.replace(rreturn, "") :
21172329 // handle cases where value is null/undef or number
21182330 ret == null ? "" : ret;
21192331 }
21202332
2121 - return undefined;
 2333+ return;
21222334 }
21232335
2124 - var isFunction = jQuery.isFunction( value );
 2336+ isFunction = jQuery.isFunction( value );
21252337
21262338 return this.each(function( i ) {
21272339 var self = jQuery(this), val;
@@ -2168,7 +2380,7 @@
21692381 },
21702382 select: {
21712383 get: function( elem ) {
2172 - var value,
 2384+ var value, i, max, option,
21732385 index = elem.selectedIndex,
21742386 values = [],
21752387 options = elem.options,
@@ -2180,8 +2392,10 @@
21812393 }
21822394
21832395 // Loop through all the selected options
2184 - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
2185 - var option = options[ i ];
 2396+ i = one ? index : 0;
 2397+ max = one ? index + 1 : options.length;
 2398+ for ( ; i < max; i++ ) {
 2399+ option = options[ i ];
21862400
21872401 // Don't return options that are disabled or in a disabled optgroup
21882402 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
@@ -2233,18 +2447,14 @@
22342448 height: true,
22352449 offset: true
22362450 },
2237 -
2238 - attrFix: {
2239 - // Always normalize to ensure hook usage
2240 - tabindex: "tabIndex"
2241 - },
2242 -
 2451+
22432452 attr: function( elem, name, value, pass ) {
2244 - var nType = elem.nodeType;
2245 -
 2453+ var ret, hooks, notxml,
 2454+ nType = elem.nodeType;
 2455+
22462456 // don't get/set attributes on text, comment and attribute nodes
22472457 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2248 - return undefined;
 2458+ return;
22492459 }
22502460
22512461 if ( pass && name in jQuery.attrFn ) {
@@ -2252,36 +2462,24 @@
22532463 }
22542464
22552465 // Fallback to prop when attributes are not supported
2256 - if ( !("getAttribute" in elem) ) {
 2466+ if ( typeof elem.getAttribute === "undefined" ) {
22572467 return jQuery.prop( elem, name, value );
22582468 }
22592469
2260 - var ret, hooks,
2261 - notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
 2470+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
22622471
2263 - // Normalize the name if needed
 2472+ // All attributes are lowercase
 2473+ // Grab necessary hook if one is defined
22642474 if ( notxml ) {
2265 - name = jQuery.attrFix[ name ] || name;
2266 -
2267 - hooks = jQuery.attrHooks[ name ];
2268 -
2269 - if ( !hooks ) {
2270 - // Use boolHook for boolean attributes
2271 - if ( rboolean.test( name ) ) {
2272 - hooks = boolHook;
2273 -
2274 - // Use nodeHook if available( IE6/7 )
2275 - } else if ( nodeHook ) {
2276 - hooks = nodeHook;
2277 - }
2278 - }
 2475+ name = name.toLowerCase();
 2476+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
22792477 }
22802478
22812479 if ( value !== undefined ) {
22822480
22832481 if ( value === null ) {
22842482 jQuery.removeAttr( elem, name );
2285 - return undefined;
 2483+ return;
22862484
22872485 } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
22882486 return ret;
@@ -2305,17 +2503,29 @@
23062504 }
23072505 },
23082506
2309 - removeAttr: function( elem, name ) {
2310 - var propName;
2311 - if ( elem.nodeType === 1 ) {
2312 - name = jQuery.attrFix[ name ] || name;
 2507+ removeAttr: function( elem, value ) {
 2508+ var propName, attrNames, name, l,
 2509+ i = 0;
23132510
2314 - jQuery.attr( elem, name, "" );
2315 - elem.removeAttribute( name );
 2511+ if ( value && elem.nodeType === 1 ) {
 2512+ attrNames = value.toLowerCase().split( rspace );
 2513+ l = attrNames.length;
23162514
2317 - // Set corresponding property to false for boolean attributes
2318 - if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
2319 - elem[ propName ] = false;
 2515+ for ( ; i < l; i++ ) {
 2516+ name = attrNames[ i ];
 2517+
 2518+ if ( name ) {
 2519+ propName = jQuery.propFix[ name ] || name;
 2520+
 2521+ // See #9699 for explanation of this approach (setting first, then removal)
 2522+ jQuery.attr( elem, name, "" );
 2523+ elem.removeAttribute( getSetAttribute ? name : propName );
 2524+
 2525+ // Set corresponding property to false for boolean attributes
 2526+ if ( rboolean.test( name ) && propName in elem ) {
 2527+ elem[ propName ] = false;
 2528+ }
 2529+ }
23202530 }
23212531 }
23222532 },
@@ -2374,17 +2584,17 @@
23752585 frameborder: "frameBorder",
23762586 contenteditable: "contentEditable"
23772587 },
2378 -
 2588+
23792589 prop: function( elem, name, value ) {
2380 - var nType = elem.nodeType;
 2590+ var ret, hooks, notxml,
 2591+ nType = elem.nodeType;
23812592
23822593 // don't get/set properties on text, comment and attribute nodes
23832594 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2384 - return undefined;
 2595+ return;
23852596 }
23862597
2387 - var ret, hooks,
2388 - notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
 2598+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
23892599
23902600 if ( notxml ) {
23912601 // Fix name and attach hooks
@@ -2397,7 +2607,7 @@
23982608 return ret;
23992609
24002610 } else {
2401 - return (elem[ name ] = value);
 2611+ return ( elem[ name ] = value );
24022612 }
24032613
24042614 } else {
@@ -2409,7 +2619,7 @@
24102620 }
24112621 }
24122622 },
2413 -
 2623+
24142624 propHooks: {
24152625 tabIndex: {
24162626 get: function( elem ) {
@@ -2427,16 +2637,17 @@
24282638 }
24292639 });
24302640
2431 -// Add the tabindex propHook to attrHooks for back-compat
2432 -jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
 2641+// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
 2642+jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
24332643
24342644 // Hook for boolean attributes
24352645 boolHook = {
24362646 get: function( elem, name ) {
24372647 // Align boolean attributes with corresponding properties
24382648 // Fall back to attribute presence where some booleans are not supported
2439 - var attrNode;
2440 - return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
 2649+ var attrNode,
 2650+ property = jQuery.prop( elem, name );
 2651+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
24412652 name.toLowerCase() :
24422653 undefined;
24432654 },
@@ -2461,16 +2672,20 @@
24622673 };
24632674
24642675 // IE6/7 do not support getting/setting some attributes with get/setAttribute
2465 -if ( !jQuery.support.getSetAttribute ) {
2466 -
 2676+if ( !getSetAttribute ) {
 2677+
 2678+ fixSpecified = {
 2679+ name: true,
 2680+ id: true
 2681+ };
 2682+
24672683 // Use this for any attribute in IE6/7
24682684 // This fixes almost every IE6/7 issue
24692685 nodeHook = jQuery.valHooks.button = {
24702686 get: function( elem, name ) {
24712687 var ret;
24722688 ret = elem.getAttributeNode( name );
2473 - // Return undefined if nodeValue is empty string
2474 - return ret && ret.nodeValue !== "" ?
 2689+ return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
24752690 ret.nodeValue :
24762691 undefined;
24772692 },
@@ -2481,10 +2696,13 @@
24822697 ret = document.createAttribute( name );
24832698 elem.setAttributeNode( ret );
24842699 }
2485 - return (ret.nodeValue = value + "");
 2700+ return ( ret.nodeValue = value + "" );
24862701 }
24872702 };
24882703
 2704+ // Apply the nodeHook to tabindex
 2705+ jQuery.attrHooks.tabindex.set = nodeHook.set;
 2706+
24892707 // Set width and height to auto instead of 0 on empty string( Bug #8150 )
24902708 // This is for removals
24912709 jQuery.each([ "width", "height" ], function( i, name ) {
@@ -2497,6 +2715,18 @@
24982716 }
24992717 });
25002718 });
 2719+
 2720+ // Set contenteditable to false on removals(#10429)
 2721+ // Setting to empty string throws an error as an invalid value
 2722+ jQuery.attrHooks.contenteditable = {
 2723+ get: nodeHook.get,
 2724+ set: function( elem, value, name ) {
 2725+ if ( value === "" ) {
 2726+ value = "false";
 2727+ }
 2728+ nodeHook.set( elem, value, name );
 2729+ }
 2730+ };
25012731 }
25022732
25032733
@@ -2520,7 +2750,7 @@
25212751 return elem.style.cssText.toLowerCase() || undefined;
25222752 },
25232753 set: function( elem, value ) {
2524 - return (elem.style.cssText = "" + value);
 2754+ return ( elem.style.cssText = "" + value );
25252755 }
25262756 };
25272757 }
@@ -2545,6 +2775,11 @@
25462776 });
25472777 }
25482778
 2779+// IE6/7 call enctype encoding
 2780+if ( !jQuery.support.enctype ) {
 2781+ jQuery.propFix.enctype = "encoding";
 2782+}
 2783+
25492784 // Radios and checkboxes getter/setter
25502785 if ( !jQuery.support.checkOn ) {
25512786 jQuery.each([ "radio", "checkbox" ], function() {
@@ -2560,7 +2795,7 @@
25612796 jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
25622797 set: function( elem, value ) {
25632798 if ( jQuery.isArray( value ) ) {
2564 - return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
 2799+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
25652800 }
25662801 }
25672802 });
@@ -2569,116 +2804,118 @@
25702805
25712806
25722807
2573 -var rnamespaces = /\.(.*)$/,
2574 - rformElems = /^(?:textarea|input|select)$/i,
2575 - rperiod = /\./g,
2576 - rspaces = / /g,
2577 - rescape = /[^\w\s.|`]/g,
2578 - fcleanup = function( nm ) {
2579 - return nm.replace(rescape, "\\$&");
 2808+var rformElems = /^(?:textarea|input|select)$/i,
 2809+ rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
 2810+ rhoverHack = /\bhover(\.\S+)?\b/,
 2811+ rkeyEvent = /^key/,
 2812+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
 2813+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
 2814+ rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
 2815+ quickParse = function( selector ) {
 2816+ var quick = rquickIs.exec( selector );
 2817+ if ( quick ) {
 2818+ // 0 1 2 3
 2819+ // [ _, tag, id, class ]
 2820+ quick[1] = ( quick[1] || "" ).toLowerCase();
 2821+ quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
 2822+ }
 2823+ return quick;
 2824+ },
 2825+ quickIs = function( elem, m ) {
 2826+ var attrs = elem.attributes || {};
 2827+ return (
 2828+ (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
 2829+ (!m[2] || (attrs.id || {}).value === m[2]) &&
 2830+ (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
 2831+ );
 2832+ },
 2833+ hoverHack = function( events ) {
 2834+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
25802835 };
25812836
25822837 /*
2583 - * A number of helper functions used for managing events.
2584 - * Many of the ideas behind this code originated from
2585 - * Dean Edwards' addEvent library.
 2838+ * Helper functions for managing events -- not part of the public interface.
 2839+ * Props to Dean Edwards' addEvent library for many of the ideas.
25862840 */
25872841 jQuery.event = {
25882842
2589 - // Bind an event to an element
2590 - // Original by Dean Edwards
2591 - add: function( elem, types, handler, data ) {
2592 - if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2593 - return;
2594 - }
 2843+ add: function( elem, types, handler, data, selector ) {
25952844
2596 - if ( handler === false ) {
2597 - handler = returnFalse;
2598 - } else if ( !handler ) {
2599 - // Fixes bug #7229. Fix recommended by jdalton
 2845+ var elemData, eventHandle, events,
 2846+ t, tns, type, namespaces, handleObj,
 2847+ handleObjIn, quick, handlers, special;
 2848+
 2849+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)
 2850+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
26002851 return;
26012852 }
26022853
2603 - var handleObjIn, handleObj;
2604 -
 2854+ // Caller can pass in an object of custom data in lieu of the handler
26052855 if ( handler.handler ) {
26062856 handleObjIn = handler;
26072857 handler = handleObjIn.handler;
26082858 }
26092859
2610 - // Make sure that the function being executed has a unique ID
 2860+ // Make sure that the handler has a unique ID, used to find/remove it later
26112861 if ( !handler.guid ) {
26122862 handler.guid = jQuery.guid++;
26132863 }
26142864
2615 - // Init the element's event structure
2616 - var elemData = jQuery._data( elem );
2617 -
2618 - // If no elemData is found then we must be trying to bind to one of the
2619 - // banned noData elements
2620 - if ( !elemData ) {
2621 - return;
2622 - }
2623 -
2624 - var events = elemData.events,
2625 - eventHandle = elemData.handle;
2626 -
 2865+ // Init the element's event structure and main handler, if this is the first
 2866+ events = elemData.events;
26272867 if ( !events ) {
26282868 elemData.events = events = {};
26292869 }
2630 -
 2870+ eventHandle = elemData.handle;
26312871 if ( !eventHandle ) {
26322872 elemData.handle = eventHandle = function( e ) {
26332873 // Discard the second event of a jQuery.event.trigger() and
26342874 // when an event is called after a page has unloaded
26352875 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
2636 - jQuery.event.handle.apply( eventHandle.elem, arguments ) :
 2876+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
26372877 undefined;
26382878 };
 2879+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
 2880+ eventHandle.elem = elem;
26392881 }
26402882
2641 - // Add elem as a property of the handle function
2642 - // This is to prevent a memory leak with non-native events in IE.
2643 - eventHandle.elem = elem;
2644 -
26452883 // Handle multiple events separated by a space
26462884 // jQuery(...).bind("mouseover mouseout", fn);
2647 - types = types.split(" ");
 2885+ types = jQuery.trim( hoverHack(types) ).split( " " );
 2886+ for ( t = 0; t < types.length; t++ ) {
26482887
2649 - var type, i = 0, namespaces;
 2888+ tns = rtypenamespace.exec( types[t] ) || [];
 2889+ type = tns[1];
 2890+ namespaces = ( tns[2] || "" ).split( "." ).sort();
26502891
2651 - while ( (type = types[ i++ ]) ) {
2652 - handleObj = handleObjIn ?
2653 - jQuery.extend({}, handleObjIn) :
2654 - { handler: handler, data: data };
 2892+ // If event changes its type, use the special event handlers for the changed type
 2893+ special = jQuery.event.special[ type ] || {};
26552894
2656 - // Namespaced event handlers
2657 - if ( type.indexOf(".") > -1 ) {
2658 - namespaces = type.split(".");
2659 - type = namespaces.shift();
2660 - handleObj.namespace = namespaces.slice(0).sort().join(".");
 2895+ // If selector defined, determine special event api type, otherwise given type
 2896+ type = ( selector ? special.delegateType : special.bindType ) || type;
26612897
2662 - } else {
2663 - namespaces = [];
2664 - handleObj.namespace = "";
2665 - }
 2898+ // Update special based on newly reset type
 2899+ special = jQuery.event.special[ type ] || {};
26662900
2667 - handleObj.type = type;
2668 - if ( !handleObj.guid ) {
2669 - handleObj.guid = handler.guid;
2670 - }
 2901+ // handleObj is passed to all event handlers
 2902+ handleObj = jQuery.extend({
 2903+ type: type,
 2904+ origType: tns[1],
 2905+ data: data,
 2906+ handler: handler,
 2907+ guid: handler.guid,
 2908+ selector: selector,
 2909+ quick: quickParse( selector ),
 2910+ namespace: namespaces.join(".")
 2911+ }, handleObjIn );
26712912
2672 - // Get the current list of functions bound to this event
2673 - var handlers = events[ type ],
2674 - special = jQuery.event.special[ type ] || {};
2675 -
2676 - // Init the event handler queue
 2913+ // Init the event handler queue if we're the first
 2914+ handlers = events[ type ];
26772915 if ( !handlers ) {
26782916 handlers = events[ type ] = [];
 2917+ handlers.delegateCount = 0;
26792918
2680 - // Check for a special event handler
2681 - // Only use addEventListener/attachEvent if the special
2682 - // events handler returns false
 2919+ // Only use addEventListener/attachEvent if the special events handler returns false
26832920 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
26842921 // Bind the global event handler to the element
26852922 if ( elem.addEventListener ) {
@@ -2698,10 +2935,14 @@
26992936 }
27002937 }
27012938
2702 - // Add the function to the element's handler list
2703 - handlers.push( handleObj );
 2939+ // Add to the element's handler list, delegates in front
 2940+ if ( selector ) {
 2941+ handlers.splice( handlers.delegateCount++, 0, handleObj );
 2942+ } else {
 2943+ handlers.push( handleObj );
 2944+ }
27042945
2705 - // Keep track of which events have been used, for event optimization
 2946+ // Keep track of which events have ever been used, for event optimization
27062947 jQuery.event.global[ type ] = true;
27072948 }
27082949
@@ -2712,129 +2953,80 @@
27132954 global: {},
27142955
27152956 // Detach an event or set of events from an element
2716 - remove: function( elem, types, handler, pos ) {
2717 - // don't do events on text and comment nodes
2718 - if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2719 - return;
2720 - }
 2957+ remove: function( elem, types, handler, selector, mappedTypes ) {
27212958
2722 - if ( handler === false ) {
2723 - handler = returnFalse;
2724 - }
 2959+ var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
 2960+ t, tns, type, origType, namespaces, origCount,
 2961+ j, events, special, handle, eventType, handleObj;
27252962
2726 - var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
2727 - elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
2728 - events = elemData && elemData.events;
2729 -
2730 - if ( !elemData || !events ) {
 2963+ if ( !elemData || !(events = elemData.events) ) {
27312964 return;
27322965 }
27332966
2734 - // types is actually an event object here
2735 - if ( types && types.type ) {
2736 - handler = types.handler;
2737 - types = types.type;
2738 - }
 2967+ // Once for each type.namespace in types; type may be omitted
 2968+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
 2969+ for ( t = 0; t < types.length; t++ ) {
 2970+ tns = rtypenamespace.exec( types[t] ) || [];
 2971+ type = origType = tns[1];
 2972+ namespaces = tns[2];
27392973
2740 - // Unbind all events for the element
2741 - if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
2742 - types = types || "";
2743 -
2744 - for ( type in events ) {
2745 - jQuery.event.remove( elem, type + types );
2746 - }
2747 -
2748 - return;
2749 - }
2750 -
2751 - // Handle multiple events separated by a space
2752 - // jQuery(...).unbind("mouseover mouseout", fn);
2753 - types = types.split(" ");
2754 -
2755 - while ( (type = types[ i++ ]) ) {
2756 - origType = type;
2757 - handleObj = null;
2758 - all = type.indexOf(".") < 0;
2759 - namespaces = [];
2760 -
2761 - if ( !all ) {
2762 - // Namespaced event handlers
2763 - namespaces = type.split(".");
2764 - type = namespaces.shift();
2765 -
2766 - namespace = new RegExp("(^|\\.)" +
2767 - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
2768 - }
2769 -
2770 - eventType = events[ type ];
2771 -
2772 - if ( !eventType ) {
2773 - continue;
2774 - }
2775 -
2776 - if ( !handler ) {
2777 - for ( j = 0; j < eventType.length; j++ ) {
2778 - handleObj = eventType[ j ];
2779 -
2780 - if ( all || namespace.test( handleObj.namespace ) ) {
2781 - jQuery.event.remove( elem, origType, handleObj.handler, j );
2782 - eventType.splice( j--, 1 );
2783 - }
 2974+ // Unbind all events (on this namespace, if provided) for the element
 2975+ if ( !type ) {
 2976+ for ( type in events ) {
 2977+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
27842978 }
2785 -
27862979 continue;
27872980 }
27882981
27892982 special = jQuery.event.special[ type ] || {};
 2983+ type = ( selector? special.delegateType : special.bindType ) || type;
 2984+ eventType = events[ type ] || [];
 2985+ origCount = eventType.length;
 2986+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
27902987
2791 - for ( j = pos || 0; j < eventType.length; j++ ) {
 2988+ // Remove matching events
 2989+ for ( j = 0; j < eventType.length; j++ ) {
27922990 handleObj = eventType[ j ];
27932991
2794 - if ( handler.guid === handleObj.guid ) {
2795 - // remove the given handler for the given type
2796 - if ( all || namespace.test( handleObj.namespace ) ) {
2797 - if ( pos == null ) {
2798 - eventType.splice( j--, 1 );
2799 - }
 2992+ if ( ( mappedTypes || origType === handleObj.origType ) &&
 2993+ ( !handler || handler.guid === handleObj.guid ) &&
 2994+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
 2995+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
 2996+ eventType.splice( j--, 1 );
28002997
2801 - if ( special.remove ) {
2802 - special.remove.call( elem, handleObj );
2803 - }
 2998+ if ( handleObj.selector ) {
 2999+ eventType.delegateCount--;
28043000 }
2805 -
2806 - if ( pos != null ) {
2807 - break;
 3001+ if ( special.remove ) {
 3002+ special.remove.call( elem, handleObj );
28083003 }
28093004 }
28103005 }
28113006
2812 - // remove generic event handler if no more handlers exist
2813 - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
 3007+ // Remove generic event handler if we removed something and no more handlers exist
 3008+ // (avoids potential for endless recursion during removal of special event handlers)
 3009+ if ( eventType.length === 0 && origCount !== eventType.length ) {
28143010 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
28153011 jQuery.removeEvent( elem, type, elemData.handle );
28163012 }
28173013
2818 - ret = null;
28193014 delete events[ type ];
28203015 }
28213016 }
28223017
28233018 // Remove the expando if it's no longer used
28243019 if ( jQuery.isEmptyObject( events ) ) {
2825 - var handle = elemData.handle;
 3020+ handle = elemData.handle;
28263021 if ( handle ) {
28273022 handle.elem = null;
28283023 }
28293024
2830 - delete elemData.events;
2831 - delete elemData.handle;
2832 -
2833 - if ( jQuery.isEmptyObject( elemData ) ) {
2834 - jQuery.removeData( elem, undefined, true );
2835 - }
 3025+ // removeData also checks for emptiness and clears the expando if empty
 3026+ // so use it instead of delete
 3027+ jQuery.removeData( elem, [ "events", "handle" ], true );
28363028 }
28373029 },
2838 -
 3030+
28393031 // Events that are safe to short-circuit if no handlers are attached.
28403032 // Native DOM events should not be added, they may have inline handlers.
28413033 customEvent: {
@@ -2844,18 +3036,28 @@
28453037 },
28463038
28473039 trigger: function( event, data, elem, onlyHandlers ) {
 3040+ // Don't do events on text and comment nodes
 3041+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
 3042+ return;
 3043+ }
 3044+
28483045 // Event object or event type
28493046 var type = event.type || event,
28503047 namespaces = [],
2851 - exclusive;
 3048+ cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
28523049
2853 - if ( type.indexOf("!") >= 0 ) {
 3050+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
 3051+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
 3052+ return;
 3053+ }
 3054+
 3055+ if ( type.indexOf( "!" ) >= 0 ) {
28543056 // Exclusive events trigger only for the exact event (no namespaces)
28553057 type = type.slice(0, -1);
28563058 exclusive = true;
28573059 }
28583060
2859 - if ( type.indexOf(".") >= 0 ) {
 3061+ if ( type.indexOf( "." ) >= 0 ) {
28603062 // Namespaced trigger; create a regexp to match event type in handle()
28613063 namespaces = type.split(".");
28623064 type = namespaces.shift();
@@ -2877,231 +3079,300 @@
28783080 new jQuery.Event( type );
28793081
28803082 event.type = type;
 3083+ event.isTrigger = true;
28813084 event.exclusive = exclusive;
2882 - event.namespace = namespaces.join(".");
2883 - event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
2884 -
2885 - // triggerHandler() and global events don't bubble or run the default action
2886 - if ( onlyHandlers || !elem ) {
2887 - event.preventDefault();
2888 - event.stopPropagation();
2889 - }
 3085+ event.namespace = namespaces.join( "." );
 3086+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
 3087+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
28903088
28913089 // Handle a global trigger
28923090 if ( !elem ) {
 3091+
28933092 // TODO: Stop taunting the data cache; remove global events and always attach to document
2894 - jQuery.each( jQuery.cache, function() {
2895 - // internalKey variable is just used to make it easier to find
2896 - // and potentially change this stuff later; currently it just
2897 - // points to jQuery.expando
2898 - var internalKey = jQuery.expando,
2899 - internalCache = this[ internalKey ];
2900 - if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
2901 - jQuery.event.trigger( event, data, internalCache.handle.elem );
 3093+ cache = jQuery.cache;
 3094+ for ( i in cache ) {
 3095+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {
 3096+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
29023097 }
2903 - });
 3098+ }
29043099 return;
29053100 }
29063101
2907 - // Don't do events on text and comment nodes
2908 - if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2909 - return;
2910 - }
2911 -
29123102 // Clean up the event in case it is being reused
29133103 event.result = undefined;
2914 - event.target = elem;
 3104+ if ( !event.target ) {
 3105+ event.target = elem;
 3106+ }
29153107
29163108 // Clone any incoming data and prepend the event, creating the handler arg list
29173109 data = data != null ? jQuery.makeArray( data ) : [];
29183110 data.unshift( event );
29193111
2920 - var cur = elem,
2921 - // IE doesn't like method names with a colon (#3533, #8272)
2922 - ontype = type.indexOf(":") < 0 ? "on" + type : "";
 3112+ // Allow special events to draw outside the lines
 3113+ special = jQuery.event.special[ type ] || {};
 3114+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
 3115+ return;
 3116+ }
29233117
2924 - // Fire event on the current element, then bubble up the DOM tree
2925 - do {
2926 - var handle = jQuery._data( cur, "handle" );
 3118+ // Determine event propagation path in advance, per W3C events spec (#9951)
 3119+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
 3120+ eventPath = [[ elem, special.bindType || type ]];
 3121+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
29273122
2928 - event.currentTarget = cur;
 3123+ bubbleType = special.delegateType || type;
 3124+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
 3125+ old = null;
 3126+ for ( ; cur; cur = cur.parentNode ) {
 3127+ eventPath.push([ cur, bubbleType ]);
 3128+ old = cur;
 3129+ }
 3130+
 3131+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
 3132+ if ( old && old === elem.ownerDocument ) {
 3133+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
 3134+ }
 3135+ }
 3136+
 3137+ // Fire handlers on the event path
 3138+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
 3139+
 3140+ cur = eventPath[i][0];
 3141+ event.type = eventPath[i][1];
 3142+
 3143+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
29293144 if ( handle ) {
29303145 handle.apply( cur, data );
29313146 }
2932 -
2933 - // Trigger an inline bound script
2934 - if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
2935 - event.result = false;
 3147+ // Note that this is a bare JS function and not a jQuery handler
 3148+ handle = ontype && cur[ ontype ];
 3149+ if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
29363150 event.preventDefault();
29373151 }
 3152+ }
 3153+ event.type = type;
29383154
2939 - // Bubble up to document, then to window
2940 - cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
2941 - } while ( cur && !event.isPropagationStopped() );
2942 -
29433155 // If nobody prevented the default action, do it now
2944 - if ( !event.isDefaultPrevented() ) {
2945 - var old,
2946 - special = jQuery.event.special[ type ] || {};
 3156+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
29473157
2948 - if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
 3158+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
29493159 !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
29503160
29513161 // Call a native DOM method on the target with the same name name as the event.
2952 - // Can't use an .isFunction)() check here because IE6/7 fails that test.
2953 - // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
2954 - try {
2955 - if ( ontype && elem[ type ] ) {
2956 - // Don't re-trigger an onFOO event when we call its FOO() method
2957 - old = elem[ ontype ];
 3162+ // Can't use an .isFunction() check here because IE6/7 fails that test.
 3163+ // Don't do default actions on window, that's where global variables be (#6170)
 3164+ // IE<9 dies on focus/blur to hidden element (#1486)
 3165+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
29583166
2959 - if ( old ) {
2960 - elem[ ontype ] = null;
2961 - }
 3167+ // Don't re-trigger an onFOO event when we call its FOO() method
 3168+ old = elem[ ontype ];
29623169
2963 - jQuery.event.triggered = type;
2964 - elem[ type ]();
 3170+ if ( old ) {
 3171+ elem[ ontype ] = null;
29653172 }
2966 - } catch ( ieError ) {}
29673173
2968 - if ( old ) {
2969 - elem[ ontype ] = old;
 3174+ // Prevent re-triggering of the same event, since we already bubbled it above
 3175+ jQuery.event.triggered = type;
 3176+ elem[ type ]();
 3177+ jQuery.event.triggered = undefined;
 3178+
 3179+ if ( old ) {
 3180+ elem[ ontype ] = old;
 3181+ }
29703182 }
2971 -
2972 - jQuery.event.triggered = undefined;
29733183 }
29743184 }
2975 -
 3185+
29763186 return event.result;
29773187 },
29783188
2979 - handle: function( event ) {
 3189+ dispatch: function( event ) {
 3190+
 3191+ // Make a writable jQuery.Event from the native event object
29803192 event = jQuery.event.fix( event || window.event );
2981 - // Snapshot the handlers list since a called handler may add/remove events.
2982 - var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
 3193+
 3194+ var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
 3195+ delegateCount = handlers.delegateCount,
 3196+ args = [].slice.call( arguments, 0 ),
29833197 run_all = !event.exclusive && !event.namespace,
2984 - args = Array.prototype.slice.call( arguments, 0 );
 3198+ handlerQueue = [],
 3199+ i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
29853200
2986 - // Use the fix-ed Event rather than the (read-only) native event
 3201+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
29873202 args[0] = event;
2988 - event.currentTarget = this;
 3203+ event.delegateTarget = this;
29893204
2990 - for ( var j = 0, l = handlers.length; j < l; j++ ) {
2991 - var handleObj = handlers[ j ];
 3205+ // Determine handlers that should run if there are delegated events
 3206+ // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
 3207+ if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
29923208
2993 - // Triggered event must 1) be non-exclusive and have no namespace, or
2994 - // 2) have namespace(s) a subset or equal to those in the bound event.
2995 - if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
2996 - // Pass in a reference to the handler function itself
2997 - // So that we can later remove it
2998 - event.handler = handleObj.handler;
2999 - event.data = handleObj.data;
3000 - event.handleObj = handleObj;
 3209+ // Pregenerate a single jQuery object for reuse with .is()
 3210+ jqcur = jQuery(this);
 3211+ jqcur.context = this.ownerDocument || this;
30013212
3002 - var ret = handleObj.handler.apply( this, args );
 3213+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
 3214+ selMatch = {};
 3215+ matches = [];
 3216+ jqcur[0] = cur;
 3217+ for ( i = 0; i < delegateCount; i++ ) {
 3218+ handleObj = handlers[ i ];
 3219+ sel = handleObj.selector;
30033220
3004 - if ( ret !== undefined ) {
3005 - event.result = ret;
3006 - if ( ret === false ) {
3007 - event.preventDefault();
3008 - event.stopPropagation();
 3221+ if ( selMatch[ sel ] === undefined ) {
 3222+ selMatch[ sel ] = (
 3223+ handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
 3224+ );
30093225 }
 3226+ if ( selMatch[ sel ] ) {
 3227+ matches.push( handleObj );
 3228+ }
30103229 }
 3230+ if ( matches.length ) {
 3231+ handlerQueue.push({ elem: cur, matches: matches });
 3232+ }
 3233+ }
 3234+ }
30113235
3012 - if ( event.isImmediatePropagationStopped() ) {
3013 - break;
 3236+ // Add the remaining (directly-bound) handlers
 3237+ if ( handlers.length > delegateCount ) {
 3238+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
 3239+ }
 3240+
 3241+ // Run delegates first; they may want to stop propagation beneath us
 3242+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
 3243+ matched = handlerQueue[ i ];
 3244+ event.currentTarget = matched.elem;
 3245+
 3246+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
 3247+ handleObj = matched.matches[ j ];
 3248+
 3249+ // Triggered event must either 1) be non-exclusive and have no namespace, or
 3250+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
 3251+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
 3252+
 3253+ event.data = handleObj.data;
 3254+ event.handleObj = handleObj;
 3255+
 3256+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
 3257+ .apply( matched.elem, args );
 3258+
 3259+ if ( ret !== undefined ) {
 3260+ event.result = ret;
 3261+ if ( ret === false ) {
 3262+ event.preventDefault();
 3263+ event.stopPropagation();
 3264+ }
 3265+ }
30143266 }
30153267 }
30163268 }
 3269+
30173270 return event.result;
30183271 },
30193272
3020 - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
 3273+ // Includes some event props shared by KeyEvent and MouseEvent
 3274+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
 3275+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
30213276
 3277+ fixHooks: {},
 3278+
 3279+ keyHooks: {
 3280+ props: "char charCode key keyCode".split(" "),
 3281+ filter: function( event, original ) {
 3282+
 3283+ // Add which for key events
 3284+ if ( event.which == null ) {
 3285+ event.which = original.charCode != null ? original.charCode : original.keyCode;
 3286+ }
 3287+
 3288+ return event;
 3289+ }
 3290+ },
 3291+
 3292+ mouseHooks: {
 3293+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
 3294+ filter: function( event, original ) {
 3295+ var eventDoc, doc, body,
 3296+ button = original.button,
 3297+ fromElement = original.fromElement;
 3298+
 3299+ // Calculate pageX/Y if missing and clientX/Y available
 3300+ if ( event.pageX == null && original.clientX != null ) {
 3301+ eventDoc = event.target.ownerDocument || document;
 3302+ doc = eventDoc.documentElement;
 3303+ body = eventDoc.body;
 3304+
 3305+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
 3306+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
 3307+ }
 3308+
 3309+ // Add relatedTarget, if necessary
 3310+ if ( !event.relatedTarget && fromElement ) {
 3311+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
 3312+ }
 3313+
 3314+ // Add which for click: 1 === left; 2 === middle; 3 === right
 3315+ // Note: button is not normalized, so don't use it
 3316+ if ( !event.which && button !== undefined ) {
 3317+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
 3318+ }
 3319+
 3320+ return event;
 3321+ }
 3322+ },
 3323+
30223324 fix: function( event ) {
30233325 if ( event[ jQuery.expando ] ) {
30243326 return event;
30253327 }
30263328
3027 - // store a copy of the original event object
3028 - // and "clone" to set read-only properties
3029 - var originalEvent = event;
 3329+ // Create a writable copy of the event object and normalize some properties
 3330+ var i, prop,
 3331+ originalEvent = event,
 3332+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
 3333+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
 3334+
30303335 event = jQuery.Event( originalEvent );
30313336
3032 - for ( var i = this.props.length, prop; i; ) {
3033 - prop = this.props[ --i ];
 3337+ for ( i = copy.length; i; ) {
 3338+ prop = copy[ --i ];
30343339 event[ prop ] = originalEvent[ prop ];
30353340 }
30363341
3037 - // Fix target property, if necessary
 3342+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
30383343 if ( !event.target ) {
3039 - // Fixes #1925 where srcElement might not be defined either
3040 - event.target = event.srcElement || document;
 3344+ event.target = originalEvent.srcElement || document;
30413345 }
30423346
3043 - // check if target is a textnode (safari)
 3347+ // Target should not be a text node (#504, Safari)
30443348 if ( event.target.nodeType === 3 ) {
30453349 event.target = event.target.parentNode;
30463350 }
30473351
3048 - // Add relatedTarget, if necessary
3049 - if ( !event.relatedTarget && event.fromElement ) {
3050 - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
3051 - }
3052 -
3053 - // Calculate pageX/Y if missing and clientX/Y available
3054 - if ( event.pageX == null && event.clientX != null ) {
3055 - var eventDocument = event.target.ownerDocument || document,
3056 - doc = eventDocument.documentElement,
3057 - body = eventDocument.body;
3058 -
3059 - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3060 - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
3061 - }
3062 -
3063 - // Add which for key events
3064 - if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
3065 - event.which = event.charCode != null ? event.charCode : event.keyCode;
3066 - }
3067 -
3068 - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
3069 - if ( !event.metaKey && event.ctrlKey ) {
 3352+ // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
 3353+ if ( event.metaKey === undefined ) {
30703354 event.metaKey = event.ctrlKey;
30713355 }
30723356
3073 - // Add which for click: 1 === left; 2 === middle; 3 === right
3074 - // Note: button is not normalized, so don't use it
3075 - if ( !event.which && event.button !== undefined ) {
3076 - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
3077 - }
3078 -
3079 - return event;
 3357+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
30803358 },
30813359
3082 - // Deprecated, use jQuery.guid instead
3083 - guid: 1E8,
3084 -
3085 - // Deprecated, use jQuery.proxy instead
3086 - proxy: jQuery.proxy,
3087 -
30883360 special: {
30893361 ready: {
30903362 // Make sure the ready event is setup
3091 - setup: jQuery.bindReady,
3092 - teardown: jQuery.noop
 3363+ setup: jQuery.bindReady
30933364 },
30943365
3095 - live: {
3096 - add: function( handleObj ) {
3097 - jQuery.event.add( this,
3098 - liveConvert( handleObj.origType, handleObj.selector ),
3099 - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
3100 - },
 3366+ load: {
 3367+ // Prevent triggered image.load events from bubbling to window.load
 3368+ noBubble: true
 3369+ },
31013370
3102 - remove: function( handleObj ) {
3103 - jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
3104 - }
 3371+ focus: {
 3372+ delegateType: "focusin"
31053373 },
 3374+ blur: {
 3375+ delegateType: "focusout"
 3376+ },
31063377
31073378 beforeunload: {
31083379 setup: function( data, namespaces, eventHandle ) {
@@ -3117,9 +3388,35 @@
31183389 }
31193390 }
31203391 }
 3392+ },
 3393+
 3394+ simulate: function( type, elem, event, bubble ) {
 3395+ // Piggyback on a donor event to simulate a different one.
 3396+ // Fake originalEvent to avoid donor's stopPropagation, but if the
 3397+ // simulated event prevents default then we do the same on the donor.
 3398+ var e = jQuery.extend(
 3399+ new jQuery.Event(),
 3400+ event,
 3401+ { type: type,
 3402+ isSimulated: true,
 3403+ originalEvent: {}
 3404+ }
 3405+ );
 3406+ if ( bubble ) {
 3407+ jQuery.event.trigger( e, null, elem );
 3408+ } else {
 3409+ jQuery.event.dispatch.call( elem, e );
 3410+ }
 3411+ if ( e.isDefaultPrevented() ) {
 3412+ event.preventDefault();
 3413+ }
31213414 }
31223415 };
31233416
 3417+// Some plugins are using, but it's undocumented/deprecated and will be removed.
 3418+// The 1.7 special event interface should provide all the hooks needed now.
 3419+jQuery.event.handle = jQuery.event.dispatch;
 3420+
31243421 jQuery.removeEvent = document.removeEventListener ?
31253422 function( elem, type, handle ) {
31263423 if ( elem.removeEventListener ) {
@@ -3134,7 +3431,7 @@
31353432
31363433 jQuery.Event = function( src, props ) {
31373434 // Allow instantiation without the 'new' keyword
3138 - if ( !this.preventDefault ) {
 3435+ if ( !(this instanceof jQuery.Event) ) {
31393436 return new jQuery.Event( src, props );
31403437 }
31413438
@@ -3145,8 +3442,8 @@
31463443
31473444 // Events bubbling up the document may have been marked as prevented
31483445 // by a handler lower down the tree; reflect the correct value.
3149 - this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
3150 - src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
 3446+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
 3447+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
31513448
31523449 // Event type
31533450 } else {
@@ -3158,9 +3455,8 @@
31593456 jQuery.extend( this, props );
31603457 }
31613458
3162 - // timeStamp is buggy for some events on Firefox(#3843)
3163 - // So we won't rely on the native value
3164 - this.timeStamp = jQuery.now();
 3459+ // Create a timestamp if incoming event doesn't have one
 3460+ this.timeStamp = src && src.timeStamp || jQuery.now();
31653461
31663462 // Mark it as fixed
31673463 this[ jQuery.expando ] = true;
@@ -3216,224 +3512,141 @@
32173513 isImmediatePropagationStopped: returnFalse
32183514 };
32193515
3220 -// Checks if an event happened on an element within another element
3221 -// Used in jQuery.event.special.mouseenter and mouseleave handlers
3222 -var withinElement = function( event ) {
3223 -
3224 - // Check if mouse(over|out) are still within the same parent element
3225 - var related = event.relatedTarget,
3226 - inside = false,
3227 - eventType = event.type;
3228 -
3229 - event.type = event.data;
3230 -
3231 - if ( related !== this ) {
3232 -
3233 - if ( related ) {
3234 - inside = jQuery.contains( this, related );
3235 - }
3236 -
3237 - if ( !inside ) {
3238 -
3239 - jQuery.event.handle.apply( this, arguments );
3240 -
3241 - event.type = eventType;
3242 - }
3243 - }
3244 -},
3245 -
3246 -// In case of event delegation, we only need to rename the event.type,
3247 -// liveHandler will take care of the rest.
3248 -delegate = function( event ) {
3249 - event.type = event.data;
3250 - jQuery.event.handle.apply( this, arguments );
3251 -};
3252 -
3253 -// Create mouseenter and mouseleave events
 3516+// Create mouseenter/leave events using mouseover/out and event-time checks
32543517 jQuery.each({
32553518 mouseenter: "mouseover",
32563519 mouseleave: "mouseout"
32573520 }, function( orig, fix ) {
32583521 jQuery.event.special[ orig ] = {
3259 - setup: function( data ) {
3260 - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
3261 - },
3262 - teardown: function( data ) {
3263 - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
 3522+ delegateType: fix,
 3523+ bindType: fix,
 3524+
 3525+ handle: function( event ) {
 3526+ var target = this,
 3527+ related = event.relatedTarget,
 3528+ handleObj = event.handleObj,
 3529+ selector = handleObj.selector,
 3530+ ret;
 3531+
 3532+ // For mousenter/leave call the handler if related is outside the target.
 3533+ // NB: No relatedTarget if the mouse left/entered the browser window
 3534+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
 3535+ event.type = handleObj.origType;
 3536+ ret = handleObj.handler.apply( this, arguments );
 3537+ event.type = fix;
 3538+ }
 3539+ return ret;
32643540 }
32653541 };
32663542 });
32673543
3268 -// submit delegation
 3544+// IE submit delegation
32693545 if ( !jQuery.support.submitBubbles ) {
32703546
32713547 jQuery.event.special.submit = {
3272 - setup: function( data, namespaces ) {
3273 - if ( !jQuery.nodeName( this, "form" ) ) {
3274 - jQuery.event.add(this, "click.specialSubmit", function( e ) {
3275 - // Avoid triggering error on non-existent type attribute in IE VML (#7071)
3276 - var elem = e.target,
3277 - type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
 3548+ setup: function() {
 3549+ // Only need this for delegated form submit events
 3550+ if ( jQuery.nodeName( this, "form" ) ) {
 3551+ return false;
 3552+ }
32783553
3279 - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
3280 - trigger( "submit", this, arguments );
3281 - }
3282 - });
 3554+ // Lazy-add a submit handler when a descendant form may potentially be submitted
 3555+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
 3556+ // Node name check avoids a VML-related crash in IE (#9807)
 3557+ var elem = e.target,
 3558+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
 3559+ if ( form && !form._submit_attached ) {
 3560+ jQuery.event.add( form, "submit._submit", function( event ) {
 3561+ // If form was submitted by the user, bubble the event up the tree
 3562+ if ( this.parentNode && !event.isTrigger ) {
 3563+ jQuery.event.simulate( "submit", this.parentNode, event, true );
 3564+ }
 3565+ });
 3566+ form._submit_attached = true;
 3567+ }
 3568+ });
 3569+ // return undefined since we don't need an event listener
 3570+ },
32833571
3284 - jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
3285 - var elem = e.target,
3286 - type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
3287 -
3288 - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
3289 - trigger( "submit", this, arguments );
3290 - }
3291 - });
3292 -
3293 - } else {
 3572+ teardown: function() {
 3573+ // Only need this for delegated form submit events
 3574+ if ( jQuery.nodeName( this, "form" ) ) {
32943575 return false;
32953576 }
3296 - },
32973577
3298 - teardown: function( namespaces ) {
3299 - jQuery.event.remove( this, ".specialSubmit" );
 3578+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
 3579+ jQuery.event.remove( this, "._submit" );
33003580 }
33013581 };
3302 -
33033582 }
33043583
3305 -// change delegation, happens here so we have bind.
 3584+// IE change delegation and checkbox/radio fix
33063585 if ( !jQuery.support.changeBubbles ) {
33073586
3308 - var changeFilters,
3309 -
3310 - getVal = function( elem ) {
3311 - var type = jQuery.nodeName( elem, "input" ) ? elem.type : "",
3312 - val = elem.value;
3313 -
3314 - if ( type === "radio" || type === "checkbox" ) {
3315 - val = elem.checked;
3316 -
3317 - } else if ( type === "select-multiple" ) {
3318 - val = elem.selectedIndex > -1 ?
3319 - jQuery.map( elem.options, function( elem ) {
3320 - return elem.selected;
3321 - }).join("-") :
3322 - "";
3323 -
3324 - } else if ( jQuery.nodeName( elem, "select" ) ) {
3325 - val = elem.selectedIndex;
3326 - }
3327 -
3328 - return val;
3329 - },
3330 -
3331 - testChange = function testChange( e ) {
3332 - var elem = e.target, data, val;
3333 -
3334 - if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
3335 - return;
3336 - }
3337 -
3338 - data = jQuery._data( elem, "_change_data" );
3339 - val = getVal(elem);
3340 -
3341 - // the current data will be also retrieved by beforeactivate
3342 - if ( e.type !== "focusout" || elem.type !== "radio" ) {
3343 - jQuery._data( elem, "_change_data", val );
3344 - }
3345 -
3346 - if ( data === undefined || val === data ) {
3347 - return;
3348 - }
3349 -
3350 - if ( data != null || val ) {
3351 - e.type = "change";
3352 - e.liveFired = undefined;
3353 - jQuery.event.trigger( e, arguments[1], elem );
3354 - }
3355 - };
3356 -
33573587 jQuery.event.special.change = {
3358 - filters: {
3359 - focusout: testChange,
33603588
3361 - beforedeactivate: testChange,
 3589+ setup: function() {
33623590
3363 - click: function( e ) {
3364 - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
3365 -
3366 - if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
3367 - testChange.call( this, e );
 3591+ if ( rformElems.test( this.nodeName ) ) {
 3592+ // IE doesn't fire change on a check/radio until blur; trigger it on click
 3593+ // after a propertychange. Eat the blur-change in special.change.handle.
 3594+ // This still fires onchange a second time for check/radio after blur.
 3595+ if ( this.type === "checkbox" || this.type === "radio" ) {
 3596+ jQuery.event.add( this, "propertychange._change", function( event ) {
 3597+ if ( event.originalEvent.propertyName === "checked" ) {
 3598+ this._just_changed = true;
 3599+ }
 3600+ });
 3601+ jQuery.event.add( this, "click._change", function( event ) {
 3602+ if ( this._just_changed && !event.isTrigger ) {
 3603+ this._just_changed = false;
 3604+ jQuery.event.simulate( "change", this, event, true );
 3605+ }
 3606+ });
33683607 }
3369 - },
 3608+ return false;
 3609+ }
 3610+ // Delegated event; lazy-add a change handler on descendant inputs
 3611+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
 3612+ var elem = e.target;
33703613
3371 - // Change has to be called before submit
3372 - // Keydown will be called before keypress, which is used in submit-event delegation
3373 - keydown: function( e ) {
3374 - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
3375 -
3376 - if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
3377 - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
3378 - type === "select-multiple" ) {
3379 - testChange.call( this, e );
 3614+ if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
 3615+ jQuery.event.add( elem, "change._change", function( event ) {
 3616+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
 3617+ jQuery.event.simulate( "change", this.parentNode, event, true );
 3618+ }
 3619+ });
 3620+ elem._change_attached = true;
33803621 }
3381 - },
3382 -
3383 - // Beforeactivate happens also before the previous element is blurred
3384 - // with this event you can't trigger a change event, but you can store
3385 - // information
3386 - beforeactivate: function( e ) {
3387 - var elem = e.target;
3388 - jQuery._data( elem, "_change_data", getVal(elem) );
3389 - }
 3622+ });
33903623 },
33913624
3392 - setup: function( data, namespaces ) {
3393 - if ( this.type === "file" ) {
3394 - return false;
3395 - }
 3625+ handle: function( event ) {
 3626+ var elem = event.target;
33963627
3397 - for ( var type in changeFilters ) {
3398 - jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
 3628+ // Swallow native change events from checkbox/radio, we already triggered them above
 3629+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
 3630+ return event.handleObj.handler.apply( this, arguments );
33993631 }
3400 -
3401 - return rformElems.test( this.nodeName );
34023632 },
34033633
3404 - teardown: function( namespaces ) {
3405 - jQuery.event.remove( this, ".specialChange" );
 3634+ teardown: function() {
 3635+ jQuery.event.remove( this, "._change" );
34063636
34073637 return rformElems.test( this.nodeName );
34083638 }
34093639 };
3410 -
3411 - changeFilters = jQuery.event.special.change.filters;
3412 -
3413 - // Handle when the input is .focus()'d
3414 - changeFilters.focus = changeFilters.beforeactivate;
34153640 }
34163641
3417 -function trigger( type, elem, args ) {
3418 - // Piggyback on a donor event to simulate a different one.
3419 - // Fake originalEvent to avoid donor's stopPropagation, but if the
3420 - // simulated event prevents default then we do the same on the donor.
3421 - // Don't pass args or remember liveFired; they apply to the donor event.
3422 - var event = jQuery.extend( {}, args[ 0 ] );
3423 - event.type = type;
3424 - event.originalEvent = {};
3425 - event.liveFired = undefined;
3426 - jQuery.event.handle.call( elem, event );
3427 - if ( event.isDefaultPrevented() ) {
3428 - args[ 0 ].preventDefault();
3429 - }
3430 -}
3431 -
34323642 // Create "bubbling" focus and blur events
34333643 if ( !jQuery.support.focusinBubbles ) {
34343644 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
34353645
34363646 // Attach a single capturing handler while someone wants focusin/focusout
3437 - var attaches = 0;
 3647+ var attaches = 0,
 3648+ handler = function( event ) {
 3649+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
 3650+ };
34383651
34393652 jQuery.event.special[ fix ] = {
34403653 setup: function() {
@@ -3447,89 +3660,120 @@
34483661 }
34493662 }
34503663 };
3451 -
3452 - function handler( donor ) {
3453 - // Donor event is always a native one; fix it and switch its type.
3454 - // Let focusin/out handler cancel the donor focus/blur event.
3455 - var e = jQuery.event.fix( donor );
3456 - e.type = fix;
3457 - e.originalEvent = {};
3458 - jQuery.event.trigger( e, null, e.target );
3459 - if ( e.isDefaultPrevented() ) {
3460 - donor.preventDefault();
3461 - }
3462 - }
34633664 });
34643665 }
34653666
3466 -jQuery.each(["bind", "one"], function( i, name ) {
3467 - jQuery.fn[ name ] = function( type, data, fn ) {
3468 - var handler;
 3667+jQuery.fn.extend({
34693668
3470 - // Handle object literals
3471 - if ( typeof type === "object" ) {
3472 - for ( var key in type ) {
3473 - this[ name ](key, data, type[key], fn);
 3669+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
 3670+ var origFn, type;
 3671+
 3672+ // Types can be a map of types/handlers
 3673+ if ( typeof types === "object" ) {
 3674+ // ( types-Object, selector, data )
 3675+ if ( typeof selector !== "string" ) {
 3676+ // ( types-Object, data )
 3677+ data = selector;
 3678+ selector = undefined;
34743679 }
 3680+ for ( type in types ) {
 3681+ this.on( type, selector, data, types[ type ], one );
 3682+ }
34753683 return this;
34763684 }
34773685
3478 - if ( arguments.length === 2 || data === false ) {
3479 - fn = data;
3480 - data = undefined;
 3686+ if ( data == null && fn == null ) {
 3687+ // ( types, fn )
 3688+ fn = selector;
 3689+ data = selector = undefined;
 3690+ } else if ( fn == null ) {
 3691+ if ( typeof selector === "string" ) {
 3692+ // ( types, selector, fn )
 3693+ fn = data;
 3694+ data = undefined;
 3695+ } else {
 3696+ // ( types, data, fn )
 3697+ fn = data;
 3698+ data = selector;
 3699+ selector = undefined;
 3700+ }
34813701 }
 3702+ if ( fn === false ) {
 3703+ fn = returnFalse;
 3704+ } else if ( !fn ) {
 3705+ return this;
 3706+ }
34823707
3483 - if ( name === "one" ) {
3484 - handler = function( event ) {
3485 - jQuery( this ).unbind( event, handler );
3486 - return fn.apply( this, arguments );
 3708+ if ( one === 1 ) {
 3709+ origFn = fn;
 3710+ fn = function( event ) {
 3711+ // Can use an empty set, since event contains the info
 3712+ jQuery().off( event );
 3713+ return origFn.apply( this, arguments );
34873714 };
3488 - handler.guid = fn.guid || jQuery.guid++;
3489 - } else {
3490 - handler = fn;
 3715+ // Use same guid so caller can remove using origFn
 3716+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
34913717 }
3492 -
3493 - if ( type === "unload" && name !== "one" ) {
3494 - this.one( type, data, fn );
3495 -
3496 - } else {
3497 - for ( var i = 0, l = this.length; i < l; i++ ) {
3498 - jQuery.event.add( this[i], type, handler, data );
 3718+ return this.each( function() {
 3719+ jQuery.event.add( this, types, fn, data, selector );
 3720+ });
 3721+ },
 3722+ one: function( types, selector, data, fn ) {
 3723+ return this.on.call( this, types, selector, data, fn, 1 );
 3724+ },
 3725+ off: function( types, selector, fn ) {
 3726+ if ( types && types.preventDefault && types.handleObj ) {
 3727+ // ( event ) dispatched jQuery.Event
 3728+ var handleObj = types.handleObj;
 3729+ jQuery( types.delegateTarget ).off(
 3730+ handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
 3731+ handleObj.selector,
 3732+ handleObj.handler
 3733+ );
 3734+ return this;
 3735+ }
 3736+ if ( typeof types === "object" ) {
 3737+ // ( types-object [, selector] )
 3738+ for ( var type in types ) {
 3739+ this.off( type, selector, types[ type ] );
34993740 }
 3741+ return this;
35003742 }
 3743+ if ( selector === false || typeof selector === "function" ) {
 3744+ // ( types [, fn] )
 3745+ fn = selector;
 3746+ selector = undefined;
 3747+ }
 3748+ if ( fn === false ) {
 3749+ fn = returnFalse;
 3750+ }
 3751+ return this.each(function() {
 3752+ jQuery.event.remove( this, types, fn, selector );
 3753+ });
 3754+ },
35013755
3502 - return this;
3503 - };
3504 -});
 3756+ bind: function( types, data, fn ) {
 3757+ return this.on( types, null, data, fn );
 3758+ },
 3759+ unbind: function( types, fn ) {
 3760+ return this.off( types, null, fn );
 3761+ },
35053762
3506 -jQuery.fn.extend({
3507 - unbind: function( type, fn ) {
3508 - // Handle object literals
3509 - if ( typeof type === "object" && !type.preventDefault ) {
3510 - for ( var key in type ) {
3511 - this.unbind(key, type[key]);
3512 - }
3513 -
3514 - } else {
3515 - for ( var i = 0, l = this.length; i < l; i++ ) {
3516 - jQuery.event.remove( this[i], type, fn );
3517 - }
3518 - }
3519 -
 3763+ live: function( types, data, fn ) {
 3764+ jQuery( this.context ).on( types, this.selector, data, fn );
35203765 return this;
35213766 },
 3767+ die: function( types, fn ) {
 3768+ jQuery( this.context ).off( types, this.selector || "**", fn );
 3769+ return this;
 3770+ },
35223771
35233772 delegate: function( selector, types, data, fn ) {
3524 - return this.live( types, data, fn, selector );
 3773+ return this.on( types, selector, data, fn );
35253774 },
3526 -
35273775 undelegate: function( selector, types, fn ) {
3528 - if ( arguments.length === 0 ) {
3529 - return this.unbind( "live" );
3530 -
3531 - } else {
3532 - return this.die( types, null, fn, selector );
3533 - }
 3776+ // ( namespace ) or ( selector, types [, fn] )
 3777+ return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
35343778 },
35353779
35363780 trigger: function( type, data ) {
@@ -3537,7 +3781,6 @@
35383782 jQuery.event.trigger( type, data, this );
35393783 });
35403784 },
3541 -
35423785 triggerHandler: function( type, data ) {
35433786 if ( this[0] ) {
35443787 return jQuery.event.trigger( type, data, this[0], true );
@@ -3551,8 +3794,8 @@
35523795 i = 0,
35533796 toggler = function( event ) {
35543797 // Figure out which function to execute
3555 - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3556 - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
 3798+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
 3799+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
35573800
35583801 // Make sure that clicks stop
35593802 event.preventDefault();
@@ -3575,178 +3818,9 @@
35763819 }
35773820 });
35783821
3579 -var liveMap = {
3580 - focus: "focusin",
3581 - blur: "focusout",
3582 - mouseenter: "mouseover",
3583 - mouseleave: "mouseout"
3584 -};
3585 -
3586 -jQuery.each(["live", "die"], function( i, name ) {
3587 - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
3588 - var type, i = 0, match, namespaces, preType,
3589 - selector = origSelector || this.selector,
3590 - context = origSelector ? this : jQuery( this.context );
3591 -
3592 - if ( typeof types === "object" && !types.preventDefault ) {
3593 - for ( var key in types ) {
3594 - context[ name ]( key, data, types[key], selector );
3595 - }
3596 -
3597 - return this;
3598 - }
3599 -
3600 - if ( name === "die" && !types &&
3601 - origSelector && origSelector.charAt(0) === "." ) {
3602 -
3603 - context.unbind( origSelector );
3604 -
3605 - return this;
3606 - }
3607 -
3608 - if ( data === false || jQuery.isFunction( data ) ) {
3609 - fn = data || returnFalse;
3610 - data = undefined;
3611 - }
3612 -
3613 - types = (types || "").split(" ");
3614 -
3615 - while ( (type = types[ i++ ]) != null ) {
3616 - match = rnamespaces.exec( type );
3617 - namespaces = "";
3618 -
3619 - if ( match ) {
3620 - namespaces = match[0];
3621 - type = type.replace( rnamespaces, "" );
3622 - }
3623 -
3624 - if ( type === "hover" ) {
3625 - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
3626 - continue;
3627 - }
3628 -
3629 - preType = type;
3630 -
3631 - if ( liveMap[ type ] ) {
3632 - types.push( liveMap[ type ] + namespaces );
3633 - type = type + namespaces;
3634 -
3635 - } else {
3636 - type = (liveMap[ type ] || type) + namespaces;
3637 - }
3638 -
3639 - if ( name === "live" ) {
3640 - // bind live handler
3641 - for ( var j = 0, l = context.length; j < l; j++ ) {
3642 - jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
3643 - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
3644 - }
3645 -
3646 - } else {
3647 - // unbind live handler
3648 - context.unbind( "live." + liveConvert( type, selector ), fn );
3649 - }
3650 - }
3651 -
3652 - return this;
3653 - };
3654 -});
3655 -
3656 -function liveHandler( event ) {
3657 - var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
3658 - elems = [],
3659 - selectors = [],
3660 - events = jQuery._data( this, "events" );
3661 -
3662 - // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
3663 - if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
3664 - return;
3665 - }
3666 -
3667 - if ( event.namespace ) {
3668 - namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
3669 - }
3670 -
3671 - event.liveFired = this;
3672 -
3673 - var live = events.live.slice(0);
3674 -
3675 - for ( j = 0; j < live.length; j++ ) {
3676 - handleObj = live[j];
3677 -
3678 - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
3679 - selectors.push( handleObj.selector );
3680 -
3681 - } else {
3682 - live.splice( j--, 1 );
3683 - }
3684 - }
3685 -
3686 - match = jQuery( event.target ).closest( selectors, event.currentTarget );
3687 -
3688 - for ( i = 0, l = match.length; i < l; i++ ) {
3689 - close = match[i];
3690 -
3691 - for ( j = 0; j < live.length; j++ ) {
3692 - handleObj = live[j];
3693 -
3694 - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
3695 - elem = close.elem;
3696 - related = null;
3697 -
3698 - // Those two events require additional checking
3699 - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
3700 - event.type = handleObj.preType;
3701 - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
3702 -
3703 - // Make sure not to accidentally match a child element with the same selector
3704 - if ( related && jQuery.contains( elem, related ) ) {
3705 - related = elem;
3706 - }
3707 - }
3708 -
3709 - if ( !related || related !== elem ) {
3710 - elems.push({ elem: elem, handleObj: handleObj, level: close.level });
3711 - }
3712 - }
3713 - }
3714 - }
3715 -
3716 - for ( i = 0, l = elems.length; i < l; i++ ) {
3717 - match = elems[i];
3718 -
3719 - if ( maxLevel && match.level > maxLevel ) {
3720 - break;
3721 - }
3722 -
3723 - event.currentTarget = match.elem;
3724 - event.data = match.handleObj.data;
3725 - event.handleObj = match.handleObj;
3726 -
3727 - ret = match.handleObj.origHandler.apply( match.elem, arguments );
3728 -
3729 - if ( ret === false || event.isPropagationStopped() ) {
3730 - maxLevel = match.level;
3731 -
3732 - if ( ret === false ) {
3733 - stop = false;
3734 - }
3735 - if ( event.isImmediatePropagationStopped() ) {
3736 - break;
3737 - }
3738 - }
3739 - }
3740 -
3741 - return stop;
3742 -}
3743 -
3744 -function liveConvert( type, selector ) {
3745 - return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
3746 -}
3747 -
37483822 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
37493823 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
3750 - "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
 3824+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
37513825
37523826 // Handle event binding
37533827 jQuery.fn[ name ] = function( data, fn ) {
@@ -3756,13 +3830,21 @@
37573831 }
37583832
37593833 return arguments.length > 0 ?
3760 - this.bind( name, data, fn ) :
 3834+ this.on( name, null, data, fn ) :
37613835 this.trigger( name );
37623836 };
37633837
37643838 if ( jQuery.attrFn ) {
37653839 jQuery.attrFn[ name ] = true;
37663840 }
 3841+
 3842+ if ( rkeyEvent.test( name ) ) {
 3843+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
 3844+ }
 3845+
 3846+ if ( rmouseEvent.test( name ) ) {
 3847+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
 3848+ }
37673849 });
37683850
37693851
@@ -3776,11 +3858,13 @@
37773859 (function(){
37783860
37793861 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
 3862+ expando = "sizcache" + (Math.random() + '').replace('.', ''),
37803863 done = 0,
37813864 toString = Object.prototype.toString,
37823865 hasDuplicate = false,
37833866 baseHasDuplicate = true,
37843867 rBackslash = /\\/g,
 3868+ rReturn = /\r\n/g,
37853869 rNonWord = /\W/;
37863870
37873871 // Here we check if the JavaScript engine is using some sort of
@@ -3832,7 +3916,7 @@
38333917 if ( parts.length > 1 && origPOS.exec( selector ) ) {
38343918
38353919 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
3836 - set = posProcess( parts[0] + parts[1], context );
 3920+ set = posProcess( parts[0] + parts[1], context, seed );
38373921
38383922 } else {
38393923 set = Expr.relative[ parts[0] ] ?
@@ -3846,7 +3930,7 @@
38473931 selector += parts.shift();
38483932 }
38493933
3850 - set = posProcess( selector, set );
 3934+ set = posProcess( selector, set, seed );
38513935 }
38523936 }
38533937
@@ -3965,18 +4049,17 @@
39664050 };
39674051
39684052 Sizzle.find = function( expr, context, isXML ) {
3969 - var set;
 4053+ var set, i, len, match, type, left;
39704054
39714055 if ( !expr ) {
39724056 return [];
39734057 }
39744058
3975 - for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
3976 - var match,
3977 - type = Expr.order[i];
 4059+ for ( i = 0, len = Expr.order.length; i < len; i++ ) {
 4060+ type = Expr.order[i];
39784061
39794062 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
3980 - var left = match[1];
 4063+ left = match[1];
39814064 match.splice( 1, 1 );
39824065
39834066 if ( left.substr( left.length - 1 ) !== "\\" ) {
@@ -4002,17 +4085,18 @@
40034086
40044087 Sizzle.filter = function( expr, set, inplace, not ) {
40054088 var match, anyFound,
 4089+ type, found, item, filter, left,
 4090+ i, pass,
40064091 old = expr,
40074092 result = [],
40084093 curLoop = set,
40094094 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
40104095
40114096 while ( expr && set.length ) {
4012 - for ( var type in Expr.filter ) {
 4097+ for ( type in Expr.filter ) {
40134098 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
4014 - var found, item,
4015 - filter = Expr.filter[ type ],
4016 - left = match[1];
 4099+ filter = Expr.filter[ type ];
 4100+ left = match[1];
40174101
40184102 anyFound = false;
40194103
@@ -4038,10 +4122,10 @@
40394123 }
40404124
40414125 if ( match ) {
4042 - for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
 4126+ for ( i = 0; (item = curLoop[i]) != null; i++ ) {
40434127 if ( item ) {
40444128 found = filter( item, match, i, curLoop );
4045 - var pass = not ^ !!found;
 4129+ pass = not ^ found;
40464130
40474131 if ( inplace && found != null ) {
40484132 if ( pass ) {
@@ -4092,9 +4176,48 @@
40934177 };
40944178
40954179 Sizzle.error = function( msg ) {
4096 - throw "Syntax error, unrecognized expression: " + msg;
 4180+ throw new Error( "Syntax error, unrecognized expression: " + msg );
40974181 };
40984182
 4183+/**
 4184+ * Utility function for retreiving the text value of an array of DOM nodes
 4185+ * @param {Array|Element} elem
 4186+ */
 4187+var getText = Sizzle.getText = function( elem ) {
 4188+ var i, node,
 4189+ nodeType = elem.nodeType,
 4190+ ret = "";
 4191+
 4192+ if ( nodeType ) {
 4193+ if ( nodeType === 1 || nodeType === 9 ) {
 4194+ // Use textContent || innerText for elements
 4195+ if ( typeof elem.textContent === 'string' ) {
 4196+ return elem.textContent;
 4197+ } else if ( typeof elem.innerText === 'string' ) {
 4198+ // Replace IE's carriage returns
 4199+ return elem.innerText.replace( rReturn, '' );
 4200+ } else {
 4201+ // Traverse it's children
 4202+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
 4203+ ret += getText( elem );
 4204+ }
 4205+ }
 4206+ } else if ( nodeType === 3 || nodeType === 4 ) {
 4207+ return elem.nodeValue;
 4208+ }
 4209+ } else {
 4210+
 4211+ // If no nodeType, this is expected to be an array
 4212+ for ( i = 0; (node = elem[i]); i++ ) {
 4213+ // Do not traverse comment nodes
 4214+ if ( node.nodeType !== 8 ) {
 4215+ ret += getText( node );
 4216+ }
 4217+ }
 4218+ }
 4219+ return ret;
 4220+};
 4221+
40994222 var Expr = Sizzle.selectors = {
41004223 order: [ "ID", "NAME", "TAG" ],
41014224
@@ -4482,7 +4605,7 @@
44834606 return filter( elem, i, match, array );
44844607
44854608 } else if ( name === "contains" ) {
4486 - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
 4609+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
44874610
44884611 } else if ( name === "not" ) {
44894612 var not = match[3];
@@ -4501,7 +4624,10 @@
45024625 },
45034626
45044627 CHILD: function( elem, match ) {
4505 - var type = match[1],
 4628+ var first, last,
 4629+ doneName, parent, cache,
 4630+ count, diff,
 4631+ type = match[1],
45064632 node = elem;
45074633
45084634 switch ( type ) {
@@ -4529,18 +4655,18 @@
45304656 return true;
45314657
45324658 case "nth":
4533 - var first = match[2],
4534 - last = match[3];
 4659+ first = match[2];
 4660+ last = match[3];
45354661
45364662 if ( first === 1 && last === 0 ) {
45374663 return true;
45384664 }
45394665
4540 - var doneName = match[0],
4541 - parent = elem.parentNode;
 4666+ doneName = match[0];
 4667+ parent = elem.parentNode;
45424668
4543 - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
4544 - var count = 0;
 4669+ if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
 4670+ count = 0;
45454671
45464672 for ( node = parent.firstChild; node; node = node.nextSibling ) {
45474673 if ( node.nodeType === 1 ) {
@@ -4548,10 +4674,10 @@
45494675 }
45504676 }
45514677
4552 - parent.sizcache = doneName;
 4678+ parent[ expando ] = doneName;
45534679 }
45544680
4555 - var diff = elem.nodeIndex - last;
 4681+ diff = elem.nodeIndex - last;
45564682
45574683 if ( first === 0 ) {
45584684 return diff === 0;
@@ -4567,7 +4693,7 @@
45684694 },
45694695
45704696 TAG: function( elem, match ) {
4571 - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
 4697+ return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
45724698 },
45734699
45744700 CLASS: function( elem, match ) {
@@ -4577,7 +4703,9 @@
45784704
45794705 ATTR: function( elem, match ) {
45804706 var name = match[1],
4581 - result = Expr.attrHandle[ name ] ?
 4707+ result = Sizzle.attr ?
 4708+ Sizzle.attr( elem, name ) :
 4709+ Expr.attrHandle[ name ] ?
45824710 Expr.attrHandle[ name ]( elem ) :
45834711 elem[ name ] != null ?
45844712 elem[ name ] :
@@ -4588,6 +4716,8 @@
45894717
45904718 return result == null ?
45914719 type === "!=" :
 4720+ !type && Sizzle.attr ?
 4721+ result != null :
45924722 type === "=" ?
45934723 value === check :
45944724 type === "*=" ?
@@ -4768,26 +4898,6 @@
47694899 };
47704900 }
47714901
4772 -// Utility function for retreiving the text value of an array of DOM nodes
4773 -Sizzle.getText = function( elems ) {
4774 - var ret = "", elem;
4775 -
4776 - for ( var i = 0; elems[i]; i++ ) {
4777 - elem = elems[i];
4778 -
4779 - // Get the text from text nodes and CDATA nodes
4780 - if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
4781 - ret += elem.nodeValue;
4782 -
4783 - // Traverse everything else, except comment nodes
4784 - } else if ( elem.nodeType !== 8 ) {
4785 - ret += Sizzle.getText( elem.childNodes );
4786 - }
4787 - }
4788 -
4789 - return ret;
4790 -};
4791 -
47924902 // Check to see if the browser returns elements by name when
47934903 // querying by getElementById (and provide a workaround)
47944904 (function(){
@@ -5065,13 +5175,13 @@
50665176 elem = elem[dir];
50675177
50685178 while ( elem ) {
5069 - if ( elem.sizcache === doneName ) {
 5179+ if ( elem[ expando ] === doneName ) {
50705180 match = checkSet[elem.sizset];
50715181 break;
50725182 }
50735183
50745184 if ( elem.nodeType === 1 && !isXML ){
5075 - elem.sizcache = doneName;
 5185+ elem[ expando ] = doneName;
50765186 elem.sizset = i;
50775187 }
50785188
@@ -5098,14 +5208,14 @@
50995209 elem = elem[dir];
51005210
51015211 while ( elem ) {
5102 - if ( elem.sizcache === doneName ) {
 5212+ if ( elem[ expando ] === doneName ) {
51035213 match = checkSet[elem.sizset];
51045214 break;
51055215 }
51065216
51075217 if ( elem.nodeType === 1 ) {
51085218 if ( !isXML ) {
5109 - elem.sizcache = doneName;
 5219+ elem[ expando ] = doneName;
51105220 elem.sizset = i;
51115221 }
51125222
@@ -5153,7 +5263,7 @@
51545264 return documentElement ? documentElement.nodeName !== "HTML" : false;
51555265 };
51565266
5157 -var posProcess = function( selector, context ) {
 5267+var posProcess = function( selector, context, seed ) {
51585268 var match,
51595269 tmpSet = [],
51605270 later = "",
@@ -5169,13 +5279,16 @@
51705280 selector = Expr.relative[selector] ? selector + "*" : selector;
51715281
51725282 for ( var i = 0, l = root.length; i < l; i++ ) {
5173 - Sizzle( selector, root[i], tmpSet );
 5283+ Sizzle( selector, root[i], tmpSet, seed );
51745284 }
51755285
51765286 return Sizzle.filter( later, tmpSet );
51775287 };
51785288
51795289 // EXPOSE
 5290+// Override sizzle attribute retrieval
 5291+Sizzle.attr = jQuery.attr;
 5292+Sizzle.selectors.attrMap = {};
51805293 jQuery.find = Sizzle;
51815294 jQuery.expr = Sizzle.selectors;
51825295 jQuery.expr[":"] = jQuery.expr.filters;
@@ -5261,43 +5374,33 @@
52625375 },
52635376
52645377 is: function( selector ) {
5265 - return !!selector && ( typeof selector === "string" ?
5266 - jQuery.filter( selector, this ).length > 0 :
5267 - this.filter( selector ).length > 0 );
 5378+ return !!selector && (
 5379+ typeof selector === "string" ?
 5380+ // If this is a positional selector, check membership in the returned set
 5381+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
 5382+ POS.test( selector ) ?
 5383+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
 5384+ jQuery.filter( selector, this ).length > 0 :
 5385+ this.filter( selector ).length > 0 );
52685386 },
52695387
52705388 closest: function( selectors, context ) {
52715389 var ret = [], i, l, cur = this[0];
52725390
5273 - // Array
 5391+ // Array (deprecated as of jQuery 1.7)
52745392 if ( jQuery.isArray( selectors ) ) {
5275 - var match, selector,
5276 - matches = {},
5277 - level = 1;
 5393+ var level = 1;
52785394
5279 - if ( cur && selectors.length ) {
5280 - for ( i = 0, l = selectors.length; i < l; i++ ) {
5281 - selector = selectors[i];
 5395+ while ( cur && cur.ownerDocument && cur !== context ) {
 5396+ for ( i = 0; i < selectors.length; i++ ) {
52825397
5283 - if ( !matches[ selector ] ) {
5284 - matches[ selector ] = POS.test( selector ) ?
5285 - jQuery( selector, context || this.context ) :
5286 - selector;
 5398+ if ( jQuery( cur ).is( selectors[ i ] ) ) {
 5399+ ret.push({ selector: selectors[ i ], elem: cur, level: level });
52875400 }
52885401 }
52895402
5290 - while ( cur && cur.ownerDocument && cur !== context ) {
5291 - for ( selector in matches ) {
5292 - match = matches[ selector ];
5293 -
5294 - if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
5295 - ret.push({ selector: selector, elem: cur, level: level });
5296 - }
5297 - }
5298 -
5299 - cur = cur.parentNode;
5300 - level++;
5301 - }
 5403+ cur = cur.parentNode;
 5404+ level++;
53025405 }
53035406
53045407 return ret;
@@ -5414,12 +5517,7 @@
54155518 }
54165519 }, function( name, fn ) {
54175520 jQuery.fn[ name ] = function( until, selector ) {
5418 - var ret = jQuery.map( this, fn, until ),
5419 - // The variable 'args' was introduced in
5420 - // https://github.com/jquery/jquery/commit/52a0238
5421 - // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
5422 - // http://code.google.com/p/v8/issues/detail?id=1050
5423 - args = slice.call(arguments);
 5521+ var ret = jQuery.map( this, fn, until );
54245522
54255523 if ( !runtil.test( name ) ) {
54265524 selector = until;
@@ -5435,7 +5533,7 @@
54365534 ret = ret.reverse();
54375535 }
54385536
5439 - return this.pushStack( ret, name, args.join(",") );
 5537+ return this.pushStack( ret, name, slice.call( arguments ).join(",") );
54405538 };
54415539 });
54425540
@@ -5504,7 +5602,7 @@
55055603
55065604 } else if ( qualifier.nodeType ) {
55075605 return jQuery.grep(elements, function( elem, i ) {
5508 - return (elem === qualifier) === keep;
 5606+ return ( elem === qualifier ) === keep;
55095607 });
55105608
55115609 } else if ( typeof qualifier === "string" ) {
@@ -5520,20 +5618,38 @@
55215619 }
55225620
55235621 return jQuery.grep(elements, function( elem, i ) {
5524 - return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
 5622+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
55255623 });
55265624 }
55275625
55285626
55295627
55305628
5531 -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
 5629+function createSafeFragment( document ) {
 5630+ var list = nodeNames.split( "|" ),
 5631+ safeFrag = document.createDocumentFragment();
 5632+
 5633+ if ( safeFrag.createElement ) {
 5634+ while ( list.length ) {
 5635+ safeFrag.createElement(
 5636+ list.pop()
 5637+ );
 5638+ }
 5639+ }
 5640+ return safeFrag;
 5641+}
 5642+
 5643+var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" +
 5644+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
 5645+ rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
55325646 rleadingWhitespace = /^\s+/,
55335647 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
55345648 rtagName = /<([\w:]+)/,
55355649 rtbody = /<tbody/i,
55365650 rhtml = /<|&#?\w+;/,
 5651+ rnoInnerhtml = /<(?:script|style)/i,
55375652 rnocache = /<(?:script|object|embed|option|style)/i,
 5653+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
55385654 // checked="checked" or checked
55395655 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
55405656 rscriptType = /\/(java|ecma)script/i,
@@ -5547,7 +5663,8 @@
55485664 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
55495665 area: [ 1, "<map>", "</map>" ],
55505666 _default: [ 0, "", "" ]
5551 - };
 5667+ },
 5668+ safeFragment = createSafeFragment( document );
55525669
55535670 wrapMap.optgroup = wrapMap.option;
55545671 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
@@ -5625,8 +5742,10 @@
56265743 },
56275744
56285745 wrap: function( html ) {
5629 - return this.each(function() {
5630 - jQuery( this ).wrapAll( html );
 5746+ var isFunction = jQuery.isFunction( html );
 5747+
 5748+ return this.each(function(i) {
 5749+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
56315750 });
56325751 },
56335752
@@ -5660,7 +5779,7 @@
56615780 this.parentNode.insertBefore( elem, this );
56625781 });
56635782 } else if ( arguments.length ) {
5664 - var set = jQuery(arguments[0]);
 5783+ var set = jQuery.clean( arguments );
56655784 set.push.apply( set, this.toArray() );
56665785 return this.pushStack( set, "before", arguments );
56675786 }
@@ -5673,7 +5792,7 @@
56745793 });
56755794 } else if ( arguments.length ) {
56765795 var set = this.pushStack( this, "after", arguments );
5677 - set.push.apply( set, jQuery(arguments[0]).toArray() );
 5796+ set.push.apply( set, jQuery.clean(arguments) );
56785797 return set;
56795798 }
56805799 },
@@ -5728,7 +5847,7 @@
57295848 null;
57305849
57315850 // See if we can take a shortcut and just use innerHTML
5732 - } else if ( typeof value === "string" && !rnocache.test( value ) &&
 5851+ } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
57335852 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
57345853 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
57355854
@@ -5854,7 +5973,7 @@
58555974 // in certain situations (Bug #8070).
58565975 // Fragments from the fragment cache must always be cloned and never used
58575976 // in place.
5858 - results.cacheable || (l > 1 && i < lastIndex) ?
 5977+ results.cacheable || ( l > 1 && i < lastIndex ) ?
58595978 jQuery.clone( fragment, true, true ) :
58605979 fragment
58615980 );
@@ -5883,27 +6002,26 @@
58846003 return;
58856004 }
58866005
5887 - var internalKey = jQuery.expando,
5888 - oldData = jQuery.data( src ),
5889 - curData = jQuery.data( dest, oldData );
 6006+ var type, i, l,
 6007+ oldData = jQuery._data( src ),
 6008+ curData = jQuery._data( dest, oldData ),
 6009+ events = oldData.events;
58906010
5891 - // Switch to use the internal data object, if it exists, for the next
5892 - // stage of data copying
5893 - if ( (oldData = oldData[ internalKey ]) ) {
5894 - var events = oldData.events;
5895 - curData = curData[ internalKey ] = jQuery.extend({}, oldData);
 6011+ if ( events ) {
 6012+ delete curData.handle;
 6013+ curData.events = {};
58966014
5897 - if ( events ) {
5898 - delete curData.handle;
5899 - curData.events = {};
5900 -
5901 - for ( var type in events ) {
5902 - for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
5903 - jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
5904 - }
 6015+ for ( type in events ) {
 6016+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
 6017+ jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
59056018 }
59066019 }
59076020 }
 6021+
 6022+ // make the cloned public data object a copy from the original
 6023+ if ( curData.data ) {
 6024+ curData.data = jQuery.extend( {}, curData.data );
 6025+ }
59086026 }
59096027
59106028 function cloneFixAttributes( src, dest ) {
@@ -5965,16 +6083,17 @@
59666084 }
59676085
59686086 jQuery.buildFragment = function( args, nodes, scripts ) {
5969 - var fragment, cacheable, cacheresults, doc;
 6087+ var fragment, cacheable, cacheresults, doc,
 6088+ first = args[ 0 ];
59706089
5971 - // nodes may contain either an explicit document object,
5972 - // a jQuery collection or context object.
5973 - // If nodes[0] contains a valid object to assign to doc
5974 - if ( nodes && nodes[0] ) {
5975 - doc = nodes[0].ownerDocument || nodes[0];
5976 - }
 6090+ // nodes may contain either an explicit document object,
 6091+ // a jQuery collection or context object.
 6092+ // If nodes[0] contains a valid object to assign to doc
 6093+ if ( nodes && nodes[0] ) {
 6094+ doc = nodes[0].ownerDocument || nodes[0];
 6095+ }
59776096
5978 - // Ensure that an attr object doesn't incorrectly stand in as a document object
 6097+ // Ensure that an attr object doesn't incorrectly stand in as a document object
59796098 // Chrome and Firefox seem to allow this to occur and will throw exception
59806099 // Fixes #8950
59816100 if ( !doc.createDocumentFragment ) {
@@ -5985,12 +6104,15 @@
59866105 // Cloning options loses the selected state, so don't cache them
59876106 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
59886107 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5989 - if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5990 - args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
 6108+ // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
 6109+ if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
 6110+ first.charAt(0) === "<" && !rnocache.test( first ) &&
 6111+ (jQuery.support.checkClone || !rchecked.test( first )) &&
 6112+ (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
59916113
59926114 cacheable = true;
59936115
5994 - cacheresults = jQuery.fragments[ args[0] ];
 6116+ cacheresults = jQuery.fragments[ first ];
59956117 if ( cacheresults && cacheresults !== 1 ) {
59966118 fragment = cacheresults;
59976119 }
@@ -6002,7 +6124,7 @@
60036125 }
60046126
60056127 if ( cacheable ) {
6006 - jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
 6128+ jQuery.fragments[ first ] = cacheresults ? fragment : 1;
60076129 }
60086130
60096131 return { fragment: fragment, cacheable: cacheable };
@@ -6028,7 +6150,7 @@
60296151
60306152 } else {
60316153 for ( var i = 0, l = insert.length; i < l; i++ ) {
6032 - var elems = (i > 0 ? this.clone(true) : this).get();
 6154+ var elems = ( i > 0 ? this.clone(true) : this ).get();
60336155 jQuery( insert[i] )[ original ]( elems );
60346156 ret = ret.concat( elems );
60356157 }
@@ -6039,10 +6161,10 @@
60406162 });
60416163
60426164 function getAll( elem ) {
6043 - if ( "getElementsByTagName" in elem ) {
 6165+ if ( typeof elem.getElementsByTagName !== "undefined" ) {
60446166 return elem.getElementsByTagName( "*" );
60456167
6046 - } else if ( "querySelectorAll" in elem ) {
 6168+ } else if ( typeof elem.querySelectorAll !== "undefined" ) {
60476169 return elem.querySelectorAll( "*" );
60486170
60496171 } else {
@@ -6058,19 +6180,33 @@
60596181 }
60606182 // Finds all inputs and passes them to fixDefaultChecked
60616183 function findInputs( elem ) {
6062 - if ( jQuery.nodeName( elem, "input" ) ) {
 6184+ var nodeName = ( elem.nodeName || "" ).toLowerCase();
 6185+ if ( nodeName === "input" ) {
60636186 fixDefaultChecked( elem );
6064 - } else if ( "getElementsByTagName" in elem ) {
 6187+ // Skip scripts, get other children
 6188+ } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
60656189 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
60666190 }
60676191 }
60686192
 6193+// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
 6194+function shimCloneNode( elem ) {
 6195+ var div = document.createElement( "div" );
 6196+ safeFragment.appendChild( div );
 6197+
 6198+ div.innerHTML = elem.outerHTML;
 6199+ return div.firstChild;
 6200+}
 6201+
60696202 jQuery.extend({
60706203 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6071 - var clone = elem.cloneNode(true),
6072 - srcElements,
6073 - destElements,
6074 - i;
 6204+ var srcElements,
 6205+ destElements,
 6206+ i,
 6207+ // IE<=8 does not properly clone detached, unknown element nodes
 6208+ clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
 6209+ elem.cloneNode( true ) :
 6210+ shimCloneNode( elem );
60756211
60766212 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
60776213 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
@@ -6082,8 +6218,7 @@
60836219
60846220 cloneFixAttributes( elem, clone );
60856221
6086 - // Using Sizzle here is crazy slow, so we use getElementsByTagName
6087 - // instead
 6222+ // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
60886223 srcElements = getAll( elem );
60896224 destElements = getAll( clone );
60906225
@@ -6148,11 +6283,20 @@
61496284 elem = elem.replace(rxhtmlTag, "<$1></$2>");
61506285
61516286 // Trim whitespace, otherwise indexOf won't work as expected
6152 - var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
 6287+ var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
61536288 wrap = wrapMap[ tag ] || wrapMap._default,
61546289 depth = wrap[0],
61556290 div = context.createElement("div");
61566291
 6292+ // Append wrapper element to unknown element safe doc fragment
 6293+ if ( context === document ) {
 6294+ // Use the fragment we've already created for this document
 6295+ safeFragment.appendChild( div );
 6296+ } else {
 6297+ // Use a fragment created with the owner document
 6298+ createSafeFragment( context ).appendChild( div );
 6299+ }
 6300+
61576301 // Go to html and back, then peel off extra wrappers
61586302 div.innerHTML = wrap[1] + elem + wrap[2];
61596303
@@ -6233,7 +6377,9 @@
62346378 },
62356379
62366380 cleanData: function( elems ) {
6237 - var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
 6381+ var data, id,
 6382+ cache = jQuery.cache,
 6383+ special = jQuery.event.special,
62386384 deleteExpando = jQuery.support.deleteExpando;
62396385
62406386 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
@@ -6244,7 +6390,7 @@
62456391 id = elem[ jQuery.expando ];
62466392
62476393 if ( id ) {
6248 - data = cache[ id ] && cache[ id ][ internalKey ];
 6394+ data = cache[ id ];
62496395
62506396 if ( data && data.events ) {
62516397 for ( var type in data.events ) {
@@ -6506,7 +6652,7 @@
65076653 set: function( elem, value ) {
65086654 var style = elem.style,
65096655 currentStyle = elem.currentStyle,
6510 - opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")",
 6656+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
65116657 filter = currentStyle && currentStyle.filter || style.filter || "";
65126658
65136659 // IE has trouble with opacity if it does not have layout
@@ -6563,11 +6709,8 @@
65646710
65656711 name = name.replace( rupper, "-$1" ).toLowerCase();
65666712
6567 - if ( !(defaultView = elem.ownerDocument.defaultView) ) {
6568 - return undefined;
6569 - }
6570 -
6571 - if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
 6713+ if ( (defaultView = elem.ownerDocument.defaultView) &&
 6714+ (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
65726715 ret = computedStyle.getPropertyValue( name );
65736716 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
65746717 ret = jQuery.style( elem, name );
@@ -6580,25 +6723,32 @@
65816724
65826725 if ( document.documentElement.currentStyle ) {
65836726 currentStyle = function( elem, name ) {
6584 - var left,
 6727+ var left, rsLeft, uncomputed,
65856728 ret = elem.currentStyle && elem.currentStyle[ name ],
6586 - rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
65876729 style = elem.style;
65886730
 6731+ // Avoid setting ret to empty string here
 6732+ // so we don't default to auto
 6733+ if ( ret === null && style && (uncomputed = style[ name ]) ) {
 6734+ ret = uncomputed;
 6735+ }
 6736+
65896737 // From the awesome hack by Dean Edwards
65906738 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
65916739
65926740 // If we're not dealing with a regular pixel number
65936741 // but a number that has a weird ending, we need to convert it to pixels
65946742 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
 6743+
65956744 // Remember the original values
65966745 left = style.left;
 6746+ rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
65976747
65986748 // Put in the new values to get a computed value out
65996749 if ( rsLeft ) {
66006750 elem.runtimeStyle.left = elem.currentStyle.left;
66016751 }
6602 - style.left = name === "fontSize" ? "1em" : (ret || 0);
 6752+ style.left = name === "fontSize" ? "1em" : ( ret || 0 );
66036753 ret = style.pixelLeft + "px";
66046754
66056755 // Revert the changed values
@@ -6618,20 +6768,22 @@
66196769
66206770 // Start with offset property
66216771 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6622 - which = name === "width" ? cssWidth : cssHeight;
 6772+ which = name === "width" ? cssWidth : cssHeight,
 6773+ i = 0,
 6774+ len = which.length;
66236775
66246776 if ( val > 0 ) {
66256777 if ( extra !== "border" ) {
6626 - jQuery.each( which, function() {
 6778+ for ( ; i < len; i++ ) {
66276779 if ( !extra ) {
6628 - val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
 6780+ val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
66296781 }
66306782 if ( extra === "margin" ) {
6631 - val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
 6783+ val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
66326784 } else {
6633 - val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
 6785+ val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
66346786 }
6635 - });
 6787+ }
66366788 }
66376789
66386790 return val + "px";
@@ -6647,15 +6799,15 @@
66486800
66496801 // Add padding, border, margin
66506802 if ( extra ) {
6651 - jQuery.each( which, function() {
6652 - val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
 6803+ for ( ; i < len; i++ ) {
 6804+ val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
66536805 if ( extra !== "padding" ) {
6654 - val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
 6806+ val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
66556807 }
66566808 if ( extra === "margin" ) {
6657 - val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
 6809+ val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
66586810 }
6659 - });
 6811+ }
66606812 }
66616813
66626814 return val + "px";
@@ -6666,7 +6818,7 @@
66676819 var width = elem.offsetWidth,
66686820 height = elem.offsetHeight;
66696821
6670 - return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
 6822+ return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
66716823 };
66726824
66736825 jQuery.expr.filters.visible = function( elem ) {
@@ -6720,7 +6872,7 @@
67216873
67226874 // Document location segments
67236875 ajaxLocParts,
6724 -
 6876+
67256877 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
67266878 allTypes = ["*/"] + ["*"];
67276879
@@ -6759,7 +6911,7 @@
67606912 placeBefore;
67616913
67626914 // For each dataType in the dataTypeExpression
6763 - for(; i < length; i++ ) {
 6915+ for ( ; i < length; i++ ) {
67646916 dataType = dataTypes[ i ];
67656917 // We control if we're asked to add before
67666918 // any existing element
@@ -6790,7 +6942,7 @@
67916943 executeOnly = ( structure === prefilters ),
67926944 selection;
67936945
6794 - for(; i < length && ( executeOnly || !selection ); i++ ) {
 6946+ for ( ; i < length && ( executeOnly || !selection ); i++ ) {
67956947 selection = list[ i ]( options, originalOptions, jqXHR );
67966948 // If we got redirected to another dataType
67976949 // we try there if executing only and not done already
@@ -6821,7 +6973,7 @@
68226974 function ajaxExtend( target, src ) {
68236975 var key, deep,
68246976 flatOptions = jQuery.ajaxSettings.flatOptions || {};
6825 - for( key in src ) {
 6977+ for ( key in src ) {
68266978 if ( src[ key ] !== undefined ) {
68276979 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
68286980 }
@@ -6938,7 +7090,7 @@
69397091 // Attach a bunch of functions for handling common AJAX events
69407092 jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
69417093 jQuery.fn[ o ] = function( f ){
6942 - return this.bind( o, f );
 7094+ return this.on( o, f );
69437095 };
69447096 });
69457097
@@ -7080,7 +7232,7 @@
70817233 jQuery( callbackContext ) : jQuery.event,
70827234 // Deferreds
70837235 deferred = jQuery.Deferred(),
7084 - completeDeferred = jQuery._Deferred(),
 7236+ completeDeferred = jQuery.Callbacks( "once memory" ),
70857237 // Status-dependent callbacks
70867238 statusCode = s.statusCode || {},
70877239 // ifModified key
@@ -7230,7 +7382,7 @@
72317383 // We extract error from statusText
72327384 // then normalize statusText and status for non-aborts
72337385 error = statusText;
7234 - if( !statusText || status ) {
 7386+ if ( !statusText || status ) {
72357387 statusText = "error";
72367388 if ( status < 0 ) {
72377389 status = 0;
@@ -7259,7 +7411,7 @@
72607412 }
72617413
72627414 // Complete
7263 - completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
 7415+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
72647416
72657417 if ( fireGlobals ) {
72667418 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
@@ -7274,14 +7426,14 @@
72757427 deferred.promise( jqXHR );
72767428 jqXHR.success = jqXHR.done;
72777429 jqXHR.error = jqXHR.fail;
7278 - jqXHR.complete = completeDeferred.done;
 7430+ jqXHR.complete = completeDeferred.add;
72797431
72807432 // Status-dependent callbacks
72817433 jqXHR.statusCode = function( map ) {
72827434 if ( map ) {
72837435 var tmp;
72847436 if ( state < 2 ) {
7285 - for( tmp in map ) {
 7437+ for ( tmp in map ) {
72867438 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
72877439 }
72887440 } else {
@@ -7358,7 +7510,7 @@
73597511 ret = s.url.replace( rts, "$1_=" + ts );
73607512
73617513 // if nothing was replaced, add timestamp to the end
7362 - s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
 7514+ s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
73637515 }
73647516 }
73657517
@@ -7432,7 +7584,7 @@
74337585 done( -1, e );
74347586 // Simply rethrow otherwise
74357587 } else {
7436 - jQuery.error( e );
 7588+ throw e;
74377589 }
74387590 }
74397591 }
@@ -7536,7 +7688,7 @@
75377689 firstDataType;
75387690
75397691 // Fill responseXXX fields
7540 - for( type in responseFields ) {
 7692+ for ( type in responseFields ) {
75417693 if ( type in responses ) {
75427694 jqXHR[ responseFields[type] ] = responses[ type ];
75437695 }
@@ -7615,13 +7767,13 @@
76167768 conv2;
76177769
76187770 // For each dataType in the chain
7619 - for( i = 1; i < length; i++ ) {
 7771+ for ( i = 1; i < length; i++ ) {
76207772
76217773 // Create converters map
76227774 // with lowercased keys
76237775 if ( i === 1 ) {
7624 - for( key in s.converters ) {
7625 - if( typeof key === "string" ) {
 7776+ for ( key in s.converters ) {
 7777+ if ( typeof key === "string" ) {
76267778 converters[ key.toLowerCase() ] = s.converters[ key ];
76277779 }
76287780 }
@@ -7632,7 +7784,7 @@
76337785 current = dataTypes[ i ];
76347786
76357787 // If current is auto dataType, update it to prev
7636 - if( current === "*" ) {
 7788+ if ( current === "*" ) {
76377789 current = prev;
76387790 // If no auto and dataTypes are actually different
76397791 } else if ( prev !== "*" && prev !== current ) {
@@ -7644,7 +7796,7 @@
76457797 // If there is no direct converter, search transitively
76467798 if ( !conv ) {
76477799 conv2 = undefined;
7648 - for( conv1 in converters ) {
 7800+ for ( conv1 in converters ) {
76497801 tmp = conv1.split( " " );
76507802 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
76517803 conv2 = converters[ tmp[1] + " " + current ];
@@ -8083,11 +8235,11 @@
80848236 var elem, display;
80858237
80868238 if ( speed || speed === 0 ) {
8087 - return this.animate( genFx("show", 3), speed, easing, callback);
 8239+ return this.animate( genFx("show", 3), speed, easing, callback );
80888240
80898241 } else {
80908242 for ( var i = 0, j = this.length; i < j; i++ ) {
8091 - elem = this[i];
 8243+ elem = this[ i ];
80928244
80938245 if ( elem.style ) {
80948246 display = elem.style.display;
@@ -8101,8 +8253,8 @@
81028254 // Set elements which have been overridden with display: none
81038255 // in a stylesheet to whatever the default browser style is
81048256 // for such an element
8105 - if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
8106 - jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
 8257+ if ( display === "" && jQuery.css(elem, "display") === "none" ) {
 8258+ jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
81078259 }
81088260 }
81098261 }
@@ -8110,13 +8262,13 @@
81118263 // Set the display of most of the elements in a second loop
81128264 // to avoid the constant reflow
81138265 for ( i = 0; i < j; i++ ) {
8114 - elem = this[i];
 8266+ elem = this[ i ];
81158267
81168268 if ( elem.style ) {
81178269 display = elem.style.display;
81188270
81198271 if ( display === "" || display === "none" ) {
8120 - elem.style.display = jQuery._data(elem, "olddisplay") || "";
 8272+ elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
81218273 }
81228274 }
81238275 }
@@ -8130,12 +8282,17 @@
81318283 return this.animate( genFx("hide", 3), speed, easing, callback);
81328284
81338285 } else {
8134 - for ( var i = 0, j = this.length; i < j; i++ ) {
8135 - if ( this[i].style ) {
8136 - var display = jQuery.css( this[i], "display" );
 8286+ var elem, display,
 8287+ i = 0,
 8288+ j = this.length;
81378289
8138 - if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
8139 - jQuery._data( this[i], "olddisplay", display );
 8290+ for ( ; i < j; i++ ) {
 8291+ elem = this[i];
 8292+ if ( elem.style ) {
 8293+ display = jQuery.css( elem, "display" );
 8294+
 8295+ if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
 8296+ jQuery._data( elem, "olddisplay", display );
81408297 }
81418298 }
81428299 }
@@ -8180,7 +8337,7 @@
81818338 },
81828339
81838340 animate: function( prop, speed, easing, callback ) {
8184 - var optall = jQuery.speed(speed, easing, callback);
 8341+ var optall = jQuery.speed( speed, easing, callback );
81858342
81868343 if ( jQuery.isEmptyObject( prop ) ) {
81878344 return this.each( optall.complete, [ false ] );
@@ -8189,7 +8346,7 @@
81908347 // Do not change referenced properties as per-property easing will be lost
81918348 prop = jQuery.extend( {}, prop );
81928349
8193 - return this[ optall.queue === false ? "each" : "queue" ](function() {
 8350+ function doAnimation() {
81948351 // XXX 'this' does not always have a nodeName when running the
81958352 // test suite
81968353
@@ -8200,9 +8357,9 @@
82018358 var opt = jQuery.extend( {}, optall ),
82028359 isElement = this.nodeType === 1,
82038360 hidden = isElement && jQuery(this).is(":hidden"),
8204 - name, val, p,
8205 - display, e,
8206 - parts, start, end, unit;
 8361+ name, val, p, e,
 8362+ parts, start, end, unit,
 8363+ method;
82078364
82088365 // will store per property easing and be used to determine when an animation is complete
82098366 opt.animatedProperties = {};
@@ -8238,25 +8395,17 @@
82398396 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
82408397
82418398 // Set display property to inline-block for height/width
8242 - // animations on inline elements that are having width/height
8243 - // animated
 8399+ // animations on inline elements that are having width/height animated
82448400 if ( jQuery.css( this, "display" ) === "inline" &&
82458401 jQuery.css( this, "float" ) === "none" ) {
8246 - if ( !jQuery.support.inlineBlockNeedsLayout ) {
 8402+
 8403+ // inline-level elements accept inline-block;
 8404+ // block-level elements need to be inline with layout
 8405+ if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
82478406 this.style.display = "inline-block";
82488407
82498408 } else {
8250 - display = defaultDisplay( this.nodeName );
8251 -
8252 - // inline-level elements accept inline-block;
8253 - // block-level elements need to be inline with layout
8254 - if ( display === "inline" ) {
8255 - this.style.display = "inline-block";
8256 -
8257 - } else {
8258 - this.style.display = "inline";
8259 - this.style.zoom = 1;
8260 - }
 8409+ this.style.zoom = 1;
82618410 }
82628411 }
82638412 }
@@ -8270,9 +8419,18 @@
82718420 e = new jQuery.fx( this, opt, p );
82728421 val = prop[ p ];
82738422
8274 - if ( rfxtypes.test(val) ) {
8275 - e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
 8423+ if ( rfxtypes.test( val ) ) {
82768424
 8425+ // Tracks whether to show or hide based on private
 8426+ // data attached to the element
 8427+ method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
 8428+ if ( method ) {
 8429+ jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
 8430+ e[ method ]();
 8431+ } else {
 8432+ e[ val ]();
 8433+ }
 8434+
82778435 } else {
82788436 parts = rfxnum.exec( val );
82798437 start = e.cur();
@@ -8284,7 +8442,7 @@
82858443 // We need to compute starting value
82868444 if ( unit !== "px" ) {
82878445 jQuery.style( this, p, (end || 1) + unit);
8288 - start = ((end || 1) / e.cur()) * start;
 8446+ start = ( (end || 1) / e.cur() ) * start;
82898447 jQuery.style( this, p, start + unit);
82908448 }
82918449
@@ -8303,39 +8461,71 @@
83048462
83058463 // For JS strict compliance
83068464 return true;
8307 - });
 8465+ }
 8466+
 8467+ return optall.queue === false ?
 8468+ this.each( doAnimation ) :
 8469+ this.queue( optall.queue, doAnimation );
83088470 },
83098471
8310 - stop: function( clearQueue, gotoEnd ) {
8311 - if ( clearQueue ) {
8312 - this.queue([]);
 8472+ stop: function( type, clearQueue, gotoEnd ) {
 8473+ if ( typeof type !== "string" ) {
 8474+ gotoEnd = clearQueue;
 8475+ clearQueue = type;
 8476+ type = undefined;
83138477 }
 8478+ if ( clearQueue && type !== false ) {
 8479+ this.queue( type || "fx", [] );
 8480+ }
83148481
8315 - this.each(function() {
8316 - var timers = jQuery.timers,
8317 - i = timers.length;
 8482+ return this.each(function() {
 8483+ var index,
 8484+ hadTimers = false,
 8485+ timers = jQuery.timers,
 8486+ data = jQuery._data( this );
 8487+
83188488 // clear marker counters if we know they won't be
83198489 if ( !gotoEnd ) {
83208490 jQuery._unmark( true, this );
83218491 }
8322 - while ( i-- ) {
8323 - if ( timers[i].elem === this ) {
8324 - if (gotoEnd) {
 8492+
 8493+ function stopQueue( elem, data, index ) {
 8494+ var hooks = data[ index ];
 8495+ jQuery.removeData( elem, index, true );
 8496+ hooks.stop( gotoEnd );
 8497+ }
 8498+
 8499+ if ( type == null ) {
 8500+ for ( index in data ) {
 8501+ if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
 8502+ stopQueue( this, data, index );
 8503+ }
 8504+ }
 8505+ } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
 8506+ stopQueue( this, data, index );
 8507+ }
 8508+
 8509+ for ( index = timers.length; index--; ) {
 8510+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
 8511+ if ( gotoEnd ) {
 8512+
83258513 // force the next step to be the last
8326 - timers[i](true);
 8514+ timers[ index ]( true );
 8515+ } else {
 8516+ timers[ index ].saveState();
83278517 }
8328 -
8329 - timers.splice(i, 1);
 8518+ hadTimers = true;
 8519+ timers.splice( index, 1 );
83308520 }
83318521 }
 8522+
 8523+ // start the next in the queue if the last step wasn't forced
 8524+ // timers currently will call their complete callbacks, which will dequeue
 8525+ // but only if they were gotoEnd
 8526+ if ( !( gotoEnd && hadTimers ) ) {
 8527+ jQuery.dequeue( this, type );
 8528+ }
83328529 });
8333 -
8334 - // start the next in the queue if the last step wasn't forced
8335 - if ( !gotoEnd ) {
8336 - this.dequeue();
8337 - }
8338 -
8339 - return this;
83408530 }
83418531
83428532 });
@@ -8354,7 +8544,7 @@
83558545 function genFx( type, num ) {
83568546 var obj = {};
83578547
8358 - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
 8548+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
83598549 obj[ this ] = type;
83608550 });
83618551
@@ -8363,9 +8553,9 @@
83648554
83658555 // Generate shortcuts for custom animations
83668556 jQuery.each({
8367 - slideDown: genFx("show", 1),
8368 - slideUp: genFx("hide", 1),
8369 - slideToggle: genFx("toggle", 1),
 8557+ slideDown: genFx( "show", 1 ),
 8558+ slideUp: genFx( "hide", 1 ),
 8559+ slideToggle: genFx( "toggle", 1 ),
83708560 fadeIn: { opacity: "show" },
83718561 fadeOut: { opacity: "hide" },
83728562 fadeToggle: { opacity: "toggle" }
@@ -8377,25 +8567,31 @@
83788568
83798569 jQuery.extend({
83808570 speed: function( speed, easing, fn ) {
8381 - var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
 8571+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
83828572 complete: fn || !fn && easing ||
83838573 jQuery.isFunction( speed ) && speed,
83848574 duration: speed,
8385 - easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
 8575+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
83868576 };
83878577
83888578 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
8389 - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
 8579+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
83908580
 8581+ // normalize opt.queue - true/undefined/null -> "fx"
 8582+ if ( opt.queue == null || opt.queue === true ) {
 8583+ opt.queue = "fx";
 8584+ }
 8585+
83918586 // Queueing
83928587 opt.old = opt.complete;
 8588+
83938589 opt.complete = function( noUnmark ) {
83948590 if ( jQuery.isFunction( opt.old ) ) {
83958591 opt.old.call( this );
83968592 }
83978593
8398 - if ( opt.queue !== false ) {
8399 - jQuery.dequeue( this );
 8594+ if ( opt.queue ) {
 8595+ jQuery.dequeue( this, opt.queue );
84008596 } else if ( noUnmark !== false ) {
84018597 jQuery._unmark( this );
84028598 }
@@ -8409,7 +8605,7 @@
84108606 return firstNum + diff * p;
84118607 },
84128608 swing: function( p, n, firstNum, diff ) {
8413 - return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
 8609+ return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
84148610 }
84158611 },
84168612
@@ -8432,12 +8628,12 @@
84338629 this.options.step.call( this.elem, this.now, this );
84348630 }
84358631
8436 - (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
 8632+ ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
84378633 },
84388634
84398635 // Get the current size
84408636 cur: function() {
8441 - if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
 8637+ if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
84428638 return this.elem[ this.prop ];
84438639 }
84448640
@@ -8455,17 +8651,22 @@
84568652 fx = jQuery.fx;
84578653
84588654 this.startTime = fxNow || createFxNow();
8459 - this.start = from;
84608655 this.end = to;
 8656+ this.now = this.start = from;
 8657+ this.pos = this.state = 0;
84618658 this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
8462 - this.now = this.start;
8463 - this.pos = this.state = 0;
84648659
84658660 function t( gotoEnd ) {
8466 - return self.step(gotoEnd);
 8661+ return self.step( gotoEnd );
84678662 }
84688663
 8664+ t.queue = this.options.queue;
84698665 t.elem = this.elem;
 8666+ t.saveState = function() {
 8667+ if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
 8668+ jQuery._data( self.elem, "fxshow" + self.prop, self.start );
 8669+ }
 8670+ };
84708671
84718672 if ( t() && jQuery.timers.push(t) && !timerId ) {
84728673 timerId = setInterval( fx.tick, fx.interval );
@@ -8474,14 +8675,20 @@
84758676
84768677 // Simple 'show' function
84778678 show: function() {
 8679+ var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
 8680+
84788681 // Remember where we started, so that we can go back to it later
8479 - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
 8682+ this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
84808683 this.options.show = true;
84818684
84828685 // Begin the animation
8483 - // Make sure that we start at a small width/height to avoid any
8484 - // flash of content
8485 - this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
 8686+ // Make sure that we start at a small width/height to avoid any flash of content
 8687+ if ( dataShow !== undefined ) {
 8688+ // This show is picking up where a previous hide or show left off
 8689+ this.custom( this.cur(), dataShow );
 8690+ } else {
 8691+ this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
 8692+ }
84868693
84878694 // Start by showing the element
84888695 jQuery( this.elem ).show();
@@ -8490,20 +8697,20 @@
84918698 // Simple 'hide' function
84928699 hide: function() {
84938700 // Remember where we started, so that we can go back to it later
8494 - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
 8701+ this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
84958702 this.options.hide = true;
84968703
84978704 // Begin the animation
8498 - this.custom(this.cur(), 0);
 8705+ this.custom( this.cur(), 0 );
84998706 },
85008707
85018708 // Each step of an animation
85028709 step: function( gotoEnd ) {
8503 - var t = fxNow || createFxNow(),
 8710+ var p, n, complete,
 8711+ t = fxNow || createFxNow(),
85048712 done = true,
85058713 elem = this.elem,
8506 - options = this.options,
8507 - i, n;
 8714+ options = this.options;
85088715
85098716 if ( gotoEnd || t >= options.duration + this.startTime ) {
85108717 this.now = this.end;
@@ -8512,8 +8719,8 @@
85138720
85148721 options.animatedProperties[ this.prop ] = true;
85158722
8516 - for ( i in options.animatedProperties ) {
8517 - if ( options.animatedProperties[i] !== true ) {
 8723+ for ( p in options.animatedProperties ) {
 8724+ if ( options.animatedProperties[ p ] !== true ) {
85188725 done = false;
85198726 }
85208727 }
@@ -8522,25 +8729,36 @@
85238730 // Reset the overflow
85248731 if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
85258732
8526 - jQuery.each( [ "", "X", "Y" ], function (index, value) {
8527 - elem.style[ "overflow" + value ] = options.overflow[index];
 8733+ jQuery.each( [ "", "X", "Y" ], function( index, value ) {
 8734+ elem.style[ "overflow" + value ] = options.overflow[ index ];
85288735 });
85298736 }
85308737
85318738 // Hide the element if the "hide" operation was done
85328739 if ( options.hide ) {
8533 - jQuery(elem).hide();
 8740+ jQuery( elem ).hide();
85348741 }
85358742
85368743 // Reset the properties, if the item has been hidden or shown
85378744 if ( options.hide || options.show ) {
8538 - for ( var p in options.animatedProperties ) {
8539 - jQuery.style( elem, p, options.orig[p] );
 8745+ for ( p in options.animatedProperties ) {
 8746+ jQuery.style( elem, p, options.orig[ p ] );
 8747+ jQuery.removeData( elem, "fxshow" + p, true );
 8748+ // Toggle data is no longer needed
 8749+ jQuery.removeData( elem, "toggle" + p, true );
85408750 }
85418751 }
85428752
85438753 // Execute the complete function
8544 - options.complete.call( elem );
 8754+ // in the event that the complete function throws an exception
 8755+ // we must ensure it won't be called twice. #5684
 8756+
 8757+ complete = options.complete;
 8758+ if ( complete ) {
 8759+
 8760+ options.complete = false;
 8761+ complete.call( elem );
 8762+ }
85458763 }
85468764
85478765 return false;
@@ -8554,8 +8772,8 @@
85558773 this.state = n / options.duration;
85568774
85578775 // Perform the easing function, defaults to swing
8558 - this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
8559 - this.now = this.start + ((this.end - this.start) * this.pos);
 8776+ this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
 8777+ this.now = this.start + ( (this.end - this.start) * this.pos );
85608778 }
85618779 // Perform the next step of the animation
85628780 this.update();
@@ -8567,9 +8785,15 @@
85688786
85698787 jQuery.extend( jQuery.fx, {
85708788 tick: function() {
8571 - for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
8572 - if ( !timers[i]() ) {
8573 - timers.splice(i--, 1);
 8789+ var timer,
 8790+ timers = jQuery.timers,
 8791+ i = 0;
 8792+
 8793+ for ( ; i < timers.length; i++ ) {
 8794+ timer = timers[ i ];
 8795+ // Checks the timer has not already been removed
 8796+ if ( !timer() && timers[ i ] === timer ) {
 8797+ timers.splice( i--, 1 );
85748798 }
85758799 }
85768800
@@ -8599,7 +8823,7 @@
86008824
86018825 _default: function( fx ) {
86028826 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
8603 - fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
 8827+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
86048828 } else {
86058829 fx.elem[ fx.prop ] = fx.now;
86068830 }
@@ -8607,6 +8831,14 @@
86088832 }
86098833 });
86108834
 8835+// Adds width/height step functions
 8836+// Do not set anything below 0
 8837+jQuery.each([ "width", "height" ], function( i, prop ) {
 8838+ jQuery.fx.step[ prop ] = function( fx ) {
 8839+ jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
 8840+ };
 8841+});
 8842+
86118843 if ( jQuery.expr && jQuery.expr.filters ) {
86128844 jQuery.expr.filters.animated = function( elem ) {
86138845 return jQuery.grep(jQuery.timers, function( fn ) {
@@ -8623,7 +8855,6 @@
86248856 var body = document.body,
86258857 elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
86268858 display = elem.css( "display" );
8627 -
86288859 elem.remove();
86298860
86308861 // If the simple way fails,
@@ -8651,7 +8882,6 @@
86528883 iframeDoc.body.appendChild( elem );
86538884
86548885 display = jQuery.css( elem, "display" );
8655 -
86568886 body.removeChild( iframe );
86578887 }
86588888
@@ -8728,8 +8958,6 @@
87298959 return jQuery.offset.bodyOffset( elem );
87308960 }
87318961
8732 - jQuery.offset.initialize();
8733 -
87348962 var computedStyle,
87358963 offsetParent = elem.offsetParent,
87368964 prevOffsetParent = elem,
@@ -8742,7 +8970,7 @@
87438971 left = elem.offsetLeft;
87448972
87458973 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
8746 - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
 8974+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
87478975 break;
87488976 }
87498977
@@ -8754,7 +8982,7 @@
87558983 top += elem.offsetTop;
87568984 left += elem.offsetLeft;
87578985
8758 - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
 8986+ if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
87598987 top += parseFloat( computedStyle.borderTopWidth ) || 0;
87608988 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
87618989 }
@@ -8763,7 +8991,7 @@
87648992 offsetParent = elem.offsetParent;
87658993 }
87668994
8767 - if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
 8995+ if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
87688996 top += parseFloat( computedStyle.borderTopWidth ) || 0;
87698997 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
87708998 }
@@ -8776,7 +9004,7 @@
87779005 left += body.offsetLeft;
87789006 }
87799007
8780 - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
 9008+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
87819009 top += Math.max( docElem.scrollTop, body.scrollTop );
87829010 left += Math.max( docElem.scrollLeft, body.scrollLeft );
87839011 }
@@ -8786,46 +9014,12 @@
87879015 }
87889016
87899017 jQuery.offset = {
8790 - initialize: function() {
8791 - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
8792 - html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
87939018
8794 - jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
8795 -
8796 - container.innerHTML = html;
8797 - body.insertBefore( container, body.firstChild );
8798 - innerDiv = container.firstChild;
8799 - checkDiv = innerDiv.firstChild;
8800 - td = innerDiv.nextSibling.firstChild.firstChild;
8801 -
8802 - this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
8803 - this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
8804 -
8805 - checkDiv.style.position = "fixed";
8806 - checkDiv.style.top = "20px";
8807 -
8808 - // safari subtracts parent border width here which is 5px
8809 - this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
8810 - checkDiv.style.position = checkDiv.style.top = "";
8811 -
8812 - innerDiv.style.overflow = "hidden";
8813 - innerDiv.style.position = "relative";
8814 -
8815 - this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
8816 -
8817 - this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
8818 -
8819 - body.removeChild( container );
8820 - jQuery.offset.initialize = jQuery.noop;
8821 - },
8822 -
88239019 bodyOffset: function( body ) {
88249020 var top = body.offsetTop,
88259021 left = body.offsetLeft;
88269022
8827 - jQuery.offset.initialize();
8828 -
8829 - if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
 9023+ if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
88309024 top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
88319025 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
88329026 }
@@ -8845,7 +9039,7 @@
88469040 curOffset = curElem.offset(),
88479041 curCSSTop = jQuery.css( elem, "top" ),
88489042 curCSSLeft = jQuery.css( elem, "left" ),
8849 - calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
 9043+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
88509044 props = {}, curPosition = {}, curTop, curLeft;
88519045
88529046 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
@@ -8862,11 +9056,11 @@
88639057 options = options.call( elem, i, curOffset );
88649058 }
88659059
8866 - if (options.top != null) {
8867 - props.top = (options.top - curOffset.top) + curTop;
 9060+ if ( options.top != null ) {
 9061+ props.top = ( options.top - curOffset.top ) + curTop;
88689062 }
8869 - if (options.left != null) {
8870 - props.left = (options.left - curOffset.left) + curLeft;
 9063+ if ( options.left != null ) {
 9064+ props.left = ( options.left - curOffset.left ) + curLeft;
88719065 }
88729066
88739067 if ( "using" in options ) {
@@ -8879,6 +9073,7 @@
88809074
88819075
88829076 jQuery.fn.extend({
 9077+
88839078 position: function() {
88849079 if ( !this[0] ) {
88859080 return null;
@@ -8981,16 +9176,20 @@
89829177 // innerHeight and innerWidth
89839178 jQuery.fn[ "inner" + name ] = function() {
89849179 var elem = this[0];
8985 - return elem && elem.style ?
 9180+ return elem ?
 9181+ elem.style ?
89869182 parseFloat( jQuery.css( elem, type, "padding" ) ) :
 9183+ this[ type ]() :
89879184 null;
89889185 };
89899186
89909187 // outerHeight and outerWidth
89919188 jQuery.fn[ "outer" + name ] = function( margin ) {
89929189 var elem = this[0];
8993 - return elem && elem.style ?
 9190+ return elem ?
 9191+ elem.style ?
89949192 parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
 9193+ this[ type ]() :
89959194 null;
89969195 };
89979196
@@ -9030,7 +9229,7 @@
90319230 var orig = jQuery.css( elem, type ),
90329231 ret = parseFloat( orig );
90339232
9034 - return jQuery.isNaN( ret ) ? orig : ret;
 9233+ return jQuery.isNumeric( ret ) ? ret : orig;
90359234
90369235 // Set the width or height on the element (default to pixels if value is unitless)
90379236 } else {
@@ -9041,6 +9240,27 @@
90429241 });
90439242
90449243
 9244+
 9245+
90459246 // Expose jQuery to the global object
90469247 window.jQuery = window.$ = jQuery;
9047 -})(window);
 9248+
 9249+// Expose jQuery as an AMD module, but only for AMD loaders that
 9250+// understand the issues with loading multiple versions of jQuery
 9251+// in a page that all might call define(). The loader will indicate
 9252+// they have special allowances for multiple jQuery versions by
 9253+// specifying define.amd.jQuery = true. Register as a named module,
 9254+// since jQuery can be concatenated with other files that may use define,
 9255+// but not use a proper concatenation script that understands anonymous
 9256+// AMD modules. A named AMD is safest and most robust way to register.
 9257+// Lowercase jquery is used because AMD module names are derived from
 9258+// file names, and jQuery is normally delivered in a lowercase file name.
 9259+// Do this after creating the global so that if an AMD module wants to call
 9260+// noConflict to hide this version of jQuery, it will work.
 9261+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
 9262+ define( "jquery", [], function () { return jQuery; } );
 9263+}
 9264+
 9265+
 9266+
 9267+})( window );

Comments

#Comment by Tim Starling (talk | contribs)   02:21, 12 December 2011

Did you check for patches against the old jQuery? I seem to remember Trevor talking about how he made one.

#Comment by Reedy (talk | contribs)   02:28, 12 December 2011

Oh? I don't think there were any reapplied after 1.6.4 was put out to fix bugs in the 1.18 deployment

Will check later, and if there is, we should get them upstreamedif not already done

#Comment by Hashar (talk | contribs)   13:35, 12 December 2011

Trevor did patch jQuery with r74326. Was added upstream and fetched back with r86106 (April 2011). Since that time, we seems to have always fetched upstream as is and send them patches for next version.

#Comment by Krinkle (talk | contribs)   10:37, 30 December 2011

Status & tagging log