r88607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88606‎ | r88607 | r88608 >
Date:21:54, 22 May 2011
Author:krinkle
Status:reverted
Tags:
Comment:
Update our jQuery from 1.4.4 to the latest version of 1.5 (1.5.2). See also bug 28904.
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
@@ -37,6 +37,7 @@
3838 * (bug 29036) For cascade-protected pages, the mw-textarea-cprotected class is
3939 added to the textarea on the edit form.
4040 * mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
 41+* (bug 28904) Update jQuery version from 1.4.4 to 1.5.2 (the latest update to 1.5)
4142
4243 === Bug fixes in 1.19 ===
4344 * (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.4.4
 3+ * jQuery JavaScript Library v1.5.2
44 * http://jquery.com/
55 *
6 - * Copyright 2010, John Resig
 6+ * Copyright 2011, 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 2010, The Dojo Foundation
 12+ * Copyright 2011, The Dojo Foundation
1313 * Released under the MIT, BSD, and GPL Licenses.
1414 *
15 - * Date: Thu Nov 11 19:04:53 2010 -0500
 15+ * Date: Thu Mar 31 15:28:23 2011 -0400
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 );
 26+ return new jQuery.fn.init( selector, context, rootjQuery );
2727 },
2828
2929 // Map over jQuery in case of overwrite
@@ -38,20 +38,13 @@
3939 // (both of which we optimize for)
4040 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
4141
42 - // Is it a simple selector
43 - isSimple = /^.[^:#\[\.,]*$/,
44 -
4542 // Check if a string has a non-whitespace character in it
4643 rnotwhite = /\S/,
47 - rwhite = /\s/,
4844
4945 // Used for trimming whitespace
5046 trimLeft = /^\s+/,
5147 trimRight = /\s+$/,
5248
53 - // Check for non-word characters
54 - rnonword = /\W/,
55 -
5649 // Check for digits
5750 rdigit = /\d/,
5851
@@ -75,13 +68,10 @@
7669
7770 // For matching the engine and version of the browser
7871 browserMatch,
79 -
80 - // Has the ready events already been bound?
81 - readyBound = false,
82 -
83 - // The functions to execute on DOM ready
84 - readyList = [],
8572
 73+ // The deferred used on DOM ready
 74+ readyList,
 75+
8676 // The ready event handler
8777 DOMContentLoaded,
8878
@@ -92,12 +82,13 @@
9383 slice = Array.prototype.slice,
9484 trim = String.prototype.trim,
9585 indexOf = Array.prototype.indexOf,
96 -
 86+
9787 // [[Class]] -> type pairs
9888 class2type = {};
9989
10090 jQuery.fn = jQuery.prototype = {
101 - init: function( selector, context ) {
 91+ constructor: jQuery,
 92+ init: function( selector, context, rootjQuery ) {
10293 var match, elem, ret, doc;
10394
10495 // Handle $(""), $(null), or $(undefined)
@@ -111,7 +102,7 @@
112103 this.length = 1;
113104 return this;
114105 }
115 -
 106+
116107 // The body element only exists once, optimize finding it
117108 if ( selector === "body" && !context && document.body ) {
118109 this.context = document;
@@ -131,6 +122,7 @@
132123
133124 // HANDLE: $(html) -> $(array)
134125 if ( match[1] ) {
 126+ context = context instanceof jQuery ? context[0] : context;
135127 doc = (context ? context.ownerDocument || context : document);
136128
137129 // If a single string is passed in and it's a single tag
@@ -148,11 +140,11 @@
149141
150142 } else {
151143 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
152 - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
 144+ selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
153145 }
154 -
 146+
155147 return jQuery.merge( this, selector );
156 -
 148+
157149 // HANDLE: $("#id")
158150 } else {
159151 elem = document.getElementById( match[2] );
@@ -176,13 +168,6 @@
177169 return this;
178170 }
179171
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 -
187172 // HANDLE: $(expr, $(...))
188173 } else if ( !context || context.jquery ) {
189174 return (context || rootjQuery).find( selector );
@@ -190,7 +175,7 @@
191176 // HANDLE: $(expr, context)
192177 // (which is just equivalent to: $(context).find(expr)
193178 } else {
194 - return jQuery( context ).find( selector );
 179+ return this.constructor( context ).find( selector );
195180 }
196181
197182 // HANDLE: $(function)
@@ -211,7 +196,7 @@
212197 selector: "",
213198
214199 // The current version of jQuery being used
215 - jquery: "1.4.4",
 200+ jquery: "1.5.2",
216201
217202 // The default length of a jQuery object is 0
218203 length: 0,
@@ -234,18 +219,18 @@
235220 this.toArray() :
236221
237222 // Return just the object
238 - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
 223+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
239224 },
240225
241226 // Take an array of elements and push it onto the stack
242227 // (returning the new matched element set)
243228 pushStack: function( elems, name, selector ) {
244229 // Build a new jQuery matched element set
245 - var ret = jQuery();
 230+ var ret = this.constructor();
246231
247232 if ( jQuery.isArray( elems ) ) {
248233 push.apply( ret, elems );
249 -
 234+
250235 } else {
251236 jQuery.merge( ret, elems );
252237 }
@@ -271,25 +256,17 @@
272257 each: function( callback, args ) {
273258 return jQuery.each( this, callback, args );
274259 },
275 -
 260+
276261 ready: function( fn ) {
277262 // Attach the listeners
278263 jQuery.bindReady();
279264
280 - // If the DOM is already ready
281 - if ( jQuery.isReady ) {
282 - // Execute the function immediately
283 - fn.call( document, jQuery );
 265+ // Add the callback
 266+ readyList.done( fn );
284267
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 -
291268 return this;
292269 },
293 -
 270+
294271 eq: function( i ) {
295272 return i === -1 ?
296273 this.slice( i ) :
@@ -314,9 +291,9 @@
315292 return callback.call( elem, i, elem );
316293 }));
317294 },
318 -
 295+
319296 end: function() {
320 - return this.prevObject || jQuery(null);
 297+ return this.prevObject || this.constructor(null);
321298 },
322299
323300 // For internal use only.
@@ -330,7 +307,7 @@
331308 jQuery.fn.init.prototype = jQuery.fn;
332309
333310 jQuery.extend = jQuery.fn.extend = function() {
334 - var options, name, src, copy, copyIsArray, clone,
 311+ var options, name, src, copy, copyIsArray, clone,
335312 target = arguments[0] || {},
336313 i = 1,
337314 length = arguments.length,
@@ -403,14 +380,14 @@
404381
405382 return jQuery;
406383 },
407 -
 384+
408385 // Is the DOM ready to be used? Set to true once it occurs.
409386 isReady: false,
410387
411388 // A counter to track how many items to wait for before
412389 // the ready event fires. See #6781
413390 readyWait: 1,
414 -
 391+
415392 // Handle when the DOM is ready
416393 ready: function( wait ) {
417394 // A third-party is pushing the ready event forwards
@@ -434,33 +411,21 @@
435412 }
436413
437414 // If there are functions bound, to execute
438 - if ( readyList ) {
439 - // Execute all of them
440 - var fn,
441 - i = 0,
442 - ready = readyList;
 415+ readyList.resolveWith( document, [ jQuery ] );
443416
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 - }
 417+ // Trigger any bound ready events
 418+ if ( jQuery.fn.trigger ) {
 419+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
455420 }
456421 }
457422 },
458 -
 423+
459424 bindReady: function() {
460 - if ( readyBound ) {
 425+ if ( readyList ) {
461426 return;
462427 }
463428
464 - readyBound = true;
 429+ readyList = jQuery._Deferred();
465430
466431 // Catch cases where $(document).ready() is called after the
467432 // browser event has already occurred.
@@ -473,7 +438,7 @@
474439 if ( document.addEventListener ) {
475440 // Use the handy event callback
476441 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
477 -
 442+
478443 // A fallback to window.onload, that will always work
479444 window.addEventListener( "load", jQuery.ready, false );
480445
@@ -482,7 +447,7 @@
483448 // ensure firing before onload,
484449 // maybe late but safe also for iframes
485450 document.attachEvent("onreadystatechange", DOMContentLoaded);
486 -
 451+
487452 // A fallback to window.onload, that will always work
488453 window.attachEvent( "onload", jQuery.ready );
489454
@@ -533,20 +498,20 @@
534499 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
535500 return false;
536501 }
537 -
 502+
538503 // Not own constructor property must be Object
539504 if ( obj.constructor &&
540505 !hasOwn.call(obj, "constructor") &&
541506 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
542507 return false;
543508 }
544 -
 509+
545510 // Own properties are enumerated firstly, so to speed up,
546511 // if last one is own, then all properties are own.
547 -
 512+
548513 var key;
549514 for ( key in obj ) {}
550 -
 515+
551516 return key === undefined || hasOwn.call( obj, key );
552517 },
553518
@@ -556,11 +521,11 @@
557522 }
558523 return true;
559524 },
560 -
 525+
561526 error: function( msg ) {
562527 throw msg;
563528 },
564 -
 529+
565530 parseJSON: function( data ) {
566531 if ( typeof data !== "string" || !data ) {
567532 return null;
@@ -568,7 +533,7 @@
569534
570535 // Make sure leading/trailing whitespace is removed (IE can't handle it)
571536 data = jQuery.trim( data );
572 -
 537+
573538 // Make sure the incoming data is actual JSON
574539 // Logic borrowed from http://json.org/json2.js
575540 if ( rvalidchars.test(data.replace(rvalidescape, "@")
@@ -585,6 +550,28 @@
586551 }
587552 },
588553
 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+
589576 noop: function() {},
590577
591578 // Evalulates a script in a global context
@@ -592,12 +579,10 @@
593580 if ( data && rnotwhite.test(data) ) {
594581 // Inspired by code by Andrea Giammarchi
595582 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
596 - var head = document.getElementsByTagName("head")[0] || document.documentElement,
597 - script = document.createElement("script");
 583+ var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
 584+ script = document.createElement( "script" );
598585
599 - script.type = "text/javascript";
600 -
601 - if ( jQuery.support.scriptEval ) {
 586+ if ( jQuery.support.scriptEval() ) {
602587 script.appendChild( document.createTextNode( data ) );
603588 } else {
604589 script.text = data;
@@ -710,7 +695,7 @@
711696 for ( var l = second.length; j < l; j++ ) {
712697 first[ i++ ] = second[ j ];
713698 }
714 -
 699+
715700 } else {
716701 while ( second[j] !== undefined ) {
717702 first[ i++ ] = second[ j++ ];
@@ -752,6 +737,7 @@
753738 }
754739 }
755740
 741+ // Flatten any nested arrays
756742 return ret.concat.apply( [], ret );
757743 },
758744
@@ -790,7 +776,7 @@
791777 // The value/s can be optionally by executed if its a function
792778 access: function( elems, key, value, exec, fn, pass ) {
793779 var length = elems.length;
794 -
 780+
795781 // Setting many attributes
796782 if ( typeof key === "object" ) {
797783 for ( var k in key ) {
@@ -798,19 +784,19 @@
799785 }
800786 return elems;
801787 }
802 -
 788+
803789 // Setting one attribute
804790 if ( value !== undefined ) {
805791 // Optionally, function values get executed if exec is true
806792 exec = !pass && exec && jQuery.isFunction(value);
807 -
 793+
808794 for ( var i = 0; i < length; i++ ) {
809795 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
810796 }
811 -
 797+
812798 return elems;
813799 }
814 -
 800+
815801 // Getting an attribute
816802 return length ? fn( elems[0], key ) : undefined;
817803 },
@@ -833,6 +819,27 @@
834820 return { browser: match[1] || "", version: match[2] || "0" };
835821 },
836822
 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+
837844 browser: {}
838845 });
839846
@@ -858,9 +865,8 @@
859866 };
860867 }
861868
862 -// Verify that \s matches non-breaking spaces
863 -// (IE fails on this test)
864 -if ( !rwhite.test( "\xA0" ) ) {
 869+// IE doesn't match non-breaking spaces with \s
 870+if ( rnotwhite.test( "\xA0" ) ) {
865871 trimLeft = /^[\s\xA0]+/;
866872 trimRight = /[\s\xA0]+$/;
867873 }
@@ -905,19 +911,188 @@
906912 }
907913
908914 // Expose jQuery to the global object
909 -return (window.jQuery = window.$ = jQuery);
 915+return jQuery;
910916
911917 })();
912918
913919
 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+
9141092 (function() {
9151093
9161094 jQuery.support = {};
9171095
918 - var root = document.documentElement,
919 - script = document.createElement("script"),
920 - div = document.createElement("div"),
921 - id = "script" + jQuery.now();
 1096+ var div = document.createElement("div");
9221097
9231098 div.style.display = "none";
9241099 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
@@ -925,7 +1100,8 @@
9261101 var all = div.getElementsByTagName("*"),
9271102 a = div.getElementsByTagName("a")[0],
9281103 select = document.createElement("select"),
929 - opt = select.appendChild( document.createElement("option") );
 1104+ opt = select.appendChild( document.createElement("option") ),
 1105+ input = div.getElementsByTagName("input")[0];
9301106
9311107 // Can't get basic test support
9321108 if ( !all || !all.length || !a ) {
@@ -964,7 +1140,7 @@
9651141 // Make sure that if no value is specified for a checkbox
9661142 // that it defaults to "on".
9671143 // (WebKit defaults to "" instead)
968 - checkOn: div.getElementsByTagName("input")[0].value === "on",
 1144+ checkOn: input.value === "on",
9691145
9701146 // Make sure that a selected-by-default option has a working selected property.
9711147 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
@@ -974,46 +1150,62 @@
9751151 deleteExpando: true,
9761152 optDisabled: false,
9771153 checkClone: false,
978 - scriptEval: false,
9791154 noCloneEvent: true,
 1155+ noCloneChecked: true,
9801156 boxModel: null,
9811157 inlineBlockNeedsLayout: false,
9821158 shrinkWrapBlocks: false,
983 - reliableHiddenOffsets: true
 1159+ reliableHiddenOffsets: true,
 1160+ reliableMarginRight: true
9841161 };
9851162
 1163+ input.checked = true;
 1164+ jQuery.support.noCloneChecked = input.cloneNode( true ).checked;
 1165+
9861166 // Make sure that the options inside disabled selects aren't marked as disabled
9871167 // (WebKit marks them as diabled)
9881168 select.disabled = true;
9891169 jQuery.support.optDisabled = !opt.disabled;
9901170
991 - script.type = "text/javascript";
992 - try {
993 - script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
994 - } catch(e) {}
 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();
9951177
996 - root.insertBefore( script, root.firstChild );
 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) {}
9971184
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 - }
 1185+ root.insertBefore( script, root.firstChild );
10051186
 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+
10061200 // Test to see if it's possible to delete an expando from an element
10071201 // Fails in Internet Explorer
10081202 try {
1009 - delete script.test;
 1203+ delete div.test;
10101204
10111205 } catch(e) {
10121206 jQuery.support.deleteExpando = false;
10131207 }
10141208
1015 - root.removeChild( script );
1016 -
1017 - if ( div.attachEvent && div.fireEvent ) {
 1209+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
10181210 div.attachEvent("onclick", function click() {
10191211 // Cloning a node shouldn't copy over any
10201212 // bound event handlers (IE does this)
@@ -1035,10 +1227,16 @@
10361228 // Figure out if the W3C box model works as expected
10371229 // document.body must exist before we can do this
10381230 jQuery(function() {
1039 - var div = document.createElement("div");
 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+
10401239 div.style.width = div.style.paddingLeft = "1px";
1041 -
1042 - document.body.appendChild( div );
 1240+ body.appendChild( div );
10431241 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
10441242
10451243 if ( "zoom" in div.style ) {
@@ -1057,7 +1255,7 @@
10581256 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
10591257 }
10601258
1061 - div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
 1259+ div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
10621260 var tds = div.getElementsByTagName("td");
10631261
10641262 // Check if table cells still have offsetWidth/Height when they are set
@@ -1077,7 +1275,18 @@
10781276 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
10791277 div.innerHTML = "";
10801278
1081 - document.body.removeChild( div ).style.display = "none";
 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";
10821291 div = tds = null;
10831292 });
10841293
@@ -1087,13 +1296,19 @@
10881297 var el = document.createElement("div");
10891298 eventName = "on" + eventName;
10901299
 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+
10911308 var isSupported = (eventName in el);
10921309 if ( !isSupported ) {
10931310 el.setAttribute(eventName, "return;");
10941311 isSupported = typeof el[eventName] === "function";
10951312 }
1096 - el = null;
1097 -
10981313 return isSupported;
10991314 };
11001315
@@ -1101,13 +1316,12 @@
11021317 jQuery.support.changeBubbles = eventSupported("change");
11031318
11041319 // release memory in IE
1105 - root = script = div = all = a = null;
 1320+ div = all = a = null;
11061321 })();
11071322
11081323
11091324
1110 -var windowData = {},
1111 - rbrace = /^(?:\{.*\}|\[.*\])$/;
 1325+var rbrace = /^(?:\{.*\}|\[.*\])$/;
11121326
11131327 jQuery.extend({
11141328 cache: {},
@@ -1115,8 +1329,9 @@
11161330 // Please use with caution
11171331 uuid: 0,
11181332
1119 - // Unique for each copy of jQuery on the page
1120 - expando: "jQuery" + jQuery.now(),
 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, "" ),
11211336
11221337 // The following elements throw uncatchable exceptions if you
11231338 // attempt to add expando properties to them.
@@ -1127,103 +1342,185 @@
11281343 "applet": true
11291344 },
11301345
1131 - data: function( elem, name, data ) {
 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 */ ) {
11321353 if ( !jQuery.acceptData( elem ) ) {
11331354 return;
11341355 }
11351356
1136 - elem = elem == window ?
1137 - windowData :
1138 - elem;
 1357+ var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
11391358
1140 - var isNode = elem.nodeType,
1141 - id = isNode ? elem[ jQuery.expando ] : null,
1142 - cache = jQuery.cache, thisCache;
 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,
11431362
1144 - if ( isNode && !id && typeof name === "string" && data === undefined ) {
 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 ) {
11451374 return;
11461375 }
11471376
1148 - // Get the data from the object directly
1149 - if ( !isNode ) {
1150 - cache = elem;
 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+ }
11511386
1152 - // Compute a unique ID for the element
1153 - } else if ( !id ) {
1154 - elem[ jQuery.expando ] = id = ++jQuery.uuid;
 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+ }
11551396 }
11561397
1157 - // Avoid generating a new cache unless none exists and we
1158 - // want to manipulate it.
1159 - if ( typeof name === "object" ) {
1160 - if ( isNode ) {
 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 {
11611404 cache[ id ] = jQuery.extend(cache[ id ], name);
 1405+ }
 1406+ }
11621407
1163 - } else {
1164 - jQuery.extend( cache, name );
 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 ] = {};
11651416 }
11661417
1167 - } else if ( isNode && !cache[ id ] ) {
1168 - cache[ id ] = {};
 1418+ thisCache = thisCache[ internalKey ];
11691419 }
11701420
1171 - thisCache = isNode ? cache[ id ] : cache;
1172 -
1173 - // Prevent overriding the named cache with undefined values
11741421 if ( data !== undefined ) {
11751422 thisCache[ name ] = data;
11761423 }
11771424
1178 - return typeof name === "string" ? thisCache[ name ] : thisCache;
 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;
11791433 },
11801434
1181 - removeData: function( elem, name ) {
 1435+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
11821436 if ( !jQuery.acceptData( elem ) ) {
11831437 return;
11841438 }
11851439
1186 - elem = elem == window ?
1187 - windowData :
1188 - elem;
 1440+ var internalKey = jQuery.expando, isNode = elem.nodeType,
11891441
1190 - var isNode = elem.nodeType,
1191 - id = isNode ? elem[ jQuery.expando ] : elem,
1192 - cache = jQuery.cache,
1193 - thisCache = isNode ? cache[ id ] : id;
 1442+ // See jQuery.data for more information
 1443+ cache = isNode ? jQuery.cache : elem,
11941444
1195 - // If we want to remove a specific section of the element's data
 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+
11961454 if ( name ) {
 1455+ var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
 1456+
11971457 if ( thisCache ) {
1198 - // Remove the section of cache data
11991458 delete thisCache[ name ];
12001459
1201 - // If we've removed all the data, remove the element's cache
1202 - if ( isNode && jQuery.isEmptyObject(thisCache) ) {
1203 - jQuery.removeData( elem );
 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;
12041464 }
12051465 }
 1466+ }
12061467
1207 - // Otherwise, we want to remove all of the element's data
 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 ];
12081486 } else {
1209 - if ( isNode && jQuery.support.deleteExpando ) {
 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 ) {
12101511 delete elem[ jQuery.expando ];
1211 -
12121512 } else if ( elem.removeAttribute ) {
12131513 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
12201514 } else {
1221 - for ( var n in elem ) {
1222 - delete elem[ n ];
1223 - }
 1515+ elem[ jQuery.expando ] = null;
12241516 }
12251517 }
12261518 },
12271519
 1520+ // For internal use only.
 1521+ _data: function( elem, name, data ) {
 1522+ return jQuery.data( elem, name, data, true );
 1523+ },
 1524+
12281525 // A method for determining if a DOM node can handle the data expando
12291526 acceptData: function( elem ) {
12301527 if ( elem.nodeName ) {
@@ -1244,15 +1541,17 @@
12451542
12461543 if ( typeof key === "undefined" ) {
12471544 if ( this.length ) {
1248 - var attr = this[0].attributes, name;
12491545 data = jQuery.data( this[0] );
12501546
1251 - for ( var i = 0, l = attr.length; i < l; i++ ) {
1252 - name = attr[i].name;
 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;
12531551
1254 - if ( name.indexOf( "data-" ) === 0 ) {
1255 - name = name.substr( 5 );
1256 - dataAttr( this[0], name, data[ name ] );
 1552+ if ( name.indexOf( "data-" ) === 0 ) {
 1553+ name = name.substr( 5 );
 1554+ dataAttr( this[0], name, data[ name ] );
 1555+ }
12571556 }
12581557 }
12591558 }
@@ -1327,9 +1626,22 @@
13281627 return data;
13291628 }
13301629
 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+ }
13311639
 1640+ return true;
 1641+}
13321642
13331643
 1644+
 1645+
13341646 jQuery.extend({
13351647 queue: function( elem, type, data ) {
13361648 if ( !elem ) {
@@ -1337,7 +1649,7 @@
13381650 }
13391651
13401652 type = (type || "fx") + "queue";
1341 - var q = jQuery.data( elem, type );
 1653+ var q = jQuery._data( elem, type );
13421654
13431655 // Speed up dequeue by getting out quickly if this is just a lookup
13441656 if ( !data ) {
@@ -1345,7 +1657,7 @@
13461658 }
13471659
13481660 if ( !q || jQuery.isArray(data) ) {
1349 - q = jQuery.data( elem, type, jQuery.makeArray(data) );
 1661+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
13501662
13511663 } else {
13521664 q.push( data );
@@ -1376,6 +1688,10 @@
13771689 jQuery.dequeue(elem, type);
13781690 });
13791691 }
 1692+
 1693+ if ( !queue.length ) {
 1694+ jQuery.removeData( elem, type + "queue", true );
 1695+ }
13801696 }
13811697 });
13821698
@@ -1425,7 +1741,7 @@
14261742
14271743
14281744
1429 -var rclass = /[\n\t]/g,
 1745+var rclass = /[\n\t\r]/g,
14301746 rspaces = /\s+/,
14311747 rreturn = /\r/g,
14321748 rspecialurl = /^(?:href|src|style)$/,
@@ -1558,11 +1874,11 @@
15591875 } else if ( type === "undefined" || type === "boolean" ) {
15601876 if ( this.className ) {
15611877 // store className if set
1562 - jQuery.data( this, "__className__", this.className );
 1878+ jQuery._data( this, "__className__", this.className );
15631879 }
15641880
15651881 // toggle whole className
1566 - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
 1882+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
15671883 }
15681884 });
15691885 },
@@ -1607,7 +1923,7 @@
16081924 var option = options[ i ];
16091925
16101926 // Don't return options that are disabled or in a disabled optgroup
1611 - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
 1927+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
16121928 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
16131929
16141930 // Get the specific value for the option
@@ -1623,6 +1939,11 @@
16241940 }
16251941 }
16261942
 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+
16271948 return values;
16281949 }
16291950
@@ -1630,7 +1951,6 @@
16311952 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
16321953 return elem.getAttribute("value") === null ? "on" : elem.value;
16331954 }
1634 -
16351955
16361956 // Everything else, we just grab the value
16371957 return (elem.value || "").replace(rreturn, "");
@@ -1696,10 +2016,10 @@
16972017 height: true,
16982018 offset: true
16992019 },
1700 -
 2020+
17012021 attr: function( elem, name, value, pass ) {
1702 - // don't set attributes on text and comment nodes
1703 - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
 2022+ // don't get/set attributes on text, comment and attribute nodes
 2023+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
17042024 return undefined;
17052025 }
17062026
@@ -1714,88 +2034,96 @@
17152035 // Try to normalize/fix the name
17162036 name = notxml && jQuery.props[ name ] || name;
17172037
1718 - // These attributes require special treatment
1719 - var special = rspecialurl.test( name );
 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 );
17202042
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;
 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;
17272049
1728 - // Make sure that it also works with optgroups, see #5701
1729 - if ( parent.parentNode ) {
1730 - parent.parentNode.selectedIndex;
 2050+ // Make sure that it also works with optgroups, see #5701
 2051+ if ( parent.parentNode ) {
 2052+ parent.parentNode.selectedIndex;
 2053+ }
17312054 }
17322055 }
1733 - }
17342056
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 - }
 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+ }
17432065
1744 - if ( value === null ) {
1745 - if ( elem.nodeType === 1 ) {
1746 - elem.removeAttribute( name );
 2066+ if ( value === null ) {
 2067+ if ( elem.nodeType === 1 ) {
 2068+ elem.removeAttribute( name );
 2069+ }
 2070+
 2071+ } else {
 2072+ elem[ name ] = value;
17472073 }
 2074+ }
17482075
1749 - } else {
1750 - elem[ name ] = value;
 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;
17512079 }
1752 - }
17532080
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;
 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 ];
17572094 }
17582095
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" );
 2096+ if ( !jQuery.support.style && notxml && name === "style" ) {
 2097+ if ( set ) {
 2098+ elem.style.cssText = "" + value;
 2099+ }
17632100
1764 - return attributeNode && attributeNode.specified ?
1765 - attributeNode.value :
1766 - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
1767 - 0 :
1768 - undefined;
 2101+ return elem.style.cssText;
17692102 }
17702103
1771 - return elem[ name ];
1772 - }
1773 -
1774 - if ( !jQuery.support.style && notxml && name === "style" ) {
17752104 if ( set ) {
1776 - elem.style.cssText = "" + value;
 2105+ // convert the value to a string (all browsers do this but IE) see #1070
 2106+ elem.setAttribute( name, "" + value );
17772107 }
17782108
1779 - return elem.style.cssText;
 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;
17802122 }
1781 -
 2123+ // Handle everything which isn't a DOM element node
17822124 if ( set ) {
1783 - // convert the value to a string (all browsers do this but IE) see #1070
1784 - elem.setAttribute( name, "" + value );
 2125+ elem[ name ] = value;
17852126 }
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;
 2127+ return elem[ name ];
18002128 }
18012129 });
18022130
@@ -1809,8 +2137,7 @@
18102138 rescape = /[^\w\s.|`]/g,
18112139 fcleanup = function( nm ) {
18122140 return nm.replace(rescape, "\\$&");
1813 - },
1814 - focusCounts = { focusin: 0, focusout: 0 };
 2141+ };
18152142
18162143 /*
18172144 * A number of helper functions used for managing events.
@@ -1826,17 +2153,22 @@
18272154 return;
18282155 }
18292156
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;
 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+ }
18342165 }
 2166+ catch ( e ) {}
18352167
18362168 if ( handler === false ) {
18372169 handler = returnFalse;
18382170 } else if ( !handler ) {
18392171 // Fixes bug #7229. Fix recommended by jdalton
1840 - return;
 2172+ return;
18412173 }
18422174
18432175 var handleObjIn, handleObj;
@@ -1852,7 +2184,7 @@
18532185 }
18542186
18552187 // Init the element's event structure
1856 - var elemData = jQuery.data( elem );
 2188+ var elemData = jQuery._data( elem );
18572189
18582190 // If no elemData is found then we must be trying to bind to one of the
18592191 // banned noData elements
@@ -1860,34 +2192,18 @@
18612193 return;
18622194 }
18632195
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 ],
 2196+ var events = elemData.events,
18682197 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;
18762198
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 -
 2199+ if ( !events ) {
18842200 elemData.events = events = {};
18852201 }
18862202
18872203 if ( !eventHandle ) {
1888 - elemData.handle = eventHandle = function() {
 2204+ elemData.handle = eventHandle = function( e ) {
18892205 // Handle the second event of a trigger and when
18902206 // an event is called after a page has unloaded
1891 - return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
 2207+ return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
18922208 jQuery.event.handle.apply( eventHandle.elem, arguments ) :
18932209 undefined;
18942210 };
@@ -1945,10 +2261,10 @@
19462262 }
19472263 }
19482264 }
1949 -
1950 - if ( special.add ) {
1951 - special.add.call( elem, handleObj );
19522265
 2266+ if ( special.add ) {
 2267+ special.add.call( elem, handleObj );
 2268+
19532269 if ( !handleObj.handler.guid ) {
19542270 handleObj.handler.guid = handler.guid;
19552271 }
@@ -1979,18 +2295,12 @@
19802296 }
19812297
19822298 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
1983 - eventKey = elem.nodeType ? "events" : "__events__",
1984 - elemData = jQuery.data( elem ),
1985 - events = elemData && elemData[ eventKey ];
 2299+ elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
 2300+ events = elemData && elemData.events;
19862301
19872302 if ( !elemData || !events ) {
19882303 return;
19892304 }
1990 -
1991 - if ( typeof events === "function" ) {
1992 - elemData = events;
1993 - events = events.events;
1994 - }
19952305
19962306 // types is actually an event object here
19972307 if ( types && types.type ) {
@@ -2024,7 +2334,7 @@
20252335 namespaces = type.split(".");
20262336 type = namespaces.shift();
20272337
2028 - namespace = new RegExp("(^|\\.)" +
 2338+ namespace = new RegExp("(^|\\.)" +
20292339 jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
20302340 }
20312341
@@ -2091,11 +2401,8 @@
20922402 delete elemData.events;
20932403 delete elemData.handle;
20942404
2095 - if ( typeof elemData === "function" ) {
2096 - jQuery.removeData( elem, eventKey );
2097 -
2098 - } else if ( jQuery.isEmptyObject( elemData ) ) {
2099 - jQuery.removeData( elem );
 2405+ if ( jQuery.isEmptyObject( elemData ) ) {
 2406+ jQuery.removeData( elem, undefined, true );
21002407 }
21012408 }
21022409 },
@@ -2127,9 +2434,16 @@
21282435
21292436 // Only trigger if we've ever bound an event for it
21302437 if ( jQuery.event.global[ type ] ) {
 2438+ // XXX This code smells terrible. event.js should not be directly
 2439+ // inspecting the data cache
21312440 jQuery.each( jQuery.cache, function() {
2132 - if ( this.events && this.events[type] ) {
2133 - jQuery.event.trigger( event, data, this.handle.elem );
 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 );
21342448 }
21352449 });
21362450 }
@@ -2154,9 +2468,7 @@
21552469 event.currentTarget = elem;
21562470
21572471 // Trigger the event, it is assumed that "handle" is a function
2158 - var handle = elem.nodeType ?
2159 - jQuery.data( elem, "handle" ) :
2160 - (jQuery.data( elem, "__events__" ) || {}).handle;
 2472+ var handle = jQuery._data( elem, "handle" );
21612473
21622474 if ( handle ) {
21632475 handle.apply( elem, data );
@@ -2186,7 +2498,7 @@
21872499 isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
21882500 special = jQuery.event.special[ targetType ] || {};
21892501
2190 - if ( (!special._default || special._default.call( elem, event ) === false) &&
 2502+ if ( (!special._default || special._default.call( elem, event ) === false) &&
21912503 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
21922504
21932505 try {
@@ -2198,7 +2510,7 @@
21992511 target[ "on" + targetType ] = null;
22002512 }
22012513
2202 - jQuery.event.triggered = true;
 2514+ jQuery.event.triggered = event.type;
22032515 target[ targetType ]();
22042516 }
22052517
@@ -2209,7 +2521,7 @@
22102522 target[ "on" + targetType ] = old;
22112523 }
22122524
2213 - jQuery.event.triggered = false;
 2525+ jQuery.event.triggered = undefined;
22142526 }
22152527 }
22162528 },
@@ -2234,12 +2546,8 @@
22352547
22362548 event.namespace = event.namespace || namespace_sort.join(".");
22372549
2238 - events = jQuery.data(this, this.nodeType ? "events" : "__events__");
 2550+ events = jQuery._data(this, "events");
22392551
2240 - if ( typeof events === "function" ) {
2241 - events = events.events;
2242 - }
2243 -
22442552 handlers = (events || {})[ event.type ];
22452553
22462554 if ( events && handlers ) {
@@ -2256,7 +2564,7 @@
22572565 event.handler = handleObj.handler;
22582566 event.data = handleObj.data;
22592567 event.handleObj = handleObj;
2260 -
 2568+
22612569 var ret = handleObj.handler.apply( this, args );
22622570
22632571 if ( ret !== undefined ) {
@@ -2355,7 +2663,7 @@
23562664 add: function( handleObj ) {
23572665 jQuery.event.add( this,
23582666 liveConvert( handleObj.origType, handleObj.selector ),
2359 - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
 2667+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
23602668 },
23612669
23622670 remove: function( handleObj ) {
@@ -2385,7 +2693,7 @@
23862694 if ( elem.removeEventListener ) {
23872695 elem.removeEventListener( type, handle, false );
23882696 }
2389 - } :
 2697+ } :
23902698 function( elem, type, handle ) {
23912699 if ( elem.detachEvent ) {
23922700 elem.detachEvent( "on" + type, handle );
@@ -2402,6 +2710,12 @@
24032711 if ( src && src.type ) {
24042712 this.originalEvent = src;
24052713 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+
24062720 // Event type
24072721 } else {
24082722 this.type = src;
@@ -2432,7 +2746,7 @@
24332747 if ( !e ) {
24342748 return;
24352749 }
2436 -
 2750+
24372751 // if preventDefault exists run it on the original event
24382752 if ( e.preventDefault ) {
24392753 e.preventDefault();
@@ -2474,6 +2788,12 @@
24752789 // Firefox sometimes assigns relatedTarget a XUL element
24762790 // which we cannot access the parentNode property of
24772791 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+ }
24782798 // Traverse up the tree
24792799 while ( parent && parent !== this ) {
24802800 parent = parent.parentNode;
@@ -2518,24 +2838,22 @@
25192839
25202840 jQuery.event.special.submit = {
25212841 setup: function( data, namespaces ) {
2522 - if ( this.nodeName.toLowerCase() !== "form" ) {
 2842+ if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
25232843 jQuery.event.add(this, "click.specialSubmit", function( e ) {
25242844 var elem = e.target,
25252845 type = elem.type;
25262846
25272847 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
2528 - e.liveFired = undefined;
2529 - return trigger( "submit", this, arguments );
 2848+ trigger( "submit", this, arguments );
25302849 }
25312850 });
2532 -
 2851+
25332852 jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
25342853 var elem = e.target,
25352854 type = elem.type;
25362855
25372856 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
2538 - e.liveFired = undefined;
2539 - return trigger( "submit", this, arguments );
 2857+ trigger( "submit", this, arguments );
25402858 }
25412859 });
25422860
@@ -2583,14 +2901,14 @@
25842902 return;
25852903 }
25862904
2587 - data = jQuery.data( elem, "_change_data" );
 2905+ data = jQuery._data( elem, "_change_data" );
25882906 val = getVal(elem);
25892907
25902908 // the current data will be also retrieved by beforeactivate
25912909 if ( e.type !== "focusout" || elem.type !== "radio" ) {
2592 - jQuery.data( elem, "_change_data", val );
 2910+ jQuery._data( elem, "_change_data", val );
25932911 }
2594 -
 2912+
25952913 if ( data === undefined || val === data ) {
25962914 return;
25972915 }
@@ -2598,13 +2916,13 @@
25992917 if ( data != null || val ) {
26002918 e.type = "change";
26012919 e.liveFired = undefined;
2602 - return jQuery.event.trigger( e, arguments[1], elem );
 2920+ jQuery.event.trigger( e, arguments[1], elem );
26032921 }
26042922 };
26052923
26062924 jQuery.event.special.change = {
26072925 filters: {
2608 - focusout: testChange,
 2926+ focusout: testChange,
26092927
26102928 beforedeactivate: testChange,
26112929
@@ -2612,7 +2930,7 @@
26132931 var elem = e.target, type = elem.type;
26142932
26152933 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
2616 - return testChange.call( this, e );
 2934+ testChange.call( this, e );
26172935 }
26182936 },
26192937
@@ -2624,7 +2942,7 @@
26252943 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
26262944 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
26272945 type === "select-multiple" ) {
2628 - return testChange.call( this, e );
 2946+ testChange.call( this, e );
26292947 }
26302948 },
26312949
@@ -2633,7 +2951,7 @@
26342952 // information
26352953 beforeactivate: function( e ) {
26362954 var elem = e.target;
2637 - jQuery.data( elem, "_change_data", getVal(elem) );
 2955+ jQuery._data( elem, "_change_data", getVal(elem) );
26382956 }
26392957 },
26402958
@@ -2663,30 +2981,50 @@
26642982 }
26652983
26662984 function trigger( type, elem, args ) {
2667 - args[0].type = type;
2668 - return jQuery.event.handle.apply( 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+ }
26692997 }
26702998
26712999 // Create "bubbling" focus and blur events
26723000 if ( document.addEventListener ) {
26733001 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+
26743006 jQuery.event.special[ fix ] = {
26753007 setup: function() {
2676 - if ( focusCounts[fix]++ === 0 ) {
 3008+ if ( attaches++ === 0 ) {
26773009 document.addEventListener( orig, handler, true );
26783010 }
2679 - },
2680 - teardown: function() {
2681 - if ( --focusCounts[fix] === 0 ) {
 3011+ },
 3012+ teardown: function() {
 3013+ if ( --attaches === 0 ) {
26823014 document.removeEventListener( orig, handler, true );
26833015 }
26843016 }
26853017 };
26863018
2687 - function handler( e ) {
2688 - e = jQuery.event.fix( e );
 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 );
26893023 e.type = fix;
2690 - return jQuery.event.trigger( e, null, e.target );
 3024+ e.originalEvent = {};
 3025+ jQuery.event.trigger( e, null, e.target );
 3026+ if ( e.isDefaultPrevented() ) {
 3027+ donor.preventDefault();
 3028+ }
26913029 }
26923030 });
26933031 }
@@ -2700,7 +3038,7 @@
27013039 }
27023040 return this;
27033041 }
2704 -
 3042+
27053043 if ( jQuery.isFunction( data ) || data === false ) {
27063044 fn = data;
27073045 data = undefined;
@@ -2740,20 +3078,20 @@
27413079
27423080 return this;
27433081 },
2744 -
 3082+
27453083 delegate: function( selector, types, data, fn ) {
27463084 return this.live( types, data, fn, selector );
27473085 },
2748 -
 3086+
27493087 undelegate: function( selector, types, fn ) {
27503088 if ( arguments.length === 0 ) {
27513089 return this.unbind( "live" );
2752 -
 3090+
27533091 } else {
27543092 return this.die( types, null, fn, selector );
27553093 }
27563094 },
2757 -
 3095+
27583096 trigger: function( type, data ) {
27593097 return this.each(function() {
27603098 jQuery.event.trigger( type, data, this );
@@ -2782,8 +3120,8 @@
27833121
27843122 return this.click( jQuery.proxy( fn, function( event ) {
27853123 // Figure out which function to execute
2786 - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
2787 - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
 3124+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
 3125+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
27883126
27893127 // Make sure that clicks stop
27903128 event.preventDefault();
@@ -2810,12 +3148,12 @@
28113149 var type, i = 0, match, namespaces, preType,
28123150 selector = origSelector || this.selector,
28133151 context = origSelector ? this : jQuery( this.context );
2814 -
 3152+
28153153 if ( typeof types === "object" && !types.preventDefault ) {
28163154 for ( var key in types ) {
28173155 context[ name ]( key, data, types[key], selector );
28183156 }
2819 -
 3157+
28203158 return this;
28213159 }
28223160
@@ -2862,7 +3200,7 @@
28633201 context.unbind( "live." + liveConvert( type, selector ), fn );
28643202 }
28653203 }
2866 -
 3204+
28673205 return this;
28683206 };
28693207 });
@@ -2871,17 +3209,13 @@
28723210 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
28733211 elems = [],
28743212 selectors = [],
2875 - events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
 3213+ events = jQuery._data( this, "events" );
28763214
2877 - if ( typeof events === "function" ) {
2878 - events = events.events;
 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;
28793218 }
28803219
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 -
28863220 if ( event.namespace ) {
28873221 namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
28883222 }
@@ -2909,7 +3243,7 @@
29103244 for ( j = 0; j < live.length; j++ ) {
29113245 handleObj = live[j];
29123246
2913 - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
 3247+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
29143248 elem = close.elem;
29153249 related = null;
29163250
@@ -2979,27 +3313,10 @@
29803314 }
29813315 });
29823316
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 -}
29993317
3000 -
30013318 /*!
3002 - * Sizzle CSS Selector Engine - v1.0
3003 - * Copyright 2009, The Dojo Foundation
 3319+ * Sizzle CSS Selector Engine
 3320+ * Copyright 2011, The Dojo Foundation
30043321 * Released under the MIT, BSD, and GPL Licenses.
30053322 * More information: http://sizzlejs.com/
30063323 */
@@ -3009,7 +3326,9 @@
30103327 done = 0,
30113328 toString = Object.prototype.toString,
30123329 hasDuplicate = false,
3013 - baseHasDuplicate = true;
 3330+ baseHasDuplicate = true,
 3331+ rBackslash = /\\/g,
 3332+ rNonWord = /\W/;
30143333
30153334 // Here we check if the JavaScript engine is using some sort of
30163335 // optimization where it does not always call our comparision
@@ -3208,7 +3527,7 @@
32093528 match.splice( 1, 1 );
32103529
32113530 if ( left.substr( left.length - 1 ) !== "\\" ) {
3212 - match[1] = (match[1] || "").replace(/\\/g, "");
 3531+ match[1] = (match[1] || "").replace( rBackslash, "" );
32133532 set = Expr.find[ type ]( match, context, isXML );
32143533
32153534 if ( set != null ) {
@@ -3220,7 +3539,9 @@
32213540 }
32223541
32233542 if ( !set ) {
3224 - set = context.getElementsByTagName( "*" );
 3543+ set = typeof context.getElementsByTagName !== "undefined" ?
 3544+ context.getElementsByTagName( "*" ) :
 3545+ [];
32253546 }
32263547
32273548 return { set: set, expr: expr };
@@ -3328,9 +3649,9 @@
33293650 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
33303651 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
33313652 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
3332 - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
 3653+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
33333654 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
3334 - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
 3655+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
33353656 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
33363657 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
33373658 },
@@ -3345,13 +3666,16 @@
33463667 attrHandle: {
33473668 href: function( elem ) {
33483669 return elem.getAttribute( "href" );
 3670+ },
 3671+ type: function( elem ) {
 3672+ return elem.getAttribute( "type" );
33493673 }
33503674 },
33513675
33523676 relative: {
33533677 "+": function(checkSet, part){
33543678 var isPartStr = typeof part === "string",
3355 - isTag = isPartStr && !/\W/.test( part ),
 3679+ isTag = isPartStr && !rNonWord.test( part ),
33563680 isPartStrNotTag = isPartStr && !isTag;
33573681
33583682 if ( isTag ) {
@@ -3379,7 +3703,7 @@
33803704 i = 0,
33813705 l = checkSet.length;
33823706
3383 - if ( isPartStr && !/\W/.test( part ) ) {
 3707+ if ( isPartStr && !rNonWord.test( part ) ) {
33843708 part = part.toLowerCase();
33853709
33863710 for ( ; i < l; i++ ) {
@@ -3413,7 +3737,7 @@
34143738 doneName = done++,
34153739 checkFn = dirCheck;
34163740
3417 - if ( typeof part === "string" && !/\W/.test(part) ) {
 3741+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
34183742 part = part.toLowerCase();
34193743 nodeCheck = part;
34203744 checkFn = dirNodeCheck;
@@ -3427,7 +3751,7 @@
34283752 doneName = done++,
34293753 checkFn = dirCheck;
34303754
3431 - if ( typeof part === "string" && !/\W/.test( part ) ) {
 3755+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
34323756 part = part.toLowerCase();
34333757 nodeCheck = part;
34343758 checkFn = dirNodeCheck;
@@ -3463,12 +3787,14 @@
34643788 },
34653789
34663790 TAG: function( match, context ) {
3467 - return context.getElementsByTagName( match[1] );
 3791+ if ( typeof context.getElementsByTagName !== "undefined" ) {
 3792+ return context.getElementsByTagName( match[1] );
 3793+ }
34683794 }
34693795 },
34703796 preFilter: {
34713797 CLASS: function( match, curLoop, inplace, result, not, isXML ) {
3472 - match = " " + match[1].replace(/\\/g, "") + " ";
 3798+ match = " " + match[1].replace( rBackslash, "" ) + " ";
34733799
34743800 if ( isXML ) {
34753801 return match;
@@ -3476,7 +3802,7 @@
34773803
34783804 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
34793805 if ( elem ) {
3480 - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
 3806+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
34813807 if ( !inplace ) {
34823808 result.push( elem );
34833809 }
@@ -3491,17 +3817,23 @@
34923818 },
34933819
34943820 ID: function( match ) {
3495 - return match[1].replace(/\\/g, "");
 3821+ return match[1].replace( rBackslash, "" );
34963822 },
34973823
34983824 TAG: function( match, curLoop ) {
3499 - return match[1].toLowerCase();
 3825+ return match[1].replace( rBackslash, "" ).toLowerCase();
35003826 },
35013827
35023828 CHILD: function( match ) {
35033829 if ( match[1] === "nth" ) {
 3830+ if ( !match[2] ) {
 3831+ Sizzle.error( match[0] );
 3832+ }
 3833+
 3834+ match[2] = match[2].replace(/^\+|\s*/g, '');
 3835+
35043836 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
3505 - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
 3837+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
35063838 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
35073839 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
35083840
@@ -3509,6 +3841,9 @@
35103842 match[2] = (test[1] + (test[2] || 1)) - 0;
35113843 match[3] = test[3] - 0;
35123844 }
 3845+ else if ( match[2] ) {
 3846+ Sizzle.error( match[0] );
 3847+ }
35133848
35143849 // TODO: Move to normal caching system
35153850 match[0] = done++;
@@ -3517,12 +3852,15 @@
35183853 },
35193854
35203855 ATTR: function( match, curLoop, inplace, result, not, isXML ) {
3521 - var name = match[1].replace(/\\/g, "");
 3856+ var name = match[1] = match[1].replace( rBackslash, "" );
35223857
35233858 if ( !isXML && Expr.attrMap[name] ) {
35243859 match[1] = Expr.attrMap[name];
35253860 }
35263861
 3862+ // Handle if an un-quoted value was used
 3863+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
 3864+
35273865 if ( match[2] === "~=" ) {
35283866 match[4] = " " + match[4] + " ";
35293867 }
@@ -3576,7 +3914,9 @@
35773915 selected: function( elem ) {
35783916 // Accessing this property makes selected-by-default
35793917 // options in Safari work properly
3580 - elem.parentNode.selectedIndex;
 3918+ if ( elem.parentNode ) {
 3919+ elem.parentNode.selectedIndex;
 3920+ }
35813921
35823922 return elem.selected === true;
35833923 },
@@ -3598,8 +3938,12 @@
35993939 },
36003940
36013941 text: function( elem ) {
3602 - return "text" === elem.type;
 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 );
36033946 },
 3947+
36043948 radio: function( elem ) {
36053949 return "radio" === elem.type;
36063950 },
@@ -3691,7 +4035,7 @@
36924036 return true;
36934037
36944038 } else {
3695 - Sizzle.error( "Syntax error, unrecognized expression: " + name );
 4039+ Sizzle.error( name );
36964040 }
36974041 },
36984042
@@ -4081,13 +4425,47 @@
40824426 Sizzle = function( query, context, extra, seed ) {
40834427 context = context || document;
40844428
4085 - // Make sure that attribute selectors are quoted
4086 - query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
4087 -
40884429 // Only use querySelectorAll on non-XML documents
40894430 // (ID selectors don't work in non-HTML documents)
40904431 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+
40914446 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+
40924470 try {
40934471 return makeArray( context.querySelectorAll(query), extra );
40944472 } catch(qsaError) {}
@@ -4097,20 +4475,30 @@
40984476 // and working up from there (Thanks to Andrew Dupont for the technique)
40994477 // IE 8 doesn't work on object elements
41004478 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
4101 - var old = context.getAttribute( "id" ),
4102 - nid = old || id;
 4479+ var oldContext = context,
 4480+ old = context.getAttribute( "id" ),
 4481+ nid = old || id,
 4482+ hasParent = context.parentNode,
 4483+ relativeHierarchySelector = /^\s*[+~]/.test( query );
41034484
41044485 if ( !old ) {
41054486 context.setAttribute( "id", nid );
 4487+ } else {
 4488+ nid = nid.replace( /'/g, "\\$&" );
41064489 }
 4490+ if ( relativeHierarchySelector && hasParent ) {
 4491+ context = context.parentNode;
 4492+ }
41074493
41084494 try {
4109 - return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
 4495+ if ( !relativeHierarchySelector || hasParent ) {
 4496+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
 4497+ }
41104498
41114499 } catch(pseudoError) {
41124500 } finally {
41134501 if ( !old ) {
4114 - context.removeAttribute( "id" );
 4502+ oldContext.removeAttribute( "id" );
41154503 }
41164504 }
41174505 }
@@ -4130,19 +4518,23 @@
41314519
41324520 (function(){
41334521 var html = document.documentElement,
4134 - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
4135 - pseudoWorks = false;
 4522+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
41364523
4137 - try {
4138 - // This should fail with an exception
4139 - // Gecko does not error, returns false instead
4140 - matches.call( document.documentElement, "[test!='']:sizzle" );
 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" );
41414534
4142 - } catch( pseudoError ) {
4143 - pseudoWorks = true;
4144 - }
 4535+ } catch( pseudoError ) {
 4536+ pseudoWorks = true;
 4537+ }
41454538
4146 - if ( matches ) {
41474539 Sizzle.matchesSelector = function( node, expr ) {
41484540 // Make sure that attribute selectors are quoted
41494541 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
@@ -4150,7 +4542,15 @@
41514543 if ( !Sizzle.isXML( node ) ) {
41524544 try {
41534545 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4154 - return matches.call( node, 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+ }
41554555 }
41564556 } catch(e) {}
41574557 }
@@ -4328,7 +4728,14 @@
43294729 rmultiselector = /,/,
43304730 isSimple = /^.[^:#\[\.,]*$/,
43314731 slice = Array.prototype.slice,
4332 - POS = jQuery.expr.match.POS;
 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+ };
43334740
43344741 jQuery.fn.extend({
43354742 find: function( selector ) {
@@ -4373,7 +4780,7 @@
43744781 filter: function( selector ) {
43754782 return this.pushStack( winnow(this, selector, true), "filter", selector );
43764783 },
4377 -
 4784+
43784785 is: function( selector ) {
43794786 return !!selector && jQuery.filter( selector, this ).length > 0;
43804787 },
@@ -4391,7 +4798,7 @@
43924799 selector = selectors[i];
43934800
43944801 if ( !matches[selector] ) {
4395 - matches[selector] = jQuery.expr.match.POS.test( selector ) ?
 4802+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
43964803 jQuery( selector, context || this.context ) :
43974804 selector;
43984805 }
@@ -4414,7 +4821,7 @@
44154822 return ret;
44164823 }
44174824
4418 - var pos = POS.test( selectors ) ?
 4825+ var pos = POS.test( selectors ) ?
44194826 jQuery( selectors, context || this.context ) : null;
44204827
44214828 for ( i = 0, l = this.length; i < l; i++ ) {
@@ -4435,10 +4842,10 @@
44364843 }
44374844
44384845 ret = ret.length > 1 ? jQuery.unique(ret) : ret;
4439 -
 4846+
44404847 return this.pushStack( ret, "closest", selectors );
44414848 },
4442 -
 4849+
44434850 // Determine the position of an element within
44444851 // the matched set of elements
44454852 index: function( elem ) {
@@ -4456,7 +4863,7 @@
44574864
44584865 add: function( selector, context ) {
44594866 var set = typeof selector === "string" ?
4460 - jQuery( selector, context || this.context ) :
 4867+ jQuery( selector, context ) :
44614868 jQuery.makeArray( selector ),
44624869 all = jQuery.merge( this.get(), set );
44634870
@@ -4518,8 +4925,13 @@
45194926 }
45204927 }, function( name, fn ) {
45214928 jQuery.fn[ name ] = function( until, selector ) {
4522 - var ret = jQuery.map( this, fn, until );
4523 -
 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+
45244936 if ( !runtil.test( name ) ) {
45254937 selector = until;
45264938 }
@@ -4528,13 +4940,13 @@
45294941 ret = jQuery.filter( selector, ret );
45304942 }
45314943
4532 - ret = this.length > 1 ? jQuery.unique( ret ) : ret;
 4944+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
45334945
45344946 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
45354947 ret = ret.reverse();
45364948 }
45374949
4538 - return this.pushStack( ret, name, slice.call(arguments).join(",") );
 4950+ return this.pushStack( ret, name, args.join(",") );
45394951 };
45404952 });
45414953
@@ -4548,7 +4960,7 @@
45494961 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
45504962 jQuery.find.matches(expr, elems);
45514963 },
4552 -
 4964+
45534965 dir: function( elem, dir, until ) {
45544966 var matched = [],
45554967 cur = elem[ dir ];
@@ -4628,9 +5040,8 @@
46295041 rtbody = /<tbody/i,
46305042 rhtml = /<|&#?\w+;/,
46315043 rnocache = /<(?:script|object|embed|option|style)/i,
4632 - // checked="checked" or checked (html5)
 5044+ // checked="checked" or checked
46335045 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
4634 - raction = /\=([^="'>\s]+\/)>/g,
46355046 wrapMap = {
46365047 option: [ 1, "<select multiple='multiple'>", "</select>" ],
46375048 legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -4770,7 +5181,7 @@
47715182 return set;
47725183 }
47735184 },
4774 -
 5185+
47755186 // keepData is for internal use only--do not document
47765187 remove: function( selector, keepData ) {
47775188 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
@@ -4781,11 +5192,11 @@
47825193 }
47835194
47845195 if ( elem.parentNode ) {
4785 - elem.parentNode.removeChild( elem );
 5196+ elem.parentNode.removeChild( elem );
47865197 }
47875198 }
47885199 }
4789 -
 5200+
47905201 return this;
47915202 },
47925203
@@ -4801,48 +5212,17 @@
48025213 elem.removeChild( elem.firstChild );
48035214 }
48045215 }
4805 -
 5216+
48065217 return this;
48075218 },
48085219
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;
 5220+ clone: function( dataAndEvents, deepDataAndEvents ) {
 5221+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
 5222+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
48235223
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 - }
 5224+ return this.map( function () {
 5225+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
48375226 });
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;
48475227 },
48485228
48495229 html: function( value ) {
@@ -4914,7 +5294,9 @@
49155295 }
49165296 });
49175297 } else {
4918 - return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
 5298+ return this.length ?
 5299+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
 5300+ this;
49195301 }
49205302 },
49215303
@@ -4952,9 +5334,9 @@
49535335 } else {
49545336 results = jQuery.buildFragment( args, this, scripts );
49555337 }
4956 -
 5338+
49575339 fragment = results.fragment;
4958 -
 5340+
49595341 if ( fragment.childNodes.length === 1 ) {
49605342 first = fragment = fragment.firstChild;
49615343 } else {
@@ -4964,13 +5346,20 @@
49655347 if ( first ) {
49665348 table = table && jQuery.nodeName( first, "tr" );
49675349
4968 - for ( var i = 0, l = this.length; i < l; i++ ) {
 5350+ for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
49695351 callback.call(
49705352 table ?
49715353 root(this[i], first) :
49725354 this[i],
4973 - i > 0 || results.cacheable || this.length > 1 ?
4974 - fragment.cloneNode(true) :
 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 ) :
49755364 fragment
49765365 );
49775366 }
@@ -4992,41 +5381,97 @@
49935382 elem;
49945383 }
49955384
4996 -function cloneCopyEvent(orig, ret) {
4997 - var i = 0;
 5385+function cloneCopyEvent( src, dest ) {
49985386
4999 - ret.each(function() {
5000 - if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
5001 - return;
5002 - }
 5387+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
 5388+ return;
 5389+ }
50035390
5004 - var oldData = jQuery.data( orig[i++] ),
5005 - curData = jQuery.data( this, oldData ),
5006 - events = oldData && oldData.events;
 5391+ var internalKey = jQuery.expando,
 5392+ oldData = jQuery.data( src ),
 5393+ curData = jQuery.data( dest, oldData );
50075394
 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+
50085401 if ( events ) {
50095402 delete curData.handle;
50105403 curData.events = {};
50115404
50125405 for ( var type in events ) {
5013 - for ( var handler in events[ type ] ) {
5014 - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
 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 );
50155408 }
50165409 }
50175410 }
5018 - });
 5411+ }
50195412 }
50205413
 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+
50215466 jQuery.buildFragment = function( args, nodes, scripts ) {
50225467 var fragment, cacheable, cacheresults,
50235468 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
50245469
5025 - // Only cache "small" (1/2 KB) strings that are associated with the main document
 5470+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
50265471 // Cloning options loses the selected state, so don't cache them
50275472 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
50285473 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
50295474 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
5030 - !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
 5475+ args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
50315476
50325477 cacheable = true;
50335478 cacheresults = jQuery.fragments[ args[0] ];
@@ -5062,24 +5507,82 @@
50635508 var ret = [],
50645509 insert = jQuery( selector ),
50655510 parent = this.length === 1 && this[0].parentNode;
5066 -
 5511+
50675512 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
50685513 insert[ original ]( this[0] );
50695514 return this;
5070 -
 5515+
50715516 } else {
50725517 for ( var i = 0, l = insert.length; i < l; i++ ) {
50735518 var elems = (i > 0 ? this.clone(true) : this).get();
50745519 jQuery( insert[i] )[ original ]( elems );
50755520 ret = ret.concat( elems );
50765521 }
5077 -
 5522+
50785523 return this.pushStack( ret, name, insert.selector );
50795524 }
50805525 };
50815526 });
50825527
 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+
50835540 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+},
50845587 clean: function( elems, context, fragment, scripts ) {
50855588 context = context || document;
50865589
@@ -5161,7 +5664,7 @@
51625665 for ( i = 0; ret[i]; i++ ) {
51635666 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
51645667 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
5165 -
 5668+
51665669 } else {
51675670 if ( ret[i].nodeType === 1 ) {
51685671 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
@@ -5173,40 +5676,45 @@
51745677
51755678 return ret;
51765679 },
5177 -
 5680+
51785681 cleanData: function( elems ) {
5179 - var data, id, cache = jQuery.cache,
5180 - special = jQuery.event.special,
 5682+ var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
51815683 deleteExpando = jQuery.support.deleteExpando;
5182 -
 5684+
51835685 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
51845686 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
51855687 continue;
51865688 }
51875689
51885690 id = elem[ jQuery.expando ];
5189 -
 5691+
51905692 if ( id ) {
5191 - data = cache[ id ];
5192 -
 5693+ data = cache[ id ] && cache[ id ][ internalKey ];
 5694+
51935695 if ( data && data.events ) {
51945696 for ( var type in data.events ) {
51955697 if ( special[ type ] ) {
51965698 jQuery.event.remove( elem, type );
51975699
 5700+ // This is a shortcut to avoid jQuery.event.remove's overhead
51985701 } else {
51995702 jQuery.removeEvent( elem, type, data.handle );
52005703 }
52015704 }
 5705+
 5706+ // Null the DOM reference to avoid IE6/7/8 leak (#7054)
 5707+ if ( data.handle ) {
 5708+ data.handle.elem = null;
 5709+ }
52025710 }
5203 -
 5711+
52045712 if ( deleteExpando ) {
52055713 delete elem[ jQuery.expando ];
52065714
52075715 } else if ( elem.removeAttribute ) {
52085716 elem.removeAttribute( jQuery.expando );
52095717 }
5210 -
 5718+
52115719 delete cache[ id ];
52125720 }
52135721 }
@@ -5235,7 +5743,8 @@
52365744 var ralpha = /alpha\([^)]*\)/i,
52375745 ropacity = /opacity=([^)]*)/,
52385746 rdashAlpha = /-([a-z])/ig,
5239 - rupper = /([A-Z])/g,
 5747+ // fixed for IE9, see #8346
 5748+ rupper = /([A-Z]|^ms)/g,
52405749 rnumpx = /^-?\d+(?:px)?$/i,
52415750 rnum = /^-?\d/,
52425751
@@ -5472,6 +5981,28 @@
54735982 };
54745983 }
54755984
 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+
54766007 if ( document.defaultView && document.defaultView.getComputedStyle ) {
54776008 getComputedStyle = function( elem, newName, name ) {
54786009 var ret, defaultView, computedStyle;
@@ -5495,8 +6026,9 @@
54966027
54976028 if ( document.documentElement.currentStyle ) {
54986029 currentStyle = function( elem, name ) {
5499 - var left, rsLeft,
 6030+ var left,
55006031 ret = elem.currentStyle && elem.currentStyle[ name ],
 6032+ rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
55016033 style = elem.style;
55026034
55036035 // From the awesome hack by Dean Edwards
@@ -5507,16 +6039,19 @@
55086040 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
55096041 // Remember the original values
55106042 left = style.left;
5511 - rsLeft = elem.runtimeStyle.left;
55126043
55136044 // Put in the new values to get a computed value out
5514 - elem.runtimeStyle.left = elem.currentStyle.left;
 6045+ if ( rsLeft ) {
 6046+ elem.runtimeStyle.left = elem.currentStyle.left;
 6047+ }
55156048 style.left = name === "fontSize" ? "1em" : (ret || 0);
55166049 ret = style.pixelLeft + "px";
55176050
55186051 // Revert the changed values
55196052 style.left = left;
5520 - elem.runtimeStyle.left = rsLeft;
 6053+ if ( rsLeft ) {
 6054+ elem.runtimeStyle.left = rsLeft;
 6055+ }
55216056 }
55226057
55236058 return ret === "" ? "auto" : ret;
@@ -5565,22 +6100,145 @@
55666101
55676102
55686103
5569 -var jsc = jQuery.now(),
5570 - rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
5571 - rselectTextarea = /^(?:select|textarea)/i,
 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
55726109 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):$/,
55736112 rnoContent = /^(?:GET|HEAD)$/,
5574 - rbracket = /\[\]$/,
5575 - jsre = /\=\?(&|$)/,
 6113+ rprotocol = /^\/\//,
55766114 rquery = /\?/,
 6115+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
 6116+ rselectTextarea = /^(?:select|textarea)/i,
 6117+ rspacesAjax = /\s+/,
55776118 rts = /([?&])_=[^&]*/,
5578 - rurl = /^(\w+:)?\/\/([^\/?#]+)/,
5579 - r20 = /%20/g,
5580 - rhash = /#.*$/,
 6119+ rucHeaders = /(^|\-)([a-z])/g,
 6120+ rucHeadersFunc = function( _, $1, $2 ) {
 6121+ return $1 + $2.toUpperCase();
 6122+ },
 6123+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
55816124
55826125 // Keep a copy of the old load method
5583 - _load = jQuery.fn.load;
 6126+ _load = jQuery.fn.load,
55846127
 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+
55856243 jQuery.fn.extend({
55866244 load: function( url, params, callback ) {
55876245 if ( typeof url !== "string" && _load ) {
@@ -5591,10 +6249,10 @@
55926250 return this;
55936251 }
55946252
5595 - var off = url.indexOf(" ");
 6253+ var off = url.indexOf( " " );
55966254 if ( off >= 0 ) {
5597 - var selector = url.slice(off, url.length);
5598 - url = url.slice(0, off);
 6255+ var selector = url.slice( off, url.length );
 6256+ url = url.slice( 0, off );
55996257 }
56006258
56016259 // Default to a GET request
@@ -5606,7 +6264,7 @@
56076265 if ( jQuery.isFunction( params ) ) {
56086266 // We assume that it's the callback
56096267 callback = params;
5610 - params = null;
 6268+ params = undefined;
56116269
56126270 // Otherwise, build a param string
56136271 } else if ( typeof params === "object" ) {
@@ -5623,26 +6281,34 @@
56246282 type: type,
56256283 dataType: "html",
56266284 data: params,
5627 - complete: function( res, status ) {
 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;
56286289 // If successful, inject the HTML into all the matched elements
5629 - if ( status === "success" || status === "notmodified" ) {
 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+ });
56306296 // See if a selector was specified
56316297 self.html( selector ?
56326298 // Create a dummy div to hold the results
56336299 jQuery("<div>")
56346300 // inject the contents of the document in, removing the scripts
56356301 // to avoid any 'Permission Denied' errors in IE
5636 - .append(res.responseText.replace(rscript, ""))
 6302+ .append(responseText.replace(rscript, ""))
56376303
56386304 // Locate the specified elements
56396305 .find(selector) :
56406306
56416307 // If not, just inject the full result
5642 - res.responseText );
 6308+ responseText );
56436309 }
56446310
56456311 if ( callback ) {
5646 - self.each( callback, [res.responseText, status, res] );
 6312+ self.each( callback, [ responseText, status, jqXHR ] );
56476313 }
56486314 }
56496315 });
@@ -5651,88 +6317,94 @@
56526318 },
56536319
56546320 serialize: function() {
5655 - return jQuery.param(this.serializeArray());
 6321+ return jQuery.param( this.serializeArray() );
56566322 },
56576323
56586324 serializeArray: function() {
5659 - return this.map(function() {
5660 - return this.elements ? jQuery.makeArray(this.elements) : this;
 6325+ return this.map(function(){
 6326+ return this.elements ? jQuery.makeArray( this.elements ) : this;
56616327 })
5662 - .filter(function() {
 6328+ .filter(function(){
56636329 return this.name && !this.disabled &&
5664 - (this.checked || rselectTextarea.test(this.nodeName) ||
5665 - rinput.test(this.type));
 6330+ ( this.checked || rselectTextarea.test( this.nodeName ) ||
 6331+ rinput.test( this.type ) );
56666332 })
5667 - .map(function( i, elem ) {
5668 - var val = jQuery(this).val();
 6333+ .map(function( i, elem ){
 6334+ var val = jQuery( this ).val();
56696335
56706336 return val == null ?
56716337 null :
5672 - jQuery.isArray(val) ?
5673 - jQuery.map( val, function( val, i ) {
5674 - return { name: elem.name, value: val };
 6338+ jQuery.isArray( val ) ?
 6339+ jQuery.map( val, function( val, i ){
 6340+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
56756341 }) :
5676 - { name: elem.name, value: val };
 6342+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
56776343 }).get();
56786344 }
56796345 });
56806346
56816347 // Attach a bunch of functions for handling common AJAX events
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);
 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 );
56856351 };
5686 -});
 6352+} );
56876353
5688 -jQuery.extend({
5689 - get: function( url, data, callback, type ) {
5690 - // shift arguments if data argument was omited
 6354+jQuery.each( [ "get", "post" ], function( i, method ) {
 6355+ jQuery[ method ] = function( url, data, callback, type ) {
 6356+ // shift arguments if data argument was omitted
56916357 if ( jQuery.isFunction( data ) ) {
56926358 type = type || callback;
56936359 callback = data;
5694 - data = null;
 6360+ data = undefined;
56956361 }
56966362
56976363 return jQuery.ajax({
5698 - type: "GET",
 6364+ type: method,
56996365 url: url,
57006366 data: data,
57016367 success: callback,
57026368 dataType: type
57036369 });
5704 - },
 6370+ };
 6371+} );
57056372
 6373+jQuery.extend({
 6374+
57066375 getScript: function( url, callback ) {
5707 - return jQuery.get(url, null, callback, "script");
 6376+ return jQuery.get( url, undefined, callback, "script" );
57086377 },
57096378
57106379 getJSON: function( url, data, callback ) {
5711 - return jQuery.get(url, data, callback, "json");
 6380+ return jQuery.get( url, data, callback, "json" );
57126381 },
57136382
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 = {};
 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 );
57206394 }
5721 -
5722 - return jQuery.ajax({
5723 - type: "POST",
5724 - url: url,
5725 - data: data,
5726 - success: callback,
5727 - dataType: type
5728 - });
 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;
57296404 },
57306405
5731 - ajaxSetup: function( settings ) {
5732 - jQuery.extend( jQuery.ajaxSettings, settings );
5733 - },
5734 -
57356406 ajaxSettings: {
5736 - url: location.href,
 6407+ url: ajaxLocation,
 6408+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
57376409 global: true,
57386410 type: "GET",
57396411 contentType: "application/x-www-form-urlencoded",
@@ -5741,332 +6413,428 @@
57426414 /*
57436415 timeout: 0,
57446416 data: null,
 6417+ dataType: null,
57456418 username: null,
57466419 password: null,
 6420+ cache: null,
57476421 traditional: false,
 6422+ headers: {},
57486423 */
5749 - // This function can be overriden by calling jQuery.ajaxSetup
5750 - xhr: function() {
5751 - return new window.XMLHttpRequest();
5752 - },
 6424+
57536425 accepts: {
57546426 xml: "application/xml, text/xml",
57556427 html: "text/html",
5756 - script: "text/javascript, application/javascript",
 6428+ text: "text/plain",
57576429 json: "application/json, text/javascript",
5758 - text: "text/plain",
5759 - _default: "*/*"
5760 - }
5761 - },
 6430+ "*": "*/*"
 6431+ },
57626432
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);
 6433+ contents: {
 6434+ xml: /xml/,
 6435+ html: /html/,
 6436+ json: /json/
 6437+ },
57666438
5767 - s.url = s.url.replace( rhash, "" );
 6439+ responseFields: {
 6440+ xml: "responseXML",
 6441+ text: "responseText"
 6442+ },
57686443
5769 - // Use original (not extended) context object if it was provided
5770 - s.context = origSettings && origSettings.context != null ? origSettings.context : s;
 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: {
57716448
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 );
 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
57756460 }
 6461+ },
57766462
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";
 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;
57876473 }
57886474
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++);
 6475+ // Force options to be an object
 6476+ options = options || {};
57926477
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 - }
 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 = {
57976514
5798 - s.url = s.url.replace(jsre, "=" + jsonp + "$1");
 6515+ readyState: 0,
57996516
5800 - // We need to make sure
5801 - // that a JSONP style response is executed properly
5802 - s.dataType = "script";
 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+ },
58036524
5804 - // Handle JSONP-style loading
5805 - var customJsonp = window[ jsonp ];
 6525+ // Raw string
 6526+ getAllResponseHeaders: function() {
 6527+ return state === 2 ? responseHeadersString : null;
 6528+ },
58066529
5807 - window[ jsonp ] = function( tmp ) {
5808 - if ( jQuery.isFunction( customJsonp ) ) {
5809 - customJsonp( tmp );
 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+ },
58106544
5811 - } else {
5812 - // Garbage collect
5813 - window[ jsonp ] = undefined;
 6545+ // Overrides response content-type header
 6546+ overrideMimeType: function( type ) {
 6547+ if ( !state ) {
 6548+ s.mimeType = type;
 6549+ }
 6550+ return this;
 6551+ },
58146552
5815 - try {
5816 - delete window[ jsonp ];
5817 - } catch( jsonpError ) {}
 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;
58186561 }
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 - }
58276562 };
5828 - }
58296563
5830 - if ( s.dataType === "script" && s.cache === null ) {
5831 - s.cache = false;
5832 - }
 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 ) {
58336568
5834 - if ( s.cache === false && noContent ) {
5835 - var ts = jQuery.now();
 6569+ // Called once
 6570+ if ( state === 2 ) {
 6571+ return;
 6572+ }
58366573
5837 - // try replacing _= if it is there
5838 - var ret = s.url.replace(rts, "$1_=" + ts);
 6574+ // State is "done" now
 6575+ state = 2;
58396576
5840 - // if nothing was replaced, add timestamp to the end
5841 - s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
5842 - }
 6577+ // Clear timeout if it exists
 6578+ if ( timeoutTimer ) {
 6579+ clearTimeout( timeoutTimer );
 6580+ }
58436581
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 - }
 6582+ // Dereference transport for early garbage collection
 6583+ // (no matter how long the jqXHR object will be used)
 6584+ transport = undefined;
58486585
5849 - // Watch for a new set of requests
5850 - if ( s.global && jQuery.active++ === 0 ) {
5851 - jQuery.event.trigger( "ajaxStart" );
5852 - }
 6586+ // Cache response headers
 6587+ responseHeadersString = headers || "";
58536588
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);
 6589+ // Set readyState
 6590+ jqXHR.readyState = status ? 4 : 0;
58576591
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;
 6592+ var isSuccess,
 6593+ success,
 6594+ error,
 6595+ response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
 6596+ lastModified,
 6597+ etag;
58676598
5868 - // Handle Script loading
5869 - if ( !jsonp ) {
5870 - var done = false;
 6599+ // If successful, handle type chaining
 6600+ if ( status >= 200 && status < 300 || status === 304 ) {
58716601
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 );
 6602+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
 6603+ if ( s.ifModified ) {
58796604
5880 - // Handle memory leak in IE
5881 - script.onload = script.onreadystatechange = null;
5882 - if ( head && script.parentNode ) {
5883 - head.removeChild( script );
5884 - }
 6605+ if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
 6606+ jQuery.lastModified[ ifModifiedKey ] = lastModified;
58856607 }
5886 - };
5887 - }
 6608+ if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
 6609+ jQuery.etag[ ifModifiedKey ] = etag;
 6610+ }
 6611+ }
58886612
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 );
 6613+ // If not modified
 6614+ if ( status === 304 ) {
58926615
5893 - // We handle everything using the script element injection
5894 - return undefined;
5895 - }
 6616+ statusText = "notmodified";
 6617+ isSuccess = true;
58966618
5897 - var requestDone = false;
 6619+ // If we have data
 6620+ } else {
58986621
5899 - // Create the request object
5900 - var xhr = s.xhr();
 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+ }
59016643
5902 - if ( !xhr ) {
5903 - return;
5904 - }
 6644+ // Set data for the fake xhr object
 6645+ jqXHR.status = status;
 6646+ jqXHR.statusText = statusText;
59056647
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 - }
 6648+ // Success/Error
 6649+ if ( isSuccess ) {
 6650+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
 6651+ } else {
 6652+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
 6653+ }
59136654
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);
 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 ] );
59196662 }
59206663
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 - }
 6664+ // Complete
 6665+ completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
59266666
5927 - if ( jQuery.etag[s.url] ) {
5928 - xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
 6667+ if ( fireGlobals ) {
 6668+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
 6669+ // Handle the global AJAX counter
 6670+ if ( !( --jQuery.active ) ) {
 6671+ jQuery.event.trigger( "ajaxStop" );
59296672 }
59306673 }
 6674+ }
59316675
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");
 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+ }
59366694 }
 6695+ return this;
 6696+ };
59376697
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 ) {}
 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 ] + "//" );
59436702
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 - }
 6703+ // Extract dataTypes list
 6704+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
59506705
5951 - // close opended socket
5952 - xhr.abort();
5953 - return false;
 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+ );
59546714 }
59556715
5956 - if ( s.global ) {
5957 - jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
 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 );
59586719 }
59596720
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 - }
 6721+ // Apply prefilters
 6722+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
59696723
5970 - requestDone = true;
5971 - if ( xhr ) {
5972 - xhr.onreadystatechange = jQuery.noop;
5973 - }
 6724+ // If request was aborted inside a prefiler, stop there
 6725+ if ( state === 2 ) {
 6726+ return false;
 6727+ }
59746728
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;
 6729+ // We can fire global events as of now if asked to
 6730+ fireGlobals = s.global;
59796731
5980 - status = isTimeout === "timeout" ?
5981 - "timeout" :
5982 - !jQuery.httpSuccess( xhr ) ?
5983 - "error" :
5984 - s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
5985 - "notmodified" :
5986 - "success";
 6732+ // Uppercase the type
 6733+ s.type = s.type.toUpperCase();
59876734
5988 - var errMsg;
 6735+ // Determine if request has content
 6736+ s.hasContent = !rnoContent.test( s.type );
59896737
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 - }
 6738+ // Watch for a new set of requests
 6739+ if ( fireGlobals && jQuery.active++ === 0 ) {
 6740+ jQuery.event.trigger( "ajaxStart" );
 6741+ }
60006742
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 - }
 6743+ // More options handling for requests with no content
 6744+ if ( !s.hasContent ) {
60106745
6011 - // Fire the complete handlers
6012 - if ( !jsonp ) {
6013 - jQuery.handleComplete( s, xhr, status, data );
6014 - }
 6746+ // If data is available, append data to url
 6747+ if ( s.data ) {
 6748+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
 6749+ }
60156750
6016 - if ( isTimeout === "timeout" ) {
6017 - xhr.abort();
6018 - }
 6751+ // Get ifModifiedKey before adding the anti-cache parameter
 6752+ ifModifiedKey = s.url;
60196753
6020 - // Stop memory leaks
6021 - if ( s.async ) {
6022 - xhr = null;
6023 - }
 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 : "" );
60246763 }
6025 - };
 6764+ }
60266765
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 - }
 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+ }
60386770
6039 - onreadystatechange( "abort" );
6040 - };
6041 - } catch( abortError ) {}
 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+ }
60426781
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);
 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 ] );
60516790 }
60526791
6053 - // Send the data
6054 - try {
6055 - xhr.send( noContent || s.data == null ? null : s.data );
 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;
60566797
6057 - } catch( sendError ) {
6058 - jQuery.handleError( s, xhr, null, sendError );
 6798+ }
60596799
6060 - // Fire the complete handlers
6061 - jQuery.handleComplete( s, xhr, status, data );
 6800+ // Install callbacks on deferreds
 6801+ for ( i in { success: 1, error: 1, complete: 1 } ) {
 6802+ jqXHR[ i ]( s[ i ] );
60626803 }
60636804
6064 - // firefox 1.5 doesn't fire statechange for sync requests
6065 - if ( !s.async ) {
6066 - onreadystatechange();
 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+ }
60676836 }
60686837
6069 - // return XMLHttpRequest to allow aborting the request etc.
6070 - return xhr;
 6838+ return jqXHR;
60716839 },
60726840
60736841 // Serialize an array of form elements or a set of
@@ -6075,37 +6843,37 @@
60766844 var s = [],
60776845 add = function( key, value ) {
60786846 // If value is a function, invoke it and return its value
6079 - value = jQuery.isFunction(value) ? value() : value;
6080 - s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
 6847+ value = jQuery.isFunction( value ) ? value() : value;
 6848+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
60816849 };
6082 -
 6850+
60836851 // Set traditional to true for jQuery <= 1.3.2 behavior.
60846852 if ( traditional === undefined ) {
60856853 traditional = jQuery.ajaxSettings.traditional;
60866854 }
6087 -
 6855+
60886856 // If an array was passed in, assume that it is an array of form elements.
6089 - if ( jQuery.isArray(a) || a.jquery ) {
 6857+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
60906858 // Serialize the form elements
60916859 jQuery.each( a, function() {
60926860 add( this.name, this.value );
6093 - });
6094 -
 6861+ } );
 6862+
60956863 } else {
60966864 // If traditional, encode the "old" way (the way 1.3.2 or older
60976865 // did it), otherwise encode params recursively.
60986866 for ( var prefix in a ) {
6099 - buildParams( prefix, a[prefix], traditional, add );
 6867+ buildParams( prefix, a[ prefix ], traditional, add );
61006868 }
61016869 }
61026870
61036871 // Return the resulting serialization
6104 - return s.join("&").replace(r20, "+");
 6872+ return s.join( "&" ).replace( r20, "+" );
61056873 }
61066874 });
61076875
61086876 function buildParams( prefix, obj, traditional, add ) {
6109 - if ( jQuery.isArray(obj) && obj.length ) {
 6877+ if ( jQuery.isArray( obj ) && obj.length ) {
61106878 // Serialize array item.
61116879 jQuery.each( obj, function( i, v ) {
61126880 if ( traditional || rbracket.test( prefix ) ) {
@@ -6123,18 +6891,20 @@
61246892 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
61256893 }
61266894 });
6127 -
 6895+
61286896 } else if ( !traditional && obj != null && typeof obj === "object" ) {
6129 - if ( jQuery.isEmptyObject( obj ) ) {
 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 ) ) {
61306900 add( prefix, "" );
61316901
61326902 // Serialize object item.
61336903 } else {
6134 - jQuery.each( obj, function( k, v ) {
6135 - buildParams( prefix + "[" + k + "]", v, traditional, add );
6136 - });
 6904+ for ( var name in obj ) {
 6905+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
 6906+ }
61376907 }
6138 -
 6908+
61396909 } else {
61406910 // Serialize scalar item.
61416911 add( prefix, obj );
@@ -6150,143 +6920,562 @@
61516921
61526922 // Last-Modified header cache for next request
61536923 lastModified: {},
6154 - etag: {},
 6924+ etag: {}
61556925
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 - }
 6926+});
61616927
6162 - // Fire the global callback
6163 - if ( s.global ) {
6164 - jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
6165 - }
6166 - },
 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 ) {
61676934
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 );
 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 ];
61726947 }
 6948+ }
61736949
6174 - // Fire the global callback
6175 - if ( s.global ) {
6176 - jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
 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" );
61776955 }
6178 - },
 6956+ }
61796957
6180 - handleComplete: function( s, xhr, status ) {
6181 - // Process result
6182 - if ( s.complete ) {
6183 - s.complete.call( s.context, xhr, status );
 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+ }
61846965 }
 6966+ }
61856967
6186 - // The request was completed
6187 - if ( s.global ) {
6188 - jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
 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+ }
61896981 }
 6982+ // Or just use first one
 6983+ finalDataType = finalDataType || firstDataType;
 6984+ }
61906985
6191 - // Handle the global AJAX counter
6192 - if ( s.global && jQuery.active-- === 1 ) {
6193 - jQuery.event.trigger( "ajaxStop" );
 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 );
61946992 }
6195 - },
6196 -
6197 - triggerGlobal: function( s, type, args ) {
6198 - (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
6199 - },
 6993+ return responses[ finalDataType ];
 6994+ }
 6995+}
62006996
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) {}
 6997+// Chain conversions given the request and the original response
 6998+function ajaxConvert( s, response ) {
62096999
6210 - return false;
6211 - },
 7000+ // Apply the dataFilter if provided
 7001+ if ( s.dataFilter ) {
 7002+ response = s.dataFilter( response, s.dataType );
 7003+ }
62127004
6213 - // Determines if an XMLHttpRequest returns NotModified
6214 - httpNotModified: function( xhr, url ) {
6215 - var lastModified = xhr.getResponseHeader("Last-Modified"),
6216 - etag = xhr.getResponseHeader("Etag");
 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;
62177021
6218 - if ( lastModified ) {
6219 - jQuery.lastModified[url] = lastModified;
6220 - }
 7022+ // For each dataType in the chain
 7023+ for( i = 1; i < length; i++ ) {
62217024
6222 - if ( etag ) {
6223 - jQuery.etag[url] = etag;
 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+ }
62247033 }
62257034
6226 - return xhr.status === 304;
6227 - },
 7035+ // Get the dataTypes
 7036+ prev = current;
 7037+ current = dataTypes[ i ];
62287038
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;
 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 ) {
62337044
6234 - if ( xml && data.documentElement.nodeName === "parsererror" ) {
6235 - jQuery.error( "parsererror" );
6236 - }
 7045+ // Get the converter
 7046+ conversion = prev + " " + current;
 7047+ conv = converters[ conversion ] || converters[ "* " + current ];
62377048
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 );
 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+ }
62427077 }
 7078+ }
 7079+ return response;
 7080+}
62437081
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 );
62497082
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 );
 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+ }
62537133 }
62547134 }
62557135
6256 - return data;
 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";
62577160 }
 7161+} );
62587162
 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+ }
62597180 });
62607181
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) {}
 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 );
62747268 }
 7269+ });
 7270+}
62757271
6276 - try {
6277 - return new window.ActiveXObject("Microsoft.XMLHTTP");
6278 - } catch(activeError) {}
6279 - };
 7272+// Functions to create xhrs
 7273+function createStandardXHR() {
 7274+ try {
 7275+ return new window.XMLHttpRequest();
 7276+ } catch( e ) {}
62807277 }
62817278
6282 -// Does this browser support XHR requests?
6283 -jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
 7279+function createActiveXHR() {
 7280+ try {
 7281+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );
 7282+ } catch( e ) {}
 7283+}
62847284
 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;
62857299
 7300+// Test if we can create an xhr object
 7301+testXHR = jQuery.ajaxSettings.xhr();
 7302+jQuery.support.ajax = !!testXHR;
62867303
 7304+// Does this browser support crossDomain XHR requests
 7305+jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
62877306
 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+
62887477 var elemdisplay = {},
62897478 rfxtypes = /^(?:toggle|show|hide)$/,
6290 - rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
 7479+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
62917480 timerId,
62927481 fxAttrs = [
62937482 // height animations
@@ -6311,7 +7500,7 @@
63127501
63137502 // Reset the inline display of this element to learn if it is
63147503 // being hidden by cascaded rules or not
6315 - if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
 7504+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
63167505 display = elem.style.display = "";
63177506 }
63187507
@@ -6319,7 +7508,7 @@
63207509 // in a stylesheet to whatever the default browser style is
63217510 // for such an element
63227511 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
6323 - jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
 7512+ jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
63247513 }
63257514 }
63267515
@@ -6330,7 +7519,7 @@
63317520 display = elem.style.display;
63327521
63337522 if ( display === "" || display === "none" ) {
6334 - elem.style.display = jQuery.data(elem, "olddisplay") || "";
 7523+ elem.style.display = jQuery._data(elem, "olddisplay") || "";
63357524 }
63367525 }
63377526
@@ -6346,8 +7535,8 @@
63477536 for ( var i = 0, j = this.length; i < j; i++ ) {
63487537 var display = jQuery.css( this[i], "display" );
63497538
6350 - if ( display !== "none" ) {
6351 - jQuery.data( this[i], "olddisplay", display );
 7539+ if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
 7540+ jQuery._data( this[i], "olddisplay", display );
63527541 }
63537542 }
63547543
@@ -6469,11 +7658,11 @@
64707659
64717660 } else {
64727661 var parts = rfxnum.exec(val),
6473 - start = e.cur() || 0;
 7662+ start = e.cur();
64747663
64757664 if ( parts ) {
64767665 var end = parseFloat( parts[2] ),
6477 - unit = parts[3] || "px";
 7666+ unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
64787667
64797668 // We need to compute starting value
64807669 if ( unit !== "px" ) {
@@ -6620,8 +7809,12 @@
66217810 return this.elem[ this.prop ];
66227811 }
66237812
6624 - var r = parseFloat( jQuery.css( this.elem, this.prop ) );
6625 - return r && r > -10000 ? r : 0;
 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;
66267819 },
66277820
66287821 // Start an animation from one number to another
@@ -6632,7 +7825,7 @@
66337826 this.startTime = jQuery.now();
66347827 this.start = from;
66357828 this.end = to;
6636 - this.unit = unit || this.unit || "px";
 7829+ this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
66377830 this.now = this.start;
66387831 this.pos = this.state = 0;
66397832
@@ -6815,7 +8008,7 @@
68168009 jQuery.fn.offset = function( options ) {
68178010 var elem = this[0], box;
68188011
6819 - if ( options ) {
 8012+ if ( options ) {
68208013 return this.each(function( i ) {
68218014 jQuery.offset.setOffset( this, options, i );
68228015 });
@@ -6838,15 +8031,15 @@
68398032
68408033 // Make sure we're not dealing with a disconnected DOM node
68418034 if ( !box || !jQuery.contains( docElem, elem ) ) {
6842 - return box || { top: 0, left: 0 };
 8035+ return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
68438036 }
68448037
68458038 var body = doc.body,
68468039 win = getWindow(doc),
68478040 clientTop = docElem.clientTop || body.clientTop || 0,
68488041 clientLeft = docElem.clientLeft || body.clientLeft || 0,
6849 - scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
6850 - scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
 8042+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
 8043+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
68518044 top = box.top + scrollTop - clientTop,
68528045 left = box.left + scrollLeft - clientLeft;
68538046
@@ -6857,7 +8050,7 @@
68588051 jQuery.fn.offset = function( options ) {
68598052 var elem = this[0];
68608053
6861 - if ( options ) {
 8054+ if ( options ) {
68628055 return this.each(function( i ) {
68638056 jQuery.offset.setOffset( this, options, i );
68648057 });
@@ -6959,7 +8152,6 @@
69608153 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
69618154
69628155 body.removeChild( container );
6963 - body = container = innerDiv = checkDiv = table = td = null;
69648156 jQuery.offset.initialize = jQuery.noop;
69658157 },
69668158
@@ -6976,7 +8168,7 @@
69778169
69788170 return { top: top, left: left };
69798171 },
6980 -
 8172+
69818173 setOffset: function( elem, options, i ) {
69828174 var position = jQuery.css( elem, "position" );
69838175
@@ -6989,10 +8181,10 @@
69908182 curOffset = curElem.offset(),
69918183 curCSSTop = jQuery.css( elem, "top" ),
69928184 curCSSLeft = jQuery.css( elem, "left" ),
6993 - calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
 8185+ calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1,
69948186 props = {}, curPosition = {}, curTop, curLeft;
69958187
6996 - // need to be able to calculate position if either top or left is auto and position is absolute
 8188+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
69978189 if ( calculatePosition ) {
69988190 curPosition = curElem.position();
69998191 }
@@ -7010,7 +8202,7 @@
70118203 if (options.left != null) {
70128204 props.left = (options.left - curOffset.left) + curLeft;
70138205 }
7014 -
 8206+
70158207 if ( "using" in options ) {
70168208 options.using.call( elem, props );
70178209 } else {
@@ -7070,7 +8262,7 @@
70718263
70728264 jQuery.fn[ method ] = function(val) {
70738265 var elem = this[0], win;
7074 -
 8266+
70758267 if ( !elem ) {
70768268 return null;
70778269 }
@@ -7083,7 +8275,7 @@
70848276 if ( win ) {
70858277 win.scrollTo(
70868278 !i ? val : jQuery(win).scrollLeft(),
7087 - i ? val : jQuery(win).scrollTop()
 8279+ i ? val : jQuery(win).scrollTop()
70888280 );
70898281
70908282 } else {
@@ -7138,7 +8330,7 @@
71398331 if ( !elem ) {
71408332 return size == null ? null : this;
71418333 }
7142 -
 8334+
71438335 if ( jQuery.isFunction( size ) ) {
71448336 return this.each(function( i ) {
71458337 var self = jQuery( this );
@@ -7148,8 +8340,10 @@
71498341
71508342 if ( jQuery.isWindow( elem ) ) {
71518343 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
7152 - return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
7153 - elem.document.body[ "client" + name ];
 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;
71548348
71558349 // Get document width or height
71568350 } else if ( elem.nodeType === 9 ) {
@@ -7176,4 +8370,5 @@
71778371 });
71788372
71798373
 8374+window.jQuery = window.$ = jQuery;
71808375 })(window);

Follow-up revisions

RevisionCommit summaryAuthorDate
r88680Adapt UW to account for the change in jQuery's behaviour since jQuery 1.5.2. ...krinkle20:26, 23 May 2011
r88725Reverting r88607. This downgrades jQuery from 1.5.2 back to 1.4.4....krinkle16:52, 24 May 2011
r89866Upgrade jQuery from 1.4.4 to 1.6.1...krinkle00:25, 11 June 2011

Status & tagging log