r88725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88724‎ | r88725 | r88726 >
Date:16:52, 24 May 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
Reverting r88607. This downgrades jQuery from 1.5.2 back to 1.4.4.
* The main reason being the problems with $.ajax that arose in UploadWizard (as remarked on wikitech-l).
* My plan is to take the following week (or two) to talk a bit about JavaScript unit testing and how we plan to do distributed continuous integration testing for it. After that we could upgrade right to 1.6.1
* See also bug 28904 and "[Wikitech-l] Any issues with pending jQuery 1.6.1 update on trunk?"
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
@@ -38,7 +38,6 @@
3939 added to the textarea on the edit form.
4040 * mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
4141 * (bug 29067) Creating "user.tokens" module (like user.options) in ResourceLoader.
42 -* (bug 28904) Update jQuery version from 1.4.4 to 1.5.2 (the latest update to 1.5)
4342
4443 === Bug fixes in 1.19 ===
4544 * (bug 10154) Don't allow user to specify days beyond $wgRCMaxAge.
Index: trunk/phase3/resources/jquery/jquery.js
@@ -1,17 +1,17 @@
22 /*!
3 - * jQuery JavaScript Library v1.5.2
 3+ * jQuery JavaScript Library v1.4.4
44 * http://jquery.com/
55 *
6 - * Copyright 2011, John Resig
 6+ * Copyright 2010, John Resig
77 * Dual licensed under the MIT or GPL Version 2 licenses.
88 * http://jquery.org/license
99 *
1010 * Includes Sizzle.js
1111 * http://sizzlejs.com/
12 - * Copyright 2011, The Dojo Foundation
 12+ * Copyright 2010, The Dojo Foundation
1313 * Released under the MIT, BSD, and GPL Licenses.
1414 *
15 - * Date: Thu Mar 31 15:28:23 2011 -0400
 15+ * Date: Thu Nov 11 19:04:53 2010 -0500
1616 */
1717 (function( window, undefined ) {
1818
@@ -22,7 +22,7 @@
2323 // Define a local copy of jQuery
2424 var jQuery = function( selector, context ) {
2525 // The jQuery object is actually just the init constructor 'enhanced'
26 - return new jQuery.fn.init( selector, context, rootjQuery );
 26+ return new jQuery.fn.init( selector, context );
2727 },
2828
2929 // Map over jQuery in case of overwrite
@@ -38,13 +38,20 @@
3939 // (both of which we optimize for)
4040 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
4141
 42+ // Is it a simple selector
 43+ isSimple = /^.[^:#\[\.,]*$/,
 44+
4245 // Check if a string has a non-whitespace character in it
4346 rnotwhite = /\S/,
 47+ rwhite = /\s/,
4448
4549 // Used for trimming whitespace
4650 trimLeft = /^\s+/,
4751 trimRight = /\s+$/,
4852
 53+ // Check for non-word characters
 54+ rnonword = /\W/,
 55+
4956 // Check for digits
5057 rdigit = /\d/,
5158
@@ -68,10 +75,13 @@
6976
7077 // For matching the engine and version of the browser
7178 browserMatch,
 79+
 80+ // Has the ready events already been bound?
 81+ readyBound = false,
 82+
 83+ // The functions to execute on DOM ready
 84+ readyList = [],
7285
73 - // The deferred used on DOM ready
74 - readyList,
75 -
7686 // The ready event handler
7787 DOMContentLoaded,
7888
@@ -82,13 +92,12 @@
8393 slice = Array.prototype.slice,
8494 trim = String.prototype.trim,
8595 indexOf = Array.prototype.indexOf,
86 -
 96+
8797 // [[Class]] -> type pairs
8898 class2type = {};
8999
90100 jQuery.fn = jQuery.prototype = {
91 - constructor: jQuery,
92 - init: function( selector, context, rootjQuery ) {
 101+ init: function( selector, context ) {
93102 var match, elem, ret, doc;
94103
95104 // Handle $(""), $(null), or $(undefined)
@@ -102,7 +111,7 @@
103112 this.length = 1;
104113 return this;
105114 }
106 -
 115+
107116 // The body element only exists once, optimize finding it
108117 if ( selector === "body" && !context && document.body ) {
109118 this.context = document;
@@ -122,7 +131,6 @@
123132
124133 // HANDLE: $(html) -> $(array)
125134 if ( match[1] ) {
126 - context = context instanceof jQuery ? context[0] : context;
127135 doc = (context ? context.ownerDocument || context : document);
128136
129137 // If a single string is passed in and it's a single tag
@@ -140,11 +148,11 @@
141149
142150 } else {
143151 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
144 - selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
 152+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
145153 }
146 -
 154+
147155 return jQuery.merge( this, selector );
148 -
 156+
149157 // HANDLE: $("#id")
150158 } else {
151159 elem = document.getElementById( match[2] );
@@ -168,6 +176,13 @@
169177 return this;
170178 }
171179
 180+ // HANDLE: $("TAG")
 181+ } else if ( !context && !rnonword.test( selector ) ) {
 182+ this.selector = selector;
 183+ this.context = document;
 184+ selector = document.getElementsByTagName( selector );
 185+ return jQuery.merge( this, selector );
 186+
172187 // HANDLE: $(expr, $(...))
173188 } else if ( !context || context.jquery ) {
174189 return (context || rootjQuery).find( selector );
@@ -175,7 +190,7 @@
176191 // HANDLE: $(expr, context)
177192 // (which is just equivalent to: $(context).find(expr)
178193 } else {
179 - return this.constructor( context ).find( selector );
 194+ return jQuery( context ).find( selector );
180195 }
181196
182197 // HANDLE: $(function)
@@ -196,7 +211,7 @@
197212 selector: "",
198213
199214 // The current version of jQuery being used
200 - jquery: "1.5.2",
 215+ jquery: "1.4.4",
201216
202217 // The default length of a jQuery object is 0
203218 length: 0,
@@ -219,18 +234,18 @@
220235 this.toArray() :
221236
222237 // Return just the object
223 - ( num < 0 ? this[ this.length + num ] : this[ num ] );
 238+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
224239 },
225240
226241 // Take an array of elements and push it onto the stack
227242 // (returning the new matched element set)
228243 pushStack: function( elems, name, selector ) {
229244 // Build a new jQuery matched element set
230 - var ret = this.constructor();
 245+ var ret = jQuery();
231246
232247 if ( jQuery.isArray( elems ) ) {
233248 push.apply( ret, elems );
234 -
 249+
235250 } else {
236251 jQuery.merge( ret, elems );
237252 }
@@ -256,17 +271,25 @@
257272 each: function( callback, args ) {
258273 return jQuery.each( this, callback, args );
259274 },
260 -
 275+
261276 ready: function( fn ) {
262277 // Attach the listeners
263278 jQuery.bindReady();
264279
265 - // Add the callback
266 - readyList.done( fn );
 280+ // If the DOM is already ready
 281+ if ( jQuery.isReady ) {
 282+ // Execute the function immediately
 283+ fn.call( document, jQuery );
267284
 285+ // Otherwise, remember the function for later
 286+ } else if ( readyList ) {
 287+ // Add the function to the wait list
 288+ readyList.push( fn );
 289+ }
 290+
268291 return this;
269292 },
270 -
 293+
271294 eq: function( i ) {
272295 return i === -1 ?
273296 this.slice( i ) :
@@ -291,9 +314,9 @@
292315 return callback.call( elem, i, elem );
293316 }));
294317 },
295 -
 318+
296319 end: function() {
297 - return this.prevObject || this.constructor(null);
 320+ return this.prevObject || jQuery(null);
298321 },
299322
300323 // For internal use only.
@@ -307,7 +330,7 @@
308331 jQuery.fn.init.prototype = jQuery.fn;
309332
310333 jQuery.extend = jQuery.fn.extend = function() {
311 - var options, name, src, copy, copyIsArray, clone,
 334+ var options, name, src, copy, copyIsArray, clone,
312335 target = arguments[0] || {},
313336 i = 1,
314337 length = arguments.length,
@@ -380,14 +403,14 @@
381404
382405 return jQuery;
383406 },
384 -
 407+
385408 // Is the DOM ready to be used? Set to true once it occurs.
386409 isReady: false,
387410
388411 // A counter to track how many items to wait for before
389412 // the ready event fires. See #6781
390413 readyWait: 1,
391 -
 414+
392415 // Handle when the DOM is ready
393416 ready: function( wait ) {
394417 // A third-party is pushing the ready event forwards
@@ -411,21 +434,33 @@
412435 }
413436
414437 // If there are functions bound, to execute
415 - readyList.resolveWith( document, [ jQuery ] );
 438+ if ( readyList ) {
 439+ // Execute all of them
 440+ var fn,
 441+ i = 0,
 442+ ready = readyList;
416443
417 - // Trigger any bound ready events
418 - if ( jQuery.fn.trigger ) {
419 - jQuery( document ).trigger( "ready" ).unbind( "ready" );
 444+ // Reset the list of functions
 445+ readyList = null;
 446+
 447+ while ( (fn = ready[ i++ ]) ) {
 448+ fn.call( document, jQuery );
 449+ }
 450+
 451+ // Trigger any bound ready events
 452+ if ( jQuery.fn.trigger ) {
 453+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
 454+ }
420455 }
421456 }
422457 },
423 -
 458+
424459 bindReady: function() {
425 - if ( readyList ) {
 460+ if ( readyBound ) {
426461 return;
427462 }
428463
429 - readyList = jQuery._Deferred();
 464+ readyBound = true;
430465
431466 // Catch cases where $(document).ready() is called after the
432467 // browser event has already occurred.
@@ -438,7 +473,7 @@
439474 if ( document.addEventListener ) {
440475 // Use the handy event callback
441476 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
442 -
 477+
443478 // A fallback to window.onload, that will always work
444479 window.addEventListener( "load", jQuery.ready, false );
445480
@@ -447,7 +482,7 @@
448483 // ensure firing before onload,
449484 // maybe late but safe also for iframes
450485 document.attachEvent("onreadystatechange", DOMContentLoaded);
451 -
 486+
452487 // A fallback to window.onload, that will always work
453488 window.attachEvent( "onload", jQuery.ready );
454489
@@ -498,20 +533,20 @@
499534 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
500535 return false;
501536 }
502 -
 537+
503538 // Not own constructor property must be Object
504539 if ( obj.constructor &&
505540 !hasOwn.call(obj, "constructor") &&
506541 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
507542 return false;
508543 }
509 -
 544+
510545 // Own properties are enumerated firstly, so to speed up,
511546 // if last one is own, then all properties are own.
512 -
 547+
513548 var key;
514549 for ( key in obj ) {}
515 -
 550+
516551 return key === undefined || hasOwn.call( obj, key );
517552 },
518553
@@ -521,11 +556,11 @@
522557 }
523558 return true;
524559 },
525 -
 560+
526561 error: function( msg ) {
527562 throw msg;
528563 },
529 -
 564+
530565 parseJSON: function( data ) {
531566 if ( typeof data !== "string" || !data ) {
532567 return null;
@@ -533,7 +568,7 @@
534569
535570 // Make sure leading/trailing whitespace is removed (IE can't handle it)
536571 data = jQuery.trim( data );
537 -
 572+
538573 // Make sure the incoming data is actual JSON
539574 // Logic borrowed from http://json.org/json2.js
540575 if ( rvalidchars.test(data.replace(rvalidescape, "@")
@@ -550,28 +585,6 @@
551586 }
552587 },
553588
554 - // Cross-browser xml parsing
555 - // (xml & tmp used internally)
556 - parseXML: function( data , xml , tmp ) {
557 -
558 - if ( window.DOMParser ) { // Standard
559 - tmp = new DOMParser();
560 - xml = tmp.parseFromString( data , "text/xml" );
561 - } else { // IE
562 - xml = new ActiveXObject( "Microsoft.XMLDOM" );
563 - xml.async = "false";
564 - xml.loadXML( data );
565 - }
566 -
567 - tmp = xml.documentElement;
568 -
569 - if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
570 - jQuery.error( "Invalid XML: " + data );
571 - }
572 -
573 - return xml;
574 - },
575 -
576589 noop: function() {},
577590
578591 // Evalulates a script in a global context
@@ -579,10 +592,12 @@
580593 if ( data && rnotwhite.test(data) ) {
581594 // Inspired by code by Andrea Giammarchi
582595 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
583 - var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
584 - script = document.createElement( "script" );
 596+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
 597+ script = document.createElement("script");
585598
586 - if ( jQuery.support.scriptEval() ) {
 599+ script.type = "text/javascript";
 600+
 601+ if ( jQuery.support.scriptEval ) {
587602 script.appendChild( document.createTextNode( data ) );
588603 } else {
589604 script.text = data;
@@ -695,7 +710,7 @@
696711 for ( var l = second.length; j < l; j++ ) {
697712 first[ i++ ] = second[ j ];
698713 }
699 -
 714+
700715 } else {
701716 while ( second[j] !== undefined ) {
702717 first[ i++ ] = second[ j++ ];
@@ -737,7 +752,6 @@
738753 }
739754 }
740755
741 - // Flatten any nested arrays
742756 return ret.concat.apply( [], ret );
743757 },
744758
@@ -776,7 +790,7 @@
777791 // The value/s can be optionally by executed if its a function
778792 access: function( elems, key, value, exec, fn, pass ) {
779793 var length = elems.length;
780 -
 794+
781795 // Setting many attributes
782796 if ( typeof key === "object" ) {
783797 for ( var k in key ) {
@@ -784,19 +798,19 @@
785799 }
786800 return elems;
787801 }
788 -
 802+
789803 // Setting one attribute
790804 if ( value !== undefined ) {
791805 // Optionally, function values get executed if exec is true
792806 exec = !pass && exec && jQuery.isFunction(value);
793 -
 807+
794808 for ( var i = 0; i < length; i++ ) {
795809 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
796810 }
797 -
 811+
798812 return elems;
799813 }
800 -
 814+
801815 // Getting an attribute
802816 return length ? fn( elems[0], key ) : undefined;
803817 },
@@ -819,27 +833,6 @@
820834 return { browser: match[1] || "", version: match[2] || "0" };
821835 },
822836
823 - sub: function() {
824 - function jQuerySubclass( selector, context ) {
825 - return new jQuerySubclass.fn.init( selector, context );
826 - }
827 - jQuery.extend( true, jQuerySubclass, this );
828 - jQuerySubclass.superclass = this;
829 - jQuerySubclass.fn = jQuerySubclass.prototype = this();
830 - jQuerySubclass.fn.constructor = jQuerySubclass;
831 - jQuerySubclass.subclass = this.subclass;
832 - jQuerySubclass.fn.init = function init( selector, context ) {
833 - if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
834 - context = jQuerySubclass(context);
835 - }
836 -
837 - return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
838 - };
839 - jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
840 - var rootjQuerySubclass = jQuerySubclass(document);
841 - return jQuerySubclass;
842 - },
843 -
844837 browser: {}
845838 });
846839
@@ -865,8 +858,9 @@
866859 };
867860 }
868861
869 -// IE doesn't match non-breaking spaces with \s
870 -if ( rnotwhite.test( "\xA0" ) ) {
 862+// Verify that \s matches non-breaking spaces
 863+// (IE fails on this test)
 864+if ( !rwhite.test( "\xA0" ) ) {
871865 trimLeft = /^[\s\xA0]+/;
872866 trimRight = /[\s\xA0]+$/;
873867 }
@@ -911,188 +905,19 @@
912906 }
913907
914908 // Expose jQuery to the global object
915 -return jQuery;
 909+return (window.jQuery = window.$ = jQuery);
916910
917911 })();
918912
919913
920 -var // Promise methods
921 - promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
922 - // Static reference to slice
923 - sliceDeferred = [].slice;
924 -
925 -jQuery.extend({
926 - // Create a simple deferred (one callbacks list)
927 - _Deferred: function() {
928 - var // callbacks list
929 - callbacks = [],
930 - // stored [ context , args ]
931 - fired,
932 - // to avoid firing when already doing so
933 - firing,
934 - // flag to know if the deferred has been cancelled
935 - cancelled,
936 - // the deferred itself
937 - deferred = {
938 -
939 - // done( f1, f2, ...)
940 - done: function() {
941 - if ( !cancelled ) {
942 - var args = arguments,
943 - i,
944 - length,
945 - elem,
946 - type,
947 - _fired;
948 - if ( fired ) {
949 - _fired = fired;
950 - fired = 0;
951 - }
952 - for ( i = 0, length = args.length; i < length; i++ ) {
953 - elem = args[ i ];
954 - type = jQuery.type( elem );
955 - if ( type === "array" ) {
956 - deferred.done.apply( deferred, elem );
957 - } else if ( type === "function" ) {
958 - callbacks.push( elem );
959 - }
960 - }
961 - if ( _fired ) {
962 - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
963 - }
964 - }
965 - return this;
966 - },
967 -
968 - // resolve with given context and args
969 - resolveWith: function( context, args ) {
970 - if ( !cancelled && !fired && !firing ) {
971 - // make sure args are available (#8421)
972 - args = args || [];
973 - firing = 1;
974 - try {
975 - while( callbacks[ 0 ] ) {
976 - callbacks.shift().apply( context, args );
977 - }
978 - }
979 - finally {
980 - fired = [ context, args ];
981 - firing = 0;
982 - }
983 - }
984 - return this;
985 - },
986 -
987 - // resolve with this as context and given arguments
988 - resolve: function() {
989 - deferred.resolveWith( this, arguments );
990 - return this;
991 - },
992 -
993 - // Has this deferred been resolved?
994 - isResolved: function() {
995 - return !!( firing || fired );
996 - },
997 -
998 - // Cancel
999 - cancel: function() {
1000 - cancelled = 1;
1001 - callbacks = [];
1002 - return this;
1003 - }
1004 - };
1005 -
1006 - return deferred;
1007 - },
1008 -
1009 - // Full fledged deferred (two callbacks list)
1010 - Deferred: function( func ) {
1011 - var deferred = jQuery._Deferred(),
1012 - failDeferred = jQuery._Deferred(),
1013 - promise;
1014 - // Add errorDeferred methods, then and promise
1015 - jQuery.extend( deferred, {
1016 - then: function( doneCallbacks, failCallbacks ) {
1017 - deferred.done( doneCallbacks ).fail( failCallbacks );
1018 - return this;
1019 - },
1020 - fail: failDeferred.done,
1021 - rejectWith: failDeferred.resolveWith,
1022 - reject: failDeferred.resolve,
1023 - isRejected: failDeferred.isResolved,
1024 - // Get a promise for this deferred
1025 - // If obj is provided, the promise aspect is added to the object
1026 - promise: function( obj ) {
1027 - if ( obj == null ) {
1028 - if ( promise ) {
1029 - return promise;
1030 - }
1031 - promise = obj = {};
1032 - }
1033 - var i = promiseMethods.length;
1034 - while( i-- ) {
1035 - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
1036 - }
1037 - return obj;
1038 - }
1039 - } );
1040 - // Make sure only one callback list will be used
1041 - deferred.done( failDeferred.cancel ).fail( deferred.cancel );
1042 - // Unexpose cancel
1043 - delete deferred.cancel;
1044 - // Call given func if any
1045 - if ( func ) {
1046 - func.call( deferred, deferred );
1047 - }
1048 - return deferred;
1049 - },
1050 -
1051 - // Deferred helper
1052 - when: function( firstParam ) {
1053 - var args = arguments,
1054 - i = 0,
1055 - length = args.length,
1056 - count = length,
1057 - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
1058 - firstParam :
1059 - jQuery.Deferred();
1060 - function resolveFunc( i ) {
1061 - return function( value ) {
1062 - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1063 - if ( !( --count ) ) {
1064 - // Strange bug in FF4:
1065 - // Values changed onto the arguments object sometimes end up as undefined values
1066 - // outside the $.when method. Cloning the object into a fresh array solves the issue
1067 - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
1068 - }
1069 - };
1070 - }
1071 - if ( length > 1 ) {
1072 - for( ; i < length; i++ ) {
1073 - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
1074 - args[ i ].promise().then( resolveFunc(i), deferred.reject );
1075 - } else {
1076 - --count;
1077 - }
1078 - }
1079 - if ( !count ) {
1080 - deferred.resolveWith( deferred, args );
1081 - }
1082 - } else if ( deferred !== firstParam ) {
1083 - deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
1084 - }
1085 - return deferred.promise();
1086 - }
1087 -});
1088 -
1089 -
1090 -
1091 -
1092914 (function() {
1093915
1094916 jQuery.support = {};
1095917
1096 - var div = document.createElement("div");
 918+ var root = document.documentElement,
 919+ script = document.createElement("script"),
 920+ div = document.createElement("div"),
 921+ id = "script" + jQuery.now();
1097922
1098923 div.style.display = "none";
1099924 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
@@ -1100,8 +925,7 @@
1101926 var all = div.getElementsByTagName("*"),
1102927 a = div.getElementsByTagName("a")[0],
1103928 select = document.createElement("select"),
1104 - opt = select.appendChild( document.createElement("option") ),
1105 - input = div.getElementsByTagName("input")[0];
 929+ opt = select.appendChild( document.createElement("option") );
1106930
1107931 // Can't get basic test support
1108932 if ( !all || !all.length || !a ) {
@@ -1140,7 +964,7 @@
1141965 // Make sure that if no value is specified for a checkbox
1142966 // that it defaults to "on".
1143967 // (WebKit defaults to "" instead)
1144 - checkOn: input.value === "on",
 968+ checkOn: div.getElementsByTagName("input")[0].value === "on",
1145969
1146970 // Make sure that a selected-by-default option has a working selected property.
1147971 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
@@ -1150,62 +974,46 @@
1151975 deleteExpando: true,
1152976 optDisabled: false,
1153977 checkClone: false,
 978+ scriptEval: false,
1154979 noCloneEvent: true,
1155 - noCloneChecked: true,
1156980 boxModel: null,
1157981 inlineBlockNeedsLayout: false,
1158982 shrinkWrapBlocks: false,
1159 - reliableHiddenOffsets: true,
1160 - reliableMarginRight: true
 983+ reliableHiddenOffsets: true
1161984 };
1162985
1163 - input.checked = true;
1164 - jQuery.support.noCloneChecked = input.cloneNode( true ).checked;
1165 -
1166986 // Make sure that the options inside disabled selects aren't marked as disabled
1167987 // (WebKit marks them as diabled)
1168988 select.disabled = true;
1169989 jQuery.support.optDisabled = !opt.disabled;
1170990
1171 - var _scriptEval = null;
1172 - jQuery.support.scriptEval = function() {
1173 - if ( _scriptEval === null ) {
1174 - var root = document.documentElement,
1175 - script = document.createElement("script"),
1176 - id = "script" + jQuery.now();
 991+ script.type = "text/javascript";
 992+ try {
 993+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
 994+ } catch(e) {}
1177995
1178 - // Make sure that the execution of code works by injecting a script
1179 - // tag with appendChild/createTextNode
1180 - // (IE doesn't support this, fails, and uses .text instead)
1181 - try {
1182 - script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
1183 - } catch(e) {}
 996+ root.insertBefore( script, root.firstChild );
1184997
1185 - root.insertBefore( script, root.firstChild );
 998+ // Make sure that the execution of code works by injecting a script
 999+ // tag with appendChild/createTextNode
 1000+ // (IE doesn't support this, fails, and uses .text instead)
 1001+ if ( window[ id ] ) {
 1002+ jQuery.support.scriptEval = true;
 1003+ delete window[ id ];
 1004+ }
11861005
1187 - if ( window[ id ] ) {
1188 - _scriptEval = true;
1189 - delete window[ id ];
1190 - } else {
1191 - _scriptEval = false;
1192 - }
1193 -
1194 - root.removeChild( script );
1195 - }
1196 -
1197 - return _scriptEval;
1198 - };
1199 -
12001006 // Test to see if it's possible to delete an expando from an element
12011007 // Fails in Internet Explorer
12021008 try {
1203 - delete div.test;
 1009+ delete script.test;
12041010
12051011 } catch(e) {
12061012 jQuery.support.deleteExpando = false;
12071013 }
12081014
1209 - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
 1015+ root.removeChild( script );
 1016+
 1017+ if ( div.attachEvent && div.fireEvent ) {
12101018 div.attachEvent("onclick", function click() {
12111019 // Cloning a node shouldn't copy over any
12121020 // bound event handlers (IE does this)
@@ -1227,16 +1035,10 @@
12281036 // Figure out if the W3C box model works as expected
12291037 // document.body must exist before we can do this
12301038 jQuery(function() {
1231 - var div = document.createElement("div"),
1232 - body = document.getElementsByTagName("body")[0];
1233 -
1234 - // Frameset documents with no body should not run this code
1235 - if ( !body ) {
1236 - return;
1237 - }
1238 -
 1039+ var div = document.createElement("div");
12391040 div.style.width = div.style.paddingLeft = "1px";
1240 - body.appendChild( div );
 1041+
 1042+ document.body.appendChild( div );
12411043 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
12421044
12431045 if ( "zoom" in div.style ) {
@@ -1255,7 +1057,7 @@
12561058 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
12571059 }
12581060
1259 - div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
 1061+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
12601062 var tds = div.getElementsByTagName("td");
12611063
12621064 // Check if table cells still have offsetWidth/Height when they are set
@@ -1275,18 +1077,7 @@
12761078 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
12771079 div.innerHTML = "";
12781080
1279 - // Check if div with explicit width and no margin-right incorrectly
1280 - // gets computed margin-right based on width of container. For more
1281 - // info see bug #3333
1282 - // Fails in WebKit before Feb 2011 nightlies
1283 - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1284 - if ( document.defaultView && document.defaultView.getComputedStyle ) {
1285 - div.style.width = "1px";
1286 - div.style.marginRight = "0";
1287 - jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0;
1288 - }
1289 -
1290 - body.removeChild( div ).style.display = "none";
 1081+ document.body.removeChild( div ).style.display = "none";
12911082 div = tds = null;
12921083 });
12931084
@@ -1296,19 +1087,13 @@
12971088 var el = document.createElement("div");
12981089 eventName = "on" + eventName;
12991090
1300 - // We only care about the case where non-standard event systems
1301 - // are used, namely in IE. Short-circuiting here helps us to
1302 - // avoid an eval call (in setAttribute) which can cause CSP
1303 - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1304 - if ( !el.attachEvent ) {
1305 - return true;
1306 - }
1307 -
13081091 var isSupported = (eventName in el);
13091092 if ( !isSupported ) {
13101093 el.setAttribute(eventName, "return;");
13111094 isSupported = typeof el[eventName] === "function";
13121095 }
 1096+ el = null;
 1097+
13131098 return isSupported;
13141099 };
13151100
@@ -1316,12 +1101,13 @@
13171102 jQuery.support.changeBubbles = eventSupported("change");
13181103
13191104 // release memory in IE
1320 - div = all = a = null;
 1105+ root = script = div = all = a = null;
13211106 })();
13221107
13231108
13241109
1325 -var rbrace = /^(?:\{.*\}|\[.*\])$/;
 1110+var windowData = {},
 1111+ rbrace = /^(?:\{.*\}|\[.*\])$/;
13261112
13271113 jQuery.extend({
13281114 cache: {},
@@ -1329,9 +1115,8 @@
13301116 // Please use with caution
13311117 uuid: 0,
13321118
1333 - // Unique for each copy of jQuery on the page
1334 - // Non-digits removed to match rinlinejQuery
1335 - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
 1119+ // Unique for each copy of jQuery on the page
 1120+ expando: "jQuery" + jQuery.now(),
13361121
13371122 // The following elements throw uncatchable exceptions if you
13381123 // attempt to add expando properties to them.
@@ -1342,185 +1127,103 @@
13431128 "applet": true
13441129 },
13451130
1346 - hasData: function( elem ) {
1347 - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1348 -
1349 - return !!elem && !isEmptyDataObject( elem );
1350 - },
1351 -
1352 - data: function( elem, name, data, pvt /* Internal Use Only */ ) {
 1131+ data: function( elem, name, data ) {
13531132 if ( !jQuery.acceptData( elem ) ) {
13541133 return;
13551134 }
13561135
1357 - var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
 1136+ elem = elem == window ?
 1137+ windowData :
 1138+ elem;
13581139
1359 - // We have to handle DOM nodes and JS objects differently because IE6-7
1360 - // can't GC object references properly across the DOM-JS boundary
1361 - isNode = elem.nodeType,
 1140+ var isNode = elem.nodeType,
 1141+ id = isNode ? elem[ jQuery.expando ] : null,
 1142+ cache = jQuery.cache, thisCache;
13621143
1363 - // Only DOM nodes need the global jQuery cache; JS object data is
1364 - // attached directly to the object so GC can occur automatically
1365 - cache = isNode ? jQuery.cache : elem,
1366 -
1367 - // Only defining an ID for JS objects if its cache already exists allows
1368 - // the code to shortcut on the same path as a DOM node with no cache
1369 - id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
1370 -
1371 - // Avoid doing any more work than we need to when trying to get data on an
1372 - // object that has no data at all
1373 - if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
 1144+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
13741145 return;
13751146 }
13761147
1377 - if ( !id ) {
1378 - // Only DOM nodes need a new unique ID for each element since their data
1379 - // ends up in the global cache
1380 - if ( isNode ) {
1381 - elem[ jQuery.expando ] = id = ++jQuery.uuid;
1382 - } else {
1383 - id = jQuery.expando;
1384 - }
1385 - }
 1148+ // Get the data from the object directly
 1149+ if ( !isNode ) {
 1150+ cache = elem;
13861151
1387 - if ( !cache[ id ] ) {
1388 - cache[ id ] = {};
1389 -
1390 - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1391 - // metadata on plain JS objects when the object is serialized using
1392 - // JSON.stringify
1393 - if ( !isNode ) {
1394 - cache[ id ].toJSON = jQuery.noop;
1395 - }
 1152+ // Compute a unique ID for the element
 1153+ } else if ( !id ) {
 1154+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
13961155 }
13971156
1398 - // An object can be passed to jQuery.data instead of a key/value pair; this gets
1399 - // shallow copied over onto the existing cache
1400 - if ( typeof name === "object" || typeof name === "function" ) {
1401 - if ( pvt ) {
1402 - cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
1403 - } else {
 1157+ // Avoid generating a new cache unless none exists and we
 1158+ // want to manipulate it.
 1159+ if ( typeof name === "object" ) {
 1160+ if ( isNode ) {
14041161 cache[ id ] = jQuery.extend(cache[ id ], name);
1405 - }
1406 - }
14071162
1408 - thisCache = cache[ id ];
1409 -
1410 - // Internal jQuery data is stored in a separate object inside the object's data
1411 - // cache in order to avoid key collisions between internal data and user-defined
1412 - // data
1413 - if ( pvt ) {
1414 - if ( !thisCache[ internalKey ] ) {
1415 - thisCache[ internalKey ] = {};
 1163+ } else {
 1164+ jQuery.extend( cache, name );
14161165 }
14171166
1418 - thisCache = thisCache[ internalKey ];
 1167+ } else if ( isNode && !cache[ id ] ) {
 1168+ cache[ id ] = {};
14191169 }
14201170
 1171+ thisCache = isNode ? cache[ id ] : cache;
 1172+
 1173+ // Prevent overriding the named cache with undefined values
14211174 if ( data !== undefined ) {
14221175 thisCache[ name ] = data;
14231176 }
14241177
1425 - // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
1426 - // not attempt to inspect the internal events object using jQuery.data, as this
1427 - // internal data object is undocumented and subject to change.
1428 - if ( name === "events" && !thisCache[name] ) {
1429 - return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1430 - }
1431 -
1432 - return getByName ? thisCache[ name ] : thisCache;
 1178+ return typeof name === "string" ? thisCache[ name ] : thisCache;
14331179 },
14341180
1435 - removeData: function( elem, name, pvt /* Internal Use Only */ ) {
 1181+ removeData: function( elem, name ) {
14361182 if ( !jQuery.acceptData( elem ) ) {
14371183 return;
14381184 }
14391185
1440 - var internalKey = jQuery.expando, isNode = elem.nodeType,
 1186+ elem = elem == window ?
 1187+ windowData :
 1188+ elem;
14411189
1442 - // See jQuery.data for more information
1443 - cache = isNode ? jQuery.cache : elem,
 1190+ var isNode = elem.nodeType,
 1191+ id = isNode ? elem[ jQuery.expando ] : elem,
 1192+ cache = jQuery.cache,
 1193+ thisCache = isNode ? cache[ id ] : id;
14441194
1445 - // See jQuery.data for more information
1446 - id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1447 -
1448 - // If there is already no cache entry for this object, there is no
1449 - // purpose in continuing
1450 - if ( !cache[ id ] ) {
1451 - return;
1452 - }
1453 -
 1195+ // If we want to remove a specific section of the element's data
14541196 if ( name ) {
1455 - var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
1456 -
14571197 if ( thisCache ) {
 1198+ // Remove the section of cache data
14581199 delete thisCache[ name ];
14591200
1460 - // If there is no data left in the cache, we want to continue
1461 - // and let the cache object itself get destroyed
1462 - if ( !isEmptyDataObject(thisCache) ) {
1463 - return;
 1201+ // If we've removed all the data, remove the element's cache
 1202+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
 1203+ jQuery.removeData( elem );
14641204 }
14651205 }
1466 - }
14671206
1468 - // See jQuery.data for more information
1469 - if ( pvt ) {
1470 - delete cache[ id ][ internalKey ];
1471 -
1472 - // Don't destroy the parent cache unless the internal data object
1473 - // had been the only thing left in it
1474 - if ( !isEmptyDataObject(cache[ id ]) ) {
1475 - return;
1476 - }
1477 - }
1478 -
1479 - var internalCache = cache[ id ][ internalKey ];
1480 -
1481 - // Browsers that fail expando deletion also refuse to delete expandos on
1482 - // the window, but it will allow it on all other JS objects; other browsers
1483 - // don't care
1484 - if ( jQuery.support.deleteExpando || cache != window ) {
1485 - delete cache[ id ];
 1207+ // Otherwise, we want to remove all of the element's data
14861208 } else {
1487 - cache[ id ] = null;
1488 - }
1489 -
1490 - // We destroyed the entire user cache at once because it's faster than
1491 - // iterating through each key, but we need to continue to persist internal
1492 - // data if it existed
1493 - if ( internalCache ) {
1494 - cache[ id ] = {};
1495 - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
1496 - // metadata on plain JS objects when the object is serialized using
1497 - // JSON.stringify
1498 - if ( !isNode ) {
1499 - cache[ id ].toJSON = jQuery.noop;
1500 - }
1501 -
1502 - cache[ id ][ internalKey ] = internalCache;
1503 -
1504 - // Otherwise, we need to eliminate the expando on the node to avoid
1505 - // false lookups in the cache for entries that no longer exist
1506 - } else if ( isNode ) {
1507 - // IE does not allow us to delete expando properties from nodes,
1508 - // nor does it have a removeAttribute function on Document nodes;
1509 - // we must handle all of these cases
1510 - if ( jQuery.support.deleteExpando ) {
 1209+ if ( isNode && jQuery.support.deleteExpando ) {
15111210 delete elem[ jQuery.expando ];
 1211+
15121212 } else if ( elem.removeAttribute ) {
15131213 elem.removeAttribute( jQuery.expando );
 1214+
 1215+ // Completely remove the data cache
 1216+ } else if ( isNode ) {
 1217+ delete cache[ id ];
 1218+
 1219+ // Remove all fields from the object
15141220 } else {
1515 - elem[ jQuery.expando ] = null;
 1221+ for ( var n in elem ) {
 1222+ delete elem[ n ];
 1223+ }
15161224 }
15171225 }
15181226 },
15191227
1520 - // For internal use only.
1521 - _data: function( elem, name, data ) {
1522 - return jQuery.data( elem, name, data, true );
1523 - },
1524 -
15251228 // A method for determining if a DOM node can handle the data expando
15261229 acceptData: function( elem ) {
15271230 if ( elem.nodeName ) {
@@ -1541,17 +1244,15 @@
15421245
15431246 if ( typeof key === "undefined" ) {
15441247 if ( this.length ) {
 1248+ var attr = this[0].attributes, name;
15451249 data = jQuery.data( this[0] );
15461250
1547 - if ( this[0].nodeType === 1 ) {
1548 - var attr = this[0].attributes, name;
1549 - for ( var i = 0, l = attr.length; i < l; i++ ) {
1550 - name = attr[i].name;
 1251+ for ( var i = 0, l = attr.length; i < l; i++ ) {
 1252+ name = attr[i].name;
15511253
1552 - if ( name.indexOf( "data-" ) === 0 ) {
1553 - name = name.substr( 5 );
1554 - dataAttr( this[0], name, data[ name ] );
1555 - }
 1254+ if ( name.indexOf( "data-" ) === 0 ) {
 1255+ name = name.substr( 5 );
 1256+ dataAttr( this[0], name, data[ name ] );
15561257 }
15571258 }
15581259 }
@@ -1626,22 +1327,9 @@
16271328 return data;
16281329 }
16291330
1630 -// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
1631 -// property to be considered empty objects; this property always exists in
1632 -// order to make sure JSON.stringify does not expose internal metadata
1633 -function isEmptyDataObject( obj ) {
1634 - for ( var name in obj ) {
1635 - if ( name !== "toJSON" ) {
1636 - return false;
1637 - }
1638 - }
16391331
1640 - return true;
1641 -}
16421332
16431333
1644 -
1645 -
16461334 jQuery.extend({
16471335 queue: function( elem, type, data ) {
16481336 if ( !elem ) {
@@ -1649,7 +1337,7 @@
16501338 }
16511339
16521340 type = (type || "fx") + "queue";
1653 - var q = jQuery._data( elem, type );
 1341+ var q = jQuery.data( elem, type );
16541342
16551343 // Speed up dequeue by getting out quickly if this is just a lookup
16561344 if ( !data ) {
@@ -1657,7 +1345,7 @@
16581346 }
16591347
16601348 if ( !q || jQuery.isArray(data) ) {
1661 - q = jQuery._data( elem, type, jQuery.makeArray(data) );
 1349+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
16621350
16631351 } else {
16641352 q.push( data );
@@ -1688,10 +1376,6 @@
16891377 jQuery.dequeue(elem, type);
16901378 });
16911379 }
1692 -
1693 - if ( !queue.length ) {
1694 - jQuery.removeData( elem, type + "queue", true );
1695 - }
16961380 }
16971381 });
16981382
@@ -1741,7 +1425,7 @@
17421426
17431427
17441428
1745 -var rclass = /[\n\t\r]/g,
 1429+var rclass = /[\n\t]/g,
17461430 rspaces = /\s+/,
17471431 rreturn = /\r/g,
17481432 rspecialurl = /^(?:href|src|style)$/,
@@ -1874,11 +1558,11 @@
18751559 } else if ( type === "undefined" || type === "boolean" ) {
18761560 if ( this.className ) {
18771561 // store className if set
1878 - jQuery._data( this, "__className__", this.className );
 1562+ jQuery.data( this, "__className__", this.className );
18791563 }
18801564
18811565 // toggle whole className
1882 - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
 1566+ this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
18831567 }
18841568 });
18851569 },
@@ -1923,7 +1607,7 @@
19241608 var option = options[ i ];
19251609
19261610 // Don't return options that are disabled or in a disabled optgroup
1927 - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
 1611+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
19281612 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
19291613
19301614 // Get the specific value for the option
@@ -1939,11 +1623,6 @@
19401624 }
19411625 }
19421626
1943 - // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
1944 - if ( one && !values.length && options.length ) {
1945 - return jQuery( options[ index ] ).val();
1946 - }
1947 -
19481627 return values;
19491628 }
19501629
@@ -1951,6 +1630,7 @@
19521631 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
19531632 return elem.getAttribute("value") === null ? "on" : elem.value;
19541633 }
 1634+
19551635
19561636 // Everything else, we just grab the value
19571637 return (elem.value || "").replace(rreturn, "");
@@ -2016,10 +1696,10 @@
20171697 height: true,
20181698 offset: true
20191699 },
2020 -
 1700+
20211701 attr: function( elem, name, value, pass ) {
2022 - // don't get/set attributes on text, comment and attribute nodes
2023 - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
 1702+ // don't set attributes on text and comment nodes
 1703+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
20241704 return undefined;
20251705 }
20261706
@@ -2034,96 +1714,88 @@
20351715 // Try to normalize/fix the name
20361716 name = notxml && jQuery.props[ name ] || name;
20371717
2038 - // Only do all the following if this is a node (faster for style)
2039 - if ( elem.nodeType === 1 ) {
2040 - // These attributes require special treatment
2041 - var special = rspecialurl.test( name );
 1718+ // These attributes require special treatment
 1719+ var special = rspecialurl.test( name );
20421720
2043 - // Safari mis-reports the default selected property of an option
2044 - // Accessing the parent's selectedIndex property fixes it
2045 - if ( name === "selected" && !jQuery.support.optSelected ) {
2046 - var parent = elem.parentNode;
2047 - if ( parent ) {
2048 - parent.selectedIndex;
 1721+ // Safari mis-reports the default selected property of an option
 1722+ // Accessing the parent's selectedIndex property fixes it
 1723+ if ( name === "selected" && !jQuery.support.optSelected ) {
 1724+ var parent = elem.parentNode;
 1725+ if ( parent ) {
 1726+ parent.selectedIndex;
20491727
2050 - // Make sure that it also works with optgroups, see #5701
2051 - if ( parent.parentNode ) {
2052 - parent.parentNode.selectedIndex;
2053 - }
 1728+ // Make sure that it also works with optgroups, see #5701
 1729+ if ( parent.parentNode ) {
 1730+ parent.parentNode.selectedIndex;
20541731 }
20551732 }
 1733+ }
20561734
2057 - // If applicable, access the attribute via the DOM 0 way
2058 - // 'in' checks fail in Blackberry 4.7 #6931
2059 - if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
2060 - if ( set ) {
2061 - // We can't allow the type property to be changed (since it causes problems in IE)
2062 - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
2063 - jQuery.error( "type property can't be changed" );
2064 - }
 1735+ // If applicable, access the attribute via the DOM 0 way
 1736+ // 'in' checks fail in Blackberry 4.7 #6931
 1737+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
 1738+ if ( set ) {
 1739+ // We can't allow the type property to be changed (since it causes problems in IE)
 1740+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
 1741+ jQuery.error( "type property can't be changed" );
 1742+ }
20651743
2066 - if ( value === null ) {
2067 - if ( elem.nodeType === 1 ) {
2068 - elem.removeAttribute( name );
2069 - }
2070 -
2071 - } else {
2072 - elem[ name ] = value;
 1744+ if ( value === null ) {
 1745+ if ( elem.nodeType === 1 ) {
 1746+ elem.removeAttribute( name );
20731747 }
2074 - }
20751748
2076 - // browsers index elements by id/name on forms, give priority to attributes.
2077 - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
2078 - return elem.getAttributeNode( name ).nodeValue;
 1749+ } else {
 1750+ elem[ name ] = value;
20791751 }
 1752+ }
20801753
2081 - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2082 - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2083 - if ( name === "tabIndex" ) {
2084 - var attributeNode = elem.getAttributeNode( "tabIndex" );
2085 -
2086 - return attributeNode && attributeNode.specified ?
2087 - attributeNode.value :
2088 - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2089 - 0 :
2090 - undefined;
2091 - }
2092 -
2093 - return elem[ name ];
 1754+ // browsers index elements by id/name on forms, give priority to attributes.
 1755+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
 1756+ return elem.getAttributeNode( name ).nodeValue;
20941757 }
20951758
2096 - if ( !jQuery.support.style && notxml && name === "style" ) {
2097 - if ( set ) {
2098 - elem.style.cssText = "" + value;
2099 - }
 1759+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
 1760+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
 1761+ if ( name === "tabIndex" ) {
 1762+ var attributeNode = elem.getAttributeNode( "tabIndex" );
21001763
2101 - return elem.style.cssText;
 1764+ return attributeNode && attributeNode.specified ?
 1765+ attributeNode.value :
 1766+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
 1767+ 0 :
 1768+ undefined;
21021769 }
21031770
 1771+ return elem[ name ];
 1772+ }
 1773+
 1774+ if ( !jQuery.support.style && notxml && name === "style" ) {
21041775 if ( set ) {
2105 - // convert the value to a string (all browsers do this but IE) see #1070
2106 - elem.setAttribute( name, "" + value );
 1776+ elem.style.cssText = "" + value;
21071777 }
21081778
2109 - // Ensure that missing attributes return undefined
2110 - // Blackberry 4.7 returns "" from getAttribute #6938
2111 - if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
2112 - return undefined;
2113 - }
2114 -
2115 - var attr = !jQuery.support.hrefNormalized && notxml && special ?
2116 - // Some attributes require a special call on IE
2117 - elem.getAttribute( name, 2 ) :
2118 - elem.getAttribute( name );
2119 -
2120 - // Non-existent attributes return null, we normalize to undefined
2121 - return attr === null ? undefined : attr;
 1779+ return elem.style.cssText;
21221780 }
2123 - // Handle everything which isn't a DOM element node
 1781+
21241782 if ( set ) {
2125 - elem[ name ] = value;
 1783+ // convert the value to a string (all browsers do this but IE) see #1070
 1784+ elem.setAttribute( name, "" + value );
21261785 }
2127 - return elem[ name ];
 1786+
 1787+ // Ensure that missing attributes return undefined
 1788+ // Blackberry 4.7 returns "" from getAttribute #6938
 1789+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
 1790+ return undefined;
 1791+ }
 1792+
 1793+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
 1794+ // Some attributes require a special call on IE
 1795+ elem.getAttribute( name, 2 ) :
 1796+ elem.getAttribute( name );
 1797+
 1798+ // Non-existent attributes return null, we normalize to undefined
 1799+ return attr === null ? undefined : attr;
21281800 }
21291801 });
21301802
@@ -2137,7 +1809,8 @@
21381810 rescape = /[^\w\s.|`]/g,
21391811 fcleanup = function( nm ) {
21401812 return nm.replace(rescape, "\\$&");
2141 - };
 1813+ },
 1814+ focusCounts = { focusin: 0, focusout: 0 };
21421815
21431816 /*
21441817 * A number of helper functions used for managing events.
@@ -2153,22 +1826,17 @@
21541827 return;
21551828 }
21561829
2157 - // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6)
2158 - // Minor release fix for bug #8018
2159 - try {
2160 - // For whatever reason, IE has trouble passing the window object
2161 - // around, causing it to be cloned in the process
2162 - if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
2163 - elem = window;
2164 - }
 1830+ // For whatever reason, IE has trouble passing the window object
 1831+ // around, causing it to be cloned in the process
 1832+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
 1833+ elem = window;
21651834 }
2166 - catch ( e ) {}
21671835
21681836 if ( handler === false ) {
21691837 handler = returnFalse;
21701838 } else if ( !handler ) {
21711839 // Fixes bug #7229. Fix recommended by jdalton
2172 - return;
 1840+ return;
21731841 }
21741842
21751843 var handleObjIn, handleObj;
@@ -2184,7 +1852,7 @@
21851853 }
21861854
21871855 // Init the element's event structure
2188 - var elemData = jQuery._data( elem );
 1856+ var elemData = jQuery.data( elem );
21891857
21901858 // If no elemData is found then we must be trying to bind to one of the
21911859 // banned noData elements
@@ -2192,18 +1860,34 @@
21931861 return;
21941862 }
21951863
2196 - var events = elemData.events,
 1864+ // Use a key less likely to result in collisions for plain JS objects.
 1865+ // Fixes bug #7150.
 1866+ var eventKey = elem.nodeType ? "events" : "__events__",
 1867+ events = elemData[ eventKey ],
21971868 eventHandle = elemData.handle;
 1869+
 1870+ if ( typeof events === "function" ) {
 1871+ // On plain objects events is a fn that holds the the data
 1872+ // which prevents this data from being JSON serialized
 1873+ // the function does not need to be called, it just contains the data
 1874+ eventHandle = events.handle;
 1875+ events = events.events;
21981876
2199 - if ( !events ) {
 1877+ } else if ( !events ) {
 1878+ if ( !elem.nodeType ) {
 1879+ // On plain objects, create a fn that acts as the holder
 1880+ // of the values to avoid JSON serialization of event data
 1881+ elemData[ eventKey ] = elemData = function(){};
 1882+ }
 1883+
22001884 elemData.events = events = {};
22011885 }
22021886
22031887 if ( !eventHandle ) {
2204 - elemData.handle = eventHandle = function( e ) {
 1888+ elemData.handle = eventHandle = function() {
22051889 // Handle the second event of a trigger and when
22061890 // an event is called after a page has unloaded
2207 - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
 1891+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
22081892 jQuery.event.handle.apply( eventHandle.elem, arguments ) :
22091893 undefined;
22101894 };
@@ -2261,10 +1945,10 @@
22621946 }
22631947 }
22641948 }
 1949+
 1950+ if ( special.add ) {
 1951+ special.add.call( elem, handleObj );
22651952
2266 - if ( special.add ) {
2267 - special.add.call( elem, handleObj );
2268 -
22691953 if ( !handleObj.handler.guid ) {
22701954 handleObj.handler.guid = handler.guid;
22711955 }
@@ -2295,12 +1979,18 @@
22961980 }
22971981
22981982 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
2299 - elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
2300 - events = elemData && elemData.events;
 1983+ eventKey = elem.nodeType ? "events" : "__events__",
 1984+ elemData = jQuery.data( elem ),
 1985+ events = elemData && elemData[ eventKey ];
23011986
23021987 if ( !elemData || !events ) {
23031988 return;
23041989 }
 1990+
 1991+ if ( typeof events === "function" ) {
 1992+ elemData = events;
 1993+ events = events.events;
 1994+ }
23051995
23061996 // types is actually an event object here
23071997 if ( types && types.type ) {
@@ -2334,7 +2024,7 @@
23352025 namespaces = type.split(".");
23362026 type = namespaces.shift();
23372027
2338 - namespace = new RegExp("(^|\\.)" +
 2028+ namespace = new RegExp("(^|\\.)" +
23392029 jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
23402030 }
23412031
@@ -2401,8 +2091,11 @@
24022092 delete elemData.events;
24032093 delete elemData.handle;
24042094
2405 - if ( jQuery.isEmptyObject( elemData ) ) {
2406 - jQuery.removeData( elem, undefined, true );
 2095+ if ( typeof elemData === "function" ) {
 2096+ jQuery.removeData( elem, eventKey );
 2097+
 2098+ } else if ( jQuery.isEmptyObject( elemData ) ) {
 2099+ jQuery.removeData( elem );
24072100 }
24082101 }
24092102 },
@@ -2434,16 +2127,9 @@
24352128
24362129 // Only trigger if we've ever bound an event for it
24372130 if ( jQuery.event.global[ type ] ) {
2438 - // XXX This code smells terrible. event.js should not be directly
2439 - // inspecting the data cache
24402131 jQuery.each( jQuery.cache, function() {
2441 - // internalKey variable is just used to make it easier to find
2442 - // and potentially change this stuff later; currently it just
2443 - // points to jQuery.expando
2444 - var internalKey = jQuery.expando,
2445 - internalCache = this[ internalKey ];
2446 - if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
2447 - jQuery.event.trigger( event, data, internalCache.handle.elem );
 2132+ if ( this.events && this.events[type] ) {
 2133+ jQuery.event.trigger( event, data, this.handle.elem );
24482134 }
24492135 });
24502136 }
@@ -2468,7 +2154,9 @@
24692155 event.currentTarget = elem;
24702156
24712157 // Trigger the event, it is assumed that "handle" is a function
2472 - var handle = jQuery._data( elem, "handle" );
 2158+ var handle = elem.nodeType ?
 2159+ jQuery.data( elem, "handle" ) :
 2160+ (jQuery.data( elem, "__events__" ) || {}).handle;
24732161
24742162 if ( handle ) {
24752163 handle.apply( elem, data );
@@ -2498,7 +2186,7 @@
24992187 isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
25002188 special = jQuery.event.special[ targetType ] || {};
25012189
2502 - if ( (!special._default || special._default.call( elem, event ) === false) &&
 2190+ if ( (!special._default || special._default.call( elem, event ) === false) &&
25032191 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
25042192
25052193 try {
@@ -2510,7 +2198,7 @@
25112199 target[ "on" + targetType ] = null;
25122200 }
25132201
2514 - jQuery.event.triggered = event.type;
 2202+ jQuery.event.triggered = true;
25152203 target[ targetType ]();
25162204 }
25172205
@@ -2521,7 +2209,7 @@
25222210 target[ "on" + targetType ] = old;
25232211 }
25242212
2525 - jQuery.event.triggered = undefined;
 2213+ jQuery.event.triggered = false;
25262214 }
25272215 }
25282216 },
@@ -2546,8 +2234,12 @@
25472235
25482236 event.namespace = event.namespace || namespace_sort.join(".");
25492237
2550 - events = jQuery._data(this, "events");
 2238+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
25512239
 2240+ if ( typeof events === "function" ) {
 2241+ events = events.events;
 2242+ }
 2243+
25522244 handlers = (events || {})[ event.type ];
25532245
25542246 if ( events && handlers ) {
@@ -2564,7 +2256,7 @@
25652257 event.handler = handleObj.handler;
25662258 event.data = handleObj.data;
25672259 event.handleObj = handleObj;
2568 -
 2260+
25692261 var ret = handleObj.handler.apply( this, args );
25702262
25712263 if ( ret !== undefined ) {
@@ -2663,7 +2355,7 @@
26642356 add: function( handleObj ) {
26652357 jQuery.event.add( this,
26662358 liveConvert( handleObj.origType, handleObj.selector ),
2667 - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
 2359+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
26682360 },
26692361
26702362 remove: function( handleObj ) {
@@ -2693,7 +2385,7 @@
26942386 if ( elem.removeEventListener ) {
26952387 elem.removeEventListener( type, handle, false );
26962388 }
2697 - } :
 2389+ } :
26982390 function( elem, type, handle ) {
26992391 if ( elem.detachEvent ) {
27002392 elem.detachEvent( "on" + type, handle );
@@ -2710,12 +2402,6 @@
27112403 if ( src && src.type ) {
27122404 this.originalEvent = src;
27132405 this.type = src.type;
2714 -
2715 - // Events bubbling up the document may have been marked as prevented
2716 - // by a handler lower down the tree; reflect the correct value.
2717 - this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
2718 - src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
2719 -
27202406 // Event type
27212407 } else {
27222408 this.type = src;
@@ -2746,7 +2432,7 @@
27472433 if ( !e ) {
27482434 return;
27492435 }
2750 -
 2436+
27512437 // if preventDefault exists run it on the original event
27522438 if ( e.preventDefault ) {
27532439 e.preventDefault();
@@ -2788,12 +2474,6 @@
27892475 // Firefox sometimes assigns relatedTarget a XUL element
27902476 // which we cannot access the parentNode property of
27912477 try {
2792 -
2793 - // Chrome does something similar, the parentNode property
2794 - // can be accessed but is null.
2795 - if ( parent && parent !== document && !parent.parentNode ) {
2796 - return;
2797 - }
27982478 // Traverse up the tree
27992479 while ( parent && parent !== this ) {
28002480 parent = parent.parentNode;
@@ -2838,22 +2518,24 @@
28392519
28402520 jQuery.event.special.submit = {
28412521 setup: function( data, namespaces ) {
2842 - if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
 2522+ if ( this.nodeName.toLowerCase() !== "form" ) {
28432523 jQuery.event.add(this, "click.specialSubmit", function( e ) {
28442524 var elem = e.target,
28452525 type = elem.type;
28462526
28472527 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
2848 - trigger( "submit", this, arguments );
 2528+ e.liveFired = undefined;
 2529+ return trigger( "submit", this, arguments );
28492530 }
28502531 });
2851 -
 2532+
28522533 jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
28532534 var elem = e.target,
28542535 type = elem.type;
28552536
28562537 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
2857 - trigger( "submit", this, arguments );
 2538+ e.liveFired = undefined;
 2539+ return trigger( "submit", this, arguments );
28582540 }
28592541 });
28602542
@@ -2901,14 +2583,14 @@
29022584 return;
29032585 }
29042586
2905 - data = jQuery._data( elem, "_change_data" );
 2587+ data = jQuery.data( elem, "_change_data" );
29062588 val = getVal(elem);
29072589
29082590 // the current data will be also retrieved by beforeactivate
29092591 if ( e.type !== "focusout" || elem.type !== "radio" ) {
2910 - jQuery._data( elem, "_change_data", val );
 2592+ jQuery.data( elem, "_change_data", val );
29112593 }
2912 -
 2594+
29132595 if ( data === undefined || val === data ) {
29142596 return;
29152597 }
@@ -2916,13 +2598,13 @@
29172599 if ( data != null || val ) {
29182600 e.type = "change";
29192601 e.liveFired = undefined;
2920 - jQuery.event.trigger( e, arguments[1], elem );
 2602+ return jQuery.event.trigger( e, arguments[1], elem );
29212603 }
29222604 };
29232605
29242606 jQuery.event.special.change = {
29252607 filters: {
2926 - focusout: testChange,
 2608+ focusout: testChange,
29272609
29282610 beforedeactivate: testChange,
29292611
@@ -2930,7 +2612,7 @@
29312613 var elem = e.target, type = elem.type;
29322614
29332615 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
2934 - testChange.call( this, e );
 2616+ return testChange.call( this, e );
29352617 }
29362618 },
29372619
@@ -2942,7 +2624,7 @@
29432625 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
29442626 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
29452627 type === "select-multiple" ) {
2946 - testChange.call( this, e );
 2628+ return testChange.call( this, e );
29472629 }
29482630 },
29492631
@@ -2951,7 +2633,7 @@
29522634 // information
29532635 beforeactivate: function( e ) {
29542636 var elem = e.target;
2955 - jQuery._data( elem, "_change_data", getVal(elem) );
 2637+ jQuery.data( elem, "_change_data", getVal(elem) );
29562638 }
29572639 },
29582640
@@ -2981,50 +2663,30 @@
29822664 }
29832665
29842666 function trigger( type, elem, args ) {
2985 - // Piggyback on a donor event to simulate a different one.
2986 - // Fake originalEvent to avoid donor's stopPropagation, but if the
2987 - // simulated event prevents default then we do the same on the donor.
2988 - // Don't pass args or remember liveFired; they apply to the donor event.
2989 - var event = jQuery.extend( {}, args[ 0 ] );
2990 - event.type = type;
2991 - event.originalEvent = {};
2992 - event.liveFired = undefined;
2993 - jQuery.event.handle.call( elem, event );
2994 - if ( event.isDefaultPrevented() ) {
2995 - args[ 0 ].preventDefault();
2996 - }
 2667+ args[0].type = type;
 2668+ return jQuery.event.handle.apply( elem, args );
29972669 }
29982670
29992671 // Create "bubbling" focus and blur events
30002672 if ( document.addEventListener ) {
30012673 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3002 -
3003 - // Attach a single capturing handler while someone wants focusin/focusout
3004 - var attaches = 0;
3005 -
30062674 jQuery.event.special[ fix ] = {
30072675 setup: function() {
3008 - if ( attaches++ === 0 ) {
 2676+ if ( focusCounts[fix]++ === 0 ) {
30092677 document.addEventListener( orig, handler, true );
30102678 }
3011 - },
3012 - teardown: function() {
3013 - if ( --attaches === 0 ) {
 2679+ },
 2680+ teardown: function() {
 2681+ if ( --focusCounts[fix] === 0 ) {
30142682 document.removeEventListener( orig, handler, true );
30152683 }
30162684 }
30172685 };
30182686
3019 - function handler( donor ) {
3020 - // Donor event is always a native one; fix it and switch its type.
3021 - // Let focusin/out handler cancel the donor focus/blur event.
3022 - var e = jQuery.event.fix( donor );
 2687+ function handler( e ) {
 2688+ e = jQuery.event.fix( e );
30232689 e.type = fix;
3024 - e.originalEvent = {};
3025 - jQuery.event.trigger( e, null, e.target );
3026 - if ( e.isDefaultPrevented() ) {
3027 - donor.preventDefault();
3028 - }
 2690+ return jQuery.event.trigger( e, null, e.target );
30292691 }
30302692 });
30312693 }
@@ -3038,7 +2700,7 @@
30392701 }
30402702 return this;
30412703 }
3042 -
 2704+
30432705 if ( jQuery.isFunction( data ) || data === false ) {
30442706 fn = data;
30452707 data = undefined;
@@ -3078,20 +2740,20 @@
30792741
30802742 return this;
30812743 },
3082 -
 2744+
30832745 delegate: function( selector, types, data, fn ) {
30842746 return this.live( types, data, fn, selector );
30852747 },
3086 -
 2748+
30872749 undelegate: function( selector, types, fn ) {
30882750 if ( arguments.length === 0 ) {
30892751 return this.unbind( "live" );
3090 -
 2752+
30912753 } else {
30922754 return this.die( types, null, fn, selector );
30932755 }
30942756 },
3095 -
 2757+
30962758 trigger: function( type, data ) {
30972759 return this.each(function() {
30982760 jQuery.event.trigger( type, data, this );
@@ -3120,8 +2782,8 @@
31212783
31222784 return this.click( jQuery.proxy( fn, function( event ) {
31232785 // Figure out which function to execute
3124 - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3125 - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
 2786+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
 2787+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
31262788
31272789 // Make sure that clicks stop
31282790 event.preventDefault();
@@ -3148,12 +2810,12 @@
31492811 var type, i = 0, match, namespaces, preType,
31502812 selector = origSelector || this.selector,
31512813 context = origSelector ? this : jQuery( this.context );
3152 -
 2814+
31532815 if ( typeof types === "object" && !types.preventDefault ) {
31542816 for ( var key in types ) {
31552817 context[ name ]( key, data, types[key], selector );
31562818 }
3157 -
 2819+
31582820 return this;
31592821 }
31602822
@@ -3200,7 +2862,7 @@
32012863 context.unbind( "live." + liveConvert( type, selector ), fn );
32022864 }
32032865 }
3204 -
 2866+
32052867 return this;
32062868 };
32072869 });
@@ -3209,13 +2871,17 @@
32102872 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
32112873 elems = [],
32122874 selectors = [],
3213 - events = jQuery._data( this, "events" );
 2875+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
32142876
3215 - // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
3216 - if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
3217 - return;
 2877+ if ( typeof events === "function" ) {
 2878+ events = events.events;
32182879 }
32192880
 2881+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
 2882+ if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
 2883+ return;
 2884+ }
 2885+
32202886 if ( event.namespace ) {
32212887 namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
32222888 }
@@ -3243,7 +2909,7 @@
32442910 for ( j = 0; j < live.length; j++ ) {
32452911 handleObj = live[j];
32462912
3247 - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
 2913+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
32482914 elem = close.elem;
32492915 related = null;
32502916
@@ -3313,10 +2979,27 @@
33142980 }
33152981 });
33162982
 2983+// Prevent memory leaks in IE
 2984+// Window isn't included so as not to unbind existing unload events
 2985+// More info:
 2986+// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
 2987+if ( window.attachEvent && !window.addEventListener ) {
 2988+ jQuery(window).bind("unload", function() {
 2989+ for ( var id in jQuery.cache ) {
 2990+ if ( jQuery.cache[ id ].handle ) {
 2991+ // Try/Catch is to handle iframes being unloaded, see #4280
 2992+ try {
 2993+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
 2994+ } catch(e) {}
 2995+ }
 2996+ }
 2997+ });
 2998+}
33172999
 3000+
33183001 /*!
3319 - * Sizzle CSS Selector Engine
3320 - * Copyright 2011, The Dojo Foundation
 3002+ * Sizzle CSS Selector Engine - v1.0
 3003+ * Copyright 2009, The Dojo Foundation
33213004 * Released under the MIT, BSD, and GPL Licenses.
33223005 * More information: http://sizzlejs.com/
33233006 */
@@ -3326,9 +3009,7 @@
33273010 done = 0,
33283011 toString = Object.prototype.toString,
33293012 hasDuplicate = false,
3330 - baseHasDuplicate = true,
3331 - rBackslash = /\\/g,
3332 - rNonWord = /\W/;
 3013+ baseHasDuplicate = true;
33333014
33343015 // Here we check if the JavaScript engine is using some sort of
33353016 // optimization where it does not always call our comparision
@@ -3527,7 +3208,7 @@
35283209 match.splice( 1, 1 );
35293210
35303211 if ( left.substr( left.length - 1 ) !== "\\" ) {
3531 - match[1] = (match[1] || "").replace( rBackslash, "" );
 3212+ match[1] = (match[1] || "").replace(/\\/g, "");
35323213 set = Expr.find[ type ]( match, context, isXML );
35333214
35343215 if ( set != null ) {
@@ -3539,9 +3220,7 @@
35403221 }
35413222
35423223 if ( !set ) {
3543 - set = typeof context.getElementsByTagName !== "undefined" ?
3544 - context.getElementsByTagName( "*" ) :
3545 - [];
 3224+ set = context.getElementsByTagName( "*" );
35463225 }
35473226
35483227 return { set: set, expr: expr };
@@ -3649,9 +3328,9 @@
36503329 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
36513330 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
36523331 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3653 - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
 3332+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
36543333 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3655 - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
 3334+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
36563335 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
36573336 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
36583337 },
@@ -3666,16 +3345,13 @@
36673346 attrHandle: {
36683347 href: function( elem ) {
36693348 return elem.getAttribute( "href" );
3670 - },
3671 - type: function( elem ) {
3672 - return elem.getAttribute( "type" );
36733349 }
36743350 },
36753351
36763352 relative: {
36773353 "+": function(checkSet, part){
36783354 var isPartStr = typeof part === "string",
3679 - isTag = isPartStr && !rNonWord.test( part ),
 3355+ isTag = isPartStr && !/\W/.test( part ),
36803356 isPartStrNotTag = isPartStr && !isTag;
36813357
36823358 if ( isTag ) {
@@ -3703,7 +3379,7 @@
37043380 i = 0,
37053381 l = checkSet.length;
37063382
3707 - if ( isPartStr && !rNonWord.test( part ) ) {
 3383+ if ( isPartStr && !/\W/.test( part ) ) {
37083384 part = part.toLowerCase();
37093385
37103386 for ( ; i < l; i++ ) {
@@ -3737,7 +3413,7 @@
37383414 doneName = done++,
37393415 checkFn = dirCheck;
37403416
3741 - if ( typeof part === "string" && !rNonWord.test( part ) ) {
 3417+ if ( typeof part === "string" && !/\W/.test(part) ) {
37423418 part = part.toLowerCase();
37433419 nodeCheck = part;
37443420 checkFn = dirNodeCheck;
@@ -3751,7 +3427,7 @@
37523428 doneName = done++,
37533429 checkFn = dirCheck;
37543430
3755 - if ( typeof part === "string" && !rNonWord.test( part ) ) {
 3431+ if ( typeof part === "string" && !/\W/.test( part ) ) {
37563432 part = part.toLowerCase();
37573433 nodeCheck = part;
37583434 checkFn = dirNodeCheck;
@@ -3787,14 +3463,12 @@
37883464 },
37893465
37903466 TAG: function( match, context ) {
3791 - if ( typeof context.getElementsByTagName !== "undefined" ) {
3792 - return context.getElementsByTagName( match[1] );
3793 - }
 3467+ return context.getElementsByTagName( match[1] );
37943468 }
37953469 },
37963470 preFilter: {
37973471 CLASS: function( match, curLoop, inplace, result, not, isXML ) {
3798 - match = " " + match[1].replace( rBackslash, "" ) + " ";
 3472+ match = " " + match[1].replace(/\\/g, "") + " ";
37993473
38003474 if ( isXML ) {
38013475 return match;
@@ -3802,7 +3476,7 @@
38033477
38043478 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
38053479 if ( elem ) {
3806 - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
 3480+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
38073481 if ( !inplace ) {
38083482 result.push( elem );
38093483 }
@@ -3817,23 +3491,17 @@
38183492 },
38193493
38203494 ID: function( match ) {
3821 - return match[1].replace( rBackslash, "" );
 3495+ return match[1].replace(/\\/g, "");
38223496 },
38233497
38243498 TAG: function( match, curLoop ) {
3825 - return match[1].replace( rBackslash, "" ).toLowerCase();
 3499+ return match[1].toLowerCase();
38263500 },
38273501
38283502 CHILD: function( match ) {
38293503 if ( match[1] === "nth" ) {
3830 - if ( !match[2] ) {
3831 - Sizzle.error( match[0] );
3832 - }
3833 -
3834 - match[2] = match[2].replace(/^\+|\s*/g, '');
3835 -
38363504 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
3837 - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
 3505+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
38383506 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
38393507 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
38403508
@@ -3841,9 +3509,6 @@
38423510 match[2] = (test[1] + (test[2] || 1)) - 0;
38433511 match[3] = test[3] - 0;
38443512 }
3845 - else if ( match[2] ) {
3846 - Sizzle.error( match[0] );
3847 - }
38483513
38493514 // TODO: Move to normal caching system
38503515 match[0] = done++;
@@ -3852,15 +3517,12 @@
38533518 },
38543519
38553520 ATTR: function( match, curLoop, inplace, result, not, isXML ) {
3856 - var name = match[1] = match[1].replace( rBackslash, "" );
 3521+ var name = match[1].replace(/\\/g, "");
38573522
38583523 if ( !isXML && Expr.attrMap[name] ) {
38593524 match[1] = Expr.attrMap[name];
38603525 }
38613526
3862 - // Handle if an un-quoted value was used
3863 - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
3864 -
38653527 if ( match[2] === "~=" ) {
38663528 match[4] = " " + match[4] + " ";
38673529 }
@@ -3914,9 +3576,7 @@
39153577 selected: function( elem ) {
39163578 // Accessing this property makes selected-by-default
39173579 // options in Safari work properly
3918 - if ( elem.parentNode ) {
3919 - elem.parentNode.selectedIndex;
3920 - }
 3580+ elem.parentNode.selectedIndex;
39213581
39223582 return elem.selected === true;
39233583 },
@@ -3938,12 +3598,8 @@
39393599 },
39403600
39413601 text: function( elem ) {
3942 - var attr = elem.getAttribute( "type" ), type = elem.type;
3943 - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
3944 - // use getAttribute instead to test this case
3945 - return "text" === type && ( attr === type || attr === null );
 3602+ return "text" === elem.type;
39463603 },
3947 -
39483604 radio: function( elem ) {
39493605 return "radio" === elem.type;
39503606 },
@@ -4035,7 +3691,7 @@
40363692 return true;
40373693
40383694 } else {
4039 - Sizzle.error( name );
 3695+ Sizzle.error( "Syntax error, unrecognized expression: " + name );
40403696 }
40413697 },
40423698
@@ -4425,47 +4081,13 @@
44264082 Sizzle = function( query, context, extra, seed ) {
44274083 context = context || document;
44284084
 4085+ // Make sure that attribute selectors are quoted
 4086+ query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
 4087+
44294088 // Only use querySelectorAll on non-XML documents
44304089 // (ID selectors don't work in non-HTML documents)
44314090 if ( !seed && !Sizzle.isXML(context) ) {
4432 - // See if we find a selector to speed up
4433 - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
4434 -
4435 - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
4436 - // Speed-up: Sizzle("TAG")
4437 - if ( match[1] ) {
4438 - return makeArray( context.getElementsByTagName( query ), extra );
4439 -
4440 - // Speed-up: Sizzle(".CLASS")
4441 - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
4442 - return makeArray( context.getElementsByClassName( match[2] ), extra );
4443 - }
4444 - }
4445 -
44464091 if ( context.nodeType === 9 ) {
4447 - // Speed-up: Sizzle("body")
4448 - // The body element only exists once, optimize finding it
4449 - if ( query === "body" && context.body ) {
4450 - return makeArray( [ context.body ], extra );
4451 -
4452 - // Speed-up: Sizzle("#ID")
4453 - } else if ( match && match[3] ) {
4454 - var elem = context.getElementById( match[3] );
4455 -
4456 - // Check parentNode to catch when Blackberry 4.6 returns
4457 - // nodes that are no longer in the document #6963
4458 - if ( elem && elem.parentNode ) {
4459 - // Handle the case where IE and Opera return items
4460 - // by name instead of ID
4461 - if ( elem.id === match[3] ) {
4462 - return makeArray( [ elem ], extra );
4463 - }
4464 -
4465 - } else {
4466 - return makeArray( [], extra );
4467 - }
4468 - }
4469 -
44704092 try {
44714093 return makeArray( context.querySelectorAll(query), extra );
44724094 } catch(qsaError) {}
@@ -4475,30 +4097,20 @@
44764098 // and working up from there (Thanks to Andrew Dupont for the technique)
44774099 // IE 8 doesn't work on object elements
44784100 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
4479 - var oldContext = context,
4480 - old = context.getAttribute( "id" ),
4481 - nid = old || id,
4482 - hasParent = context.parentNode,
4483 - relativeHierarchySelector = /^\s*[+~]/.test( query );
 4101+ var old = context.getAttribute( "id" ),
 4102+ nid = old || id;
44844103
44854104 if ( !old ) {
44864105 context.setAttribute( "id", nid );
4487 - } else {
4488 - nid = nid.replace( /'/g, "\\$&" );
44894106 }
4490 - if ( relativeHierarchySelector && hasParent ) {
4491 - context = context.parentNode;
4492 - }
44934107
44944108 try {
4495 - if ( !relativeHierarchySelector || hasParent ) {
4496 - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
4497 - }
 4109+ return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
44984110
44994111 } catch(pseudoError) {
45004112 } finally {
45014113 if ( !old ) {
4502 - oldContext.removeAttribute( "id" );
 4114+ context.removeAttribute( "id" );
45034115 }
45044116 }
45054117 }
@@ -4518,23 +4130,19 @@
45194131
45204132 (function(){
45214133 var html = document.documentElement,
4522 - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
 4134+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
 4135+ pseudoWorks = false;
45234136
4524 - if ( matches ) {
4525 - // Check to see if it's possible to do matchesSelector
4526 - // on a disconnected node (IE 9 fails this)
4527 - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
4528 - pseudoWorks = false;
4529 -
4530 - try {
4531 - // This should fail with an exception
4532 - // Gecko does not error, returns false instead
4533 - matches.call( document.documentElement, "[test!='']:sizzle" );
 4137+ try {
 4138+ // This should fail with an exception
 4139+ // Gecko does not error, returns false instead
 4140+ matches.call( document.documentElement, "[test!='']:sizzle" );
45344141
4535 - } catch( pseudoError ) {
4536 - pseudoWorks = true;
4537 - }
 4142+ } catch( pseudoError ) {
 4143+ pseudoWorks = true;
 4144+ }
45384145
 4146+ if ( matches ) {
45394147 Sizzle.matchesSelector = function( node, expr ) {
45404148 // Make sure that attribute selectors are quoted
45414149 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
@@ -4542,15 +4150,7 @@
45434151 if ( !Sizzle.isXML( node ) ) {
45444152 try {
45454153 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4546 - var ret = matches.call( node, expr );
4547 -
4548 - // IE 9's matchesSelector returns false on disconnected nodes
4549 - if ( ret || !disconnectedMatch ||
4550 - // As well, disconnected nodes are said to be in a document
4551 - // fragment in IE 9, so check for that
4552 - node.document && node.document.nodeType !== 11 ) {
4553 - return ret;
4554 - }
 4154+ return matches.call( node, expr );
45554155 }
45564156 } catch(e) {}
45574157 }
@@ -4728,14 +4328,7 @@
47294329 rmultiselector = /,/,
47304330 isSimple = /^.[^:#\[\.,]*$/,
47314331 slice = Array.prototype.slice,
4732 - POS = jQuery.expr.match.POS,
4733 - // methods guaranteed to produce a unique set when starting from a unique set
4734 - guaranteedUnique = {
4735 - children: true,
4736 - contents: true,
4737 - next: true,
4738 - prev: true
4739 - };
 4332+ POS = jQuery.expr.match.POS;
47404333
47414334 jQuery.fn.extend({
47424335 find: function( selector ) {
@@ -4780,7 +4373,7 @@
47814374 filter: function( selector ) {
47824375 return this.pushStack( winnow(this, selector, true), "filter", selector );
47834376 },
4784 -
 4377+
47854378 is: function( selector ) {
47864379 return !!selector && jQuery.filter( selector, this ).length > 0;
47874380 },
@@ -4798,7 +4391,7 @@
47994392 selector = selectors[i];
48004393
48014394 if ( !matches[selector] ) {
4802 - matches[selector] = jQuery.expr.match.POS.test( selector ) ?
 4395+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
48034396 jQuery( selector, context || this.context ) :
48044397 selector;
48054398 }
@@ -4821,7 +4414,7 @@
48224415 return ret;
48234416 }
48244417
4825 - var pos = POS.test( selectors ) ?
 4418+ var pos = POS.test( selectors ) ?
48264419 jQuery( selectors, context || this.context ) : null;
48274420
48284421 for ( i = 0, l = this.length; i < l; i++ ) {
@@ -4842,10 +4435,10 @@
48434436 }
48444437
48454438 ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4846 -
 4439+
48474440 return this.pushStack( ret, "closest", selectors );
48484441 },
4849 -
 4442+
48504443 // Determine the position of an element within
48514444 // the matched set of elements
48524445 index: function( elem ) {
@@ -4863,7 +4456,7 @@
48644457
48654458 add: function( selector, context ) {
48664459 var set = typeof selector === "string" ?
4867 - jQuery( selector, context ) :
 4460+ jQuery( selector, context || this.context ) :
48684461 jQuery.makeArray( selector ),
48694462 all = jQuery.merge( this.get(), set );
48704463
@@ -4925,13 +4518,8 @@
49264519 }
49274520 }, function( name, fn ) {
49284521 jQuery.fn[ name ] = function( until, selector ) {
4929 - var ret = jQuery.map( this, fn, until ),
4930 - // The variable 'args' was introduced in
4931 - // https://github.com/jquery/jquery/commit/52a0238
4932 - // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
4933 - // http://code.google.com/p/v8/issues/detail?id=1050
4934 - args = slice.call(arguments);
4935 -
 4522+ var ret = jQuery.map( this, fn, until );
 4523+
49364524 if ( !runtil.test( name ) ) {
49374525 selector = until;
49384526 }
@@ -4940,13 +4528,13 @@
49414529 ret = jQuery.filter( selector, ret );
49424530 }
49434531
4944 - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
 4532+ ret = this.length > 1 ? jQuery.unique( ret ) : ret;
49454533
49464534 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
49474535 ret = ret.reverse();
49484536 }
49494537
4950 - return this.pushStack( ret, name, args.join(",") );
 4538+ return this.pushStack( ret, name, slice.call(arguments).join(",") );
49514539 };
49524540 });
49534541
@@ -4960,7 +4548,7 @@
49614549 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
49624550 jQuery.find.matches(expr, elems);
49634551 },
4964 -
 4552+
49654553 dir: function( elem, dir, until ) {
49664554 var matched = [],
49674555 cur = elem[ dir ];
@@ -5040,8 +4628,9 @@
50414629 rtbody = /<tbody/i,
50424630 rhtml = /<|&#?\w+;/,
50434631 rnocache = /<(?:script|object|embed|option|style)/i,
5044 - // checked="checked" or checked
 4632+ // checked="checked" or checked (html5)
50454633 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
 4634+ raction = /\=([^="'>\s]+\/)>/g,
50464635 wrapMap = {
50474636 option: [ 1, "<select multiple='multiple'>", "</select>" ],
50484637 legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -5181,7 +4770,7 @@
51824771 return set;
51834772 }
51844773 },
5185 -
 4774+
51864775 // keepData is for internal use only--do not document
51874776 remove: function( selector, keepData ) {
51884777 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
@@ -5192,11 +4781,11 @@
51934782 }
51944783
51954784 if ( elem.parentNode ) {
5196 - elem.parentNode.removeChild( elem );
 4785+ elem.parentNode.removeChild( elem );
51974786 }
51984787 }
51994788 }
5200 -
 4789+
52014790 return this;
52024791 },
52034792
@@ -5212,17 +4801,48 @@
52134802 elem.removeChild( elem.firstChild );
52144803 }
52154804 }
5216 -
 4805+
52174806 return this;
52184807 },
52194808
5220 - clone: function( dataAndEvents, deepDataAndEvents ) {
5221 - dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5222 - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
 4809+ clone: function( events ) {
 4810+ // Do the clone
 4811+ var ret = this.map(function() {
 4812+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
 4813+ // IE copies events bound via attachEvent when
 4814+ // using cloneNode. Calling detachEvent on the
 4815+ // clone will also remove the events from the orignal
 4816+ // In order to get around this, we use innerHTML.
 4817+ // Unfortunately, this means some modifications to
 4818+ // attributes in IE that are actually only stored
 4819+ // as properties will not be copied (such as the
 4820+ // the name attribute on an input).
 4821+ var html = this.outerHTML,
 4822+ ownerDocument = this.ownerDocument;
52234823
5224 - return this.map( function () {
5225 - return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
 4824+ if ( !html ) {
 4825+ var div = ownerDocument.createElement("div");
 4826+ div.appendChild( this.cloneNode(true) );
 4827+ html = div.innerHTML;
 4828+ }
 4829+
 4830+ return jQuery.clean([html.replace(rinlinejQuery, "")
 4831+ // Handle the case in IE 8 where action=/test/> self-closes a tag
 4832+ .replace(raction, '="$1">')
 4833+ .replace(rleadingWhitespace, "")], ownerDocument)[0];
 4834+ } else {
 4835+ return this.cloneNode(true);
 4836+ }
52264837 });
 4838+
 4839+ // Copy the events from the original to the clone
 4840+ if ( events === true ) {
 4841+ cloneCopyEvent( this, ret );
 4842+ cloneCopyEvent( this.find("*"), ret.find("*") );
 4843+ }
 4844+
 4845+ // Return the cloned set
 4846+ return ret;
52274847 },
52284848
52294849 html: function( value ) {
@@ -5294,9 +4914,7 @@
52954915 }
52964916 });
52974917 } else {
5298 - return this.length ?
5299 - this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
5300 - this;
 4918+ return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
53014919 }
53024920 },
53034921
@@ -5334,9 +4952,9 @@
53354953 } else {
53364954 results = jQuery.buildFragment( args, this, scripts );
53374955 }
5338 -
 4956+
53394957 fragment = results.fragment;
5340 -
 4958+
53414959 if ( fragment.childNodes.length === 1 ) {
53424960 first = fragment = fragment.firstChild;
53434961 } else {
@@ -5346,20 +4964,13 @@
53474965 if ( first ) {
53484966 table = table && jQuery.nodeName( first, "tr" );
53494967
5350 - for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
 4968+ for ( var i = 0, l = this.length; i < l; i++ ) {
53514969 callback.call(
53524970 table ?
53534971 root(this[i], first) :
53544972 this[i],
5355 - // Make sure that we do not leak memory by inadvertently discarding
5356 - // the original fragment (which might have attached data) instead of
5357 - // using it; in addition, use the original fragment object for the last
5358 - // item instead of first because it can end up being emptied incorrectly
5359 - // in certain situations (Bug #8070).
5360 - // Fragments from the fragment cache must always be cloned and never used
5361 - // in place.
5362 - results.cacheable || (l > 1 && i < lastIndex) ?
5363 - jQuery.clone( fragment, true, true ) :
 4973+ i > 0 || results.cacheable || this.length > 1 ?
 4974+ fragment.cloneNode(true) :
53644975 fragment
53654976 );
53664977 }
@@ -5381,97 +4992,41 @@
53824993 elem;
53834994 }
53844995
5385 -function cloneCopyEvent( src, dest ) {
 4996+function cloneCopyEvent(orig, ret) {
 4997+ var i = 0;
53864998
5387 - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5388 - return;
5389 - }
 4999+ ret.each(function() {
 5000+ if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
 5001+ return;
 5002+ }
53905003
5391 - var internalKey = jQuery.expando,
5392 - oldData = jQuery.data( src ),
5393 - curData = jQuery.data( dest, oldData );
 5004+ var oldData = jQuery.data( orig[i++] ),
 5005+ curData = jQuery.data( this, oldData ),
 5006+ events = oldData && oldData.events;
53945007
5395 - // Switch to use the internal data object, if it exists, for the next
5396 - // stage of data copying
5397 - if ( (oldData = oldData[ internalKey ]) ) {
5398 - var events = oldData.events;
5399 - curData = curData[ internalKey ] = jQuery.extend({}, oldData);
5400 -
54015008 if ( events ) {
54025009 delete curData.handle;
54035010 curData.events = {};
54045011
54055012 for ( var type in events ) {
5406 - for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
5407 - jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
 5013+ for ( var handler in events[ type ] ) {
 5014+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
54085015 }
54095016 }
54105017 }
5411 - }
 5018+ });
54125019 }
54135020
5414 -function cloneFixAttributes(src, dest) {
5415 - // We do not need to do anything for non-Elements
5416 - if ( dest.nodeType !== 1 ) {
5417 - return;
5418 - }
5419 -
5420 - var nodeName = dest.nodeName.toLowerCase();
5421 -
5422 - // clearAttributes removes the attributes, which we don't want,
5423 - // but also removes the attachEvent events, which we *do* want
5424 - dest.clearAttributes();
5425 -
5426 - // mergeAttributes, in contrast, only merges back on the
5427 - // original attributes, not the events
5428 - dest.mergeAttributes(src);
5429 -
5430 - // IE6-8 fail to clone children inside object elements that use
5431 - // the proprietary classid attribute value (rather than the type
5432 - // attribute) to identify the type of content to display
5433 - if ( nodeName === "object" ) {
5434 - dest.outerHTML = src.outerHTML;
5435 -
5436 - } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
5437 - // IE6-8 fails to persist the checked state of a cloned checkbox
5438 - // or radio button. Worse, IE6-7 fail to give the cloned element
5439 - // a checked appearance if the defaultChecked value isn't also set
5440 - if ( src.checked ) {
5441 - dest.defaultChecked = dest.checked = src.checked;
5442 - }
5443 -
5444 - // IE6-7 get confused and end up setting the value of a cloned
5445 - // checkbox/radio button to an empty string instead of "on"
5446 - if ( dest.value !== src.value ) {
5447 - dest.value = src.value;
5448 - }
5449 -
5450 - // IE6-8 fails to return the selected option to the default selected
5451 - // state when cloning options
5452 - } else if ( nodeName === "option" ) {
5453 - dest.selected = src.defaultSelected;
5454 -
5455 - // IE6-8 fails to set the defaultValue to the correct value when
5456 - // cloning other types of input fields
5457 - } else if ( nodeName === "input" || nodeName === "textarea" ) {
5458 - dest.defaultValue = src.defaultValue;
5459 - }
5460 -
5461 - // Event data gets referenced instead of copied if the expando
5462 - // gets copied too
5463 - dest.removeAttribute( jQuery.expando );
5464 -}
5465 -
54665021 jQuery.buildFragment = function( args, nodes, scripts ) {
54675022 var fragment, cacheable, cacheresults,
54685023 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
54695024
5470 - // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
 5025+ // Only cache "small" (1/2 KB) strings that are associated with the main document
54715026 // Cloning options loses the selected state, so don't cache them
54725027 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
54735028 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
54745029 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5475 - args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
 5030+ !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
54765031
54775032 cacheable = true;
54785033 cacheresults = jQuery.fragments[ args[0] ];
@@ -5507,82 +5062,24 @@
55085063 var ret = [],
55095064 insert = jQuery( selector ),
55105065 parent = this.length === 1 && this[0].parentNode;
5511 -
 5066+
55125067 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
55135068 insert[ original ]( this[0] );
55145069 return this;
5515 -
 5070+
55165071 } else {
55175072 for ( var i = 0, l = insert.length; i < l; i++ ) {
55185073 var elems = (i > 0 ? this.clone(true) : this).get();
55195074 jQuery( insert[i] )[ original ]( elems );
55205075 ret = ret.concat( elems );
55215076 }
5522 -
 5077+
55235078 return this.pushStack( ret, name, insert.selector );
55245079 }
55255080 };
55265081 });
55275082
5528 -function getAll( elem ) {
5529 - if ( "getElementsByTagName" in elem ) {
5530 - return elem.getElementsByTagName( "*" );
5531 -
5532 - } else if ( "querySelectorAll" in elem ) {
5533 - return elem.querySelectorAll( "*" );
5534 -
5535 - } else {
5536 - return [];
5537 - }
5538 -}
5539 -
55405083 jQuery.extend({
5541 - clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5542 - var clone = elem.cloneNode(true),
5543 - srcElements,
5544 - destElements,
5545 - i;
5546 -
5547 - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
5548 - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
5549 - // IE copies events bound via attachEvent when using cloneNode.
5550 - // Calling detachEvent on the clone will also remove the events
5551 - // from the original. In order to get around this, we use some
5552 - // proprietary methods to clear the events. Thanks to MooTools
5553 - // guys for this hotness.
5554 -
5555 - cloneFixAttributes( elem, clone );
5556 -
5557 - // Using Sizzle here is crazy slow, so we use getElementsByTagName
5558 - // instead
5559 - srcElements = getAll( elem );
5560 - destElements = getAll( clone );
5561 -
5562 - // Weird iteration because IE will replace the length property
5563 - // with an element if you are cloning the body and one of the
5564 - // elements on the page has a name or id of "length"
5565 - for ( i = 0; srcElements[i]; ++i ) {
5566 - cloneFixAttributes( srcElements[i], destElements[i] );
5567 - }
5568 - }
5569 -
5570 - // Copy the events from the original to the clone
5571 - if ( dataAndEvents ) {
5572 - cloneCopyEvent( elem, clone );
5573 -
5574 - if ( deepDataAndEvents ) {
5575 - srcElements = getAll( elem );
5576 - destElements = getAll( clone );
5577 -
5578 - for ( i = 0; srcElements[i]; ++i ) {
5579 - cloneCopyEvent( srcElements[i], destElements[i] );
5580 - }
5581 - }
5582 - }
5583 -
5584 - // Return the cloned set
5585 - return clone;
5586 -},
55875084 clean: function( elems, context, fragment, scripts ) {
55885085 context = context || document;
55895086
@@ -5664,7 +5161,7 @@
56655162 for ( i = 0; ret[i]; i++ ) {
56665163 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
56675164 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5668 -
 5165+
56695166 } else {
56705167 if ( ret[i].nodeType === 1 ) {
56715168 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
@@ -5676,45 +5173,40 @@
56775174
56785175 return ret;
56795176 },
5680 -
 5177+
56815178 cleanData: function( elems ) {
5682 - var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
 5179+ var data, id, cache = jQuery.cache,
 5180+ special = jQuery.event.special,
56835181 deleteExpando = jQuery.support.deleteExpando;
5684 -
 5182+
56855183 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
56865184 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
56875185 continue;
56885186 }
56895187
56905188 id = elem[ jQuery.expando ];
5691 -
 5189+
56925190 if ( id ) {
5693 - data = cache[ id ] && cache[ id ][ internalKey ];
5694 -
 5191+ data = cache[ id ];
 5192+
56955193 if ( data && data.events ) {
56965194 for ( var type in data.events ) {
56975195 if ( special[ type ] ) {
56985196 jQuery.event.remove( elem, type );
56995197
5700 - // This is a shortcut to avoid jQuery.event.remove's overhead
57015198 } else {
57025199 jQuery.removeEvent( elem, type, data.handle );
57035200 }
57045201 }
5705 -
5706 - // Null the DOM reference to avoid IE6/7/8 leak (#7054)
5707 - if ( data.handle ) {
5708 - data.handle.elem = null;
5709 - }
57105202 }
5711 -
 5203+
57125204 if ( deleteExpando ) {
57135205 delete elem[ jQuery.expando ];
57145206
57155207 } else if ( elem.removeAttribute ) {
57165208 elem.removeAttribute( jQuery.expando );
57175209 }
5718 -
 5210+
57195211 delete cache[ id ];
57205212 }
57215213 }
@@ -5743,8 +5235,7 @@
57445236 var ralpha = /alpha\([^)]*\)/i,
57455237 ropacity = /opacity=([^)]*)/,
57465238 rdashAlpha = /-([a-z])/ig,
5747 - // fixed for IE9, see #8346
5748 - rupper = /([A-Z]|^ms)/g,
 5239+ rupper = /([A-Z])/g,
57495240 rnumpx = /^-?\d+(?:px)?$/i,
57505241 rnum = /^-?\d/,
57515242
@@ -5981,28 +5472,6 @@
59825473 };
59835474 }
59845475
5985 -jQuery(function() {
5986 - // This hook cannot be added until DOM ready because the support test
5987 - // for it is not run until after DOM ready
5988 - if ( !jQuery.support.reliableMarginRight ) {
5989 - jQuery.cssHooks.marginRight = {
5990 - get: function( elem, computed ) {
5991 - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
5992 - // Work around by temporarily setting element display to inline-block
5993 - var ret;
5994 - jQuery.swap( elem, { "display": "inline-block" }, function() {
5995 - if ( computed ) {
5996 - ret = curCSS( elem, "margin-right", "marginRight" );
5997 - } else {
5998 - ret = elem.style.marginRight;
5999 - }
6000 - });
6001 - return ret;
6002 - }
6003 - };
6004 - }
6005 -});
6006 -
60075476 if ( document.defaultView && document.defaultView.getComputedStyle ) {
60085477 getComputedStyle = function( elem, newName, name ) {
60095478 var ret, defaultView, computedStyle;
@@ -6026,9 +5495,8 @@
60275496
60285497 if ( document.documentElement.currentStyle ) {
60295498 currentStyle = function( elem, name ) {
6030 - var left,
 5499+ var left, rsLeft,
60315500 ret = elem.currentStyle && elem.currentStyle[ name ],
6032 - rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
60335501 style = elem.style;
60345502
60355503 // From the awesome hack by Dean Edwards
@@ -6039,19 +5507,16 @@
60405508 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
60415509 // Remember the original values
60425510 left = style.left;
 5511+ rsLeft = elem.runtimeStyle.left;
60435512
60445513 // Put in the new values to get a computed value out
6045 - if ( rsLeft ) {
6046 - elem.runtimeStyle.left = elem.currentStyle.left;
6047 - }
 5514+ elem.runtimeStyle.left = elem.currentStyle.left;
60485515 style.left = name === "fontSize" ? "1em" : (ret || 0);
60495516 ret = style.pixelLeft + "px";
60505517
60515518 // Revert the changed values
60525519 style.left = left;
6053 - if ( rsLeft ) {
6054 - elem.runtimeStyle.left = rsLeft;
6055 - }
 5520+ elem.runtimeStyle.left = rsLeft;
60565521 }
60575522
60585523 return ret === "" ? "auto" : ret;
@@ -6100,145 +5565,22 @@
61015566
61025567
61035568
6104 -var r20 = /%20/g,
6105 - rbracket = /\[\]$/,
6106 - rCRLF = /\r?\n/g,
6107 - rhash = /#.*$/,
6108 - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
 5569+var jsc = jQuery.now(),
 5570+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
 5571+ rselectTextarea = /^(?:select|textarea)/i,
61095572 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6110 - // #7653, #8125, #8152: local protocol detection
6111 - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
61125573 rnoContent = /^(?:GET|HEAD)$/,
6113 - rprotocol = /^\/\//,
 5574+ rbracket = /\[\]$/,
 5575+ jsre = /\=\?(&|$)/,
61145576 rquery = /\?/,
6115 - rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
6116 - rselectTextarea = /^(?:select|textarea)/i,
6117 - rspacesAjax = /\s+/,
61185577 rts = /([?&])_=[^&]*/,
6119 - rucHeaders = /(^|\-)([a-z])/g,
6120 - rucHeadersFunc = function( _, $1, $2 ) {
6121 - return $1 + $2.toUpperCase();
6122 - },
6123 - rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
 5578+ rurl = /^(\w+:)?\/\/([^\/?#]+)/,
 5579+ r20 = /%20/g,
 5580+ rhash = /#.*$/,
61245581
61255582 // Keep a copy of the old load method
6126 - _load = jQuery.fn.load,
 5583+ _load = jQuery.fn.load;
61275584
6128 - /* Prefilters
6129 - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
6130 - * 2) These are called:
6131 - * - BEFORE asking for a transport
6132 - * - AFTER param serialization (s.data is a string if s.processData is true)
6133 - * 3) key is the dataType
6134 - * 4) the catchall symbol "*" can be used
6135 - * 5) execution will start with transport dataType and THEN continue down to "*" if needed
6136 - */
6137 - prefilters = {},
6138 -
6139 - /* Transports bindings
6140 - * 1) key is the dataType
6141 - * 2) the catchall symbol "*" can be used
6142 - * 3) selection will start with transport dataType and THEN go to "*" if needed
6143 - */
6144 - transports = {},
6145 -
6146 - // Document location
6147 - ajaxLocation,
6148 -
6149 - // Document location segments
6150 - ajaxLocParts;
6151 -
6152 -// #8138, IE may throw an exception when accessing
6153 -// a field from document.location if document.domain has been set
6154 -try {
6155 - ajaxLocation = document.location.href;
6156 -} catch( e ) {
6157 - // Use the href attribute of an A element
6158 - // since IE will modify it given document.location
6159 - ajaxLocation = document.createElement( "a" );
6160 - ajaxLocation.href = "";
6161 - ajaxLocation = ajaxLocation.href;
6162 -}
6163 -
6164 -// Segment location into parts
6165 -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
6166 -
6167 -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6168 -function addToPrefiltersOrTransports( structure ) {
6169 -
6170 - // dataTypeExpression is optional and defaults to "*"
6171 - return function( dataTypeExpression, func ) {
6172 -
6173 - if ( typeof dataTypeExpression !== "string" ) {
6174 - func = dataTypeExpression;
6175 - dataTypeExpression = "*";
6176 - }
6177 -
6178 - if ( jQuery.isFunction( func ) ) {
6179 - var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
6180 - i = 0,
6181 - length = dataTypes.length,
6182 - dataType,
6183 - list,
6184 - placeBefore;
6185 -
6186 - // For each dataType in the dataTypeExpression
6187 - for(; i < length; i++ ) {
6188 - dataType = dataTypes[ i ];
6189 - // We control if we're asked to add before
6190 - // any existing element
6191 - placeBefore = /^\+/.test( dataType );
6192 - if ( placeBefore ) {
6193 - dataType = dataType.substr( 1 ) || "*";
6194 - }
6195 - list = structure[ dataType ] = structure[ dataType ] || [];
6196 - // then we add to the structure accordingly
6197 - list[ placeBefore ? "unshift" : "push" ]( func );
6198 - }
6199 - }
6200 - };
6201 -}
6202 -
6203 -//Base inspection function for prefilters and transports
6204 -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
6205 - dataType /* internal */, inspected /* internal */ ) {
6206 -
6207 - dataType = dataType || options.dataTypes[ 0 ];
6208 - inspected = inspected || {};
6209 -
6210 - inspected[ dataType ] = true;
6211 -
6212 - var list = structure[ dataType ],
6213 - i = 0,
6214 - length = list ? list.length : 0,
6215 - executeOnly = ( structure === prefilters ),
6216 - selection;
6217 -
6218 - for(; i < length && ( executeOnly || !selection ); i++ ) {
6219 - selection = list[ i ]( options, originalOptions, jqXHR );
6220 - // If we got redirected to another dataType
6221 - // we try there if executing only and not done already
6222 - if ( typeof selection === "string" ) {
6223 - if ( !executeOnly || inspected[ selection ] ) {
6224 - selection = undefined;
6225 - } else {
6226 - options.dataTypes.unshift( selection );
6227 - selection = inspectPrefiltersOrTransports(
6228 - structure, options, originalOptions, jqXHR, selection, inspected );
6229 - }
6230 - }
6231 - }
6232 - // If we're only executing or nothing was selected
6233 - // we try the catchall dataType if not done already
6234 - if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
6235 - selection = inspectPrefiltersOrTransports(
6236 - structure, options, originalOptions, jqXHR, "*", inspected );
6237 - }
6238 - // unnecessary when only executing (prefilters)
6239 - // but it'll be ignored by the caller in that case
6240 - return selection;
6241 -}
6242 -
62435585 jQuery.fn.extend({
62445586 load: function( url, params, callback ) {
62455587 if ( typeof url !== "string" && _load ) {
@@ -6249,10 +5591,10 @@
62505592 return this;
62515593 }
62525594
6253 - var off = url.indexOf( " " );
 5595+ var off = url.indexOf(" ");
62545596 if ( off >= 0 ) {
6255 - var selector = url.slice( off, url.length );
6256 - url = url.slice( 0, off );
 5597+ var selector = url.slice(off, url.length);
 5598+ url = url.slice(0, off);
62575599 }
62585600
62595601 // Default to a GET request
@@ -6264,7 +5606,7 @@
62655607 if ( jQuery.isFunction( params ) ) {
62665608 // We assume that it's the callback
62675609 callback = params;
6268 - params = undefined;
 5610+ params = null;
62695611
62705612 // Otherwise, build a param string
62715613 } else if ( typeof params === "object" ) {
@@ -6281,34 +5623,26 @@
62825624 type: type,
62835625 dataType: "html",
62845626 data: params,
6285 - // Complete callback (responseText is used internally)
6286 - complete: function( jqXHR, status, responseText ) {
6287 - // Store the response as specified by the jqXHR object
6288 - responseText = jqXHR.responseText;
 5627+ complete: function( res, status ) {
62895628 // If successful, inject the HTML into all the matched elements
6290 - if ( jqXHR.isResolved() ) {
6291 - // #4825: Get the actual response in case
6292 - // a dataFilter is present in ajaxSettings
6293 - jqXHR.done(function( r ) {
6294 - responseText = r;
6295 - });
 5629+ if ( status === "success" || status === "notmodified" ) {
62965630 // See if a selector was specified
62975631 self.html( selector ?
62985632 // Create a dummy div to hold the results
62995633 jQuery("<div>")
63005634 // inject the contents of the document in, removing the scripts
63015635 // to avoid any 'Permission Denied' errors in IE
6302 - .append(responseText.replace(rscript, ""))
 5636+ .append(res.responseText.replace(rscript, ""))
63035637
63045638 // Locate the specified elements
63055639 .find(selector) :
63065640
63075641 // If not, just inject the full result
6308 - responseText );
 5642+ res.responseText );
63095643 }
63105644
63115645 if ( callback ) {
6312 - self.each( callback, [ responseText, status, jqXHR ] );
 5646+ self.each( callback, [res.responseText, status, res] );
63135647 }
63145648 }
63155649 });
@@ -6317,94 +5651,88 @@
63185652 },
63195653
63205654 serialize: function() {
6321 - return jQuery.param( this.serializeArray() );
 5655+ return jQuery.param(this.serializeArray());
63225656 },
63235657
63245658 serializeArray: function() {
6325 - return this.map(function(){
6326 - return this.elements ? jQuery.makeArray( this.elements ) : this;
 5659+ return this.map(function() {
 5660+ return this.elements ? jQuery.makeArray(this.elements) : this;
63275661 })
6328 - .filter(function(){
 5662+ .filter(function() {
63295663 return this.name && !this.disabled &&
6330 - ( this.checked || rselectTextarea.test( this.nodeName ) ||
6331 - rinput.test( this.type ) );
 5664+ (this.checked || rselectTextarea.test(this.nodeName) ||
 5665+ rinput.test(this.type));
63325666 })
6333 - .map(function( i, elem ){
6334 - var val = jQuery( this ).val();
 5667+ .map(function( i, elem ) {
 5668+ var val = jQuery(this).val();
63355669
63365670 return val == null ?
63375671 null :
6338 - jQuery.isArray( val ) ?
6339 - jQuery.map( val, function( val, i ){
6340 - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
 5672+ jQuery.isArray(val) ?
 5673+ jQuery.map( val, function( val, i ) {
 5674+ return { name: elem.name, value: val };
63415675 }) :
6342 - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
 5676+ { name: elem.name, value: val };
63435677 }).get();
63445678 }
63455679 });
63465680
63475681 // Attach a bunch of functions for handling common AJAX events
6348 -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
6349 - jQuery.fn[ o ] = function( f ){
6350 - return this.bind( o, f );
 5682+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
 5683+ jQuery.fn[o] = function( f ) {
 5684+ return this.bind(o, f);
63515685 };
6352 -} );
 5686+});
63535687
6354 -jQuery.each( [ "get", "post" ], function( i, method ) {
6355 - jQuery[ method ] = function( url, data, callback, type ) {
6356 - // shift arguments if data argument was omitted
 5688+jQuery.extend({
 5689+ get: function( url, data, callback, type ) {
 5690+ // shift arguments if data argument was omited
63575691 if ( jQuery.isFunction( data ) ) {
63585692 type = type || callback;
63595693 callback = data;
6360 - data = undefined;
 5694+ data = null;
63615695 }
63625696
63635697 return jQuery.ajax({
6364 - type: method,
 5698+ type: "GET",
63655699 url: url,
63665700 data: data,
63675701 success: callback,
63685702 dataType: type
63695703 });
6370 - };
6371 -} );
 5704+ },
63725705
6373 -jQuery.extend({
6374 -
63755706 getScript: function( url, callback ) {
6376 - return jQuery.get( url, undefined, callback, "script" );
 5707+ return jQuery.get(url, null, callback, "script");
63775708 },
63785709
63795710 getJSON: function( url, data, callback ) {
6380 - return jQuery.get( url, data, callback, "json" );
 5711+ return jQuery.get(url, data, callback, "json");
63815712 },
63825713
6383 - // Creates a full fledged settings object into target
6384 - // with both ajaxSettings and settings fields.
6385 - // If target is omitted, writes into ajaxSettings.
6386 - ajaxSetup: function ( target, settings ) {
6387 - if ( !settings ) {
6388 - // Only one parameter, we extend ajaxSettings
6389 - settings = target;
6390 - target = jQuery.extend( true, jQuery.ajaxSettings, settings );
6391 - } else {
6392 - // target was provided, we extend into it
6393 - jQuery.extend( true, target, jQuery.ajaxSettings, settings );
 5714+ post: function( url, data, callback, type ) {
 5715+ // shift arguments if data argument was omited
 5716+ if ( jQuery.isFunction( data ) ) {
 5717+ type = type || callback;
 5718+ callback = data;
 5719+ data = {};
63945720 }
6395 - // Flatten fields we don't want deep extended
6396 - for( var field in { context: 1, url: 1 } ) {
6397 - if ( field in settings ) {
6398 - target[ field ] = settings[ field ];
6399 - } else if( field in jQuery.ajaxSettings ) {
6400 - target[ field ] = jQuery.ajaxSettings[ field ];
6401 - }
6402 - }
6403 - return target;
 5721+
 5722+ return jQuery.ajax({
 5723+ type: "POST",
 5724+ url: url,
 5725+ data: data,
 5726+ success: callback,
 5727+ dataType: type
 5728+ });
64045729 },
64055730
 5731+ ajaxSetup: function( settings ) {
 5732+ jQuery.extend( jQuery.ajaxSettings, settings );
 5733+ },
 5734+
64065735 ajaxSettings: {
6407 - url: ajaxLocation,
6408 - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
 5736+ url: location.href,
64095737 global: true,
64105738 type: "GET",
64115739 contentType: "application/x-www-form-urlencoded",
@@ -6413,428 +5741,332 @@
64145742 /*
64155743 timeout: 0,
64165744 data: null,
6417 - dataType: null,
64185745 username: null,
64195746 password: null,
6420 - cache: null,
64215747 traditional: false,
6422 - headers: {},
64235748 */
6424 -
 5749+ // This function can be overriden by calling jQuery.ajaxSetup
 5750+ xhr: function() {
 5751+ return new window.XMLHttpRequest();
 5752+ },
64255753 accepts: {
64265754 xml: "application/xml, text/xml",
64275755 html: "text/html",
6428 - text: "text/plain",
 5756+ script: "text/javascript, application/javascript",
64295757 json: "application/json, text/javascript",
6430 - "*": "*/*"
6431 - },
 5758+ text: "text/plain",
 5759+ _default: "*/*"
 5760+ }
 5761+ },
64325762
6433 - contents: {
6434 - xml: /xml/,
6435 - html: /html/,
6436 - json: /json/
6437 - },
 5763+ ajax: function( origSettings ) {
 5764+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
 5765+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
64385766
6439 - responseFields: {
6440 - xml: "responseXML",
6441 - text: "responseText"
6442 - },
 5767+ s.url = s.url.replace( rhash, "" );
64435768
6444 - // List of data converters
6445 - // 1) key format is "source_type destination_type" (a single space in-between)
6446 - // 2) the catchall symbol "*" can be used for source_type
6447 - converters: {
 5769+ // Use original (not extended) context object if it was provided
 5770+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
64485771
6449 - // Convert anything to text
6450 - "* text": window.String,
6451 -
6452 - // Text to html (true = no transformation)
6453 - "text html": true,
6454 -
6455 - // Evaluate text as a json expression
6456 - "text json": jQuery.parseJSON,
6457 -
6458 - // Parse text as xml
6459 - "text xml": jQuery.parseXML
 5772+ // convert data if not already a string
 5773+ if ( s.data && s.processData && typeof s.data !== "string" ) {
 5774+ s.data = jQuery.param( s.data, s.traditional );
64605775 }
6461 - },
64625776
6463 - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
6464 - ajaxTransport: addToPrefiltersOrTransports( transports ),
6465 -
6466 - // Main method
6467 - ajax: function( url, options ) {
6468 -
6469 - // If url is an object, simulate pre-1.5 signature
6470 - if ( typeof url === "object" ) {
6471 - options = url;
6472 - url = undefined;
 5777+ // Handle JSONP Parameter Callbacks
 5778+ if ( s.dataType === "jsonp" ) {
 5779+ if ( type === "GET" ) {
 5780+ if ( !jsre.test( s.url ) ) {
 5781+ s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
 5782+ }
 5783+ } else if ( !s.data || !jsre.test(s.data) ) {
 5784+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
 5785+ }
 5786+ s.dataType = "json";
64735787 }
64745788
6475 - // Force options to be an object
6476 - options = options || {};
 5789+ // Build temporary JSONP function
 5790+ if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
 5791+ jsonp = s.jsonpCallback || ("jsonp" + jsc++);
64775792
6478 - var // Create the final options object
6479 - s = jQuery.ajaxSetup( {}, options ),
6480 - // Callbacks context
6481 - callbackContext = s.context || s,
6482 - // Context for global events
6483 - // It's the callbackContext if one was provided in the options
6484 - // and if it's a DOM node or a jQuery collection
6485 - globalEventContext = callbackContext !== s &&
6486 - ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
6487 - jQuery( callbackContext ) : jQuery.event,
6488 - // Deferreds
6489 - deferred = jQuery.Deferred(),
6490 - completeDeferred = jQuery._Deferred(),
6491 - // Status-dependent callbacks
6492 - statusCode = s.statusCode || {},
6493 - // ifModified key
6494 - ifModifiedKey,
6495 - // Headers (they are sent all at once)
6496 - requestHeaders = {},
6497 - // Response headers
6498 - responseHeadersString,
6499 - responseHeaders,
6500 - // transport
6501 - transport,
6502 - // timeout handle
6503 - timeoutTimer,
6504 - // Cross-domain detection vars
6505 - parts,
6506 - // The jqXHR state
6507 - state = 0,
6508 - // To know if global events are to be dispatched
6509 - fireGlobals,
6510 - // Loop variable
6511 - i,
6512 - // Fake xhr
6513 - jqXHR = {
 5793+ // Replace the =? sequence both in the query string and the data
 5794+ if ( s.data ) {
 5795+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
 5796+ }
65145797
6515 - readyState: 0,
 5798+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
65165799
6517 - // Caches the header
6518 - setRequestHeader: function( name, value ) {
6519 - if ( !state ) {
6520 - requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value;
6521 - }
6522 - return this;
6523 - },
 5800+ // We need to make sure
 5801+ // that a JSONP style response is executed properly
 5802+ s.dataType = "script";
65245803
6525 - // Raw string
6526 - getAllResponseHeaders: function() {
6527 - return state === 2 ? responseHeadersString : null;
6528 - },
 5804+ // Handle JSONP-style loading
 5805+ var customJsonp = window[ jsonp ];
65295806
6530 - // Builds headers hashtable if needed
6531 - getResponseHeader: function( key ) {
6532 - var match;
6533 - if ( state === 2 ) {
6534 - if ( !responseHeaders ) {
6535 - responseHeaders = {};
6536 - while( ( match = rheaders.exec( responseHeadersString ) ) ) {
6537 - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
6538 - }
6539 - }
6540 - match = responseHeaders[ key.toLowerCase() ];
6541 - }
6542 - return match === undefined ? null : match;
6543 - },
 5807+ window[ jsonp ] = function( tmp ) {
 5808+ if ( jQuery.isFunction( customJsonp ) ) {
 5809+ customJsonp( tmp );
65445810
6545 - // Overrides response content-type header
6546 - overrideMimeType: function( type ) {
6547 - if ( !state ) {
6548 - s.mimeType = type;
6549 - }
6550 - return this;
6551 - },
 5811+ } else {
 5812+ // Garbage collect
 5813+ window[ jsonp ] = undefined;
65525814
6553 - // Cancel the request
6554 - abort: function( statusText ) {
6555 - statusText = statusText || "abort";
6556 - if ( transport ) {
6557 - transport.abort( statusText );
6558 - }
6559 - done( 0, statusText );
6560 - return this;
 5815+ try {
 5816+ delete window[ jsonp ];
 5817+ } catch( jsonpError ) {}
65615818 }
 5819+
 5820+ data = tmp;
 5821+ jQuery.handleSuccess( s, xhr, status, data );
 5822+ jQuery.handleComplete( s, xhr, status, data );
 5823+
 5824+ if ( head ) {
 5825+ head.removeChild( script );
 5826+ }
65625827 };
 5828+ }
65635829
6564 - // Callback for when everything is done
6565 - // It is defined here because jslint complains if it is declared
6566 - // at the end of the function (which would be more logical and readable)
6567 - function done( status, statusText, responses, headers ) {
 5830+ if ( s.dataType === "script" && s.cache === null ) {
 5831+ s.cache = false;
 5832+ }
65685833
6569 - // Called once
6570 - if ( state === 2 ) {
6571 - return;
6572 - }
 5834+ if ( s.cache === false && noContent ) {
 5835+ var ts = jQuery.now();
65735836
6574 - // State is "done" now
6575 - state = 2;
 5837+ // try replacing _= if it is there
 5838+ var ret = s.url.replace(rts, "$1_=" + ts);
65765839
6577 - // Clear timeout if it exists
6578 - if ( timeoutTimer ) {
6579 - clearTimeout( timeoutTimer );
6580 - }
 5840+ // if nothing was replaced, add timestamp to the end
 5841+ s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
 5842+ }
65815843
6582 - // Dereference transport for early garbage collection
6583 - // (no matter how long the jqXHR object will be used)
6584 - transport = undefined;
 5844+ // If data is available, append data to url for GET/HEAD requests
 5845+ if ( s.data && noContent ) {
 5846+ s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
 5847+ }
65855848
6586 - // Cache response headers
6587 - responseHeadersString = headers || "";
 5849+ // Watch for a new set of requests
 5850+ if ( s.global && jQuery.active++ === 0 ) {
 5851+ jQuery.event.trigger( "ajaxStart" );
 5852+ }
65885853
6589 - // Set readyState
6590 - jqXHR.readyState = status ? 4 : 0;
 5854+ // Matches an absolute URL, and saves the domain
 5855+ var parts = rurl.exec( s.url ),
 5856+ remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
65915857
6592 - var isSuccess,
6593 - success,
6594 - error,
6595 - response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
6596 - lastModified,
6597 - etag;
 5858+ // If we're requesting a remote document
 5859+ // and trying to load JSON or Script with a GET
 5860+ if ( s.dataType === "script" && type === "GET" && remote ) {
 5861+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
 5862+ var script = document.createElement("script");
 5863+ if ( s.scriptCharset ) {
 5864+ script.charset = s.scriptCharset;
 5865+ }
 5866+ script.src = s.url;
65985867
6599 - // If successful, handle type chaining
6600 - if ( status >= 200 && status < 300 || status === 304 ) {
 5868+ // Handle Script loading
 5869+ if ( !jsonp ) {
 5870+ var done = false;
66015871
6602 - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6603 - if ( s.ifModified ) {
 5872+ // Attach handlers for all browsers
 5873+ script.onload = script.onreadystatechange = function() {
 5874+ if ( !done && (!this.readyState ||
 5875+ this.readyState === "loaded" || this.readyState === "complete") ) {
 5876+ done = true;
 5877+ jQuery.handleSuccess( s, xhr, status, data );
 5878+ jQuery.handleComplete( s, xhr, status, data );
66045879
6605 - if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
6606 - jQuery.lastModified[ ifModifiedKey ] = lastModified;
 5880+ // Handle memory leak in IE
 5881+ script.onload = script.onreadystatechange = null;
 5882+ if ( head && script.parentNode ) {
 5883+ head.removeChild( script );
 5884+ }
66075885 }
6608 - if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
6609 - jQuery.etag[ ifModifiedKey ] = etag;
6610 - }
6611 - }
 5886+ };
 5887+ }
66125888
6613 - // If not modified
6614 - if ( status === 304 ) {
 5889+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
 5890+ // This arises when a base node is used (#2709 and #4378).
 5891+ head.insertBefore( script, head.firstChild );
66155892
6616 - statusText = "notmodified";
6617 - isSuccess = true;
 5893+ // We handle everything using the script element injection
 5894+ return undefined;
 5895+ }
66185896
6619 - // If we have data
6620 - } else {
 5897+ var requestDone = false;
66215898
6622 - try {
6623 - success = ajaxConvert( s, response );
6624 - statusText = "success";
6625 - isSuccess = true;
6626 - } catch(e) {
6627 - // We have a parsererror
6628 - statusText = "parsererror";
6629 - error = e;
6630 - }
6631 - }
6632 - } else {
6633 - // We extract error from statusText
6634 - // then normalize statusText and status for non-aborts
6635 - error = statusText;
6636 - if( !statusText || status ) {
6637 - statusText = "error";
6638 - if ( status < 0 ) {
6639 - status = 0;
6640 - }
6641 - }
6642 - }
 5899+ // Create the request object
 5900+ var xhr = s.xhr();
66435901
6644 - // Set data for the fake xhr object
6645 - jqXHR.status = status;
6646 - jqXHR.statusText = statusText;
 5902+ if ( !xhr ) {
 5903+ return;
 5904+ }
66475905
6648 - // Success/Error
6649 - if ( isSuccess ) {
6650 - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
6651 - } else {
6652 - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
6653 - }
 5906+ // Open the socket
 5907+ // Passing null username, generates a login popup on Opera (#2865)
 5908+ if ( s.username ) {
 5909+ xhr.open(type, s.url, s.async, s.username, s.password);
 5910+ } else {
 5911+ xhr.open(type, s.url, s.async);
 5912+ }
66545913
6655 - // Status-dependent callbacks
6656 - jqXHR.statusCode( statusCode );
6657 - statusCode = undefined;
6658 -
6659 - if ( fireGlobals ) {
6660 - globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
6661 - [ jqXHR, s, isSuccess ? success : error ] );
 5914+ // Need an extra try/catch for cross domain requests in Firefox 3
 5915+ try {
 5916+ // Set content-type if data specified and content-body is valid for this type
 5917+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
 5918+ xhr.setRequestHeader("Content-Type", s.contentType);
66625919 }
66635920
6664 - // Complete
6665 - completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
 5921+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
 5922+ if ( s.ifModified ) {
 5923+ if ( jQuery.lastModified[s.url] ) {
 5924+ xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
 5925+ }
66665926
6667 - if ( fireGlobals ) {
6668 - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
6669 - // Handle the global AJAX counter
6670 - if ( !( --jQuery.active ) ) {
6671 - jQuery.event.trigger( "ajaxStop" );
 5927+ if ( jQuery.etag[s.url] ) {
 5928+ xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
66725929 }
66735930 }
6674 - }
66755931
6676 - // Attach deferreds
6677 - deferred.promise( jqXHR );
6678 - jqXHR.success = jqXHR.done;
6679 - jqXHR.error = jqXHR.fail;
6680 - jqXHR.complete = completeDeferred.done;
6681 -
6682 - // Status-dependent callbacks
6683 - jqXHR.statusCode = function( map ) {
6684 - if ( map ) {
6685 - var tmp;
6686 - if ( state < 2 ) {
6687 - for( tmp in map ) {
6688 - statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
6689 - }
6690 - } else {
6691 - tmp = map[ jqXHR.status ];
6692 - jqXHR.then( tmp, tmp );
6693 - }
 5932+ // Set header so the called script knows that it's an XMLHttpRequest
 5933+ // Only send the header if it's not a remote XHR
 5934+ if ( !remote ) {
 5935+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
66945936 }
6695 - return this;
6696 - };
66975937
6698 - // Remove hash character (#7531: and string promotion)
6699 - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
6700 - // We also use the url parameter if available
6701 - s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
 5938+ // Set the Accepts header for the server, depending on the dataType
 5939+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
 5940+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
 5941+ s.accepts._default );
 5942+ } catch( headerError ) {}
67025943
6703 - // Extract dataTypes list
6704 - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
 5944+ // Allow custom headers/mimetypes and early abort
 5945+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
 5946+ // Handle the global AJAX counter
 5947+ if ( s.global && jQuery.active-- === 1 ) {
 5948+ jQuery.event.trigger( "ajaxStop" );
 5949+ }
67055950
6706 - // Determine if a cross-domain request is in order
6707 - if ( s.crossDomain == null ) {
6708 - parts = rurl.exec( s.url.toLowerCase() );
6709 - s.crossDomain = !!( parts &&
6710 - ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
6711 - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
6712 - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
6713 - );
 5951+ // close opended socket
 5952+ xhr.abort();
 5953+ return false;
67145954 }
67155955
6716 - // Convert data if not already a string
6717 - if ( s.data && s.processData && typeof s.data !== "string" ) {
6718 - s.data = jQuery.param( s.data, s.traditional );
 5956+ if ( s.global ) {
 5957+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
67195958 }
67205959
6721 - // Apply prefilters
6722 - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
 5960+ // Wait for a response to come back
 5961+ var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
 5962+ // The request was aborted
 5963+ if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
 5964+ // Opera doesn't call onreadystatechange before this point
 5965+ // so we simulate the call
 5966+ if ( !requestDone ) {
 5967+ jQuery.handleComplete( s, xhr, status, data );
 5968+ }
67235969
6724 - // If request was aborted inside a prefiler, stop there
6725 - if ( state === 2 ) {
6726 - return false;
6727 - }
 5970+ requestDone = true;
 5971+ if ( xhr ) {
 5972+ xhr.onreadystatechange = jQuery.noop;
 5973+ }
67285974
6729 - // We can fire global events as of now if asked to
6730 - fireGlobals = s.global;
 5975+ // The transfer is complete and the data is available, or the request timed out
 5976+ } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
 5977+ requestDone = true;
 5978+ xhr.onreadystatechange = jQuery.noop;
67315979
6732 - // Uppercase the type
6733 - s.type = s.type.toUpperCase();
 5980+ status = isTimeout === "timeout" ?
 5981+ "timeout" :
 5982+ !jQuery.httpSuccess( xhr ) ?
 5983+ "error" :
 5984+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
 5985+ "notmodified" :
 5986+ "success";
67345987
6735 - // Determine if request has content
6736 - s.hasContent = !rnoContent.test( s.type );
 5988+ var errMsg;
67375989
6738 - // Watch for a new set of requests
6739 - if ( fireGlobals && jQuery.active++ === 0 ) {
6740 - jQuery.event.trigger( "ajaxStart" );
6741 - }
 5990+ if ( status === "success" ) {
 5991+ // Watch for, and catch, XML document parse errors
 5992+ try {
 5993+ // process the data (runs the xml through httpData regardless of callback)
 5994+ data = jQuery.httpData( xhr, s.dataType, s );
 5995+ } catch( parserError ) {
 5996+ status = "parsererror";
 5997+ errMsg = parserError;
 5998+ }
 5999+ }
67426000
6743 - // More options handling for requests with no content
6744 - if ( !s.hasContent ) {
 6001+ // Make sure that the request was successful or notmodified
 6002+ if ( status === "success" || status === "notmodified" ) {
 6003+ // JSONP handles its own success callback
 6004+ if ( !jsonp ) {
 6005+ jQuery.handleSuccess( s, xhr, status, data );
 6006+ }
 6007+ } else {
 6008+ jQuery.handleError( s, xhr, status, errMsg );
 6009+ }
67456010
6746 - // If data is available, append data to url
6747 - if ( s.data ) {
6748 - s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
6749 - }
 6011+ // Fire the complete handlers
 6012+ if ( !jsonp ) {
 6013+ jQuery.handleComplete( s, xhr, status, data );
 6014+ }
67506015
6751 - // Get ifModifiedKey before adding the anti-cache parameter
6752 - ifModifiedKey = s.url;
 6016+ if ( isTimeout === "timeout" ) {
 6017+ xhr.abort();
 6018+ }
67536019
6754 - // Add anti-cache in url if needed
6755 - if ( s.cache === false ) {
6756 -
6757 - var ts = jQuery.now(),
6758 - // try replacing _= if it is there
6759 - ret = s.url.replace( rts, "$1_=" + ts );
6760 -
6761 - // if nothing was replaced, add timestamp to the end
6762 - s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
 6020+ // Stop memory leaks
 6021+ if ( s.async ) {
 6022+ xhr = null;
 6023+ }
67636024 }
6764 - }
 6025+ };
67656026
6766 - // Set the correct header, if data is being sent
6767 - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
6768 - requestHeaders[ "Content-Type" ] = s.contentType;
6769 - }
 6027+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
 6028+ // Opera doesn't fire onreadystatechange at all on abort
 6029+ try {
 6030+ var oldAbort = xhr.abort;
 6031+ xhr.abort = function() {
 6032+ if ( xhr ) {
 6033+ // oldAbort has no call property in IE7 so
 6034+ // just do it this way, which works in all
 6035+ // browsers
 6036+ Function.prototype.call.call( oldAbort, xhr );
 6037+ }
67706038
6771 - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
6772 - if ( s.ifModified ) {
6773 - ifModifiedKey = ifModifiedKey || s.url;
6774 - if ( jQuery.lastModified[ ifModifiedKey ] ) {
6775 - requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ];
6776 - }
6777 - if ( jQuery.etag[ ifModifiedKey ] ) {
6778 - requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ];
6779 - }
6780 - }
 6039+ onreadystatechange( "abort" );
 6040+ };
 6041+ } catch( abortError ) {}
67816042
6782 - // Set the Accepts header for the server, depending on the dataType
6783 - requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
6784 - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
6785 - s.accepts[ "*" ];
6786 -
6787 - // Check for headers option
6788 - for ( i in s.headers ) {
6789 - jqXHR.setRequestHeader( i, s.headers[ i ] );
 6043+ // Timeout checker
 6044+ if ( s.async && s.timeout > 0 ) {
 6045+ setTimeout(function() {
 6046+ // Check to see if the request is still happening
 6047+ if ( xhr && !requestDone ) {
 6048+ onreadystatechange( "timeout" );
 6049+ }
 6050+ }, s.timeout);
67906051 }
67916052
6792 - // Allow custom headers/mimetypes and early abort
6793 - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
6794 - // Abort if not done already
6795 - jqXHR.abort();
6796 - return false;
 6053+ // Send the data
 6054+ try {
 6055+ xhr.send( noContent || s.data == null ? null : s.data );
67976056
6798 - }
 6057+ } catch( sendError ) {
 6058+ jQuery.handleError( s, xhr, null, sendError );
67996059
6800 - // Install callbacks on deferreds
6801 - for ( i in { success: 1, error: 1, complete: 1 } ) {
6802 - jqXHR[ i ]( s[ i ] );
 6060+ // Fire the complete handlers
 6061+ jQuery.handleComplete( s, xhr, status, data );
68036062 }
68046063
6805 - // Get transport
6806 - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
6807 -
6808 - // If no transport, we auto-abort
6809 - if ( !transport ) {
6810 - done( -1, "No Transport" );
6811 - } else {
6812 - jqXHR.readyState = 1;
6813 - // Send global event
6814 - if ( fireGlobals ) {
6815 - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
6816 - }
6817 - // Timeout
6818 - if ( s.async && s.timeout > 0 ) {
6819 - timeoutTimer = setTimeout( function(){
6820 - jqXHR.abort( "timeout" );
6821 - }, s.timeout );
6822 - }
6823 -
6824 - try {
6825 - state = 1;
6826 - transport.send( requestHeaders, done );
6827 - } catch (e) {
6828 - // Propagate exception as error if not done
6829 - if ( status < 2 ) {
6830 - done( -1, e );
6831 - // Simply rethrow otherwise
6832 - } else {
6833 - jQuery.error( e );
6834 - }
6835 - }
 6064+ // firefox 1.5 doesn't fire statechange for sync requests
 6065+ if ( !s.async ) {
 6066+ onreadystatechange();
68366067 }
68376068
6838 - return jqXHR;
 6069+ // return XMLHttpRequest to allow aborting the request etc.
 6070+ return xhr;
68396071 },
68406072
68416073 // Serialize an array of form elements or a set of
@@ -6843,37 +6075,37 @@
68446076 var s = [],
68456077 add = function( key, value ) {
68466078 // If value is a function, invoke it and return its value
6847 - value = jQuery.isFunction( value ) ? value() : value;
6848 - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
 6079+ value = jQuery.isFunction(value) ? value() : value;
 6080+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
68496081 };
6850 -
 6082+
68516083 // Set traditional to true for jQuery <= 1.3.2 behavior.
68526084 if ( traditional === undefined ) {
68536085 traditional = jQuery.ajaxSettings.traditional;
68546086 }
6855 -
 6087+
68566088 // If an array was passed in, assume that it is an array of form elements.
6857 - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
 6089+ if ( jQuery.isArray(a) || a.jquery ) {
68586090 // Serialize the form elements
68596091 jQuery.each( a, function() {
68606092 add( this.name, this.value );
6861 - } );
6862 -
 6093+ });
 6094+
68636095 } else {
68646096 // If traditional, encode the "old" way (the way 1.3.2 or older
68656097 // did it), otherwise encode params recursively.
68666098 for ( var prefix in a ) {
6867 - buildParams( prefix, a[ prefix ], traditional, add );
 6099+ buildParams( prefix, a[prefix], traditional, add );
68686100 }
68696101 }
68706102
68716103 // Return the resulting serialization
6872 - return s.join( "&" ).replace( r20, "+" );
 6104+ return s.join("&").replace(r20, "+");
68736105 }
68746106 });
68756107
68766108 function buildParams( prefix, obj, traditional, add ) {
6877 - if ( jQuery.isArray( obj ) && obj.length ) {
 6109+ if ( jQuery.isArray(obj) && obj.length ) {
68786110 // Serialize array item.
68796111 jQuery.each( obj, function( i, v ) {
68806112 if ( traditional || rbracket.test( prefix ) ) {
@@ -6891,20 +6123,18 @@
68926124 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
68936125 }
68946126 });
6895 -
 6127+
68966128 } else if ( !traditional && obj != null && typeof obj === "object" ) {
6897 - // If we see an array here, it is empty and should be treated as an empty
6898 - // object
6899 - if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {
 6129+ if ( jQuery.isEmptyObject( obj ) ) {
69006130 add( prefix, "" );
69016131
69026132 // Serialize object item.
69036133 } else {
6904 - for ( var name in obj ) {
6905 - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
6906 - }
 6134+ jQuery.each( obj, function( k, v ) {
 6135+ buildParams( prefix + "[" + k + "]", v, traditional, add );
 6136+ });
69076137 }
6908 -
 6138+
69096139 } else {
69106140 // Serialize scalar item.
69116141 add( prefix, obj );
@@ -6920,562 +6150,143 @@
69216151
69226152 // Last-Modified header cache for next request
69236153 lastModified: {},
6924 - etag: {}
 6154+ etag: {},
69256155
6926 -});
 6156+ handleError: function( s, xhr, status, e ) {
 6157+ // If a local callback was specified, fire it
 6158+ if ( s.error ) {
 6159+ s.error.call( s.context, xhr, status, e );
 6160+ }
69276161
6928 -/* Handles responses to an ajax request:
6929 - * - sets all responseXXX fields accordingly
6930 - * - finds the right dataType (mediates between content-type and expected dataType)
6931 - * - returns the corresponding response
6932 - */
6933 -function ajaxHandleResponses( s, jqXHR, responses ) {
 6162+ // Fire the global callback
 6163+ if ( s.global ) {
 6164+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
 6165+ }
 6166+ },
69346167
6935 - var contents = s.contents,
6936 - dataTypes = s.dataTypes,
6937 - responseFields = s.responseFields,
6938 - ct,
6939 - type,
6940 - finalDataType,
6941 - firstDataType;
6942 -
6943 - // Fill responseXXX fields
6944 - for( type in responseFields ) {
6945 - if ( type in responses ) {
6946 - jqXHR[ responseFields[type] ] = responses[ type ];
 6168+ handleSuccess: function( s, xhr, status, data ) {
 6169+ // If a local callback was specified, fire it and pass it the data
 6170+ if ( s.success ) {
 6171+ s.success.call( s.context, data, status, xhr );
69476172 }
6948 - }
69496173
6950 - // Remove auto dataType and get content-type in the process
6951 - while( dataTypes[ 0 ] === "*" ) {
6952 - dataTypes.shift();
6953 - if ( ct === undefined ) {
6954 - ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
 6174+ // Fire the global callback
 6175+ if ( s.global ) {
 6176+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
69556177 }
6956 - }
 6178+ },
69576179
6958 - // Check if we're dealing with a known content-type
6959 - if ( ct ) {
6960 - for ( type in contents ) {
6961 - if ( contents[ type ] && contents[ type ].test( ct ) ) {
6962 - dataTypes.unshift( type );
6963 - break;
6964 - }
 6180+ handleComplete: function( s, xhr, status ) {
 6181+ // Process result
 6182+ if ( s.complete ) {
 6183+ s.complete.call( s.context, xhr, status );
69656184 }
6966 - }
69676185
6968 - // Check to see if we have a response for the expected dataType
6969 - if ( dataTypes[ 0 ] in responses ) {
6970 - finalDataType = dataTypes[ 0 ];
6971 - } else {
6972 - // Try convertible dataTypes
6973 - for ( type in responses ) {
6974 - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
6975 - finalDataType = type;
6976 - break;
6977 - }
6978 - if ( !firstDataType ) {
6979 - firstDataType = type;
6980 - }
 6186+ // The request was completed
 6187+ if ( s.global ) {
 6188+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
69816189 }
6982 - // Or just use first one
6983 - finalDataType = finalDataType || firstDataType;
6984 - }
69856190
6986 - // If we found a dataType
6987 - // We add the dataType to the list if needed
6988 - // and return the corresponding response
6989 - if ( finalDataType ) {
6990 - if ( finalDataType !== dataTypes[ 0 ] ) {
6991 - dataTypes.unshift( finalDataType );
 6191+ // Handle the global AJAX counter
 6192+ if ( s.global && jQuery.active-- === 1 ) {
 6193+ jQuery.event.trigger( "ajaxStop" );
69926194 }
6993 - return responses[ finalDataType ];
6994 - }
6995 -}
 6195+ },
 6196+
 6197+ triggerGlobal: function( s, type, args ) {
 6198+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
 6199+ },
69966200
6997 -// Chain conversions given the request and the original response
6998 -function ajaxConvert( s, response ) {
 6201+ // Determines if an XMLHttpRequest was successful or not
 6202+ httpSuccess: function( xhr ) {
 6203+ try {
 6204+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
 6205+ return !xhr.status && location.protocol === "file:" ||
 6206+ xhr.status >= 200 && xhr.status < 300 ||
 6207+ xhr.status === 304 || xhr.status === 1223;
 6208+ } catch(e) {}
69996209
7000 - // Apply the dataFilter if provided
7001 - if ( s.dataFilter ) {
7002 - response = s.dataFilter( response, s.dataType );
7003 - }
 6210+ return false;
 6211+ },
70046212
7005 - var dataTypes = s.dataTypes,
7006 - converters = {},
7007 - i,
7008 - key,
7009 - length = dataTypes.length,
7010 - tmp,
7011 - // Current and previous dataTypes
7012 - current = dataTypes[ 0 ],
7013 - prev,
7014 - // Conversion expression
7015 - conversion,
7016 - // Conversion function
7017 - conv,
7018 - // Conversion functions (transitive conversion)
7019 - conv1,
7020 - conv2;
 6213+ // Determines if an XMLHttpRequest returns NotModified
 6214+ httpNotModified: function( xhr, url ) {
 6215+ var lastModified = xhr.getResponseHeader("Last-Modified"),
 6216+ etag = xhr.getResponseHeader("Etag");
70216217
7022 - // For each dataType in the chain
7023 - for( i = 1; i < length; i++ ) {
 6218+ if ( lastModified ) {
 6219+ jQuery.lastModified[url] = lastModified;
 6220+ }
70246221
7025 - // Create converters map
7026 - // with lowercased keys
7027 - if ( i === 1 ) {
7028 - for( key in s.converters ) {
7029 - if( typeof key === "string" ) {
7030 - converters[ key.toLowerCase() ] = s.converters[ key ];
7031 - }
7032 - }
 6222+ if ( etag ) {
 6223+ jQuery.etag[url] = etag;
70336224 }
70346225
7035 - // Get the dataTypes
7036 - prev = current;
7037 - current = dataTypes[ i ];
 6226+ return xhr.status === 304;
 6227+ },
70386228
7039 - // If current is auto dataType, update it to prev
7040 - if( current === "*" ) {
7041 - current = prev;
7042 - // If no auto and dataTypes are actually different
7043 - } else if ( prev !== "*" && prev !== current ) {
 6229+ httpData: function( xhr, type, s ) {
 6230+ var ct = xhr.getResponseHeader("content-type") || "",
 6231+ xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
 6232+ data = xml ? xhr.responseXML : xhr.responseText;
70446233
7045 - // Get the converter
7046 - conversion = prev + " " + current;
7047 - conv = converters[ conversion ] || converters[ "* " + current ];
 6234+ if ( xml && data.documentElement.nodeName === "parsererror" ) {
 6235+ jQuery.error( "parsererror" );
 6236+ }
70486237
7049 - // If there is no direct converter, search transitively
7050 - if ( !conv ) {
7051 - conv2 = undefined;
7052 - for( conv1 in converters ) {
7053 - tmp = conv1.split( " " );
7054 - if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
7055 - conv2 = converters[ tmp[1] + " " + current ];
7056 - if ( conv2 ) {
7057 - conv1 = converters[ conv1 ];
7058 - if ( conv1 === true ) {
7059 - conv = conv2;
7060 - } else if ( conv2 === true ) {
7061 - conv = conv1;
7062 - }
7063 - break;
7064 - }
7065 - }
7066 - }
7067 - }
7068 - // If we found no converter, dispatch an error
7069 - if ( !( conv || conv2 ) ) {
7070 - jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
7071 - }
7072 - // If found converter is not an equivalence
7073 - if ( conv !== true ) {
7074 - // Convert with 1 or 2 converters accordingly
7075 - response = conv ? conv( response ) : conv2( conv1(response) );
7076 - }
 6238+ // Allow a pre-filtering function to sanitize the response
 6239+ // s is checked to keep backwards compatibility
 6240+ if ( s && s.dataFilter ) {
 6241+ data = s.dataFilter( data, type );
70776242 }
7078 - }
7079 - return response;
7080 -}
70816243
 6244+ // The filter can actually parse the response
 6245+ if ( typeof data === "string" ) {
 6246+ // Get the JavaScript object, if JSON is used.
 6247+ if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
 6248+ data = jQuery.parseJSON( data );
70826249
7083 -
7084 -
7085 -var jsc = jQuery.now(),
7086 - jsre = /(\=)\?(&|$)|\?\?/i;
7087 -
7088 -// Default jsonp settings
7089 -jQuery.ajaxSetup({
7090 - jsonp: "callback",
7091 - jsonpCallback: function() {
7092 - return jQuery.expando + "_" + ( jsc++ );
7093 - }
7094 -});
7095 -
7096 -// Detect, normalize options and install callbacks for jsonp requests
7097 -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7098 -
7099 - var dataIsString = ( typeof s.data === "string" );
7100 -
7101 - if ( s.dataTypes[ 0 ] === "jsonp" ||
7102 - originalSettings.jsonpCallback ||
7103 - originalSettings.jsonp != null ||
7104 - s.jsonp !== false && ( jsre.test( s.url ) ||
7105 - dataIsString && jsre.test( s.data ) ) ) {
7106 -
7107 - var responseContainer,
7108 - jsonpCallback = s.jsonpCallback =
7109 - jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
7110 - previous = window[ jsonpCallback ],
7111 - url = s.url,
7112 - data = s.data,
7113 - replace = "$1" + jsonpCallback + "$2",
7114 - cleanUp = function() {
7115 - // Set callback back to previous value
7116 - window[ jsonpCallback ] = previous;
7117 - // Call if it was a function and we have a response
7118 - if ( responseContainer && jQuery.isFunction( previous ) ) {
7119 - window[ jsonpCallback ]( responseContainer[ 0 ] );
7120 - }
7121 - };
7122 -
7123 - if ( s.jsonp !== false ) {
7124 - url = url.replace( jsre, replace );
7125 - if ( s.url === url ) {
7126 - if ( dataIsString ) {
7127 - data = data.replace( jsre, replace );
7128 - }
7129 - if ( s.data === data ) {
7130 - // Add callback manually
7131 - url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
7132 - }
 6250+ // If the type is "script", eval it in global context
 6251+ } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
 6252+ jQuery.globalEval( data );
71336253 }
71346254 }
71356255
7136 - s.url = url;
7137 - s.data = data;
7138 -
7139 - // Install callback
7140 - window[ jsonpCallback ] = function( response ) {
7141 - responseContainer = [ response ];
7142 - };
7143 -
7144 - // Install cleanUp function
7145 - jqXHR.then( cleanUp, cleanUp );
7146 -
7147 - // Use data converter to retrieve json after script execution
7148 - s.converters["script json"] = function() {
7149 - if ( !responseContainer ) {
7150 - jQuery.error( jsonpCallback + " was not called" );
7151 - }
7152 - return responseContainer[ 0 ];
7153 - };
7154 -
7155 - // force json dataType
7156 - s.dataTypes[ 0 ] = "json";
7157 -
7158 - // Delegate to script
7159 - return "script";
 6256+ return data;
71606257 }
7161 -} );
71626258
7163 -
7164 -
7165 -
7166 -// Install script dataType
7167 -jQuery.ajaxSetup({
7168 - accepts: {
7169 - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
7170 - },
7171 - contents: {
7172 - script: /javascript|ecmascript/
7173 - },
7174 - converters: {
7175 - "text script": function( text ) {
7176 - jQuery.globalEval( text );
7177 - return text;
7178 - }
7179 - }
71806259 });
71816260
7182 -// Handle cache's special case and global
7183 -jQuery.ajaxPrefilter( "script", function( s ) {
7184 - if ( s.cache === undefined ) {
7185 - s.cache = false;
7186 - }
7187 - if ( s.crossDomain ) {
7188 - s.type = "GET";
7189 - s.global = false;
7190 - }
7191 -} );
7192 -
7193 -// Bind script tag hack transport
7194 -jQuery.ajaxTransport( "script", function(s) {
7195 -
7196 - // This transport only deals with cross domain requests
7197 - if ( s.crossDomain ) {
7198 -
7199 - var script,
7200 - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
7201 -
7202 - return {
7203 -
7204 - send: function( _, callback ) {
7205 -
7206 - script = document.createElement( "script" );
7207 -
7208 - script.async = "async";
7209 -
7210 - if ( s.scriptCharset ) {
7211 - script.charset = s.scriptCharset;
7212 - }
7213 -
7214 - script.src = s.url;
7215 -
7216 - // Attach handlers for all browsers
7217 - script.onload = script.onreadystatechange = function( _, isAbort ) {
7218 -
7219 - if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
7220 -
7221 - // Handle memory leak in IE
7222 - script.onload = script.onreadystatechange = null;
7223 -
7224 - // Remove the script
7225 - if ( head && script.parentNode ) {
7226 - head.removeChild( script );
7227 - }
7228 -
7229 - // Dereference the script
7230 - script = undefined;
7231 -
7232 - // Callback if not abort
7233 - if ( !isAbort ) {
7234 - callback( 200, "success" );
7235 - }
7236 - }
7237 - };
7238 - // Use insertBefore instead of appendChild to circumvent an IE6 bug.
7239 - // This arises when a base node is used (#2709 and #4378).
7240 - head.insertBefore( script, head.firstChild );
7241 - },
7242 -
7243 - abort: function() {
7244 - if ( script ) {
7245 - script.onload( 0, 1 );
7246 - }
7247 - }
7248 - };
7249 - }
7250 -} );
7251 -
7252 -
7253 -
7254 -
7255 -var // #5280: next active xhr id and list of active xhrs' callbacks
7256 - xhrId = jQuery.now(),
7257 - xhrCallbacks,
7258 -
7259 - // XHR used to determine supports properties
7260 - testXHR;
7261 -
7262 -// #5280: Internet Explorer will keep connections alive if we don't abort on unload
7263 -function xhrOnUnloadAbort() {
7264 - jQuery( window ).unload(function() {
7265 - // Abort all pending requests
7266 - for ( var key in xhrCallbacks ) {
7267 - xhrCallbacks[ key ]( 0, 1 );
 6261+/*
 6262+ * Create the request object; Microsoft failed to properly
 6263+ * implement the XMLHttpRequest in IE7 (can't request local files),
 6264+ * so we use the ActiveXObject when it is available
 6265+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
 6266+ * we need a fallback.
 6267+ */
 6268+if ( window.ActiveXObject ) {
 6269+ jQuery.ajaxSettings.xhr = function() {
 6270+ if ( window.location.protocol !== "file:" ) {
 6271+ try {
 6272+ return new window.XMLHttpRequest();
 6273+ } catch(xhrError) {}
72686274 }
7269 - });
7270 -}
72716275
7272 -// Functions to create xhrs
7273 -function createStandardXHR() {
7274 - try {
7275 - return new window.XMLHttpRequest();
7276 - } catch( e ) {}
 6276+ try {
 6277+ return new window.ActiveXObject("Microsoft.XMLHTTP");
 6278+ } catch(activeError) {}
 6279+ };
72776280 }
72786281
7279 -function createActiveXHR() {
7280 - try {
7281 - return new window.ActiveXObject( "Microsoft.XMLHTTP" );
7282 - } catch( e ) {}
7283 -}
 6282+// Does this browser support XHR requests?
 6283+jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
72846284
7285 -// Create the request object
7286 -// (This is still attached to ajaxSettings for backward compatibility)
7287 -jQuery.ajaxSettings.xhr = window.ActiveXObject ?
7288 - /* Microsoft failed to properly
7289 - * implement the XMLHttpRequest in IE7 (can't request local files),
7290 - * so we use the ActiveXObject when it is available
7291 - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
7292 - * we need a fallback.
7293 - */
7294 - function() {
7295 - return !this.isLocal && createStandardXHR() || createActiveXHR();
7296 - } :
7297 - // For all other browsers, use the standard XMLHttpRequest object
7298 - createStandardXHR;
72996285
7300 -// Test if we can create an xhr object
7301 -testXHR = jQuery.ajaxSettings.xhr();
7302 -jQuery.support.ajax = !!testXHR;
73036286
7304 -// Does this browser support crossDomain XHR requests
7305 -jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
73066287
7307 -// No need for the temporary xhr anymore
7308 -testXHR = undefined;
7309 -
7310 -// Create transport if the browser can provide an xhr
7311 -if ( jQuery.support.ajax ) {
7312 -
7313 - jQuery.ajaxTransport(function( s ) {
7314 - // Cross domain only allowed if supported through XMLHttpRequest
7315 - if ( !s.crossDomain || jQuery.support.cors ) {
7316 -
7317 - var callback;
7318 -
7319 - return {
7320 - send: function( headers, complete ) {
7321 -
7322 - // Get a new xhr
7323 - var xhr = s.xhr(),
7324 - handle,
7325 - i;
7326 -
7327 - // Open the socket
7328 - // Passing null username, generates a login popup on Opera (#2865)
7329 - if ( s.username ) {
7330 - xhr.open( s.type, s.url, s.async, s.username, s.password );
7331 - } else {
7332 - xhr.open( s.type, s.url, s.async );
7333 - }
7334 -
7335 - // Apply custom fields if provided
7336 - if ( s.xhrFields ) {
7337 - for ( i in s.xhrFields ) {
7338 - xhr[ i ] = s.xhrFields[ i ];
7339 - }
7340 - }
7341 -
7342 - // Override mime type if needed
7343 - if ( s.mimeType && xhr.overrideMimeType ) {
7344 - xhr.overrideMimeType( s.mimeType );
7345 - }
7346 -
7347 - // X-Requested-With header
7348 - // For cross-domain requests, seeing as conditions for a preflight are
7349 - // akin to a jigsaw puzzle, we simply never set it to be sure.
7350 - // (it can always be set on a per-request basis or even using ajaxSetup)
7351 - // For same-domain requests, won't change header if already provided.
7352 - if ( !s.crossDomain && !headers["X-Requested-With"] ) {
7353 - headers[ "X-Requested-With" ] = "XMLHttpRequest";
7354 - }
7355 -
7356 - // Need an extra try/catch for cross domain requests in Firefox 3
7357 - try {
7358 - for ( i in headers ) {
7359 - xhr.setRequestHeader( i, headers[ i ] );
7360 - }
7361 - } catch( _ ) {}
7362 -
7363 - // Do send the request
7364 - // This may raise an exception which is actually
7365 - // handled in jQuery.ajax (so no try/catch here)
7366 - xhr.send( ( s.hasContent && s.data ) || null );
7367 -
7368 - // Listener
7369 - callback = function( _, isAbort ) {
7370 -
7371 - var status,
7372 - statusText,
7373 - responseHeaders,
7374 - responses,
7375 - xml;
7376 -
7377 - // Firefox throws exceptions when accessing properties
7378 - // of an xhr when a network error occured
7379 - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
7380 - try {
7381 -
7382 - // Was never called and is aborted or complete
7383 - if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
7384 -
7385 - // Only called once
7386 - callback = undefined;
7387 -
7388 - // Do not keep as active anymore
7389 - if ( handle ) {
7390 - xhr.onreadystatechange = jQuery.noop;
7391 - delete xhrCallbacks[ handle ];
7392 - }
7393 -
7394 - // If it's an abort
7395 - if ( isAbort ) {
7396 - // Abort it manually if needed
7397 - if ( xhr.readyState !== 4 ) {
7398 - xhr.abort();
7399 - }
7400 - } else {
7401 - status = xhr.status;
7402 - responseHeaders = xhr.getAllResponseHeaders();
7403 - responses = {};
7404 - xml = xhr.responseXML;
7405 -
7406 - // Construct response list
7407 - if ( xml && xml.documentElement /* #4958 */ ) {
7408 - responses.xml = xml;
7409 - }
7410 - responses.text = xhr.responseText;
7411 -
7412 - // Firefox throws an exception when accessing
7413 - // statusText for faulty cross-domain requests
7414 - try {
7415 - statusText = xhr.statusText;
7416 - } catch( e ) {
7417 - // We normalize with Webkit giving an empty statusText
7418 - statusText = "";
7419 - }
7420 -
7421 - // Filter status for non standard behaviors
7422 -
7423 - // If the request is local and we have data: assume a success
7424 - // (success with no data won't get notified, that's the best we
7425 - // can do given current implementations)
7426 - if ( !status && s.isLocal && !s.crossDomain ) {
7427 - status = responses.text ? 200 : 404;
7428 - // IE - #1450: sometimes returns 1223 when it should be 204
7429 - } else if ( status === 1223 ) {
7430 - status = 204;
7431 - }
7432 - }
7433 - }
7434 - } catch( firefoxAccessException ) {
7435 - if ( !isAbort ) {
7436 - complete( -1, firefoxAccessException );
7437 - }
7438 - }
7439 -
7440 - // Call complete if needed
7441 - if ( responses ) {
7442 - complete( status, statusText, responses, responseHeaders );
7443 - }
7444 - };
7445 -
7446 - // if we're in sync mode or it's in cache
7447 - // and has been retrieved directly (IE6 & IE7)
7448 - // we need to manually fire the callback
7449 - if ( !s.async || xhr.readyState === 4 ) {
7450 - callback();
7451 - } else {
7452 - // Create the active xhrs callbacks list if needed
7453 - // and attach the unload handler
7454 - if ( !xhrCallbacks ) {
7455 - xhrCallbacks = {};
7456 - xhrOnUnloadAbort();
7457 - }
7458 - // Add to list of active xhrs callbacks
7459 - handle = xhrId++;
7460 - xhr.onreadystatechange = xhrCallbacks[ handle ] = callback;
7461 - }
7462 - },
7463 -
7464 - abort: function() {
7465 - if ( callback ) {
7466 - callback(0,1);
7467 - }
7468 - }
7469 - };
7470 - }
7471 - });
7472 -}
7473 -
7474 -
7475 -
7476 -
74776288 var elemdisplay = {},
74786289 rfxtypes = /^(?:toggle|show|hide)$/,
7479 - rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
 6290+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
74806291 timerId,
74816292 fxAttrs = [
74826293 // height animations
@@ -7500,7 +6311,7 @@
75016312
75026313 // Reset the inline display of this element to learn if it is
75036314 // being hidden by cascaded rules or not
7504 - if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
 6315+ if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
75056316 display = elem.style.display = "";
75066317 }
75076318
@@ -7508,7 +6319,7 @@
75096320 // in a stylesheet to whatever the default browser style is
75106321 // for such an element
75116322 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
7512 - jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
 6323+ jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
75136324 }
75146325 }
75156326
@@ -7519,7 +6330,7 @@
75206331 display = elem.style.display;
75216332
75226333 if ( display === "" || display === "none" ) {
7523 - elem.style.display = jQuery._data(elem, "olddisplay") || "";
 6334+ elem.style.display = jQuery.data(elem, "olddisplay") || "";
75246335 }
75256336 }
75266337
@@ -7535,8 +6346,8 @@
75366347 for ( var i = 0, j = this.length; i < j; i++ ) {
75376348 var display = jQuery.css( this[i], "display" );
75386349
7539 - if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
7540 - jQuery._data( this[i], "olddisplay", display );
 6350+ if ( display !== "none" ) {
 6351+ jQuery.data( this[i], "olddisplay", display );
75416352 }
75426353 }
75436354
@@ -7658,11 +6469,11 @@
76596470
76606471 } else {
76616472 var parts = rfxnum.exec(val),
7662 - start = e.cur();
 6473+ start = e.cur() || 0;
76636474
76646475 if ( parts ) {
76656476 var end = parseFloat( parts[2] ),
7666 - unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
 6477+ unit = parts[3] || "px";
76676478
76686479 // We need to compute starting value
76696480 if ( unit !== "px" ) {
@@ -7809,12 +6620,8 @@
78106621 return this.elem[ this.prop ];
78116622 }
78126623
7813 - var parsed,
7814 - r = jQuery.css( this.elem, this.prop );
7815 - // Empty strings, null, undefined and "auto" are converted to 0,
7816 - // complex values such as "rotate(1rad)" are returned as is,
7817 - // simple values such as "10px" are parsed to Float.
7818 - return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
 6624+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
 6625+ return r && r > -10000 ? r : 0;
78196626 },
78206627
78216628 // Start an animation from one number to another
@@ -7825,7 +6632,7 @@
78266633 this.startTime = jQuery.now();
78276634 this.start = from;
78286635 this.end = to;
7829 - this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
 6636+ this.unit = unit || this.unit || "px";
78306637 this.now = this.start;
78316638 this.pos = this.state = 0;
78326639
@@ -8008,7 +6815,7 @@
80096816 jQuery.fn.offset = function( options ) {
80106817 var elem = this[0], box;
80116818
8012 - if ( options ) {
 6819+ if ( options ) {
80136820 return this.each(function( i ) {
80146821 jQuery.offset.setOffset( this, options, i );
80156822 });
@@ -8031,15 +6838,15 @@
80326839
80336840 // Make sure we're not dealing with a disconnected DOM node
80346841 if ( !box || !jQuery.contains( docElem, elem ) ) {
8035 - return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
 6842+ return box || { top: 0, left: 0 };
80366843 }
80376844
80386845 var body = doc.body,
80396846 win = getWindow(doc),
80406847 clientTop = docElem.clientTop || body.clientTop || 0,
80416848 clientLeft = docElem.clientLeft || body.clientLeft || 0,
8042 - scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
8043 - scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
 6849+ scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
 6850+ scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
80446851 top = box.top + scrollTop - clientTop,
80456852 left = box.left + scrollLeft - clientLeft;
80466853
@@ -8050,7 +6857,7 @@
80516858 jQuery.fn.offset = function( options ) {
80526859 var elem = this[0];
80536860
8054 - if ( options ) {
 6861+ if ( options ) {
80556862 return this.each(function( i ) {
80566863 jQuery.offset.setOffset( this, options, i );
80576864 });
@@ -8152,6 +6959,7 @@
81536960 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
81546961
81556962 body.removeChild( container );
 6963+ body = container = innerDiv = checkDiv = table = td = null;
81566964 jQuery.offset.initialize = jQuery.noop;
81576965 },
81586966
@@ -8168,7 +6976,7 @@
81696977
81706978 return { top: top, left: left };
81716979 },
8172 -
 6980+
81736981 setOffset: function( elem, options, i ) {
81746982 var position = jQuery.css( elem, "position" );
81756983
@@ -8181,10 +6989,10 @@
81826990 curOffset = curElem.offset(),
81836991 curCSSTop = jQuery.css( elem, "top" ),
81846992 curCSSLeft = jQuery.css( elem, "left" ),
8185 - calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1,
 6993+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
81866994 props = {}, curPosition = {}, curTop, curLeft;
81876995
8188 - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
 6996+ // need to be able to calculate position if either top or left is auto and position is absolute
81896997 if ( calculatePosition ) {
81906998 curPosition = curElem.position();
81916999 }
@@ -8202,7 +7010,7 @@
82037011 if (options.left != null) {
82047012 props.left = (options.left - curOffset.left) + curLeft;
82057013 }
8206 -
 7014+
82077015 if ( "using" in options ) {
82087016 options.using.call( elem, props );
82097017 } else {
@@ -8262,7 +7070,7 @@
82637071
82647072 jQuery.fn[ method ] = function(val) {
82657073 var elem = this[0], win;
8266 -
 7074+
82677075 if ( !elem ) {
82687076 return null;
82697077 }
@@ -8275,7 +7083,7 @@
82767084 if ( win ) {
82777085 win.scrollTo(
82787086 !i ? val : jQuery(win).scrollLeft(),
8279 - i ? val : jQuery(win).scrollTop()
 7087+ i ? val : jQuery(win).scrollTop()
82807088 );
82817089
82827090 } else {
@@ -8330,7 +7138,7 @@
83317139 if ( !elem ) {
83327140 return size == null ? null : this;
83337141 }
8334 -
 7142+
83357143 if ( jQuery.isFunction( size ) ) {
83367144 return this.each(function( i ) {
83377145 var self = jQuery( this );
@@ -8340,10 +7148,8 @@
83417149
83427150 if ( jQuery.isWindow( elem ) ) {
83437151 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
8344 - // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
8345 - var docElemProp = elem.document.documentElement[ "client" + name ];
8346 - return elem.document.compatMode === "CSS1Compat" && docElemProp ||
8347 - elem.document.body[ "client" + name ] || docElemProp;
 7152+ return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
 7153+ elem.document.body[ "client" + name ];
83487154
83497155 // Get document width or height
83507156 } else if ( elem.nodeType === 9 ) {
@@ -8370,5 +7176,4 @@
83717177 });
83727178
83737179
8374 -window.jQuery = window.$ = jQuery;
83757180 })(window);

Sign-offs

UserFlagDate
Hasharinspected08:18, 31 May 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r89866Upgrade jQuery from 1.4.4 to 1.6.1...krinkle00:25, 11 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88607Update our jQuery from 1.4.4 to the latest version of 1.5 (1.5.2). See also b...krinkle21:54, 22 May 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   17:37, 24 May 2011

The bug and mailing list don't indicate any particular problems with 1.6.1 or with 1.5.2 other than the $.ajax thing that's supposedly fixed by 1.6.1, and which also has a workaround.

#Comment by Hashar (talk | contribs)   08:17, 31 May 2011

You might want to revert r88680 "Adapt UW to account for the change in jQuery's behaviour since jQuery 1.5.2" which is a follow up of r88607 (jQuery upgrade to 1.5.2)

Status & tagging log