r86106 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86105‎ | r86106 | r86107 >
Date:07:28, 15 April 2011
Author:diebuche
Status:ok
Tags:
Comment:
Updating jQuery from 1.4.2->1.4.4, for better data-* support. 1.4.4 contains the patch from r74326 in core
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.js
@@ -1,5 +1,5 @@
22 /*!
3 - * jQuery JavaScript Library v1.4.2
 3+ * jQuery JavaScript Library v1.4.4
44 * http://jquery.com/
55 *
66 * Copyright 2010, John Resig
@@ -11,10 +11,14 @@
1212 * Copyright 2010, The Dojo Foundation
1313 * Released under the MIT, BSD, and GPL Licenses.
1414 *
15 - * Date: Sat Feb 13 22:33:48 2010 -0500
 15+ * Date: Thu Nov 11 19:04:53 2010 -0500
1616 */
1717 (function( window, undefined ) {
1818
 19+// Use the correct document accordingly with window argument (sandbox)
 20+var document = window.document;
 21+var jQuery = (function() {
 22+
1923 // Define a local copy of jQuery
2024 var jQuery = function( selector, context ) {
2125 // The jQuery object is actually just the init constructor 'enhanced'
@@ -27,28 +31,45 @@
2832 // Map over the $ in case of overwrite
2933 _$ = window.$,
3034
31 - // Use the correct document accordingly with window argument (sandbox)
32 - document = window.document,
33 -
3435 // A central reference to the root jQuery(document)
3536 rootjQuery,
3637
3738 // A simple way to check for HTML strings or ID strings
3839 // (both of which we optimize for)
39 - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
 40+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
4041
4142 // Is it a simple selector
4243 isSimple = /^.[^:#\[\.,]*$/,
4344
4445 // Check if a string has a non-whitespace character in it
4546 rnotwhite = /\S/,
 47+ rwhite = /\s/,
4648
4749 // Used for trimming whitespace
48 - rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
 50+ trimLeft = /^\s+/,
 51+ trimRight = /\s+$/,
4952
 53+ // Check for non-word characters
 54+ rnonword = /\W/,
 55+
 56+ // Check for digits
 57+ rdigit = /\d/,
 58+
5059 // Match a standalone tag
5160 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
5261
 62+ // JSON RegExp
 63+ rvalidchars = /^[\],:{}\s]*$/,
 64+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
 65+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
 66+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
 67+
 68+ // Useragent RegExp
 69+ rwebkit = /(webkit)[ \/]([\w.]+)/,
 70+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
 71+ rmsie = /(msie) ([\w.]+)/,
 72+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
 73+
5374 // Keep a UserAgent string for use with jQuery.browser
5475 userAgent = navigator.userAgent,
5576
@@ -66,10 +87,14 @@
6788
6889 // Save a reference to some core methods
6990 toString = Object.prototype.toString,
70 - hasOwnProperty = Object.prototype.hasOwnProperty,
 91+ hasOwn = Object.prototype.hasOwnProperty,
7192 push = Array.prototype.push,
7293 slice = Array.prototype.slice,
73 - indexOf = Array.prototype.indexOf;
 94+ trim = String.prototype.trim,
 95+ indexOf = Array.prototype.indexOf,
 96+
 97+ // [[Class]] -> type pairs
 98+ class2type = {};
7499
75100 jQuery.fn = jQuery.prototype = {
76101 init: function( selector, context ) {
@@ -88,7 +113,7 @@
89114 }
90115
91116 // The body element only exists once, optimize finding it
92 - if ( selector === "body" && !context ) {
 117+ if ( selector === "body" && !context && document.body ) {
93118 this.context = document;
94119 this[0] = document.body;
95120 this.selector = "body";
@@ -122,7 +147,7 @@
123148 }
124149
125150 } else {
126 - ret = buildFragment( [ match[1] ], [ doc ] );
 151+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
127152 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
128153 }
129154
@@ -132,7 +157,9 @@
133158 } else {
134159 elem = document.getElementById( match[2] );
135160
136 - if ( elem ) {
 161+ // Check parentNode to catch when Blackberry 4.6 returns
 162+ // nodes that are no longer in the document #6963
 163+ if ( elem && elem.parentNode ) {
137164 // Handle the case where IE and Opera return items
138165 // by name instead of ID
139166 if ( elem.id !== match[2] ) {
@@ -150,7 +177,7 @@
151178 }
152179
153180 // HANDLE: $("TAG")
154 - } else if ( !context && /^\w+$/.test( selector ) ) {
 181+ } else if ( !context && !rnonword.test( selector ) ) {
155182 this.selector = selector;
156183 this.context = document;
157184 selector = document.getElementsByTagName( selector );
@@ -184,7 +211,7 @@
185212 selector: "",
186213
187214 // The current version of jQuery being used
188 - jquery: "1.4.2",
 215+ jquery: "1.4.4",
189216
190217 // The default length of a jQuery object is 0
191218 length: 0,
@@ -303,8 +330,11 @@
304331 jQuery.fn.init.prototype = jQuery.fn;
305332
306333 jQuery.extend = jQuery.fn.extend = function() {
307 - // copy reference to target object
308 - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
 334+ var options, name, src, copy, copyIsArray, clone,
 335+ target = arguments[0] || {},
 336+ i = 1,
 337+ length = arguments.length,
 338+ deep = false;
309339
310340 // Handle a deep copy situation
311341 if ( typeof target === "boolean" ) {
@@ -338,11 +368,16 @@
339369 continue;
340370 }
341371
342 - // Recurse if we're merging object literal values or arrays
343 - if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
344 - var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
345 - : jQuery.isArray(copy) ? [] : {};
 372+ // Recurse if we're merging plain objects or arrays
 373+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
 374+ if ( copyIsArray ) {
 375+ copyIsArray = false;
 376+ clone = src && jQuery.isArray(src) ? src : [];
346377
 378+ } else {
 379+ clone = src && jQuery.isPlainObject(src) ? src : {};
 380+ }
 381+
347382 // Never move original objects, clone them
348383 target[ name ] = jQuery.extend( deep, clone, copy );
349384
@@ -371,34 +406,51 @@
372407
373408 // Is the DOM ready to be used? Set to true once it occurs.
374409 isReady: false,
 410+
 411+ // A counter to track how many items to wait for before
 412+ // the ready event fires. See #6781
 413+ readyWait: 1,
375414
376415 // Handle when the DOM is ready
377 - ready: function() {
 416+ ready: function( wait ) {
 417+ // A third-party is pushing the ready event forwards
 418+ if ( wait === true ) {
 419+ jQuery.readyWait--;
 420+ }
 421+
378422 // Make sure that the DOM is not already loaded
379 - if ( !jQuery.isReady ) {
 423+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
380424 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
381425 if ( !document.body ) {
382 - return setTimeout( jQuery.ready, 13 );
 426+ return setTimeout( jQuery.ready, 1 );
383427 }
384428
385429 // Remember that the DOM is ready
386430 jQuery.isReady = true;
387431
 432+ // If a normal DOM Ready event fired, decrement, and wait if need be
 433+ if ( wait !== true && --jQuery.readyWait > 0 ) {
 434+ return;
 435+ }
 436+
388437 // If there are functions bound, to execute
389438 if ( readyList ) {
390439 // Execute all of them
391 - var fn, i = 0;
392 - while ( (fn = readyList[ i++ ]) ) {
393 - fn.call( document, jQuery );
394 - }
 440+ var fn,
 441+ i = 0,
 442+ ready = readyList;
395443
396444 // Reset the list of functions
397445 readyList = null;
398 - }
399446
400 - // Trigger any bound ready events
401 - if ( jQuery.fn.triggerHandler ) {
402 - jQuery( document ).triggerHandler( "ready" );
 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+ }
403455 }
404456 }
405457 },
@@ -413,7 +465,8 @@
414466 // Catch cases where $(document).ready() is called after the
415467 // browser event has already occurred.
416468 if ( document.readyState === "complete" ) {
417 - return jQuery.ready();
 469+ // Handle it asynchronously to allow scripts the opportunity to delay ready
 470+ return setTimeout( jQuery.ready, 1 );
418471 }
419472
420473 // Mozilla, Opera and webkit nightlies currently support this event
@@ -451,25 +504,40 @@
452505 // Since version 1.3, DOM methods and functions like alert
453506 // aren't supported. They return false on IE (#2968).
454507 isFunction: function( obj ) {
455 - return toString.call(obj) === "[object Function]";
 508+ return jQuery.type(obj) === "function";
456509 },
457510
458 - isArray: function( obj ) {
459 - return toString.call(obj) === "[object Array]";
 511+ isArray: Array.isArray || function( obj ) {
 512+ return jQuery.type(obj) === "array";
460513 },
461514
 515+ // A crude way of determining if an object is a window
 516+ isWindow: function( obj ) {
 517+ return obj && typeof obj === "object" && "setInterval" in obj;
 518+ },
 519+
 520+ isNaN: function( obj ) {
 521+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
 522+ },
 523+
 524+ type: function( obj ) {
 525+ return obj == null ?
 526+ String( obj ) :
 527+ class2type[ toString.call(obj) ] || "object";
 528+ },
 529+
462530 isPlainObject: function( obj ) {
463531 // Must be an Object.
464532 // Because of IE, we also have to check the presence of the constructor property.
465533 // Make sure that DOM nodes and window objects don't pass through, as well
466 - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
 534+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
467535 return false;
468536 }
469537
470538 // Not own constructor property must be Object
471 - if ( obj.constructor
472 - && !hasOwnProperty.call(obj, "constructor")
473 - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
 539+ if ( obj.constructor &&
 540+ !hasOwn.call(obj, "constructor") &&
 541+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
474542 return false;
475543 }
476544
@@ -479,7 +547,7 @@
480548 var key;
481549 for ( key in obj ) {}
482550
483 - return key === undefined || hasOwnProperty.call( obj, key );
 551+ return key === undefined || hasOwn.call( obj, key );
484552 },
485553
486554 isEmptyObject: function( obj ) {
@@ -503,9 +571,9 @@
504572
505573 // Make sure the incoming data is actual JSON
506574 // Logic borrowed from http://json.org/json2.js
507 - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
508 - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
509 - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
 575+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
 576+ .replace(rvalidtokens, "]")
 577+ .replace(rvalidbraces, "")) ) {
510578
511579 // Try to use the native JSON parser first
512580 return window.JSON && window.JSON.parse ?
@@ -584,10 +652,21 @@
585653 return object;
586654 },
587655
588 - trim: function( text ) {
589 - return (text || "").replace( rtrim, "" );
590 - },
 656+ // Use native String.trim function wherever possible
 657+ trim: trim ?
 658+ function( text ) {
 659+ return text == null ?
 660+ "" :
 661+ trim.call( text );
 662+ } :
591663
 664+ // Otherwise use our own trimming functionality
 665+ function( text ) {
 666+ return text == null ?
 667+ "" :
 668+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
 669+ },
 670+
592671 // results is for internal usage only
593672 makeArray: function( array, results ) {
594673 var ret = results || [];
@@ -596,7 +675,10 @@
597676 // The window, strings (and functions) also have 'length'
598677 // The extra typeof function check is to prevent crashes
599678 // in Safari 2 (See: #3039)
600 - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
 679+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
 680+ var type = jQuery.type(array);
 681+
 682+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
601683 push.call( ret, array );
602684 } else {
603685 jQuery.merge( ret, array );
@@ -621,7 +703,8 @@
622704 },
623705
624706 merge: function( first, second ) {
625 - var i = first.length, j = 0;
 707+ var i = first.length,
 708+ j = 0;
626709
627710 if ( typeof second.length === "number" ) {
628711 for ( var l = second.length; j < l; j++ ) {
@@ -640,12 +723,14 @@
641724 },
642725
643726 grep: function( elems, callback, inv ) {
644 - var ret = [];
 727+ var ret = [], retVal;
 728+ inv = !!inv;
645729
646730 // Go through the array, only saving the items
647731 // that pass the validator function
648732 for ( var i = 0, length = elems.length; i < length; i++ ) {
649 - if ( !inv !== !callback( elems[ i ], i ) ) {
 733+ retVal = !!callback( elems[ i ], i );
 734+ if ( inv !== retVal ) {
650735 ret.push( elems[ i ] );
651736 }
652737 }
@@ -701,16 +786,49 @@
702787 return proxy;
703788 },
704789
 790+ // Mutifunctional method to get and set values to a collection
 791+ // The value/s can be optionally by executed if its a function
 792+ access: function( elems, key, value, exec, fn, pass ) {
 793+ var length = elems.length;
 794+
 795+ // Setting many attributes
 796+ if ( typeof key === "object" ) {
 797+ for ( var k in key ) {
 798+ jQuery.access( elems, k, key[k], exec, fn, value );
 799+ }
 800+ return elems;
 801+ }
 802+
 803+ // Setting one attribute
 804+ if ( value !== undefined ) {
 805+ // Optionally, function values get executed if exec is true
 806+ exec = !pass && exec && jQuery.isFunction(value);
 807+
 808+ for ( var i = 0; i < length; i++ ) {
 809+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
 810+ }
 811+
 812+ return elems;
 813+ }
 814+
 815+ // Getting an attribute
 816+ return length ? fn( elems[0], key ) : undefined;
 817+ },
 818+
 819+ now: function() {
 820+ return (new Date()).getTime();
 821+ },
 822+
705823 // Use of jQuery.browser is frowned upon.
706824 // More details: http://docs.jquery.com/Utilities/jQuery.browser
707825 uaMatch: function( ua ) {
708826 ua = ua.toLowerCase();
709827
710 - var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
711 - /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
712 - /(msie) ([\w.]+)/.exec( ua ) ||
713 - !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
714 - [];
 828+ var match = rwebkit.exec( ua ) ||
 829+ ropera.exec( ua ) ||
 830+ rmsie.exec( ua ) ||
 831+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
 832+ [];
715833
716834 return { browser: match[1] || "", version: match[2] || "0" };
717835 },
@@ -718,6 +836,11 @@
719837 browser: {}
720838 });
721839
 840+// Populate the class2type map
 841+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
 842+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
 843+});
 844+
722845 browserMatch = jQuery.uaMatch( userAgent );
723846 if ( browserMatch.browser ) {
724847 jQuery.browser[ browserMatch.browser ] = true;
@@ -735,6 +858,13 @@
736859 };
737860 }
738861
 862+// Verify that \s matches non-breaking spaces
 863+// (IE fails on this test)
 864+if ( !rwhite.test( "\xA0" ) ) {
 865+ trimLeft = /^[\s\xA0]+/;
 866+ trimRight = /[\s\xA0]+$/;
 867+}
 868+
739869 // All jQuery objects should point back to these
740870 rootjQuery = jQuery(document);
741871
@@ -765,7 +895,7 @@
766896 // If IE is used, use the trick by Diego Perini
767897 // http://javascript.nwbox.com/IEContentLoaded/
768898 document.documentElement.doScroll("left");
769 - } catch( error ) {
 899+ } catch(e) {
770900 setTimeout( doScrollCheck, 1 );
771901 return;
772902 }
@@ -774,54 +904,12 @@
775905 jQuery.ready();
776906 }
777907
778 -function evalScript( i, elem ) {
779 - if ( elem.src ) {
780 - jQuery.ajax({
781 - url: elem.src,
782 - async: false,
783 - dataType: "script"
784 - });
785 - } else {
786 - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
787 - }
 908+// Expose jQuery to the global object
 909+return (window.jQuery = window.$ = jQuery);
788910
789 - if ( elem.parentNode ) {
790 - elem.parentNode.removeChild( elem );
791 - }
792 -}
 911+})();
793912
794 -// Mutifunctional method to get and set values to a collection
795 -// The value/s can be optionally by executed if its a function
796 -function access( elems, key, value, exec, fn, pass ) {
797 - var length = elems.length;
798 -
799 - // Setting many attributes
800 - if ( typeof key === "object" ) {
801 - for ( var k in key ) {
802 - access( elems, k, key[k], exec, fn, value );
803 - }
804 - return elems;
805 - }
806 -
807 - // Setting one attribute
808 - if ( value !== undefined ) {
809 - // Optionally, function values get executed if exec is true
810 - exec = !pass && exec && jQuery.isFunction(value);
811 -
812 - for ( var i = 0; i < length; i++ ) {
813 - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
814 - }
815 -
816 - return elems;
817 - }
818 -
819 - // Getting an attribute
820 - return length ? fn( elems[0], key ) : undefined;
821 -}
822913
823 -function now() {
824 - return (new Date).getTime();
825 -}
826914 (function() {
827915
828916 jQuery.support = {};
@@ -829,13 +917,15 @@
830918 var root = document.documentElement,
831919 script = document.createElement("script"),
832920 div = document.createElement("div"),
833 - id = "script" + now();
 921+ id = "script" + jQuery.now();
834922
835923 div.style.display = "none";
836924 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
837925
838926 var all = div.getElementsByTagName("*"),
839 - a = div.getElementsByTagName("a")[0];
 927+ a = div.getElementsByTagName("a")[0],
 928+ select = document.createElement("select"),
 929+ opt = select.appendChild( document.createElement("option") );
840930
841931 // Can't get basic test support
842932 if ( !all || !all.length || !a ) {
@@ -878,18 +968,25 @@
879969
880970 // Make sure that a selected-by-default option has a working selected property.
881971 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
882 - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
 972+ optSelected: opt.selected,
883973
884 - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
885 -
886974 // Will be defined later
887975 deleteExpando: true,
 976+ optDisabled: false,
888977 checkClone: false,
889978 scriptEval: false,
890979 noCloneEvent: true,
891 - boxModel: null
 980+ boxModel: null,
 981+ inlineBlockNeedsLayout: false,
 982+ shrinkWrapBlocks: false,
 983+ reliableHiddenOffsets: true
892984 };
893985
 986+ // Make sure that the options inside disabled selects aren't marked as disabled
 987+ // (WebKit marks them as diabled)
 988+ select.disabled = true;
 989+ jQuery.support.optDisabled = !opt.disabled;
 990+
894991 script.type = "text/javascript";
895992 try {
896993 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
@@ -909,7 +1006,7 @@
9101007 // Fails in Internet Explorer
9111008 try {
9121009 delete script.test;
913 -
 1010+
9141011 } catch(e) {
9151012 jQuery.support.deleteExpando = false;
9161013 }
@@ -943,27 +1040,63 @@
9441041
9451042 document.body.appendChild( div );
9461043 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
947 - document.body.removeChild( div ).style.display = 'none';
9481044
949 - div = null;
 1045+ if ( "zoom" in div.style ) {
 1046+ // Check if natively block-level elements act like inline-block
 1047+ // elements when setting their display to 'inline' and giving
 1048+ // them layout
 1049+ // (IE < 8 does this)
 1050+ div.style.display = "inline";
 1051+ div.style.zoom = 1;
 1052+ jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
 1053+
 1054+ // Check if elements with layout shrink-wrap their children
 1055+ // (IE 6 does this)
 1056+ div.style.display = "";
 1057+ div.innerHTML = "<div style='width:4px;'></div>";
 1058+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
 1059+ }
 1060+
 1061+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
 1062+ var tds = div.getElementsByTagName("td");
 1063+
 1064+ // Check if table cells still have offsetWidth/Height when they are set
 1065+ // to display:none and there are still other visible table cells in a
 1066+ // table row; if so, offsetWidth/Height are not reliable for use when
 1067+ // determining if an element has been hidden directly using
 1068+ // display:none (it is still safe to use offsets if a parent element is
 1069+ // hidden; don safety goggles and see bug #4512 for more information).
 1070+ // (only IE 8 fails this test)
 1071+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
 1072+
 1073+ tds[0].style.display = "";
 1074+ tds[1].style.display = "none";
 1075+
 1076+ // Check if empty table cells still have offsetWidth/Height
 1077+ // (IE < 8 fail this test)
 1078+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
 1079+ div.innerHTML = "";
 1080+
 1081+ document.body.removeChild( div ).style.display = "none";
 1082+ div = tds = null;
9501083 });
9511084
9521085 // Technique from Juriy Zaytsev
9531086 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
954 - var eventSupported = function( eventName ) {
955 - var el = document.createElement("div");
956 - eventName = "on" + eventName;
 1087+ var eventSupported = function( eventName ) {
 1088+ var el = document.createElement("div");
 1089+ eventName = "on" + eventName;
9571090
958 - var isSupported = (eventName in el);
959 - if ( !isSupported ) {
960 - el.setAttribute(eventName, "return;");
961 - isSupported = typeof el[eventName] === "function";
962 - }
963 - el = null;
 1091+ var isSupported = (eventName in el);
 1092+ if ( !isSupported ) {
 1093+ el.setAttribute(eventName, "return;");
 1094+ isSupported = typeof el[eventName] === "function";
 1095+ }
 1096+ el = null;
9641097
965 - return isSupported;
 1098+ return isSupported;
9661099 };
967 -
 1100+
9681101 jQuery.support.submitBubbles = eventSupported("submit");
9691102 jQuery.support.changeBubbles = eventSupported("change");
9701103
@@ -971,35 +1104,31 @@
9721105 root = script = div = all = a = null;
9731106 })();
9741107
975 -jQuery.props = {
976 - "for": "htmlFor",
977 - "class": "className",
978 - readonly: "readOnly",
979 - maxlength: "maxLength",
980 - cellspacing: "cellSpacing",
981 - rowspan: "rowSpan",
982 - colspan: "colSpan",
983 - tabindex: "tabIndex",
984 - usemap: "useMap",
985 - frameborder: "frameBorder"
986 -};
987 -var expando = "jQuery" + now(), uuid = 0, windowData = {};
9881108
 1109+
 1110+var windowData = {},
 1111+ rbrace = /^(?:\{.*\}|\[.*\])$/;
 1112+
9891113 jQuery.extend({
9901114 cache: {},
991 -
992 - expando:expando,
9931115
 1116+ // Please use with caution
 1117+ uuid: 0,
 1118+
 1119+ // Unique for each copy of jQuery on the page
 1120+ expando: "jQuery" + jQuery.now(),
 1121+
9941122 // The following elements throw uncatchable exceptions if you
9951123 // attempt to add expando properties to them.
9961124 noData: {
9971125 "embed": true,
998 - "object": true,
 1126+ // Ban all objects except for Flash (which handle expandos)
 1127+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
9991128 "applet": true
10001129 },
10011130
10021131 data: function( elem, name, data ) {
1003 - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
 1132+ if ( !jQuery.acceptData( elem ) ) {
10041133 return;
10051134 }
10061135
@@ -1007,29 +1136,38 @@
10081137 windowData :
10091138 elem;
10101139
1011 - var id = elem[ expando ], cache = jQuery.cache, thisCache;
 1140+ var isNode = elem.nodeType,
 1141+ id = isNode ? elem[ jQuery.expando ] : null,
 1142+ cache = jQuery.cache, thisCache;
10121143
1013 - if ( !id && typeof name === "string" && data === undefined ) {
1014 - return null;
 1144+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
 1145+ return;
10151146 }
10161147
 1148+ // Get the data from the object directly
 1149+ if ( !isNode ) {
 1150+ cache = elem;
 1151+
10171152 // Compute a unique ID for the element
1018 - if ( !id ) {
1019 - id = ++uuid;
 1153+ } else if ( !id ) {
 1154+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
10201155 }
10211156
10221157 // Avoid generating a new cache unless none exists and we
10231158 // want to manipulate it.
10241159 if ( typeof name === "object" ) {
1025 - elem[ expando ] = id;
1026 - thisCache = cache[ id ] = jQuery.extend(true, {}, name);
 1160+ if ( isNode ) {
 1161+ cache[ id ] = jQuery.extend(cache[ id ], name);
10271162
1028 - } else if ( !cache[ id ] ) {
1029 - elem[ expando ] = id;
 1163+ } else {
 1164+ jQuery.extend( cache, name );
 1165+ }
 1166+
 1167+ } else if ( isNode && !cache[ id ] ) {
10301168 cache[ id ] = {};
10311169 }
10321170
1033 - thisCache = cache[ id ];
 1171+ thisCache = isNode ? cache[ id ] : cache;
10341172
10351173 // Prevent overriding the named cache with undefined values
10361174 if ( data !== undefined ) {
@@ -1040,7 +1178,7 @@
10411179 },
10421180
10431181 removeData: function( elem, name ) {
1044 - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
 1182+ if ( !jQuery.acceptData( elem ) ) {
10451183 return;
10461184 }
10471185
@@ -1048,7 +1186,10 @@
10491187 windowData :
10501188 elem;
10511189
1052 - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
 1190+ var isNode = elem.nodeType,
 1191+ id = isNode ? elem[ jQuery.expando ] : elem,
 1192+ cache = jQuery.cache,
 1193+ thisCache = isNode ? cache[ id ] : id;
10531194
10541195 // If we want to remove a specific section of the element's data
10551196 if ( name ) {
@@ -1057,31 +1198,67 @@
10581199 delete thisCache[ name ];
10591200
10601201 // If we've removed all the data, remove the element's cache
1061 - if ( jQuery.isEmptyObject(thisCache) ) {
 1202+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
10621203 jQuery.removeData( elem );
10631204 }
10641205 }
10651206
10661207 // Otherwise, we want to remove all of the element's data
10671208 } else {
1068 - if ( jQuery.support.deleteExpando ) {
 1209+ if ( isNode && jQuery.support.deleteExpando ) {
10691210 delete elem[ jQuery.expando ];
10701211
10711212 } else if ( elem.removeAttribute ) {
10721213 elem.removeAttribute( jQuery.expando );
1073 - }
10741214
10751215 // Completely remove the data cache
1076 - delete cache[ id ];
 1216+ } else if ( isNode ) {
 1217+ delete cache[ id ];
 1218+
 1219+ // Remove all fields from the object
 1220+ } else {
 1221+ for ( var n in elem ) {
 1222+ delete elem[ n ];
 1223+ }
 1224+ }
10771225 }
 1226+ },
 1227+
 1228+ // A method for determining if a DOM node can handle the data expando
 1229+ acceptData: function( elem ) {
 1230+ if ( elem.nodeName ) {
 1231+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
 1232+
 1233+ if ( match ) {
 1234+ return !(match === true || elem.getAttribute("classid") !== match);
 1235+ }
 1236+ }
 1237+
 1238+ return true;
10781239 }
10791240 });
10801241
10811242 jQuery.fn.extend({
10821243 data: function( key, value ) {
1083 - if ( typeof key === "undefined" && this.length ) {
1084 - return jQuery.data( this[0] );
 1244+ var data = null;
10851245
 1246+ if ( typeof key === "undefined" ) {
 1247+ if ( this.length ) {
 1248+ var attr = this[0].attributes, name;
 1249+ data = jQuery.data( this[0] );
 1250+
 1251+ for ( var i = 0, l = attr.length; i < l; i++ ) {
 1252+ name = attr[i].name;
 1253+
 1254+ if ( name.indexOf( "data-" ) === 0 ) {
 1255+ name = name.substr( 5 );
 1256+ dataAttr( this[0], name, data[ name ] );
 1257+ }
 1258+ }
 1259+ }
 1260+
 1261+ return data;
 1262+
10861263 } else if ( typeof key === "object" ) {
10871264 return this.each(function() {
10881265 jQuery.data( this, key );
@@ -1092,17 +1269,26 @@
10931270 parts[1] = parts[1] ? "." + parts[1] : "";
10941271
10951272 if ( value === undefined ) {
1096 - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
 1273+ data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
10971274
 1275+ // Try to fetch any internally stored data first
10981276 if ( data === undefined && this.length ) {
10991277 data = jQuery.data( this[0], key );
 1278+ data = dataAttr( this[0], key, data );
11001279 }
 1280+
11011281 return data === undefined && parts[1] ?
11021282 this.data( parts[0] ) :
11031283 data;
 1284+
11041285 } else {
1105 - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
 1286+ return this.each(function() {
 1287+ var $this = jQuery( this ),
 1288+ args = [ parts[0], value ];
 1289+
 1290+ $this.triggerHandler( "setData" + parts[1] + "!", args );
11061291 jQuery.data( this, key, value );
 1292+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
11071293 });
11081294 }
11091295 },
@@ -1113,6 +1299,37 @@
11141300 });
11151301 }
11161302 });
 1303+
 1304+function dataAttr( elem, key, data ) {
 1305+ // If nothing was found internally, try to fetch any
 1306+ // data from the HTML5 data-* attribute
 1307+ if ( data === undefined && elem.nodeType === 1 ) {
 1308+ data = elem.getAttribute( "data-" + key );
 1309+
 1310+ if ( typeof data === "string" ) {
 1311+ try {
 1312+ data = data === "true" ? true :
 1313+ data === "false" ? false :
 1314+ data === "null" ? null :
 1315+ !jQuery.isNaN( data ) ? parseFloat( data ) :
 1316+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
 1317+ data;
 1318+ } catch( e ) {}
 1319+
 1320+ // Make sure we set the data so it isn't changed later
 1321+ jQuery.data( elem, key, data );
 1322+
 1323+ } else {
 1324+ data = undefined;
 1325+ }
 1326+ }
 1327+
 1328+ return data;
 1329+}
 1330+
 1331+
 1332+
 1333+
11171334 jQuery.extend({
11181335 queue: function( elem, type, data ) {
11191336 if ( !elem ) {
@@ -1140,7 +1357,8 @@
11411358 dequeue: function( elem, type ) {
11421359 type = type || "fx";
11431360
1144 - var queue = jQuery.queue( elem, type ), fn = queue.shift();
 1361+ var queue = jQuery.queue( elem, type ),
 1362+ fn = queue.shift();
11451363
11461364 // If the fx queue is dequeued, always remove the progress sentinel
11471365 if ( fn === "inprogress" ) {
@@ -1171,7 +1389,7 @@
11721390 if ( data === undefined ) {
11731391 return jQuery.queue( this[0], type );
11741392 }
1175 - return this.each(function( i, elem ) {
 1393+ return this.each(function( i ) {
11761394 var queue = jQuery.queue( this, type, data );
11771395
11781396 if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -1203,18 +1421,35 @@
12041422 return this.queue( type || "fx", [] );
12051423 }
12061424 });
 1425+
 1426+
 1427+
 1428+
12071429 var rclass = /[\n\t]/g,
1208 - rspace = /\s+/,
 1430+ rspaces = /\s+/,
12091431 rreturn = /\r/g,
1210 - rspecialurl = /href|src|style/,
1211 - rtype = /(button|input)/i,
1212 - rfocusable = /(button|input|object|select|textarea)/i,
1213 - rclickable = /^(a|area)$/i,
1214 - rradiocheck = /radio|checkbox/;
 1432+ rspecialurl = /^(?:href|src|style)$/,
 1433+ rtype = /^(?:button|input)$/i,
 1434+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
 1435+ rclickable = /^a(?:rea)?$/i,
 1436+ rradiocheck = /^(?:radio|checkbox)$/i;
12151437
 1438+jQuery.props = {
 1439+ "for": "htmlFor",
 1440+ "class": "className",
 1441+ readonly: "readOnly",
 1442+ maxlength: "maxLength",
 1443+ cellspacing: "cellSpacing",
 1444+ rowspan: "rowSpan",
 1445+ colspan: "colSpan",
 1446+ tabindex: "tabIndex",
 1447+ usemap: "useMap",
 1448+ frameborder: "frameBorder"
 1449+};
 1450+
12161451 jQuery.fn.extend({
12171452 attr: function( name, value ) {
1218 - return access( this, name, value, true, jQuery.attr );
 1453+ return jQuery.access( this, name, value, true, jQuery.attr );
12191454 },
12201455
12211456 removeAttr: function( name, fn ) {
@@ -1235,7 +1470,7 @@
12361471 }
12371472
12381473 if ( value && typeof value === "string" ) {
1239 - var classNames = (value || "").split( rspace );
 1474+ var classNames = (value || "").split( rspaces );
12401475
12411476 for ( var i = 0, l = this.length; i < l; i++ ) {
12421477 var elem = this[i];
@@ -1245,7 +1480,9 @@
12461481 elem.className = value;
12471482
12481483 } else {
1249 - var className = " " + elem.className + " ", setClass = elem.className;
 1484+ var className = " " + elem.className + " ",
 1485+ setClass = elem.className;
 1486+
12501487 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
12511488 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
12521489 setClass += " " + classNames[c];
@@ -1269,7 +1506,7 @@
12701507 }
12711508
12721509 if ( (value && typeof value === "string") || value === undefined ) {
1273 - var classNames = (value || "").split(rspace);
 1510+ var classNames = (value || "").split( rspaces );
12741511
12751512 for ( var i = 0, l = this.length; i < l; i++ ) {
12761513 var elem = this[i];
@@ -1293,7 +1530,8 @@
12941531 },
12951532
12961533 toggleClass: function( value, stateVal ) {
1297 - var type = typeof value, isBool = typeof stateVal === "boolean";
 1534+ var type = typeof value,
 1535+ isBool = typeof stateVal === "boolean";
12981536
12991537 if ( jQuery.isFunction( value ) ) {
13001538 return this.each(function(i) {
@@ -1305,9 +1543,11 @@
13061544 return this.each(function() {
13071545 if ( type === "string" ) {
13081546 // toggle individual class names
1309 - var className, i = 0, self = jQuery(this),
 1547+ var className,
 1548+ i = 0,
 1549+ self = jQuery( this ),
13101550 state = stateVal,
1311 - classNames = value.split( rspace );
 1551+ classNames = value.split( rspaces );
13121552
13131553 while ( (className = classNames[ i++ ]) ) {
13141554 // check each className given, space seperated list
@@ -1339,12 +1579,15 @@
13401580 },
13411581
13421582 val: function( value ) {
1343 - if ( value === undefined ) {
 1583+ if ( !arguments.length ) {
13441584 var elem = this[0];
13451585
13461586 if ( elem ) {
13471587 if ( jQuery.nodeName( elem, "option" ) ) {
1348 - return (elem.attributes.value || {}).specified ? elem.value : elem.text;
 1588+ // attributes.value is undefined in Blackberry 4.7 but
 1589+ // uses .value. See #6932
 1590+ var val = elem.attributes.value;
 1591+ return !val || val.specified ? elem.value : elem.text;
13491592 }
13501593
13511594 // We need to handle select boxes special
@@ -1363,8 +1606,11 @@
13641607 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
13651608 var option = options[ i ];
13661609
1367 - if ( option.selected ) {
1368 - // Get the specifc value for the option
 1610+ // 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) &&
 1612+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
 1613+
 1614+ // Get the specific value for the option
13691615 value = jQuery(option).val();
13701616
13711617 // We don't need an array for one selects
@@ -1407,10 +1653,15 @@
14081654 val = value.call(this, i, self.val());
14091655 }
14101656
1411 - // Typecast each time if the value is a Function and the appended
1412 - // value is therefore different each time.
1413 - if ( typeof val === "number" ) {
 1657+ // Treat null/undefined as ""; convert numbers to string
 1658+ if ( val == null ) {
 1659+ val = "";
 1660+ } else if ( typeof val === "number" ) {
14141661 val += "";
 1662+ } else if ( jQuery.isArray(val) ) {
 1663+ val = jQuery.map(val, function (value) {
 1664+ return value == null ? "" : value + "";
 1665+ });
14151666 }
14161667
14171668 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
@@ -1463,89 +1714,103 @@
14641715 // Try to normalize/fix the name
14651716 name = notxml && jQuery.props[ name ] || name;
14661717
1467 - // Only do all the following if this is a node (faster for style)
1468 - if ( elem.nodeType === 1 ) {
1469 - // These attributes require special treatment
1470 - var special = rspecialurl.test( name );
 1718+ // These attributes require special treatment
 1719+ var special = rspecialurl.test( name );
14711720
1472 - // Safari mis-reports the default selected property of an option
1473 - // Accessing the parent's selectedIndex property fixes it
1474 - if ( name === "selected" && !jQuery.support.optSelected ) {
1475 - var parent = elem.parentNode;
1476 - if ( parent ) {
1477 - parent.selectedIndex;
1478 -
1479 - // Make sure that it also works with optgroups, see #5701
1480 - if ( parent.parentNode ) {
1481 - parent.parentNode.selectedIndex;
1482 - }
 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;
 1727+
 1728+ // Make sure that it also works with optgroups, see #5701
 1729+ if ( parent.parentNode ) {
 1730+ parent.parentNode.selectedIndex;
14831731 }
14841732 }
 1733+ }
14851734
1486 - // If applicable, access the attribute via the DOM 0 way
1487 - if ( name in elem && notxml && !special ) {
1488 - if ( set ) {
1489 - // We can't allow the type property to be changed (since it causes problems in IE)
1490 - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1491 - jQuery.error( "type property can't be changed" );
 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+ }
 1743+
 1744+ if ( value === null ) {
 1745+ if ( elem.nodeType === 1 ) {
 1746+ elem.removeAttribute( name );
14921747 }
14931748
 1749+ } else {
14941750 elem[ name ] = value;
14951751 }
 1752+ }
14961753
1497 - // browsers index elements by id/name on forms, give priority to attributes.
1498 - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
1499 - return elem.getAttributeNode( name ).nodeValue;
1500 - }
 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;
 1757+ }
15011758
1502 - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1503 - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1504 - if ( name === "tabIndex" ) {
1505 - var attributeNode = elem.getAttributeNode( "tabIndex" );
 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" );
15061763
1507 - return attributeNode && attributeNode.specified ?
1508 - attributeNode.value :
1509 - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
1510 - 0 :
1511 - undefined;
1512 - }
1513 -
1514 - return elem[ name ];
 1764+ return attributeNode && attributeNode.specified ?
 1765+ attributeNode.value :
 1766+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
 1767+ 0 :
 1768+ undefined;
15151769 }
15161770
1517 - if ( !jQuery.support.style && notxml && name === "style" ) {
1518 - if ( set ) {
1519 - elem.style.cssText = "" + value;
1520 - }
 1771+ return elem[ name ];
 1772+ }
15211773
1522 - return elem.style.cssText;
1523 - }
1524 -
 1774+ if ( !jQuery.support.style && notxml && name === "style" ) {
15251775 if ( set ) {
1526 - // convert the value to a string (all browsers do this but IE) see #1070
1527 - elem.setAttribute( name, "" + value );
 1776+ elem.style.cssText = "" + value;
15281777 }
15291778
1530 - var attr = !jQuery.support.hrefNormalized && notxml && special ?
1531 - // Some attributes require a special call on IE
1532 - elem.getAttribute( name, 2 ) :
1533 - elem.getAttribute( name );
 1779+ return elem.style.cssText;
 1780+ }
15341781
1535 - // Non-existent attributes return null, we normalize to undefined
1536 - return attr === null ? undefined : attr;
 1782+ if ( set ) {
 1783+ // convert the value to a string (all browsers do this but IE) see #1070
 1784+ elem.setAttribute( name, "" + value );
15371785 }
15381786
1539 - // elem is actually elem.style ... set the style
1540 - // Using attr for specific style information is now deprecated. Use style instead.
1541 - return jQuery.style( elem, name, value );
 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;
15421800 }
15431801 });
 1802+
 1803+
 1804+
 1805+
15441806 var rnamespaces = /\.(.*)$/,
 1807+ rformElems = /^(?:textarea|input|select)$/i,
 1808+ rperiod = /\./g,
 1809+ rspace = / /g,
 1810+ rescape = /[^\w\s.|`]/g,
15451811 fcleanup = function( nm ) {
1546 - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
1547 - return "\\" + ch;
1548 - });
1549 - };
 1812+ return nm.replace(rescape, "\\$&");
 1813+ },
 1814+ focusCounts = { focusin: 0, focusout: 0 };
15501815
15511816 /*
15521817 * A number of helper functions used for managing events.
@@ -1563,10 +1828,17 @@
15641829
15651830 // For whatever reason, IE has trouble passing the window object
15661831 // around, causing it to be cloned in the process
1567 - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
 1832+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
15681833 elem = window;
15691834 }
15701835
 1836+ if ( handler === false ) {
 1837+ handler = returnFalse;
 1838+ } else if ( !handler ) {
 1839+ // Fixes bug #7229. Fix recommended by jdalton
 1840+ return;
 1841+ }
 1842+
15711843 var handleObjIn, handleObj;
15721844
15731845 if ( handler.handler ) {
@@ -1588,9 +1860,29 @@
15891861 return;
15901862 }
15911863
1592 - var events = elemData.events = elemData.events || {},
1593 - eventHandle = elemData.handle, eventHandle;
 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 ],
 1868+ 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;
15941876
 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+
 1884+ elemData.events = events = {};
 1885+ }
 1886+
15951887 if ( !eventHandle ) {
15961888 elemData.handle = eventHandle = function() {
15971889 // Handle the second event of a trigger and when
@@ -1628,7 +1920,9 @@
16291921 }
16301922
16311923 handleObj.type = type;
1632 - handleObj.guid = handler.guid;
 1924+ if ( !handleObj.guid ) {
 1925+ handleObj.guid = handler.guid;
 1926+ }
16331927
16341928 // Get the current list of functions bound to this event
16351929 var handlers = events[ type ],
@@ -1680,13 +1974,23 @@
16811975 return;
16821976 }
16831977
1684 - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
 1978+ if ( handler === false ) {
 1979+ handler = returnFalse;
 1980+ }
 1981+
 1982+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
 1983+ eventKey = elem.nodeType ? "events" : "__events__",
16851984 elemData = jQuery.data( elem ),
1686 - events = elemData && elemData.events;
 1985+ events = elemData && elemData[ eventKey ];
16871986
16881987 if ( !elemData || !events ) {
16891988 return;
16901989 }
 1990+
 1991+ if ( typeof events === "function" ) {
 1992+ elemData = events;
 1993+ events = events.events;
 1994+ }
16911995
16921996 // types is actually an event object here
16931997 if ( types && types.type ) {
@@ -1721,7 +2025,7 @@
17222026 type = namespaces.shift();
17232027
17242028 namespace = new RegExp("(^|\\.)" +
1725 - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
 2029+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
17262030 }
17272031
17282032 eventType = events[ type ];
@@ -1731,7 +2035,7 @@
17322036 }
17332037
17342038 if ( !handler ) {
1735 - for ( var j = 0; j < eventType.length; j++ ) {
 2039+ for ( j = 0; j < eventType.length; j++ ) {
17362040 handleObj = eventType[ j ];
17372041
17382042 if ( all || namespace.test( handleObj.namespace ) ) {
@@ -1745,7 +2049,7 @@
17462050
17472051 special = jQuery.event.special[ type ] || {};
17482052
1749 - for ( var j = pos || 0; j < eventType.length; j++ ) {
 2053+ for ( j = pos || 0; j < eventType.length; j++ ) {
17502054 handleObj = eventType[ j ];
17512055
17522056 if ( handler.guid === handleObj.guid ) {
@@ -1769,7 +2073,7 @@
17702074 // remove generic event handler if no more handlers exist
17712075 if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
17722076 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
1773 - removeEvent( elem, type, elemData.handle );
 2077+ jQuery.removeEvent( elem, type, elemData.handle );
17742078 }
17752079
17762080 ret = null;
@@ -1787,7 +2091,10 @@
17882092 delete elemData.events;
17892093 delete elemData.handle;
17902094
1791 - if ( jQuery.isEmptyObject( elemData ) ) {
 2095+ if ( typeof elemData === "function" ) {
 2096+ jQuery.removeData( elem, eventKey );
 2097+
 2098+ } else if ( jQuery.isEmptyObject( elemData ) ) {
17922099 jQuery.removeData( elem );
17932100 }
17942101 }
@@ -1802,7 +2109,7 @@
18032110 if ( !bubbling ) {
18042111 event = typeof event === "object" ?
18052112 // jQuery.Event object
1806 - event[expando] ? event :
 2113+ event[ jQuery.expando ] ? event :
18072114 // Object literal
18082115 jQuery.extend( jQuery.Event(type), event ) :
18092116 // Just the event type (string)
@@ -1847,7 +2154,10 @@
18482155 event.currentTarget = elem;
18492156
18502157 // Trigger the event, it is assumed that "handle" is a function
1851 - var handle = jQuery.data( elem, "handle" );
 2158+ var handle = elem.nodeType ?
 2159+ jQuery.data( elem, "handle" ) :
 2160+ (jQuery.data( elem, "__events__" ) || {}).handle;
 2161+
18522162 if ( handle ) {
18532163 handle.apply( elem, data );
18542164 }
@@ -1859,41 +2169,44 @@
18602170 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
18612171 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
18622172 event.result = false;
 2173+ event.preventDefault();
18632174 }
18642175 }
18652176
18662177 // prevent IE from throwing an error for some elements with some event types, see #3533
1867 - } catch (e) {}
 2178+ } catch (inlineError) {}
18682179
18692180 if ( !event.isPropagationStopped() && parent ) {
18702181 jQuery.event.trigger( event, data, parent, true );
18712182
18722183 } else if ( !event.isDefaultPrevented() ) {
1873 - var target = event.target, old,
1874 - isClick = jQuery.nodeName(target, "a") && type === "click",
1875 - special = jQuery.event.special[ type ] || {};
 2184+ var old,
 2185+ target = event.target,
 2186+ targetType = type.replace( rnamespaces, "" ),
 2187+ isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
 2188+ special = jQuery.event.special[ targetType ] || {};
18762189
18772190 if ( (!special._default || special._default.call( elem, event ) === false) &&
18782191 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
18792192
18802193 try {
1881 - if ( target[ type ] ) {
 2194+ if ( target[ targetType ] ) {
18822195 // Make sure that we don't accidentally re-trigger the onFOO events
1883 - old = target[ "on" + type ];
 2196+ old = target[ "on" + targetType ];
18842197
18852198 if ( old ) {
1886 - target[ "on" + type ] = null;
 2199+ target[ "on" + targetType ] = null;
18872200 }
18882201
18892202 jQuery.event.triggered = true;
1890 - target[ type ]();
 2203+ target[ targetType ]();
18912204 }
18922205
18932206 // prevent IE from throwing an error for some elements with some event types, see #3533
1894 - } catch (e) {}
 2207+ } catch (triggerError) {}
18952208
18962209 if ( old ) {
1897 - target[ "on" + type ] = old;
 2210+ target[ "on" + targetType ] = old;
18982211 }
18992212
19002213 jQuery.event.triggered = false;
@@ -1902,9 +2215,11 @@
19032216 },
19042217
19052218 handle: function( event ) {
1906 - var all, handlers, namespaces, namespace, events;
 2219+ var all, handlers, namespaces, namespace_re, events,
 2220+ namespace_sort = [],
 2221+ args = jQuery.makeArray( arguments );
19072222
1908 - event = arguments[0] = jQuery.event.fix( event || window.event );
 2223+ event = args[0] = jQuery.event.fix( event || window.event );
19092224 event.currentTarget = this;
19102225
19112226 // Namespaced event handlers
@@ -1913,11 +2228,20 @@
19142229 if ( !all ) {
19152230 namespaces = event.type.split(".");
19162231 event.type = namespaces.shift();
1917 - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
 2232+ namespace_sort = namespaces.slice(0).sort();
 2233+ namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
19182234 }
19192235
1920 - var events = jQuery.data(this, "events"), handlers = events[ event.type ];
 2236+ event.namespace = event.namespace || namespace_sort.join(".");
19212237
 2238+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
 2239+
 2240+ if ( typeof events === "function" ) {
 2241+ events = events.events;
 2242+ }
 2243+
 2244+ handlers = (events || {})[ event.type ];
 2245+
19222246 if ( events && handlers ) {
19232247 // Clone the handlers to prevent manipulation
19242248 handlers = handlers.slice(0);
@@ -1926,14 +2250,14 @@
19272251 var handleObj = handlers[ j ];
19282252
19292253 // Filter the functions by class
1930 - if ( all || namespace.test( handleObj.namespace ) ) {
 2254+ if ( all || namespace_re.test( handleObj.namespace ) ) {
19312255 // Pass in a reference to the handler function itself
19322256 // So that we can later remove it
19332257 event.handler = handleObj.handler;
19342258 event.data = handleObj.data;
19352259 event.handleObj = handleObj;
19362260
1937 - var ret = handleObj.handler.apply( this, arguments );
 2261+ var ret = handleObj.handler.apply( this, args );
19382262
19392263 if ( ret !== undefined ) {
19402264 event.result = ret;
@@ -1953,10 +2277,10 @@
19542278 return event.result;
19552279 },
19562280
1957 - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
 2281+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
19582282
19592283 fix: function( event ) {
1960 - if ( event[ expando ] ) {
 2284+ if ( event[ jQuery.expando ] ) {
19612285 return event;
19622286 }
19632287
@@ -1972,7 +2296,8 @@
19732297
19742298 // Fix target property, if necessary
19752299 if ( !event.target ) {
1976 - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
 2300+ // Fixes #1925 where srcElement might not be defined either
 2301+ event.target = event.srcElement || document;
19772302 }
19782303
19792304 // check if target is a textnode (safari)
@@ -1987,14 +2312,16 @@
19882313
19892314 // Calculate pageX/Y if missing and clientX/Y available
19902315 if ( event.pageX == null && event.clientX != null ) {
1991 - var doc = document.documentElement, body = document.body;
 2316+ var doc = document.documentElement,
 2317+ body = document.body;
 2318+
19922319 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
19932320 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
19942321 }
19952322
19962323 // Add which for key events
1997 - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
1998 - event.which = event.charCode || event.keyCode;
 2324+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
 2325+ event.which = event.charCode != null ? event.charCode : event.keyCode;
19992326 }
20002327
20012328 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
@@ -2026,36 +2353,24 @@
20272354
20282355 live: {
20292356 add: function( handleObj ) {
2030 - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) );
 2357+ jQuery.event.add( this,
 2358+ liveConvert( handleObj.origType, handleObj.selector ),
 2359+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
20312360 },
20322361
20332362 remove: function( handleObj ) {
2034 - var remove = true,
2035 - type = handleObj.origType.replace(rnamespaces, "");
2036 -
2037 - jQuery.each( jQuery.data(this, "events").live || [], function() {
2038 - if ( type === this.origType.replace(rnamespaces, "") ) {
2039 - remove = false;
2040 - return false;
2041 - }
2042 - });
2043 -
2044 - if ( remove ) {
2045 - jQuery.event.remove( this, handleObj.origType, liveHandler );
2046 - }
 2363+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
20472364 }
2048 -
20492365 },
20502366
20512367 beforeunload: {
20522368 setup: function( data, namespaces, eventHandle ) {
20532369 // We only want to do this special case on windows
2054 - if ( this.setInterval ) {
 2370+ if ( jQuery.isWindow( this ) ) {
20552371 this.onbeforeunload = eventHandle;
20562372 }
 2373+ },
20572374
2058 - return false;
2059 - },
20602375 teardown: function( namespaces, eventHandle ) {
20612376 if ( this.onbeforeunload === eventHandle ) {
20622377 this.onbeforeunload = null;
@@ -2065,12 +2380,16 @@
20662381 }
20672382 };
20682383
2069 -var removeEvent = document.removeEventListener ?
 2384+jQuery.removeEvent = document.removeEventListener ?
20702385 function( elem, type, handle ) {
2071 - elem.removeEventListener( type, handle, false );
 2386+ if ( elem.removeEventListener ) {
 2387+ elem.removeEventListener( type, handle, false );
 2388+ }
20722389 } :
20732390 function( elem, type, handle ) {
2074 - elem.detachEvent( "on" + type, handle );
 2391+ if ( elem.detachEvent ) {
 2392+ elem.detachEvent( "on" + type, handle );
 2393+ }
20752394 };
20762395
20772396 jQuery.Event = function( src ) {
@@ -2090,10 +2409,10 @@
20912410
20922411 // timeStamp is buggy for some events on Firefox(#3843)
20932412 // So we won't rely on the native value
2094 - this.timeStamp = now();
 2413+ this.timeStamp = jQuery.now();
20952414
20962415 // Mark it as fixed
2097 - this[ expando ] = true;
 2416+ this[ jQuery.expando ] = true;
20982417 };
20992418
21002419 function returnFalse() {
@@ -2117,9 +2436,11 @@
21182437 // if preventDefault exists run it on the original event
21192438 if ( e.preventDefault ) {
21202439 e.preventDefault();
 2440+
 2441+ // otherwise set the returnValue property of the original event to false (IE)
 2442+ } else {
 2443+ e.returnValue = false;
21212444 }
2122 - // otherwise set the returnValue property of the original event to false (IE)
2123 - e.returnValue = false;
21242445 },
21252446 stopPropagation: function() {
21262447 this.isPropagationStopped = returnTrue;
@@ -2199,17 +2520,21 @@
22002521 setup: function( data, namespaces ) {
22012522 if ( this.nodeName.toLowerCase() !== "form" ) {
22022523 jQuery.event.add(this, "click.specialSubmit", function( e ) {
2203 - var elem = e.target, type = elem.type;
 2524+ var elem = e.target,
 2525+ type = elem.type;
22042526
22052527 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
 2528+ e.liveFired = undefined;
22062529 return trigger( "submit", this, arguments );
22072530 }
22082531 });
22092532
22102533 jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
2211 - var elem = e.target, type = elem.type;
 2534+ var elem = e.target,
 2535+ type = elem.type;
22122536
22132537 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
 2538+ e.liveFired = undefined;
22142539 return trigger( "submit", this, arguments );
22152540 }
22162541 });
@@ -2229,10 +2554,8 @@
22302555 // change delegation, happens here so we have bind.
22312556 if ( !jQuery.support.changeBubbles ) {
22322557
2233 - var formElems = /textarea|input|select/i,
 2558+ var changeFilters,
22342559
2235 - changeFilters,
2236 -
22372560 getVal = function( elem ) {
22382561 var type = elem.type, val = elem.value;
22392562
@@ -2256,7 +2579,7 @@
22572580 testChange = function testChange( e ) {
22582581 var elem = e.target, data, val;
22592582
2260 - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
 2583+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
22612584 return;
22622585 }
22632586
@@ -2274,6 +2597,7 @@
22752598
22762599 if ( data != null || val ) {
22772600 e.type = "change";
 2601+ e.liveFired = undefined;
22782602 return jQuery.event.trigger( e, arguments[1], elem );
22792603 }
22802604 };
@@ -2282,6 +2606,8 @@
22832607 filters: {
22842608 focusout: testChange,
22852609
 2610+ beforedeactivate: testChange,
 2611+
22862612 click: function( e ) {
22872613 var elem = e.target, type = elem.type;
22882614
@@ -2304,7 +2630,7 @@
23052631
23062632 // Beforeactivate happens also before the previous element is blurred
23072633 // with this event you can't trigger a change event, but you can store
2308 - // information/focus[in] is not needed anymore
 2634+ // information
23092635 beforeactivate: function( e ) {
23102636 var elem = e.target;
23112637 jQuery.data( elem, "_change_data", getVal(elem) );
@@ -2320,17 +2646,20 @@
23212647 jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
23222648 }
23232649
2324 - return formElems.test( this.nodeName );
 2650+ return rformElems.test( this.nodeName );
23252651 },
23262652
23272653 teardown: function( namespaces ) {
23282654 jQuery.event.remove( this, ".specialChange" );
23292655
2330 - return formElems.test( this.nodeName );
 2656+ return rformElems.test( this.nodeName );
23312657 }
23322658 };
23332659
23342660 changeFilters = jQuery.event.special.change.filters;
 2661+
 2662+ // Handle when the input is .focus()'d
 2663+ changeFilters.focus = changeFilters.beforeactivate;
23352664 }
23362665
23372666 function trigger( type, elem, args ) {
@@ -2343,17 +2672,21 @@
23442673 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
23452674 jQuery.event.special[ fix ] = {
23462675 setup: function() {
2347 - this.addEventListener( orig, handler, true );
 2676+ if ( focusCounts[fix]++ === 0 ) {
 2677+ document.addEventListener( orig, handler, true );
 2678+ }
23482679 },
23492680 teardown: function() {
2350 - this.removeEventListener( orig, handler, true );
 2681+ if ( --focusCounts[fix] === 0 ) {
 2682+ document.removeEventListener( orig, handler, true );
 2683+ }
23512684 }
23522685 };
23532686
23542687 function handler( e ) {
23552688 e = jQuery.event.fix( e );
23562689 e.type = fix;
2357 - return jQuery.event.handle.call( this, e );
 2690+ return jQuery.event.trigger( e, null, e.target );
23582691 }
23592692 });
23602693 }
@@ -2368,7 +2701,7 @@
23692702 return this;
23702703 }
23712704
2372 - if ( jQuery.isFunction( data ) ) {
 2705+ if ( jQuery.isFunction( data ) || data === false ) {
23732706 fn = data;
23742707 data = undefined;
23752708 }
@@ -2439,7 +2772,8 @@
24402773
24412774 toggle: function( fn ) {
24422775 // Save reference to arguments for access in closure
2443 - var args = arguments, i = 1;
 2776+ var args = arguments,
 2777+ i = 1;
24442778
24452779 // link all the functions, so any of them can unbind this click handler
24462780 while ( i < args.length ) {
@@ -2476,6 +2810,14 @@
24772811 var type, i = 0, match, namespaces, preType,
24782812 selector = origSelector || this.selector,
24792813 context = origSelector ? this : jQuery( this.context );
 2814+
 2815+ if ( typeof types === "object" && !types.preventDefault ) {
 2816+ for ( var key in types ) {
 2817+ context[ name ]( key, data, types[key], selector );
 2818+ }
 2819+
 2820+ return this;
 2821+ }
24802822
24812823 if ( jQuery.isFunction( data ) ) {
24822824 fn = data;
@@ -2510,30 +2852,39 @@
25112853
25122854 if ( name === "live" ) {
25132855 // bind live handler
2514 - context.each(function(){
2515 - jQuery.event.add( this, liveConvert( type, selector ),
 2856+ for ( var j = 0, l = context.length; j < l; j++ ) {
 2857+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
25162858 { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
2517 - });
 2859+ }
25182860
25192861 } else {
25202862 // unbind live handler
2521 - context.unbind( liveConvert( type, selector ), fn );
 2863+ context.unbind( "live." + liveConvert( type, selector ), fn );
25222864 }
25232865 }
25242866
25252867 return this;
2526 - }
 2868+ };
25272869 });
25282870
25292871 function liveHandler( event ) {
2530 - var stop, elems = [], selectors = [], args = arguments,
2531 - related, match, handleObj, elem, j, i, l, data,
2532 - events = jQuery.data( this, "events" );
 2872+ var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
 2873+ elems = [],
 2874+ selectors = [],
 2875+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
25332876
 2877+ if ( typeof events === "function" ) {
 2878+ events = events.events;
 2879+ }
 2880+
25342881 // Make sure we avoid non-left-click bubbling in Firefox (#3861)
25352882 if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
25362883 return;
25372884 }
 2885+
 2886+ if ( event.namespace ) {
 2887+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
 2888+ }
25382889
25392890 event.liveFired = this;
25402891
@@ -2553,20 +2904,23 @@
25542905 match = jQuery( event.target ).closest( selectors, event.currentTarget );
25552906
25562907 for ( i = 0, l = match.length; i < l; i++ ) {
 2908+ close = match[i];
 2909+
25572910 for ( j = 0; j < live.length; j++ ) {
25582911 handleObj = live[j];
25592912
2560 - if ( match[i].selector === handleObj.selector ) {
2561 - elem = match[i].elem;
 2913+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
 2914+ elem = close.elem;
25622915 related = null;
25632916
25642917 // Those two events require additional checking
25652918 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
 2919+ event.type = handleObj.preType;
25662920 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
25672921 }
25682922
25692923 if ( !related || related !== elem ) {
2570 - elems.push({ elem: elem, handleObj: handleObj });
 2924+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
25712925 }
25722926 }
25732927 }
@@ -2574,13 +2928,26 @@
25752929
25762930 for ( i = 0, l = elems.length; i < l; i++ ) {
25772931 match = elems[i];
 2932+
 2933+ if ( maxLevel && match.level > maxLevel ) {
 2934+ break;
 2935+ }
 2936+
25782937 event.currentTarget = match.elem;
25792938 event.data = match.handleObj.data;
25802939 event.handleObj = match.handleObj;
25812940
2582 - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
2583 - stop = false;
2584 - break;
 2941+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
 2942+
 2943+ if ( ret === false || event.isPropagationStopped() ) {
 2944+ maxLevel = match.level;
 2945+
 2946+ if ( ret === false ) {
 2947+ stop = false;
 2948+ }
 2949+ if ( event.isImmediatePropagationStopped() ) {
 2950+ break;
 2951+ }
25852952 }
25862953 }
25872954
@@ -2588,7 +2955,7 @@
25892956 }
25902957
25912958 function liveConvert( type, selector ) {
2592 - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
 2959+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
25932960 }
25942961
25952962 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
@@ -2596,8 +2963,15 @@
25972964 "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
25982965
25992966 // Handle event binding
2600 - jQuery.fn[ name ] = function( fn ) {
2601 - return fn ? this.bind( name, fn ) : this.trigger( name );
 2967+ jQuery.fn[ name ] = function( data, fn ) {
 2968+ if ( fn == null ) {
 2969+ fn = data;
 2970+ data = null;
 2971+ }
 2972+
 2973+ return arguments.length > 0 ?
 2974+ this.bind( name, data, fn ) :
 2975+ this.trigger( name );
26022976 };
26032977
26042978 if ( jQuery.attrFn ) {
@@ -2610,7 +2984,7 @@
26112985 // More info:
26122986 // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
26132987 if ( window.attachEvent && !window.addEventListener ) {
2614 - window.attachEvent("onunload", function() {
 2988+ jQuery(window).bind("unload", function() {
26152989 for ( var id in jQuery.cache ) {
26162990 if ( jQuery.cache[ id ].handle ) {
26172991 // Try/Catch is to handle iframes being unloaded, see #4280
@@ -2621,6 +2995,8 @@
26222996 }
26232997 });
26242998 }
 2999+
 3000+
26253001 /*!
26263002 * Sizzle CSS Selector Engine - v1.0
26273003 * Copyright 2009, The Dojo Foundation
@@ -2629,7 +3005,7 @@
26303006 */
26313007 (function(){
26323008
2633 -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
 3009+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
26343010 done = 0,
26353011 toString = Object.prototype.toString,
26363012 hasDuplicate = false,
@@ -2639,15 +3015,17 @@
26403016 // optimization where it does not always call our comparision
26413017 // function. If that is the case, discard the hasDuplicate value.
26423018 // Thus far that includes Google Chrome.
2643 -[0, 0].sort(function(){
 3019+[0, 0].sort(function() {
26443020 baseHasDuplicate = false;
26453021 return 0;
26463022 });
26473023
2648 -var Sizzle = function(selector, context, results, seed) {
 3024+var Sizzle = function( selector, context, results, seed ) {
26493025 results = results || [];
2650 - var origContext = context = context || document;
 3026+ context = context || document;
26513027
 3028+ var origContext = context;
 3029+
26523030 if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
26533031 return [];
26543032 }
@@ -2656,24 +3034,34 @@
26573035 return results;
26583036 }
26593037
2660 - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
 3038+ var m, set, checkSet, extra, ret, cur, pop, i,
 3039+ prune = true,
 3040+ contextXML = Sizzle.isXML( context ),
 3041+ parts = [],
26613042 soFar = selector;
26623043
26633044 // Reset the position of the chunker regexp (start from head)
2664 - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
2665 - soFar = m[3];
 3045+ do {
 3046+ chunker.exec( "" );
 3047+ m = chunker.exec( soFar );
 3048+
 3049+ if ( m ) {
 3050+ soFar = m[3];
26663051
2667 - parts.push( m[1] );
 3052+ parts.push( m[1] );
26683053
2669 - if ( m[2] ) {
2670 - extra = m[3];
2671 - break;
 3054+ if ( m[2] ) {
 3055+ extra = m[3];
 3056+ break;
 3057+ }
26723058 }
2673 - }
 3059+ } while ( m );
26743060
26753061 if ( parts.length > 1 && origPOS.exec( selector ) ) {
 3062+
26763063 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
26773064 set = posProcess( parts[0] + parts[1], context );
 3065+
26783066 } else {
26793067 set = Expr.relative[ parts[0] ] ?
26803068 [ context ] :
@@ -2689,29 +3077,38 @@
26903078 set = posProcess( selector, set );
26913079 }
26923080 }
 3081+
26933082 } else {
26943083 // Take a shortcut and set the context if the root selector is an ID
26953084 // (but not if it'll be faster if the inner selector is an ID)
26963085 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
26973086 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
2698 - var ret = Sizzle.find( parts.shift(), context, contextXML );
2699 - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
 3087+
 3088+ ret = Sizzle.find( parts.shift(), context, contextXML );
 3089+ context = ret.expr ?
 3090+ Sizzle.filter( ret.expr, ret.set )[0] :
 3091+ ret.set[0];
27003092 }
27013093
27023094 if ( context ) {
2703 - var ret = seed ?
 3095+ ret = seed ?
27043096 { expr: parts.pop(), set: makeArray(seed) } :
27053097 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
2706 - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
27073098
 3099+ set = ret.expr ?
 3100+ Sizzle.filter( ret.expr, ret.set ) :
 3101+ ret.set;
 3102+
27083103 if ( parts.length > 0 ) {
2709 - checkSet = makeArray(set);
 3104+ checkSet = makeArray( set );
 3105+
27103106 } else {
27113107 prune = false;
27123108 }
27133109
27143110 while ( parts.length ) {
2715 - var cur = parts.pop(), pop = cur;
 3111+ cur = parts.pop();
 3112+ pop = cur;
27163113
27173114 if ( !Expr.relative[ cur ] ) {
27183115 cur = "";
@@ -2725,6 +3122,7 @@
27263123
27273124 Expr.relative[ cur ]( checkSet, pop, contextXML );
27283125 }
 3126+
27293127 } else {
27303128 checkSet = parts = [];
27313129 }
@@ -2741,19 +3139,22 @@
27423140 if ( toString.call(checkSet) === "[object Array]" ) {
27433141 if ( !prune ) {
27443142 results.push.apply( results, checkSet );
 3143+
27453144 } else if ( context && context.nodeType === 1 ) {
2746 - for ( var i = 0; checkSet[i] != null; i++ ) {
2747 - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
 3145+ for ( i = 0; checkSet[i] != null; i++ ) {
 3146+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
27483147 results.push( set[i] );
27493148 }
27503149 }
 3150+
27513151 } else {
2752 - for ( var i = 0; checkSet[i] != null; i++ ) {
 3152+ for ( i = 0; checkSet[i] != null; i++ ) {
27533153 if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
27543154 results.push( set[i] );
27553155 }
27563156 }
27573157 }
 3158+
27583159 } else {
27593160 makeArray( checkSet, results );
27603161 }
@@ -2766,15 +3167,15 @@
27673168 return results;
27683169 };
27693170
2770 -Sizzle.uniqueSort = function(results){
 3171+Sizzle.uniqueSort = function( results ) {
27713172 if ( sortOrder ) {
27723173 hasDuplicate = baseHasDuplicate;
2773 - results.sort(sortOrder);
 3174+ results.sort( sortOrder );
27743175
27753176 if ( hasDuplicate ) {
27763177 for ( var i = 1; i < results.length; i++ ) {
2777 - if ( results[i] === results[i-1] ) {
2778 - results.splice(i--, 1);
 3178+ if ( results[i] === results[ i - 1 ] ) {
 3179+ results.splice( i--, 1 );
27793180 }
27803181 }
27813182 }
@@ -2783,27 +3184,33 @@
27843185 return results;
27853186 };
27863187
2787 -Sizzle.matches = function(expr, set){
2788 - return Sizzle(expr, null, null, set);
 3188+Sizzle.matches = function( expr, set ) {
 3189+ return Sizzle( expr, null, null, set );
27893190 };
27903191
2791 -Sizzle.find = function(expr, context, isXML){
2792 - var set, match;
 3192+Sizzle.matchesSelector = function( node, expr ) {
 3193+ return Sizzle( expr, null, null, [node] ).length > 0;
 3194+};
27933195
 3196+Sizzle.find = function( expr, context, isXML ) {
 3197+ var set;
 3198+
27943199 if ( !expr ) {
27953200 return [];
27963201 }
27973202
27983203 for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
2799 - var type = Expr.order[i], match;
 3204+ var match,
 3205+ type = Expr.order[i];
28003206
28013207 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
28023208 var left = match[1];
2803 - match.splice(1,1);
 3209+ match.splice( 1, 1 );
28043210
28053211 if ( left.substr( left.length - 1 ) !== "\\" ) {
28063212 match[1] = (match[1] || "").replace(/\\/g, "");
28073213 set = Expr.find[ type ]( match, context, isXML );
 3214+
28083215 if ( set != null ) {
28093216 expr = expr.replace( Expr.match[ type ], "" );
28103217 break;
@@ -2813,20 +3220,26 @@
28143221 }
28153222
28163223 if ( !set ) {
2817 - set = context.getElementsByTagName("*");
 3224+ set = context.getElementsByTagName( "*" );
28183225 }
28193226
2820 - return {set: set, expr: expr};
 3227+ return { set: set, expr: expr };
28213228 };
28223229
2823 -Sizzle.filter = function(expr, set, inplace, not){
2824 - var old = expr, result = [], curLoop = set, match, anyFound,
2825 - isXMLFilter = set && set[0] && isXML(set[0]);
 3230+Sizzle.filter = function( expr, set, inplace, not ) {
 3231+ var match, anyFound,
 3232+ old = expr,
 3233+ result = [],
 3234+ curLoop = set,
 3235+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
28263236
28273237 while ( expr && set.length ) {
28283238 for ( var type in Expr.filter ) {
28293239 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
2830 - var filter = Expr.filter[ type ], found, item, left = match[1];
 3240+ var found, item,
 3241+ filter = Expr.filter[ type ],
 3242+ left = match[1];
 3243+
28313244 anyFound = false;
28323245
28333246 match.splice(1,1);
@@ -2844,6 +3257,7 @@
28453258
28463259 if ( !match ) {
28473260 anyFound = found = true;
 3261+
28483262 } else if ( match === true ) {
28493263 continue;
28503264 }
@@ -2858,9 +3272,11 @@
28593273 if ( inplace && found != null ) {
28603274 if ( pass ) {
28613275 anyFound = true;
 3276+
28623277 } else {
28633278 curLoop[i] = false;
28643279 }
 3280+
28653281 } else if ( pass ) {
28663282 result.push( item );
28673283 anyFound = true;
@@ -2889,6 +3305,7 @@
28903306 if ( expr === old ) {
28913307 if ( anyFound == null ) {
28923308 Sizzle.error( expr );
 3309+
28933310 } else {
28943311 break;
28953312 }
@@ -2906,30 +3323,35 @@
29073324
29083325 var Expr = Sizzle.selectors = {
29093326 order: [ "ID", "NAME", "TAG" ],
 3327+
29103328 match: {
2911 - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
2912 - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
2913 - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
2914 - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
2915 - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
2916 - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
2917 - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
2918 - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
 3329+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
 3330+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
 3331+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
 3332+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
 3333+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
 3334+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
 3335+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
 3336+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
29193337 },
 3338+
29203339 leftMatch: {},
 3340+
29213341 attrMap: {
29223342 "class": "className",
29233343 "for": "htmlFor"
29243344 },
 3345+
29253346 attrHandle: {
2926 - href: function(elem){
2927 - return elem.getAttribute("href");
 3347+ href: function( elem ) {
 3348+ return elem.getAttribute( "href" );
29283349 }
29293350 },
 3351+
29303352 relative: {
29313353 "+": function(checkSet, part){
29323354 var isPartStr = typeof part === "string",
2933 - isTag = isPartStr && !/\W/.test(part),
 3355+ isTag = isPartStr && !/\W/.test( part ),
29343356 isPartStrNotTag = isPartStr && !isTag;
29353357
29363358 if ( isTag ) {
@@ -2950,22 +3372,29 @@
29513373 Sizzle.filter( part, checkSet, true );
29523374 }
29533375 },
2954 - ">": function(checkSet, part){
2955 - var isPartStr = typeof part === "string";
29563376
2957 - if ( isPartStr && !/\W/.test(part) ) {
 3377+ ">": function( checkSet, part ) {
 3378+ var elem,
 3379+ isPartStr = typeof part === "string",
 3380+ i = 0,
 3381+ l = checkSet.length;
 3382+
 3383+ if ( isPartStr && !/\W/.test( part ) ) {
29583384 part = part.toLowerCase();
29593385
2960 - for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2961 - var elem = checkSet[i];
 3386+ for ( ; i < l; i++ ) {
 3387+ elem = checkSet[i];
 3388+
29623389 if ( elem ) {
29633390 var parent = elem.parentNode;
29643391 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
29653392 }
29663393 }
 3394+
29673395 } else {
2968 - for ( var i = 0, l = checkSet.length; i < l; i++ ) {
2969 - var elem = checkSet[i];
 3396+ for ( ; i < l; i++ ) {
 3397+ elem = checkSet[i];
 3398+
29703399 if ( elem ) {
29713400 checkSet[i] = isPartStr ?
29723401 elem.parentNode :
@@ -2978,37 +3407,50 @@
29793408 }
29803409 }
29813410 },
 3411+
29823412 "": function(checkSet, part, isXML){
2983 - var doneName = done++, checkFn = dirCheck;
 3413+ var nodeCheck,
 3414+ doneName = done++,
 3415+ checkFn = dirCheck;
29843416
29853417 if ( typeof part === "string" && !/\W/.test(part) ) {
2986 - var nodeCheck = part = part.toLowerCase();
 3418+ part = part.toLowerCase();
 3419+ nodeCheck = part;
29873420 checkFn = dirNodeCheck;
29883421 }
29893422
2990 - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
 3423+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
29913424 },
2992 - "~": function(checkSet, part, isXML){
2993 - var doneName = done++, checkFn = dirCheck;
29943425
2995 - if ( typeof part === "string" && !/\W/.test(part) ) {
2996 - var nodeCheck = part = part.toLowerCase();
 3426+ "~": function( checkSet, part, isXML ) {
 3427+ var nodeCheck,
 3428+ doneName = done++,
 3429+ checkFn = dirCheck;
 3430+
 3431+ if ( typeof part === "string" && !/\W/.test( part ) ) {
 3432+ part = part.toLowerCase();
 3433+ nodeCheck = part;
29973434 checkFn = dirNodeCheck;
29983435 }
29993436
3000 - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
 3437+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
30013438 }
30023439 },
 3440+
30033441 find: {
3004 - ID: function(match, context, isXML){
 3442+ ID: function( match, context, isXML ) {
30053443 if ( typeof context.getElementById !== "undefined" && !isXML ) {
30063444 var m = context.getElementById(match[1]);
3007 - return m ? [m] : [];
 3445+ // Check parentNode to catch when Blackberry 4.6 returns
 3446+ // nodes that are no longer in the document #6963
 3447+ return m && m.parentNode ? [m] : [];
30083448 }
30093449 },
3010 - NAME: function(match, context){
 3450+
 3451+ NAME: function( match, context ) {
30113452 if ( typeof context.getElementsByName !== "undefined" ) {
3012 - var ret = [], results = context.getElementsByName(match[1]);
 3453+ var ret = [],
 3454+ results = context.getElementsByName( match[1] );
30133455
30143456 for ( var i = 0, l = results.length; i < l; i++ ) {
30153457 if ( results[i].getAttribute("name") === match[1] ) {
@@ -3019,12 +3461,13 @@
30203462 return ret.length === 0 ? null : ret;
30213463 }
30223464 },
3023 - TAG: function(match, context){
3024 - return context.getElementsByTagName(match[1]);
 3465+
 3466+ TAG: function( match, context ) {
 3467+ return context.getElementsByTagName( match[1] );
30253468 }
30263469 },
30273470 preFilter: {
3028 - CLASS: function(match, curLoop, inplace, result, not, isXML){
 3471+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
30293472 match = " " + match[1].replace(/\\/g, "") + " ";
30303473
30313474 if ( isXML ) {
@@ -3037,6 +3480,7 @@
30383481 if ( !inplace ) {
30393482 result.push( elem );
30403483 }
 3484+
30413485 } else if ( inplace ) {
30423486 curLoop[i] = false;
30433487 }
@@ -3045,13 +3489,16 @@
30463490
30473491 return false;
30483492 },
3049 - ID: function(match){
 3493+
 3494+ ID: function( match ) {
30503495 return match[1].replace(/\\/g, "");
30513496 },
3052 - TAG: function(match, curLoop){
 3497+
 3498+ TAG: function( match, curLoop ) {
30533499 return match[1].toLowerCase();
30543500 },
3055 - CHILD: function(match){
 3501+
 3502+ CHILD: function( match ) {
30563503 if ( match[1] === "nth" ) {
30573504 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
30583505 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
@@ -3068,7 +3515,8 @@
30693516
30703517 return match;
30713518 },
3072 - ATTR: function(match, curLoop, inplace, result, not, isXML){
 3519+
 3520+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
30733521 var name = match[1].replace(/\\/g, "");
30743522
30753523 if ( !isXML && Expr.attrMap[name] ) {
@@ -3081,160 +3529,204 @@
30823530
30833531 return match;
30843532 },
3085 - PSEUDO: function(match, curLoop, inplace, result, not){
 3533+
 3534+ PSEUDO: function( match, curLoop, inplace, result, not ) {
30863535 if ( match[1] === "not" ) {
30873536 // If we're dealing with a complex expression, or a simple one
30883537 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
30893538 match[3] = Sizzle(match[3], null, null, curLoop);
 3539+
30903540 } else {
30913541 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
 3542+
30923543 if ( !inplace ) {
30933544 result.push.apply( result, ret );
30943545 }
 3546+
30953547 return false;
30963548 }
 3549+
30973550 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
30983551 return true;
30993552 }
31003553
31013554 return match;
31023555 },
3103 - POS: function(match){
 3556+
 3557+ POS: function( match ) {
31043558 match.unshift( true );
 3559+
31053560 return match;
31063561 }
31073562 },
 3563+
31083564 filters: {
3109 - enabled: function(elem){
 3565+ enabled: function( elem ) {
31103566 return elem.disabled === false && elem.type !== "hidden";
31113567 },
3112 - disabled: function(elem){
 3568+
 3569+ disabled: function( elem ) {
31133570 return elem.disabled === true;
31143571 },
3115 - checked: function(elem){
 3572+
 3573+ checked: function( elem ) {
31163574 return elem.checked === true;
31173575 },
3118 - selected: function(elem){
 3576+
 3577+ selected: function( elem ) {
31193578 // Accessing this property makes selected-by-default
31203579 // options in Safari work properly
31213580 elem.parentNode.selectedIndex;
 3581+
31223582 return elem.selected === true;
31233583 },
3124 - parent: function(elem){
 3584+
 3585+ parent: function( elem ) {
31253586 return !!elem.firstChild;
31263587 },
3127 - empty: function(elem){
 3588+
 3589+ empty: function( elem ) {
31283590 return !elem.firstChild;
31293591 },
3130 - has: function(elem, i, match){
 3592+
 3593+ has: function( elem, i, match ) {
31313594 return !!Sizzle( match[3], elem ).length;
31323595 },
3133 - header: function(elem){
3134 - return /h\d/i.test( elem.nodeName );
 3596+
 3597+ header: function( elem ) {
 3598+ return (/h\d/i).test( elem.nodeName );
31353599 },
3136 - text: function(elem){
 3600+
 3601+ text: function( elem ) {
31373602 return "text" === elem.type;
31383603 },
3139 - radio: function(elem){
 3604+ radio: function( elem ) {
31403605 return "radio" === elem.type;
31413606 },
3142 - checkbox: function(elem){
 3607+
 3608+ checkbox: function( elem ) {
31433609 return "checkbox" === elem.type;
31443610 },
3145 - file: function(elem){
 3611+
 3612+ file: function( elem ) {
31463613 return "file" === elem.type;
31473614 },
3148 - password: function(elem){
 3615+ password: function( elem ) {
31493616 return "password" === elem.type;
31503617 },
3151 - submit: function(elem){
 3618+
 3619+ submit: function( elem ) {
31523620 return "submit" === elem.type;
31533621 },
3154 - image: function(elem){
 3622+
 3623+ image: function( elem ) {
31553624 return "image" === elem.type;
31563625 },
3157 - reset: function(elem){
 3626+
 3627+ reset: function( elem ) {
31583628 return "reset" === elem.type;
31593629 },
3160 - button: function(elem){
 3630+
 3631+ button: function( elem ) {
31613632 return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
31623633 },
3163 - input: function(elem){
3164 - return /input|select|textarea|button/i.test(elem.nodeName);
 3634+
 3635+ input: function( elem ) {
 3636+ return (/input|select|textarea|button/i).test( elem.nodeName );
31653637 }
31663638 },
31673639 setFilters: {
3168 - first: function(elem, i){
 3640+ first: function( elem, i ) {
31693641 return i === 0;
31703642 },
3171 - last: function(elem, i, match, array){
 3643+
 3644+ last: function( elem, i, match, array ) {
31723645 return i === array.length - 1;
31733646 },
3174 - even: function(elem, i){
 3647+
 3648+ even: function( elem, i ) {
31753649 return i % 2 === 0;
31763650 },
3177 - odd: function(elem, i){
 3651+
 3652+ odd: function( elem, i ) {
31783653 return i % 2 === 1;
31793654 },
3180 - lt: function(elem, i, match){
 3655+
 3656+ lt: function( elem, i, match ) {
31813657 return i < match[3] - 0;
31823658 },
3183 - gt: function(elem, i, match){
 3659+
 3660+ gt: function( elem, i, match ) {
31843661 return i > match[3] - 0;
31853662 },
3186 - nth: function(elem, i, match){
 3663+
 3664+ nth: function( elem, i, match ) {
31873665 return match[3] - 0 === i;
31883666 },
3189 - eq: function(elem, i, match){
 3667+
 3668+ eq: function( elem, i, match ) {
31903669 return match[3] - 0 === i;
31913670 }
31923671 },
31933672 filter: {
3194 - PSEUDO: function(elem, match, i, array){
3195 - var name = match[1], filter = Expr.filters[ name ];
 3673+ PSEUDO: function( elem, match, i, array ) {
 3674+ var name = match[1],
 3675+ filter = Expr.filters[ name ];
31963676
31973677 if ( filter ) {
31983678 return filter( elem, i, match, array );
 3679+
31993680 } else if ( name === "contains" ) {
3200 - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
 3681+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
 3682+
32013683 } else if ( name === "not" ) {
32023684 var not = match[3];
32033685
3204 - for ( var i = 0, l = not.length; i < l; i++ ) {
3205 - if ( not[i] === elem ) {
 3686+ for ( var j = 0, l = not.length; j < l; j++ ) {
 3687+ if ( not[j] === elem ) {
32063688 return false;
32073689 }
32083690 }
32093691
32103692 return true;
 3693+
32113694 } else {
32123695 Sizzle.error( "Syntax error, unrecognized expression: " + name );
32133696 }
32143697 },
3215 - CHILD: function(elem, match){
3216 - var type = match[1], node = elem;
3217 - switch (type) {
3218 - case 'only':
3219 - case 'first':
 3698+
 3699+ CHILD: function( elem, match ) {
 3700+ var type = match[1],
 3701+ node = elem;
 3702+
 3703+ switch ( type ) {
 3704+ case "only":
 3705+ case "first":
32203706 while ( (node = node.previousSibling) ) {
32213707 if ( node.nodeType === 1 ) {
32223708 return false;
32233709 }
32243710 }
 3711+
32253712 if ( type === "first" ) {
32263713 return true;
32273714 }
 3715+
32283716 node = elem;
3229 - case 'last':
 3717+
 3718+ case "last":
32303719 while ( (node = node.nextSibling) ) {
32313720 if ( node.nodeType === 1 ) {
32323721 return false;
32333722 }
32343723 }
 3724+
32353725 return true;
3236 - case 'nth':
3237 - var first = match[2], last = match[3];
32383726
 3727+ case "nth":
 3728+ var first = match[2],
 3729+ last = match[3];
 3730+
32393731 if ( first === 1 && last === 0 ) {
32403732 return true;
32413733 }
@@ -3244,33 +3736,41 @@
32453737
32463738 if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
32473739 var count = 0;
 3740+
32483741 for ( node = parent.firstChild; node; node = node.nextSibling ) {
32493742 if ( node.nodeType === 1 ) {
32503743 node.nodeIndex = ++count;
32513744 }
32523745 }
 3746+
32533747 parent.sizcache = doneName;
32543748 }
32553749
32563750 var diff = elem.nodeIndex - last;
 3751+
32573752 if ( first === 0 ) {
32583753 return diff === 0;
 3754+
32593755 } else {
32603756 return ( diff % first === 0 && diff / first >= 0 );
32613757 }
32623758 }
32633759 },
3264 - ID: function(elem, match){
 3760+
 3761+ ID: function( elem, match ) {
32653762 return elem.nodeType === 1 && elem.getAttribute("id") === match;
32663763 },
3267 - TAG: function(elem, match){
 3764+
 3765+ TAG: function( elem, match ) {
32683766 return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
32693767 },
3270 - CLASS: function(elem, match){
 3768+
 3769+ CLASS: function( elem, match ) {
32713770 return (" " + (elem.className || elem.getAttribute("class")) + " ")
32723771 .indexOf( match ) > -1;
32733772 },
3274 - ATTR: function(elem, match){
 3773+
 3774+ ATTR: function( elem, match ) {
32753775 var name = match[1],
32763776 result = Expr.attrHandle[ name ] ?
32773777 Expr.attrHandle[ name ]( elem ) :
@@ -3301,9 +3801,11 @@
33023802 value === check || value.substr(0, check.length + 1) === check + "-" :
33033803 false;
33043804 },
3305 - POS: function(elem, match, i, array){
3306 - var name = match[2], filter = Expr.setFilters[ name ];
33073805
 3806+ POS: function( elem, match, i, array ) {
 3807+ var name = match[2],
 3808+ filter = Expr.setFilters[ name ];
 3809+
33083810 if ( filter ) {
33093811 return filter( elem, i, match, array );
33103812 }
@@ -3311,16 +3813,17 @@
33123814 }
33133815 };
33143816
3315 -var origPOS = Expr.match.POS;
 3817+var origPOS = Expr.match.POS,
 3818+ fescape = function(all, num){
 3819+ return "\\" + (num - 0 + 1);
 3820+ };
33163821
33173822 for ( var type in Expr.match ) {
3318 - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
3319 - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
3320 - return "\\" + (num - 0 + 1);
3321 - }));
 3823+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
 3824+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
33223825 }
33233826
3324 -var makeArray = function(array, results) {
 3827+var makeArray = function( array, results ) {
33253828 array = Array.prototype.slice.call( array, 0 );
33263829
33273830 if ( results ) {
@@ -3339,19 +3842,22 @@
33403843 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
33413844
33423845 // Provide a fallback method if it does not work
3343 -} catch(e){
3344 - makeArray = function(array, results) {
3345 - var ret = results || [];
 3846+} catch( e ) {
 3847+ makeArray = function( array, results ) {
 3848+ var i = 0,
 3849+ ret = results || [];
33463850
33473851 if ( toString.call(array) === "[object Array]" ) {
33483852 Array.prototype.push.apply( ret, array );
 3853+
33493854 } else {
33503855 if ( typeof array.length === "number" ) {
3351 - for ( var i = 0, l = array.length; i < l; i++ ) {
 3856+ for ( var l = array.length; i < l; i++ ) {
33523857 ret.push( array[i] );
33533858 }
 3859+
33543860 } else {
3355 - for ( var i = 0; array[i]; i++ ) {
 3861+ for ( ; array[i]; i++ ) {
33563862 ret.push( array[i] );
33573863 }
33583864 }
@@ -3361,62 +3867,99 @@
33623868 };
33633869 }
33643870
3365 -var sortOrder;
 3871+var sortOrder, siblingCheck;
33663872
33673873 if ( document.documentElement.compareDocumentPosition ) {
33683874 sortOrder = function( a, b ) {
 3875+ if ( a === b ) {
 3876+ hasDuplicate = true;
 3877+ return 0;
 3878+ }
 3879+
33693880 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
3370 - if ( a == b ) {
3371 - hasDuplicate = true;
3372 - }
33733881 return a.compareDocumentPosition ? -1 : 1;
33743882 }
33753883
3376 - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
3377 - if ( ret === 0 ) {
 3884+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
 3885+ };
 3886+
 3887+} else {
 3888+ sortOrder = function( a, b ) {
 3889+ var al, bl,
 3890+ ap = [],
 3891+ bp = [],
 3892+ aup = a.parentNode,
 3893+ bup = b.parentNode,
 3894+ cur = aup;
 3895+
 3896+ // The nodes are identical, we can exit early
 3897+ if ( a === b ) {
33783898 hasDuplicate = true;
 3899+ return 0;
 3900+
 3901+ // If the nodes are siblings (or identical) we can do a quick check
 3902+ } else if ( aup === bup ) {
 3903+ return siblingCheck( a, b );
 3904+
 3905+ // If no parents were found then the nodes are disconnected
 3906+ } else if ( !aup ) {
 3907+ return -1;
 3908+
 3909+ } else if ( !bup ) {
 3910+ return 1;
33793911 }
3380 - return ret;
3381 - };
3382 -} else if ( "sourceIndex" in document.documentElement ) {
3383 - sortOrder = function( a, b ) {
3384 - if ( !a.sourceIndex || !b.sourceIndex ) {
3385 - if ( a == b ) {
3386 - hasDuplicate = true;
 3912+
 3913+ // Otherwise they're somewhere else in the tree so we need
 3914+ // to build up a full list of the parentNodes for comparison
 3915+ while ( cur ) {
 3916+ ap.unshift( cur );
 3917+ cur = cur.parentNode;
 3918+ }
 3919+
 3920+ cur = bup;
 3921+
 3922+ while ( cur ) {
 3923+ bp.unshift( cur );
 3924+ cur = cur.parentNode;
 3925+ }
 3926+
 3927+ al = ap.length;
 3928+ bl = bp.length;
 3929+
 3930+ // Start walking down the tree looking for a discrepancy
 3931+ for ( var i = 0; i < al && i < bl; i++ ) {
 3932+ if ( ap[i] !== bp[i] ) {
 3933+ return siblingCheck( ap[i], bp[i] );
33873934 }
3388 - return a.sourceIndex ? -1 : 1;
33893935 }
33903936
3391 - var ret = a.sourceIndex - b.sourceIndex;
3392 - if ( ret === 0 ) {
3393 - hasDuplicate = true;
 3937+ // We ended someplace up the tree so do a sibling check
 3938+ return i === al ?
 3939+ siblingCheck( a, bp[i], -1 ) :
 3940+ siblingCheck( ap[i], b, 1 );
 3941+ };
 3942+
 3943+ siblingCheck = function( a, b, ret ) {
 3944+ if ( a === b ) {
 3945+ return ret;
33943946 }
3395 - return ret;
3396 - };
3397 -} else if ( document.createRange ) {
3398 - sortOrder = function( a, b ) {
3399 - if ( !a.ownerDocument || !b.ownerDocument ) {
3400 - if ( a == b ) {
3401 - hasDuplicate = true;
 3947+
 3948+ var cur = a.nextSibling;
 3949+
 3950+ while ( cur ) {
 3951+ if ( cur === b ) {
 3952+ return -1;
34023953 }
3403 - return a.ownerDocument ? -1 : 1;
 3954+
 3955+ cur = cur.nextSibling;
34043956 }
34053957
3406 - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
3407 - aRange.setStart(a, 0);
3408 - aRange.setEnd(a, 0);
3409 - bRange.setStart(b, 0);
3410 - bRange.setEnd(b, 0);
3411 - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
3412 - if ( ret === 0 ) {
3413 - hasDuplicate = true;
3414 - }
3415 - return ret;
 3958+ return 1;
34163959 };
34173960 }
34183961
34193962 // Utility function for retreiving the text value of an array of DOM nodes
3420 -function getText( elems ) {
 3963+Sizzle.getText = function( elems ) {
34213964 var ret = "", elem;
34223965
34233966 for ( var i = 0; elems[i]; i++ ) {
@@ -3428,43 +3971,52 @@
34293972
34303973 // Traverse everything else, except comment nodes
34313974 } else if ( elem.nodeType !== 8 ) {
3432 - ret += getText( elem.childNodes );
 3975+ ret += Sizzle.getText( elem.childNodes );
34333976 }
34343977 }
34353978
34363979 return ret;
3437 -}
 3980+};
34383981
34393982 // Check to see if the browser returns elements by name when
34403983 // querying by getElementById (and provide a workaround)
34413984 (function(){
34423985 // We're going to inject a fake input element with a specified name
34433986 var form = document.createElement("div"),
3444 - id = "script" + (new Date).getTime();
 3987+ id = "script" + (new Date()).getTime(),
 3988+ root = document.documentElement;
 3989+
34453990 form.innerHTML = "<a name='" + id + "'/>";
34463991
34473992 // Inject it into the root element, check its status, and remove it quickly
3448 - var root = document.documentElement;
34493993 root.insertBefore( form, root.firstChild );
34503994
34513995 // The workaround has to do additional checks after a getElementById
34523996 // Which slows things down for other browsers (hence the branching)
34533997 if ( document.getElementById( id ) ) {
3454 - Expr.find.ID = function(match, context, isXML){
 3998+ Expr.find.ID = function( match, context, isXML ) {
34553999 if ( typeof context.getElementById !== "undefined" && !isXML ) {
34564000 var m = context.getElementById(match[1]);
3457 - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
 4001+
 4002+ return m ?
 4003+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
 4004+ [m] :
 4005+ undefined :
 4006+ [];
34584007 }
34594008 };
34604009
3461 - Expr.filter.ID = function(elem, match){
 4010+ Expr.filter.ID = function( elem, match ) {
34624011 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
 4012+
34634013 return elem.nodeType === 1 && node && node.nodeValue === match;
34644014 };
34654015 }
34664016
34674017 root.removeChild( form );
3468 - root = form = null; // release memory in IE
 4018+
 4019+ // release memory in IE
 4020+ root = form = null;
34694021 })();
34704022
34714023 (function(){
@@ -3477,8 +4029,8 @@
34784030
34794031 // Make sure no comments are found
34804032 if ( div.getElementsByTagName("*").length > 0 ) {
3481 - Expr.find.TAG = function(match, context){
3482 - var results = context.getElementsByTagName(match[1]);
 4033+ Expr.find.TAG = function( match, context ) {
 4034+ var results = context.getElementsByTagName( match[1] );
34834035
34844036 // Filter out possible comments
34854037 if ( match[1] === "*" ) {
@@ -3499,19 +4051,25 @@
35004052
35014053 // Check to see if an attribute returns normalized href attributes
35024054 div.innerHTML = "<a href='#'></a>";
 4055+
35034056 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
35044057 div.firstChild.getAttribute("href") !== "#" ) {
3505 - Expr.attrHandle.href = function(elem){
3506 - return elem.getAttribute("href", 2);
 4058+
 4059+ Expr.attrHandle.href = function( elem ) {
 4060+ return elem.getAttribute( "href", 2 );
35074061 };
35084062 }
35094063
3510 - div = null; // release memory in IE
 4064+ // release memory in IE
 4065+ div = null;
35114066 })();
35124067
35134068 if ( document.querySelectorAll ) {
35144069 (function(){
3515 - var oldSizzle = Sizzle, div = document.createElement("div");
 4070+ var oldSizzle = Sizzle,
 4071+ div = document.createElement("div"),
 4072+ id = "__sizzle__";
 4073+
35164074 div.innerHTML = "<p class='TEST'></p>";
35174075
35184076 // Safari can't handle uppercase or unicode characters when
@@ -3520,15 +4078,42 @@
35214079 return;
35224080 }
35234081
3524 - Sizzle = function(query, context, extra, seed){
 4082+ Sizzle = function( query, context, extra, seed ) {
35254083 context = context || document;
35264084
 4085+ // Make sure that attribute selectors are quoted
 4086+ query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
 4087+
35274088 // Only use querySelectorAll on non-XML documents
35284089 // (ID selectors don't work in non-HTML documents)
3529 - if ( !seed && context.nodeType === 9 && !isXML(context) ) {
3530 - try {
3531 - return makeArray( context.querySelectorAll(query), extra );
3532 - } catch(e){}
 4090+ if ( !seed && !Sizzle.isXML(context) ) {
 4091+ if ( context.nodeType === 9 ) {
 4092+ try {
 4093+ return makeArray( context.querySelectorAll(query), extra );
 4094+ } catch(qsaError) {}
 4095+
 4096+ // qSA works strangely on Element-rooted queries
 4097+ // We can work around this by specifying an extra ID on the root
 4098+ // and working up from there (Thanks to Andrew Dupont for the technique)
 4099+ // IE 8 doesn't work on object elements
 4100+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
 4101+ var old = context.getAttribute( "id" ),
 4102+ nid = old || id;
 4103+
 4104+ if ( !old ) {
 4105+ context.setAttribute( "id", nid );
 4106+ }
 4107+
 4108+ try {
 4109+ return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
 4110+
 4111+ } catch(pseudoError) {
 4112+ } finally {
 4113+ if ( !old ) {
 4114+ context.removeAttribute( "id" );
 4115+ }
 4116+ }
 4117+ }
35334118 }
35344119
35354120 return oldSizzle(query, context, extra, seed);
@@ -3538,11 +4123,44 @@
35394124 Sizzle[ prop ] = oldSizzle[ prop ];
35404125 }
35414126
3542 - div = null; // release memory in IE
 4127+ // release memory in IE
 4128+ div = null;
35434129 })();
35444130 }
35454131
35464132 (function(){
 4133+ var html = document.documentElement,
 4134+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
 4135+ pseudoWorks = false;
 4136+
 4137+ try {
 4138+ // This should fail with an exception
 4139+ // Gecko does not error, returns false instead
 4140+ matches.call( document.documentElement, "[test!='']:sizzle" );
 4141+
 4142+ } catch( pseudoError ) {
 4143+ pseudoWorks = true;
 4144+ }
 4145+
 4146+ if ( matches ) {
 4147+ Sizzle.matchesSelector = function( node, expr ) {
 4148+ // Make sure that attribute selectors are quoted
 4149+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
 4150+
 4151+ if ( !Sizzle.isXML( node ) ) {
 4152+ try {
 4153+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
 4154+ return matches.call( node, expr );
 4155+ }
 4156+ } catch(e) {}
 4157+ }
 4158+
 4159+ return Sizzle(expr, null, null, [node]).length > 0;
 4160+ };
 4161+ }
 4162+})();
 4163+
 4164+(function(){
35474165 var div = document.createElement("div");
35484166
35494167 div.innerHTML = "<div class='test e'></div><div class='test'></div>";
@@ -3561,22 +4179,25 @@
35624180 }
35634181
35644182 Expr.order.splice(1, 0, "CLASS");
3565 - Expr.find.CLASS = function(match, context, isXML) {
 4183+ Expr.find.CLASS = function( match, context, isXML ) {
35664184 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
35674185 return context.getElementsByClassName(match[1]);
35684186 }
35694187 };
35704188
3571 - div = null; // release memory in IE
 4189+ // release memory in IE
 4190+ div = null;
35724191 })();
35734192
35744193 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
35754194 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
35764195 var elem = checkSet[i];
 4196+
35774197 if ( elem ) {
3578 - elem = elem[dir];
35794198 var match = false;
35804199
 4200+ elem = elem[dir];
 4201+
35814202 while ( elem ) {
35824203 if ( elem.sizcache === doneName ) {
35834204 match = checkSet[elem.sizset];
@@ -3604,9 +4225,11 @@
36054226 function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
36064227 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
36074228 var elem = checkSet[i];
 4229+
36084230 if ( elem ) {
 4231+ var match = false;
 4232+
36094233 elem = elem[dir];
3610 - var match = false;
36114234
36124235 while ( elem ) {
36134236 if ( elem.sizcache === doneName ) {
@@ -3619,6 +4242,7 @@
36204243 elem.sizcache = doneName;
36214244 elem.sizset = i;
36224245 }
 4246+
36234247 if ( typeof cur !== "string" ) {
36244248 if ( elem === cur ) {
36254249 match = true;
@@ -3639,21 +4263,34 @@
36404264 }
36414265 }
36424266
3643 -var contains = document.compareDocumentPosition ? function(a, b){
3644 - return !!(a.compareDocumentPosition(b) & 16);
3645 -} : function(a, b){
3646 - return a !== b && (a.contains ? a.contains(b) : true);
3647 -};
 4267+if ( document.documentElement.contains ) {
 4268+ Sizzle.contains = function( a, b ) {
 4269+ return a !== b && (a.contains ? a.contains(b) : true);
 4270+ };
36484271
3649 -var isXML = function(elem){
 4272+} else if ( document.documentElement.compareDocumentPosition ) {
 4273+ Sizzle.contains = function( a, b ) {
 4274+ return !!(a.compareDocumentPosition(b) & 16);
 4275+ };
 4276+
 4277+} else {
 4278+ Sizzle.contains = function() {
 4279+ return false;
 4280+ };
 4281+}
 4282+
 4283+Sizzle.isXML = function( elem ) {
36504284 // documentElement is verified for cases where it doesn't yet exist
36514285 // (such as loading iframes in IE - #4833)
36524286 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
 4287+
36534288 return documentElement ? documentElement.nodeName !== "HTML" : false;
36544289 };
36554290
3656 -var posProcess = function(selector, context){
3657 - var tmpSet = [], later = "", match,
 4291+var posProcess = function( selector, context ) {
 4292+ var match,
 4293+ tmpSet = [],
 4294+ later = "",
36584295 root = context.nodeType ? [context] : context;
36594296
36604297 // Position selectors must be done after the filter
@@ -3677,53 +4314,26 @@
36784315 jQuery.expr = Sizzle.selectors;
36794316 jQuery.expr[":"] = jQuery.expr.filters;
36804317 jQuery.unique = Sizzle.uniqueSort;
3681 -jQuery.text = getText;
3682 -jQuery.isXMLDoc = isXML;
3683 -jQuery.contains = contains;
 4318+jQuery.text = Sizzle.getText;
 4319+jQuery.isXMLDoc = Sizzle.isXML;
 4320+jQuery.contains = Sizzle.contains;
36844321
3685 -return;
36864322
3687 -window.Sizzle = Sizzle;
 4323+})();
36884324
3689 -})();
 4325+
36904326 var runtil = /Until$/,
36914327 rparentsprev = /^(?:parents|prevUntil|prevAll)/,
36924328 // Note: This RegExp should be improved, or likely pulled from Sizzle
36934329 rmultiselector = /,/,
3694 - slice = Array.prototype.slice;
 4330+ isSimple = /^.[^:#\[\.,]*$/,
 4331+ slice = Array.prototype.slice,
 4332+ POS = jQuery.expr.match.POS;
36954333
3696 -// Implement the identical functionality for filter and not
3697 -var winnow = function( elements, qualifier, keep ) {
3698 - if ( jQuery.isFunction( qualifier ) ) {
3699 - return jQuery.grep(elements, function( elem, i ) {
3700 - return !!qualifier.call( elem, i, elem ) === keep;
3701 - });
3702 -
3703 - } else if ( qualifier.nodeType ) {
3704 - return jQuery.grep(elements, function( elem, i ) {
3705 - return (elem === qualifier) === keep;
3706 - });
3707 -
3708 - } else if ( typeof qualifier === "string" ) {
3709 - var filtered = jQuery.grep(elements, function( elem ) {
3710 - return elem.nodeType === 1;
3711 - });
3712 -
3713 - if ( isSimple.test( qualifier ) ) {
3714 - return jQuery.filter(qualifier, filtered, !keep);
3715 - } else {
3716 - qualifier = jQuery.filter( qualifier, filtered );
3717 - }
3718 - }
3719 -
3720 - return jQuery.grep(elements, function( elem, i ) {
3721 - return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
3722 - });
3723 -};
3724 -
37254334 jQuery.fn.extend({
37264335 find: function( selector ) {
3727 - var ret = this.pushStack( "", "find", selector ), length = 0;
 4336+ var ret = this.pushStack( "", "find", selector ),
 4337+ length = 0;
37284338
37294339 for ( var i = 0, l = this.length; i < l; i++ ) {
37304340 length = ret.length;
@@ -3769,11 +4379,15 @@
37704380 },
37714381
37724382 closest: function( selectors, context ) {
 4383+ var ret = [], i, l, cur = this[0];
 4384+
37734385 if ( jQuery.isArray( selectors ) ) {
3774 - var ret = [], cur = this[0], match, matches = {}, selector;
 4386+ var match, selector,
 4387+ matches = {},
 4388+ level = 1;
37754389
37764390 if ( cur && selectors.length ) {
3777 - for ( var i = 0, l = selectors.length; i < l; i++ ) {
 4391+ for ( i = 0, l = selectors.length; i < l; i++ ) {
37784392 selector = selectors[i];
37794393
37804394 if ( !matches[selector] ) {
@@ -3788,29 +4402,41 @@
37894403 match = matches[selector];
37904404
37914405 if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
3792 - ret.push({ selector: selector, elem: cur });
3793 - delete matches[selector];
 4406+ ret.push({ selector: selector, elem: cur, level: level });
37944407 }
37954408 }
 4409+
37964410 cur = cur.parentNode;
 4411+ level++;
37974412 }
37984413 }
37994414
38004415 return ret;
38014416 }
38024417
3803 - var pos = jQuery.expr.match.POS.test( selectors ) ?
 4418+ var pos = POS.test( selectors ) ?
38044419 jQuery( selectors, context || this.context ) : null;
38054420
3806 - return this.map(function( i, cur ) {
3807 - while ( cur && cur.ownerDocument && cur !== context ) {
3808 - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
3809 - return cur;
 4421+ for ( i = 0, l = this.length; i < l; i++ ) {
 4422+ cur = this[i];
 4423+
 4424+ while ( cur ) {
 4425+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
 4426+ ret.push( cur );
 4427+ break;
 4428+
 4429+ } else {
 4430+ cur = cur.parentNode;
 4431+ if ( !cur || !cur.ownerDocument || cur === context ) {
 4432+ break;
 4433+ }
38104434 }
3811 - cur = cur.parentNode;
38124435 }
3813 - return null;
3814 - });
 4436+ }
 4437+
 4438+ ret = ret.length > 1 ? jQuery.unique(ret) : ret;
 4439+
 4440+ return this.pushStack( ret, "closest", selectors );
38154441 },
38164442
38174443 // Determine the position of an element within
@@ -3918,11 +4544,15 @@
39194545 expr = ":not(" + expr + ")";
39204546 }
39214547
3922 - return jQuery.find.matches(expr, elems);
 4548+ return elems.length === 1 ?
 4549+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
 4550+ jQuery.find.matches(expr, elems);
39234551 },
39244552
39254553 dir: function( elem, dir, until ) {
3926 - var matched = [], cur = elem[dir];
 4554+ var matched = [],
 4555+ cur = elem[ dir ];
 4556+
39274557 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
39284558 if ( cur.nodeType === 1 ) {
39294559 matched.push( cur );
@@ -3957,20 +4587,50 @@
39584588 return r;
39594589 }
39604590 });
 4591+
 4592+// Implement the identical functionality for filter and not
 4593+function winnow( elements, qualifier, keep ) {
 4594+ if ( jQuery.isFunction( qualifier ) ) {
 4595+ return jQuery.grep(elements, function( elem, i ) {
 4596+ var retVal = !!qualifier.call( elem, i, elem );
 4597+ return retVal === keep;
 4598+ });
 4599+
 4600+ } else if ( qualifier.nodeType ) {
 4601+ return jQuery.grep(elements, function( elem, i ) {
 4602+ return (elem === qualifier) === keep;
 4603+ });
 4604+
 4605+ } else if ( typeof qualifier === "string" ) {
 4606+ var filtered = jQuery.grep(elements, function( elem ) {
 4607+ return elem.nodeType === 1;
 4608+ });
 4609+
 4610+ if ( isSimple.test( qualifier ) ) {
 4611+ return jQuery.filter(qualifier, filtered, !keep);
 4612+ } else {
 4613+ qualifier = jQuery.filter( qualifier, filtered );
 4614+ }
 4615+ }
 4616+
 4617+ return jQuery.grep(elements, function( elem, i ) {
 4618+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
 4619+ });
 4620+}
 4621+
 4622+
 4623+
 4624+
39614625 var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
39624626 rleadingWhitespace = /^\s+/,
3963 - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
3964 - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
 4627+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
39654628 rtagName = /<([\w:]+)/,
39664629 rtbody = /<tbody/i,
39674630 rhtml = /<|&#?\w+;/,
3968 - rnocache = /<script|<object|<embed|<option|<style/i,
3969 - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
3970 - fcloseTag = function( all, front, tag ) {
3971 - return rselfClosing.test( tag ) ?
3972 - all :
3973 - front + "></" + tag + ">";
3974 - },
 4631+ rnocache = /<(?:script|object|embed|option|style)/i,
 4632+ // checked="checked" or checked (html5)
 4633+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
 4634+ raction = /\=([^="'>\s]+\/)>/g,
39754635 wrapMap = {
39764636 option: [ 1, "<select multiple='multiple'>", "</select>" ],
39774637 legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -3995,7 +4655,8 @@
39964656 text: function( text ) {
39974657 if ( jQuery.isFunction(text) ) {
39984658 return this.each(function(i) {
3999 - var self = jQuery(this);
 4659+ var self = jQuery( this );
 4660+
40004661 self.text( text.call(this, i, self.text()) );
40014662 });
40024663 }
@@ -4044,7 +4705,8 @@
40454706 }
40464707
40474708 return this.each(function() {
4048 - var self = jQuery( this ), contents = self.contents();
 4709+ var self = jQuery( this ),
 4710+ contents = self.contents();
40494711
40504712 if ( contents.length ) {
40514713 contents.wrapAll( html );
@@ -4155,7 +4817,9 @@
41564818 // attributes in IE that are actually only stored
41574819 // as properties will not be copied (such as the
41584820 // the name attribute on an input).
4159 - var html = this.outerHTML, ownerDocument = this.ownerDocument;
 4821+ var html = this.outerHTML,
 4822+ ownerDocument = this.ownerDocument;
 4823+
41604824 if ( !html ) {
41614825 var div = ownerDocument.createElement("div");
41624826 div.appendChild( this.cloneNode(true) );
@@ -4164,7 +4828,7 @@
41654829
41664830 return jQuery.clean([html.replace(rinlinejQuery, "")
41674831 // Handle the case in IE 8 where action=/test/> self-closes a tag
4168 - .replace(/=([^="'>\s]+\/)>/g, '="$1">')
 4832+ .replace(raction, '="$1">')
41694833 .replace(rleadingWhitespace, "")], ownerDocument)[0];
41704834 } else {
41714835 return this.cloneNode(true);
@@ -4192,7 +4856,7 @@
41934857 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
41944858 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
41954859
4196 - value = value.replace(rxhtmlTag, fcloseTag);
 4860+ value = value.replace(rxhtmlTag, "<$1></$2>");
41974861
41984862 try {
41994863 for ( var i = 0, l = this.length; i < l; i++ ) {
@@ -4210,10 +4874,9 @@
42114875
42124876 } else if ( jQuery.isFunction( value ) ) {
42134877 this.each(function(i){
4214 - var self = jQuery(this), old = self.html();
4215 - self.empty().append(function(){
4216 - return value.call( this, i, old );
4217 - });
 4878+ var self = jQuery( this );
 4879+
 4880+ self.html( value.call(this, i, self.html()) );
42184881 });
42194882
42204883 } else {
@@ -4235,13 +4898,14 @@
42364899 }
42374900
42384901 if ( typeof value !== "string" ) {
4239 - value = jQuery(value).detach();
 4902+ value = jQuery( value ).detach();
42404903 }
42414904
42424905 return this.each(function() {
4243 - var next = this.nextSibling, parent = this.parentNode;
 4906+ var next = this.nextSibling,
 4907+ parent = this.parentNode;
42444908
4245 - jQuery(this).remove();
 4909+ jQuery( this ).remove();
42464910
42474911 if ( next ) {
42484912 jQuery(next).before( value );
@@ -4259,7 +4923,9 @@
42604924 },
42614925
42624926 domManip: function( args, table, callback ) {
4263 - var results, first, value = args[0], scripts = [], fragment, parent;
 4927+ var results, first, fragment, parent,
 4928+ value = args[0],
 4929+ scripts = [];
42644930
42654931 // We can't cloneNode fragments that contain checked, in WebKit
42664932 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
@@ -4284,7 +4950,7 @@
42854951 results = { fragment: parent };
42864952
42874953 } else {
4288 - results = buildFragment( args, this, scripts );
 4954+ results = jQuery.buildFragment( args, this, scripts );
42894955 }
42904956
42914957 fragment = results.fragment;
@@ -4316,16 +4982,16 @@
43174983 }
43184984
43194985 return this;
4320 -
4321 - function root( elem, cur ) {
4322 - return jQuery.nodeName(elem, "table") ?
4323 - (elem.getElementsByTagName("tbody")[0] ||
4324 - elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
4325 - elem;
4326 - }
43274986 }
43284987 });
43294988
 4989+function root( elem, cur ) {
 4990+ return jQuery.nodeName(elem, "table") ?
 4991+ (elem.getElementsByTagName("tbody")[0] ||
 4992+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
 4993+ elem;
 4994+}
 4995+
43304996 function cloneCopyEvent(orig, ret) {
43314997 var i = 0;
43324998
@@ -4334,7 +5000,9 @@
43355001 return;
43365002 }
43375003
4338 - var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
 5004+ var oldData = jQuery.data( orig[i++] ),
 5005+ curData = jQuery.data( this, oldData ),
 5006+ events = oldData && oldData.events;
43395007
43405008 if ( events ) {
43415009 delete curData.handle;
@@ -4349,7 +5017,7 @@
43505018 });
43515019 }
43525020
4353 -function buildFragment( args, nodes, scripts ) {
 5021+jQuery.buildFragment = function( args, nodes, scripts ) {
43545022 var fragment, cacheable, cacheresults,
43555023 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
43565024
@@ -4379,7 +5047,7 @@
43805048 }
43815049
43825050 return { fragment: fragment, cacheable: cacheable };
4383 -}
 5051+};
43845052
43855053 jQuery.fragments = {};
43865054
@@ -4391,7 +5059,8 @@
43925060 replaceAll: "replaceWith"
43935061 }, function( name, original ) {
43945062 jQuery.fn[ name ] = function( selector ) {
4395 - var ret = [], insert = jQuery( selector ),
 5063+ var ret = [],
 5064+ insert = jQuery( selector ),
43965065 parent = this.length === 1 && this[0].parentNode;
43975066
43985067 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
@@ -4401,7 +5070,7 @@
44025071 } else {
44035072 for ( var i = 0, l = insert.length; i < l; i++ ) {
44045073 var elems = (i > 0 ? this.clone(true) : this).get();
4405 - jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
 5074+ jQuery( insert[i] )[ original ]( elems );
44065075 ret = ret.concat( elems );
44075076 }
44085077
@@ -4436,7 +5105,7 @@
44375106
44385107 } else if ( typeof elem === "string" ) {
44395108 // Fix "XHTML"-style tags in all browsers
4440 - elem = elem.replace(rxhtmlTag, fcloseTag);
 5109+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
44415110
44425111 // Trim whitespace, otherwise indexOf won't work as expected
44435112 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
@@ -4489,7 +5158,7 @@
44905159 }
44915160
44925161 if ( fragment ) {
4493 - for ( var i = 0; ret[i]; i++ ) {
 5162+ for ( i = 0; ret[i]; i++ ) {
44945163 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
44955164 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
44965165
@@ -4511,18 +5180,22 @@
45125181 deleteExpando = jQuery.support.deleteExpando;
45135182
45145183 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
 5184+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
 5185+ continue;
 5186+ }
 5187+
45155188 id = elem[ jQuery.expando ];
45165189
45175190 if ( id ) {
45185191 data = cache[ id ];
45195192
4520 - if ( data.events ) {
 5193+ if ( data && data.events ) {
45215194 for ( var type in data.events ) {
45225195 if ( special[ type ] ) {
45235196 jQuery.event.remove( elem, type );
45245197
45255198 } else {
4526 - removeEvent( elem, type, data.handle );
 5199+ jQuery.removeEvent( elem, type, data.handle );
45275200 }
45285201 }
45295202 }
@@ -4539,252 +5212,379 @@
45405213 }
45415214 }
45425215 });
4543 -// exclude the following css properties to add px
4544 -var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
4545 - ralpha = /alpha\([^)]*\)/,
 5216+
 5217+function evalScript( i, elem ) {
 5218+ if ( elem.src ) {
 5219+ jQuery.ajax({
 5220+ url: elem.src,
 5221+ async: false,
 5222+ dataType: "script"
 5223+ });
 5224+ } else {
 5225+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
 5226+ }
 5227+
 5228+ if ( elem.parentNode ) {
 5229+ elem.parentNode.removeChild( elem );
 5230+ }
 5231+}
 5232+
 5233+
 5234+
 5235+
 5236+var ralpha = /alpha\([^)]*\)/i,
45465237 ropacity = /opacity=([^)]*)/,
4547 - rfloat = /float/i,
45485238 rdashAlpha = /-([a-z])/ig,
45495239 rupper = /([A-Z])/g,
45505240 rnumpx = /^-?\d+(?:px)?$/i,
45515241 rnum = /^-?\d/,
45525242
4553 - cssShow = { position: "absolute", visibility: "hidden", display:"block" },
 5243+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
45545244 cssWidth = [ "Left", "Right" ],
45555245 cssHeight = [ "Top", "Bottom" ],
 5246+ curCSS,
45565247
4557 - // cache check for defaultView.getComputedStyle
4558 - getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
4559 - // normalize float css property
4560 - styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
 5248+ getComputedStyle,
 5249+ currentStyle,
 5250+
45615251 fcamelCase = function( all, letter ) {
45625252 return letter.toUpperCase();
45635253 };
45645254
45655255 jQuery.fn.css = function( name, value ) {
4566 - return access( this, name, value, true, function( elem, name, value ) {
4567 - if ( value === undefined ) {
4568 - return jQuery.curCSS( elem, name );
4569 - }
4570 -
4571 - if ( typeof value === "number" && !rexclude.test(name) ) {
4572 - value += "px";
4573 - }
 5256+ // Setting 'undefined' is a no-op
 5257+ if ( arguments.length === 2 && value === undefined ) {
 5258+ return this;
 5259+ }
45745260
4575 - jQuery.style( elem, name, value );
 5261+ return jQuery.access( this, name, value, true, function( elem, name, value ) {
 5262+ return value !== undefined ?
 5263+ jQuery.style( elem, name, value ) :
 5264+ jQuery.css( elem, name );
45765265 });
45775266 };
45785267
45795268 jQuery.extend({
4580 - style: function( elem, name, value ) {
4581 - // don't set styles on text and comment nodes
4582 - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
4583 - return undefined;
 5269+ // Add in style property hooks for overriding the default
 5270+ // behavior of getting and setting a style property
 5271+ cssHooks: {
 5272+ opacity: {
 5273+ get: function( elem, computed ) {
 5274+ if ( computed ) {
 5275+ // We should always get a number back from opacity
 5276+ var ret = curCSS( elem, "opacity", "opacity" );
 5277+ return ret === "" ? "1" : ret;
 5278+
 5279+ } else {
 5280+ return elem.style.opacity;
 5281+ }
 5282+ }
45845283 }
 5284+ },
45855285
4586 - // ignore negative width and height values #1599
4587 - if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
4588 - value = undefined;
 5286+ // Exclude the following css properties to add px
 5287+ cssNumber: {
 5288+ "zIndex": true,
 5289+ "fontWeight": true,
 5290+ "opacity": true,
 5291+ "zoom": true,
 5292+ "lineHeight": true
 5293+ },
 5294+
 5295+ // Add in properties whose names you wish to fix before
 5296+ // setting or getting the value
 5297+ cssProps: {
 5298+ // normalize float css property
 5299+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
 5300+ },
 5301+
 5302+ // Get and set the style property on a DOM Node
 5303+ style: function( elem, name, value, extra ) {
 5304+ // Don't set styles on text and comment nodes
 5305+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
 5306+ return;
45895307 }
45905308
4591 - var style = elem.style || elem, set = value !== undefined;
 5309+ // Make sure that we're working with the right name
 5310+ var ret, origName = jQuery.camelCase( name ),
 5311+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
45925312
4593 - // IE uses filters for opacity
4594 - if ( !jQuery.support.opacity && name === "opacity" ) {
4595 - if ( set ) {
4596 - // IE has trouble with opacity if it does not have layout
4597 - // Force it by setting the zoom level
4598 - style.zoom = 1;
 5313+ name = jQuery.cssProps[ origName ] || origName;
45995314
4600 - // Set the alpha filter to set the opacity
4601 - var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
4602 - var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
4603 - style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
 5315+ // Check if we're setting a value
 5316+ if ( value !== undefined ) {
 5317+ // Make sure that NaN and null values aren't set. See: #7116
 5318+ if ( typeof value === "number" && isNaN( value ) || value == null ) {
 5319+ return;
46045320 }
46055321
4606 - return style.filter && style.filter.indexOf("opacity=") >= 0 ?
4607 - (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
4608 - "";
 5322+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
 5323+ if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
 5324+ value += "px";
 5325+ }
 5326+
 5327+ // If a hook was provided, use that value, otherwise just set the specified value
 5328+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
 5329+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
 5330+ // Fixes bug #5509
 5331+ try {
 5332+ style[ name ] = value;
 5333+ } catch(e) {}
 5334+ }
 5335+
 5336+ } else {
 5337+ // If a hook was provided get the non-computed value from there
 5338+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
 5339+ return ret;
 5340+ }
 5341+
 5342+ // Otherwise just get the value from the style object
 5343+ return style[ name ];
46095344 }
 5345+ },
46105346
4611 - // Make sure we're using the right name for getting the float value
4612 - if ( rfloat.test( name ) ) {
4613 - name = styleFloat;
 5347+ css: function( elem, name, extra ) {
 5348+ // Make sure that we're working with the right name
 5349+ var ret, origName = jQuery.camelCase( name ),
 5350+ hooks = jQuery.cssHooks[ origName ];
 5351+
 5352+ name = jQuery.cssProps[ origName ] || origName;
 5353+
 5354+ // If a hook was provided get the computed value from there
 5355+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
 5356+ return ret;
 5357+
 5358+ // Otherwise, if a way to get the computed value exists, use that
 5359+ } else if ( curCSS ) {
 5360+ return curCSS( elem, name, origName );
46145361 }
 5362+ },
46155363
4616 - name = name.replace(rdashAlpha, fcamelCase);
 5364+ // A method for quickly swapping in/out CSS properties to get correct calculations
 5365+ swap: function( elem, options, callback ) {
 5366+ var old = {};
46175367
4618 - if ( set ) {
4619 - style[ name ] = value;
 5368+ // Remember the old values, and insert the new ones
 5369+ for ( var name in options ) {
 5370+ old[ name ] = elem.style[ name ];
 5371+ elem.style[ name ] = options[ name ];
46205372 }
46215373
4622 - return style[ name ];
 5374+ callback.call( elem );
 5375+
 5376+ // Revert the old values
 5377+ for ( name in options ) {
 5378+ elem.style[ name ] = old[ name ];
 5379+ }
46235380 },
46245381
4625 - css: function( elem, name, force, extra ) {
4626 - if ( name === "width" || name === "height" ) {
4627 - var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
 5382+ camelCase: function( string ) {
 5383+ return string.replace( rdashAlpha, fcamelCase );
 5384+ }
 5385+});
46285386
4629 - function getWH() {
4630 - val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
 5387+// DEPRECATED, Use jQuery.css() instead
 5388+jQuery.curCSS = jQuery.css;
46315389
4632 - if ( extra === "border" ) {
4633 - return;
 5390+jQuery.each(["height", "width"], function( i, name ) {
 5391+ jQuery.cssHooks[ name ] = {
 5392+ get: function( elem, computed, extra ) {
 5393+ var val;
 5394+
 5395+ if ( computed ) {
 5396+ if ( elem.offsetWidth !== 0 ) {
 5397+ val = getWH( elem, name, extra );
 5398+
 5399+ } else {
 5400+ jQuery.swap( elem, cssShow, function() {
 5401+ val = getWH( elem, name, extra );
 5402+ });
46345403 }
46355404
4636 - jQuery.each( which, function() {
4637 - if ( !extra ) {
4638 - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
 5405+ if ( val <= 0 ) {
 5406+ val = curCSS( elem, name, name );
 5407+
 5408+ if ( val === "0px" && currentStyle ) {
 5409+ val = currentStyle( elem, name, name );
46395410 }
46405411
4641 - if ( extra === "margin" ) {
4642 - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
4643 - } else {
4644 - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
 5412+ if ( val != null ) {
 5413+ // Should return "auto" instead of 0, use 0 for
 5414+ // temporary backwards-compat
 5415+ return val === "" || val === "auto" ? "0px" : val;
46455416 }
4646 - });
 5417+ }
 5418+
 5419+ if ( val < 0 || val == null ) {
 5420+ val = elem.style[ name ];
 5421+
 5422+ // Should return "auto" instead of 0, use 0 for
 5423+ // temporary backwards-compat
 5424+ return val === "" || val === "auto" ? "0px" : val;
 5425+ }
 5426+
 5427+ return typeof val === "string" ? val : val + "px";
46475428 }
 5429+ },
46485430
4649 - if ( elem.offsetWidth !== 0 ) {
4650 - getWH();
 5431+ set: function( elem, value ) {
 5432+ if ( rnumpx.test( value ) ) {
 5433+ // ignore negative width and height values #1599
 5434+ value = parseFloat(value);
 5435+
 5436+ if ( value >= 0 ) {
 5437+ return value + "px";
 5438+ }
 5439+
46515440 } else {
4652 - jQuery.swap( elem, props, getWH );
 5441+ return value;
46535442 }
4654 -
4655 - return Math.max(0, Math.round(val));
46565443 }
 5444+ };
 5445+});
46575446
4658 - return jQuery.curCSS( elem, name, force );
4659 - },
 5447+if ( !jQuery.support.opacity ) {
 5448+ jQuery.cssHooks.opacity = {
 5449+ get: function( elem, computed ) {
 5450+ // IE uses filters for opacity
 5451+ return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
 5452+ (parseFloat(RegExp.$1) / 100) + "" :
 5453+ computed ? "1" : "";
 5454+ },
46605455
4661 - curCSS: function( elem, name, force ) {
4662 - var ret, style = elem.style, filter;
 5456+ set: function( elem, value ) {
 5457+ var style = elem.style;
46635458
4664 - // IE uses filters for opacity
4665 - if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
4666 - ret = ropacity.test(elem.currentStyle.filter || "") ?
4667 - (parseFloat(RegExp.$1) / 100) + "" :
4668 - "";
 5459+ // IE has trouble with opacity if it does not have layout
 5460+ // Force it by setting the zoom level
 5461+ style.zoom = 1;
46695462
4670 - return ret === "" ?
4671 - "1" :
4672 - ret;
4673 - }
 5463+ // Set the alpha filter to set the opacity
 5464+ var opacity = jQuery.isNaN(value) ?
 5465+ "" :
 5466+ "alpha(opacity=" + value * 100 + ")",
 5467+ filter = style.filter || "";
46745468
4675 - // Make sure we're using the right name for getting the float value
4676 - if ( rfloat.test( name ) ) {
4677 - name = styleFloat;
 5469+ style.filter = ralpha.test(filter) ?
 5470+ filter.replace(ralpha, opacity) :
 5471+ style.filter + ' ' + opacity;
46785472 }
 5473+ };
 5474+}
46795475
4680 - if ( !force && style && style[ name ] ) {
4681 - ret = style[ name ];
 5476+if ( document.defaultView && document.defaultView.getComputedStyle ) {
 5477+ getComputedStyle = function( elem, newName, name ) {
 5478+ var ret, defaultView, computedStyle;
46825479
4683 - } else if ( getComputedStyle ) {
 5480+ name = name.replace( rupper, "-$1" ).toLowerCase();
46845481
4685 - // Only "float" is needed here
4686 - if ( rfloat.test( name ) ) {
4687 - name = "float";
 5482+ if ( !(defaultView = elem.ownerDocument.defaultView) ) {
 5483+ return undefined;
 5484+ }
 5485+
 5486+ if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
 5487+ ret = computedStyle.getPropertyValue( name );
 5488+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
 5489+ ret = jQuery.style( elem, name );
46885490 }
 5491+ }
46895492
4690 - name = name.replace( rupper, "-$1" ).toLowerCase();
 5493+ return ret;
 5494+ };
 5495+}
46915496
4692 - var defaultView = elem.ownerDocument.defaultView;
 5497+if ( document.documentElement.currentStyle ) {
 5498+ currentStyle = function( elem, name ) {
 5499+ var left, rsLeft,
 5500+ ret = elem.currentStyle && elem.currentStyle[ name ],
 5501+ style = elem.style;
46935502
4694 - if ( !defaultView ) {
4695 - return null;
4696 - }
 5503+ // From the awesome hack by Dean Edwards
 5504+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
46975505
4698 - var computedStyle = defaultView.getComputedStyle( elem, null );
 5506+ // If we're not dealing with a regular pixel number
 5507+ // but a number that has a weird ending, we need to convert it to pixels
 5508+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
 5509+ // Remember the original values
 5510+ left = style.left;
 5511+ rsLeft = elem.runtimeStyle.left;
46995512
4700 - if ( computedStyle ) {
4701 - ret = computedStyle.getPropertyValue( name );
4702 - }
 5513+ // Put in the new values to get a computed value out
 5514+ elem.runtimeStyle.left = elem.currentStyle.left;
 5515+ style.left = name === "fontSize" ? "1em" : (ret || 0);
 5516+ ret = style.pixelLeft + "px";
47035517
4704 - // We should always get a number back from opacity
4705 - if ( name === "opacity" && ret === "" ) {
4706 - ret = "1";
4707 - }
 5518+ // Revert the changed values
 5519+ style.left = left;
 5520+ elem.runtimeStyle.left = rsLeft;
 5521+ }
47085522
4709 - } else if ( elem.currentStyle ) {
4710 - var camelCase = name.replace(rdashAlpha, fcamelCase);
 5523+ return ret === "" ? "auto" : ret;
 5524+ };
 5525+}
47115526
4712 - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
 5527+curCSS = getComputedStyle || currentStyle;
47135528
4714 - // From the awesome hack by Dean Edwards
4715 - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
 5529+function getWH( elem, name, extra ) {
 5530+ var which = name === "width" ? cssWidth : cssHeight,
 5531+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
47165532
4717 - // If we're not dealing with a regular pixel number
4718 - // but a number that has a weird ending, we need to convert it to pixels
4719 - if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
4720 - // Remember the original values
4721 - var left = style.left, rsLeft = elem.runtimeStyle.left;
 5533+ if ( extra === "border" ) {
 5534+ return val;
 5535+ }
47225536
4723 - // Put in the new values to get a computed value out
4724 - elem.runtimeStyle.left = elem.currentStyle.left;
4725 - style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
4726 - ret = style.pixelLeft + "px";
4727 -
4728 - // Revert the changed values
4729 - style.left = left;
4730 - elem.runtimeStyle.left = rsLeft;
4731 - }
 5537+ jQuery.each( which, function() {
 5538+ if ( !extra ) {
 5539+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
47325540 }
47335541
4734 - return ret;
4735 - },
 5542+ if ( extra === "margin" ) {
 5543+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
47365544
4737 - // A method for quickly swapping in/out CSS properties to get correct calculations
4738 - swap: function( elem, options, callback ) {
4739 - var old = {};
4740 -
4741 - // Remember the old values, and insert the new ones
4742 - for ( var name in options ) {
4743 - old[ name ] = elem.style[ name ];
4744 - elem.style[ name ] = options[ name ];
 5545+ } else {
 5546+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
47455547 }
 5548+ });
47465549
4747 - callback.call( elem );
 5550+ return val;
 5551+}
47485552
4749 - // Revert the old values
4750 - for ( var name in options ) {
4751 - elem.style[ name ] = old[ name ];
4752 - }
4753 - }
4754 -});
4755 -
47565553 if ( jQuery.expr && jQuery.expr.filters ) {
47575554 jQuery.expr.filters.hidden = function( elem ) {
4758 - var width = elem.offsetWidth, height = elem.offsetHeight,
4759 - skip = elem.nodeName.toLowerCase() === "tr";
 5555+ var width = elem.offsetWidth,
 5556+ height = elem.offsetHeight;
47605557
4761 - return width === 0 && height === 0 && !skip ?
4762 - true :
4763 - width > 0 && height > 0 && !skip ?
4764 - false :
4765 - jQuery.curCSS(elem, "display") === "none";
 5558+ return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
47665559 };
47675560
47685561 jQuery.expr.filters.visible = function( elem ) {
47695562 return !jQuery.expr.filters.hidden( elem );
47705563 };
47715564 }
4772 -var jsc = now(),
4773 - rscript = /<script(.|\s)*?\/script>/gi,
4774 - rselectTextarea = /select|textarea/i,
4775 - rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
4776 - jsre = /=\?(&|$)/,
 5565+
 5566+
 5567+
 5568+
 5569+var jsc = jQuery.now(),
 5570+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
 5571+ rselectTextarea = /^(?:select|textarea)/i,
 5572+ rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
 5573+ rnoContent = /^(?:GET|HEAD)$/,
 5574+ rbracket = /\[\]$/,
 5575+ jsre = /\=\?(&|$)/,
47775576 rquery = /\?/,
4778 - rts = /(\?|&)_=.*?(&|$)/,
 5577+ rts = /([?&])_=[^&]*/,
47795578 rurl = /^(\w+:)?\/\/([^\/?#]+)/,
47805579 r20 = /%20/g,
 5580+ rhash = /#.*$/,
47815581
47825582 // Keep a copy of the old load method
47835583 _load = jQuery.fn.load;
47845584
47855585 jQuery.fn.extend({
47865586 load: function( url, params, callback ) {
4787 - if ( typeof url !== "string" ) {
4788 - return _load.call( this, url );
 5587+ if ( typeof url !== "string" && _load ) {
 5588+ return _load.apply( this, arguments );
47895589
47905590 // Don't do a request if no elements are being requested
47915591 } else if ( !this.length ) {
@@ -4829,7 +5629,7 @@
48305630 // See if a selector was specified
48315631 self.html( selector ?
48325632 // Create a dummy div to hold the results
4833 - jQuery("<div />")
 5633+ jQuery("<div>")
48345634 // inject the contents of the document in, removing the scripts
48355635 // to avoid any 'Permission Denied' errors in IE
48365636 .append(res.responseText.replace(rscript, ""))
@@ -4853,6 +5653,7 @@
48545654 serialize: function() {
48555655 return jQuery.param(this.serializeArray());
48565656 },
 5657+
48575658 serializeArray: function() {
48585659 return this.map(function() {
48595660 return this.elements ? jQuery.makeArray(this.elements) : this;
@@ -4884,7 +5685,6 @@
48855686 });
48865687
48875688 jQuery.extend({
4888 -
48895689 get: function( url, data, callback, type ) {
48905690 // shift arguments if data argument was omited
48915691 if ( jQuery.isFunction( data ) ) {
@@ -4945,19 +5745,10 @@
49465746 password: null,
49475747 traditional: false,
49485748 */
4949 - // Create the request object; Microsoft failed to properly
4950 - // implement the XMLHttpRequest in IE7 (can't request local files),
4951 - // so we use the ActiveXObject when it is available
49525749 // This function can be overriden by calling jQuery.ajaxSetup
4953 - xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
4954 - function() {
4955 - return new window.XMLHttpRequest();
4956 - } :
4957 - function() {
4958 - try {
4959 - return new window.ActiveXObject("Microsoft.XMLHTTP");
4960 - } catch(e) {}
4961 - },
 5750+ xhr: function() {
 5751+ return new window.XMLHttpRequest();
 5752+ },
49625753 accepts: {
49635754 xml: "application/xml, text/xml",
49645755 html: "text/html",
@@ -4968,17 +5759,15 @@
49695760 }
49705761 },
49715762
4972 - // Last-Modified header cache for next request
4973 - lastModified: {},
4974 - etag: {},
4975 -
49765763 ajax: function( origSettings ) {
4977 - var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
4978 -
4979 - var jsonp, status, data,
4980 - callbackContext = origSettings && origSettings.context || s,
4981 - type = s.type.toUpperCase();
 5764+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
 5765+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
49825766
 5767+ s.url = s.url.replace( rhash, "" );
 5768+
 5769+ // Use original (not extended) context object if it was provided
 5770+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
 5771+
49835772 // convert data if not already a string
49845773 if ( s.data && s.processData && typeof s.data !== "string" ) {
49855774 s.data = jQuery.param( s.data, s.traditional );
@@ -5012,17 +5801,25 @@
50135802 s.dataType = "script";
50145803
50155804 // Handle JSONP-style loading
5016 - window[ jsonp ] = window[ jsonp ] || function( tmp ) {
5017 - data = tmp;
5018 - success();
5019 - complete();
5020 - // Garbage collect
5021 - window[ jsonp ] = undefined;
 5805+ var customJsonp = window[ jsonp ];
50225806
5023 - try {
5024 - delete window[ jsonp ];
5025 - } catch(e) {}
 5807+ window[ jsonp ] = function( tmp ) {
 5808+ if ( jQuery.isFunction( customJsonp ) ) {
 5809+ customJsonp( tmp );
50265810
 5811+ } else {
 5812+ // Garbage collect
 5813+ window[ jsonp ] = undefined;
 5814+
 5815+ try {
 5816+ delete window[ jsonp ];
 5817+ } catch( jsonpError ) {}
 5818+ }
 5819+
 5820+ data = tmp;
 5821+ jQuery.handleSuccess( s, xhr, status, data );
 5822+ jQuery.handleComplete( s, xhr, status, data );
 5823+
50275824 if ( head ) {
50285825 head.removeChild( script );
50295826 }
@@ -5033,39 +5830,39 @@
50345831 s.cache = false;
50355832 }
50365833
5037 - if ( s.cache === false && type === "GET" ) {
5038 - var ts = now();
 5834+ if ( s.cache === false && noContent ) {
 5835+ var ts = jQuery.now();
50395836
50405837 // try replacing _= if it is there
5041 - var ret = s.url.replace(rts, "$1_=" + ts + "$2");
 5838+ var ret = s.url.replace(rts, "$1_=" + ts);
50425839
50435840 // if nothing was replaced, add timestamp to the end
50445841 s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
50455842 }
50465843
5047 - // If data is available, append data to url for get requests
5048 - if ( s.data && type === "GET" ) {
 5844+ // If data is available, append data to url for GET/HEAD requests
 5845+ if ( s.data && noContent ) {
50495846 s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
50505847 }
50515848
50525849 // Watch for a new set of requests
5053 - if ( s.global && ! jQuery.active++ ) {
 5850+ if ( s.global && jQuery.active++ === 0 ) {
50545851 jQuery.event.trigger( "ajaxStart" );
50555852 }
50565853
50575854 // Matches an absolute URL, and saves the domain
50585855 var parts = rurl.exec( s.url ),
5059 - remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
 5856+ remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
50605857
50615858 // If we're requesting a remote document
50625859 // and trying to load JSON or Script with a GET
50635860 if ( s.dataType === "script" && type === "GET" && remote ) {
50645861 var head = document.getElementsByTagName("head")[0] || document.documentElement;
50655862 var script = document.createElement("script");
5066 - script.src = s.url;
50675863 if ( s.scriptCharset ) {
50685864 script.charset = s.scriptCharset;
50695865 }
 5866+ script.src = s.url;
50705867
50715868 // Handle Script loading
50725869 if ( !jsonp ) {
@@ -5076,8 +5873,8 @@
50775874 if ( !done && (!this.readyState ||
50785875 this.readyState === "loaded" || this.readyState === "complete") ) {
50795876 done = true;
5080 - success();
5081 - complete();
 5877+ jQuery.handleSuccess( s, xhr, status, data );
 5878+ jQuery.handleComplete( s, xhr, status, data );
50825879
50835880 // Handle memory leak in IE
50845881 script.onload = script.onreadystatechange = null;
@@ -5115,8 +5912,8 @@
51165913
51175914 // Need an extra try/catch for cross domain requests in Firefox 3
51185915 try {
5119 - // Set the correct header, if data is being sent
5120 - if ( s.data || origSettings && origSettings.contentType ) {
 5916+ // Set content-type if data specified and content-body is valid for this type
 5917+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
51215918 xhr.setRequestHeader("Content-Type", s.contentType);
51225919 }
51235920
@@ -5139,14 +5936,14 @@
51405937
51415938 // Set the Accepts header for the server, depending on the dataType
51425939 xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
5143 - s.accepts[ s.dataType ] + ", */*" :
 5940+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
51445941 s.accepts._default );
5145 - } catch(e) {}
 5942+ } catch( headerError ) {}
51465943
51475944 // Allow custom headers/mimetypes and early abort
5148 - if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
 5945+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
51495946 // Handle the global AJAX counter
5150 - if ( s.global && ! --jQuery.active ) {
 5947+ if ( s.global && jQuery.active-- === 1 ) {
51515948 jQuery.event.trigger( "ajaxStop" );
51525949 }
51535950
@@ -5156,7 +5953,7 @@
51575954 }
51585955
51595956 if ( s.global ) {
5160 - trigger("ajaxSend", [xhr, s]);
 5957+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
51615958 }
51625959
51635960 // Wait for a response to come back
@@ -5166,7 +5963,7 @@
51675964 // Opera doesn't call onreadystatechange before this point
51685965 // so we simulate the call
51695966 if ( !requestDone ) {
5170 - complete();
 5967+ jQuery.handleComplete( s, xhr, status, data );
51715968 }
51725969
51735970 requestDone = true;
@@ -5194,9 +5991,9 @@
51955992 try {
51965993 // process the data (runs the xml through httpData regardless of callback)
51975994 data = jQuery.httpData( xhr, s.dataType, s );
5198 - } catch(err) {
 5995+ } catch( parserError ) {
51995996 status = "parsererror";
5200 - errMsg = err;
 5997+ errMsg = parserError;
52015998 }
52025999 }
52036000
@@ -5204,14 +6001,16 @@
52056002 if ( status === "success" || status === "notmodified" ) {
52066003 // JSONP handles its own success callback
52076004 if ( !jsonp ) {
5208 - success();
 6005+ jQuery.handleSuccess( s, xhr, status, data );
52096006 }
52106007 } else {
5211 - jQuery.handleError(s, xhr, status, errMsg);
 6008+ jQuery.handleError( s, xhr, status, errMsg );
52126009 }
52136010
52146011 // Fire the complete handlers
5215 - complete();
 6012+ if ( !jsonp ) {
 6013+ jQuery.handleComplete( s, xhr, status, data );
 6014+ }
52166015
52176016 if ( isTimeout === "timeout" ) {
52186017 xhr.abort();
@@ -5224,18 +6023,21 @@
52256024 }
52266025 };
52276026
5228 - // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
 6027+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
52296028 // Opera doesn't fire onreadystatechange at all on abort
52306029 try {
52316030 var oldAbort = xhr.abort;
52326031 xhr.abort = function() {
52336032 if ( xhr ) {
5234 - oldAbort.call( 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 );
52356037 }
52366038
52376039 onreadystatechange( "abort" );
52386040 };
5239 - } catch(e) { }
 6041+ } catch( abortError ) {}
52406042
52416043 // Timeout checker
52426044 if ( s.async && s.timeout > 0 ) {
@@ -5249,11 +6051,13 @@
52506052
52516053 // Send the data
52526054 try {
5253 - xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
5254 - } catch(e) {
5255 - jQuery.handleError(s, xhr, null, e);
 6055+ xhr.send( noContent || s.data == null ? null : s.data );
 6056+
 6057+ } catch( sendError ) {
 6058+ jQuery.handleError( s, xhr, null, sendError );
 6059+
52566060 // Fire the complete handlers
5257 - complete();
 6061+ jQuery.handleComplete( s, xhr, status, data );
52586062 }
52596063
52606064 // firefox 1.5 doesn't fire statechange for sync requests
@@ -5261,66 +6065,145 @@
52626066 onreadystatechange();
52636067 }
52646068
5265 - function success() {
5266 - // If a local callback was specified, fire it and pass it the data
5267 - if ( s.success ) {
5268 - s.success.call( callbackContext, data, status, xhr );
5269 - }
 6069+ // return XMLHttpRequest to allow aborting the request etc.
 6070+ return xhr;
 6071+ },
52706072
5271 - // Fire the global callback
5272 - if ( s.global ) {
5273 - trigger( "ajaxSuccess", [xhr, s] );
 6073+ // Serialize an array of form elements or a set of
 6074+ // key/values into a query string
 6075+ param: function( a, traditional ) {
 6076+ var s = [],
 6077+ add = function( key, value ) {
 6078+ // 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);
 6081+ };
 6082+
 6083+ // Set traditional to true for jQuery <= 1.3.2 behavior.
 6084+ if ( traditional === undefined ) {
 6085+ traditional = jQuery.ajaxSettings.traditional;
 6086+ }
 6087+
 6088+ // If an array was passed in, assume that it is an array of form elements.
 6089+ if ( jQuery.isArray(a) || a.jquery ) {
 6090+ // Serialize the form elements
 6091+ jQuery.each( a, function() {
 6092+ add( this.name, this.value );
 6093+ });
 6094+
 6095+ } else {
 6096+ // If traditional, encode the "old" way (the way 1.3.2 or older
 6097+ // did it), otherwise encode params recursively.
 6098+ for ( var prefix in a ) {
 6099+ buildParams( prefix, a[prefix], traditional, add );
52746100 }
52756101 }
52766102
5277 - function complete() {
5278 - // Process result
5279 - if ( s.complete ) {
5280 - s.complete.call( callbackContext, xhr, status);
5281 - }
 6103+ // Return the resulting serialization
 6104+ return s.join("&").replace(r20, "+");
 6105+ }
 6106+});
52826107
5283 - // The request was completed
5284 - if ( s.global ) {
5285 - trigger( "ajaxComplete", [xhr, s] );
 6108+function buildParams( prefix, obj, traditional, add ) {
 6109+ if ( jQuery.isArray(obj) && obj.length ) {
 6110+ // Serialize array item.
 6111+ jQuery.each( obj, function( i, v ) {
 6112+ if ( traditional || rbracket.test( prefix ) ) {
 6113+ // Treat each array item as a scalar.
 6114+ add( prefix, v );
 6115+
 6116+ } else {
 6117+ // If array item is non-scalar (array or object), encode its
 6118+ // numeric index to resolve deserialization ambiguity issues.
 6119+ // Note that rack (as of 1.0.0) can't currently deserialize
 6120+ // nested arrays properly, and attempting to do so may cause
 6121+ // a server error. Possible fixes are to modify rack's
 6122+ // deserialization algorithm or to provide an option or flag
 6123+ // to force array serialization to be shallow.
 6124+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
52866125 }
 6126+ });
 6127+
 6128+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
 6129+ if ( jQuery.isEmptyObject( obj ) ) {
 6130+ add( prefix, "" );
52876131
5288 - // Handle the global AJAX counter
5289 - if ( s.global && ! --jQuery.active ) {
5290 - jQuery.event.trigger( "ajaxStop" );
5291 - }
 6132+ // Serialize object item.
 6133+ } else {
 6134+ jQuery.each( obj, function( k, v ) {
 6135+ buildParams( prefix + "[" + k + "]", v, traditional, add );
 6136+ });
52926137 }
5293 -
5294 - function trigger(type, args) {
5295 - (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
5296 - }
 6138+
 6139+ } else {
 6140+ // Serialize scalar item.
 6141+ add( prefix, obj );
 6142+ }
 6143+}
52976144
5298 - // return XMLHttpRequest to allow aborting the request etc.
5299 - return xhr;
5300 - },
 6145+// This is still on the jQuery object... for now
 6146+// Want to move this to jQuery.ajax some day
 6147+jQuery.extend({
53016148
 6149+ // Counter for holding the number of active queries
 6150+ active: 0,
 6151+
 6152+ // Last-Modified header cache for next request
 6153+ lastModified: {},
 6154+ etag: {},
 6155+
53026156 handleError: function( s, xhr, status, e ) {
53036157 // If a local callback was specified, fire it
53046158 if ( s.error ) {
5305 - s.error.call( s.context || s, xhr, status, e );
 6159+ s.error.call( s.context, xhr, status, e );
53066160 }
53076161
53086162 // Fire the global callback
53096163 if ( s.global ) {
5310 - (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
 6164+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
53116165 }
53126166 },
53136167
5314 - // Counter for holding the number of active queries
5315 - active: 0,
 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 );
 6172+ }
53166173
 6174+ // Fire the global callback
 6175+ if ( s.global ) {
 6176+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
 6177+ }
 6178+ },
 6179+
 6180+ handleComplete: function( s, xhr, status ) {
 6181+ // Process result
 6182+ if ( s.complete ) {
 6183+ s.complete.call( s.context, xhr, status );
 6184+ }
 6185+
 6186+ // The request was completed
 6187+ if ( s.global ) {
 6188+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
 6189+ }
 6190+
 6191+ // Handle the global AJAX counter
 6192+ if ( s.global && jQuery.active-- === 1 ) {
 6193+ jQuery.event.trigger( "ajaxStop" );
 6194+ }
 6195+ },
 6196+
 6197+ triggerGlobal: function( s, type, args ) {
 6198+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
 6199+ },
 6200+
53176201 // Determines if an XMLHttpRequest was successful or not
53186202 httpSuccess: function( xhr ) {
53196203 try {
53206204 // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
53216205 return !xhr.status && location.protocol === "file:" ||
5322 - // Opera returns 0 when status is 304
5323 - ( xhr.status >= 200 && xhr.status < 300 ) ||
5324 - xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
 6206+ xhr.status >= 200 && xhr.status < 300 ||
 6207+ xhr.status === 304 || xhr.status === 1223;
53256208 } catch(e) {}
53266209
53276210 return false;
@@ -5339,8 +6222,7 @@
53406223 jQuery.etag[url] = etag;
53416224 }
53426225
5343 - // Opera returns 0 when status is 304
5344 - return xhr.status === 304 || xhr.status === 0;
 6226+ return xhr.status === 304;
53456227 },
53466228
53476229 httpData: function( xhr, type, s ) {
@@ -5371,77 +6253,40 @@
53726254 }
53736255
53746256 return data;
5375 - },
 6257+ }
53766258
5377 - // Serialize an array of form elements or a set of
5378 - // key/values into a query string
5379 - param: function( a, traditional ) {
5380 - var s = [];
5381 -
5382 - // Set traditional to true for jQuery <= 1.3.2 behavior.
5383 - if ( traditional === undefined ) {
5384 - traditional = jQuery.ajaxSettings.traditional;
 6259+});
 6260+
 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) {}
53856274 }
5386 -
5387 - // If an array was passed in, assume that it is an array of form elements.
5388 - if ( jQuery.isArray(a) || a.jquery ) {
5389 - // Serialize the form elements
5390 - jQuery.each( a, function() {
5391 - add( this.name, this.value );
5392 - });
5393 -
5394 - } else {
5395 - // If traditional, encode the "old" way (the way 1.3.2 or older
5396 - // did it), otherwise encode params recursively.
5397 - for ( var prefix in a ) {
5398 - buildParams( prefix, a[prefix] );
5399 - }
5400 - }
54016275
5402 - // Return the resulting serialization
5403 - return s.join("&").replace(r20, "+");
 6276+ try {
 6277+ return new window.ActiveXObject("Microsoft.XMLHTTP");
 6278+ } catch(activeError) {}
 6279+ };
 6280+}
54046281
5405 - function buildParams( prefix, obj ) {
5406 - if ( jQuery.isArray(obj) ) {
5407 - // Serialize array item.
5408 - jQuery.each( obj, function( i, v ) {
5409 - if ( traditional || /\[\]$/.test( prefix ) ) {
5410 - // Treat each array item as a scalar.
5411 - add( prefix, v );
5412 - } else {
5413 - // If array item is non-scalar (array or object), encode its
5414 - // numeric index to resolve deserialization ambiguity issues.
5415 - // Note that rack (as of 1.0.0) can't currently deserialize
5416 - // nested arrays properly, and attempting to do so may cause
5417 - // a server error. Possible fixes are to modify rack's
5418 - // deserialization algorithm or to provide an option or flag
5419 - // to force array serialization to be shallow.
5420 - buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
5421 - }
5422 - });
5423 -
5424 - } else if ( !traditional && obj != null && typeof obj === "object" ) {
5425 - // Serialize object item.
5426 - jQuery.each( obj, function( k, v ) {
5427 - buildParams( prefix + "[" + k + "]", v );
5428 - });
5429 -
5430 - } else {
5431 - // Serialize scalar item.
5432 - add( prefix, obj );
5433 - }
5434 - }
 6282+// Does this browser support XHR requests?
 6283+jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
54356284
5436 - function add( key, value ) {
5437 - // If value is a function, invoke it and return its value
5438 - value = jQuery.isFunction(value) ? value() : value;
5439 - s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
5440 - }
5441 - }
5442 -});
 6285+
 6286+
 6287+
54436288 var elemdisplay = {},
5444 - rfxtypes = /toggle|show|hide/,
5445 - rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
 6289+ rfxtypes = /^(?:toggle|show|hide)$/,
 6290+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
54466291 timerId,
54476292 fxAttrs = [
54486293 // height animations
@@ -5453,66 +6298,63 @@
54546299 ];
54556300
54566301 jQuery.fn.extend({
5457 - show: function( speed, callback ) {
5458 - if ( speed || speed === 0) {
5459 - return this.animate( genFx("show", 3), speed, callback);
 6302+ show: function( speed, easing, callback ) {
 6303+ var elem, display;
54606304
 6305+ if ( speed || speed === 0 ) {
 6306+ return this.animate( genFx("show", 3), speed, easing, callback);
 6307+
54616308 } else {
5462 - for ( var i = 0, l = this.length; i < l; i++ ) {
5463 - var old = jQuery.data(this[i], "olddisplay");
 6309+ for ( var i = 0, j = this.length; i < j; i++ ) {
 6310+ elem = this[i];
 6311+ display = elem.style.display;
54646312
5465 - this[i].style.display = old || "";
 6313+ // Reset the inline display of this element to learn if it is
 6314+ // being hidden by cascaded rules or not
 6315+ if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
 6316+ display = elem.style.display = "";
 6317+ }
54666318
5467 - if ( jQuery.css(this[i], "display") === "none" ) {
5468 - var nodeName = this[i].nodeName, display;
5469 -
5470 - if ( elemdisplay[ nodeName ] ) {
5471 - display = elemdisplay[ nodeName ];
5472 -
5473 - } else {
5474 - var elem = jQuery("<" + nodeName + " />").appendTo("body");
5475 -
5476 - display = elem.css("display");
5477 -
5478 - if ( display === "none" ) {
5479 - display = "block";
5480 - }
5481 -
5482 - elem.remove();
5483 -
5484 - elemdisplay[ nodeName ] = display;
5485 - }
5486 -
5487 - jQuery.data(this[i], "olddisplay", display);
 6319+ // Set elements which have been overridden with display: none
 6320+ // in a stylesheet to whatever the default browser style is
 6321+ // for such an element
 6322+ if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
 6323+ jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
54886324 }
54896325 }
54906326
5491 - // Set the display of the elements in a second loop
 6327+ // Set the display of most of the elements in a second loop
54926328 // to avoid the constant reflow
5493 - for ( var j = 0, k = this.length; j < k; j++ ) {
5494 - this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
 6329+ for ( i = 0; i < j; i++ ) {
 6330+ elem = this[i];
 6331+ display = elem.style.display;
 6332+
 6333+ if ( display === "" || display === "none" ) {
 6334+ elem.style.display = jQuery.data(elem, "olddisplay") || "";
 6335+ }
54956336 }
54966337
54976338 return this;
54986339 }
54996340 },
55006341
5501 - hide: function( speed, callback ) {
 6342+ hide: function( speed, easing, callback ) {
55026343 if ( speed || speed === 0 ) {
5503 - return this.animate( genFx("hide", 3), speed, callback);
 6344+ return this.animate( genFx("hide", 3), speed, easing, callback);
55046345
55056346 } else {
5506 - for ( var i = 0, l = this.length; i < l; i++ ) {
5507 - var old = jQuery.data(this[i], "olddisplay");
5508 - if ( !old && old !== "none" ) {
5509 - jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
 6347+ for ( var i = 0, j = this.length; i < j; i++ ) {
 6348+ var display = jQuery.css( this[i], "display" );
 6349+
 6350+ if ( display !== "none" ) {
 6351+ jQuery.data( this[i], "olddisplay", display );
55106352 }
55116353 }
55126354
55136355 // Set the display of the elements in a second loop
55146356 // to avoid the constant reflow
5515 - for ( var j = 0, k = this.length; j < k; j++ ) {
5516 - this[j].style.display = "none";
 6357+ for ( i = 0; i < j; i++ ) {
 6358+ this[i].style.display = "none";
55176359 }
55186360
55196361 return this;
@@ -5522,7 +6364,7 @@
55236365 // Save the old toggle function
55246366 _toggle: jQuery.fn.toggle,
55256367
5526 - toggle: function( fn, fn2 ) {
 6368+ toggle: function( fn, fn2, callback ) {
55276369 var bool = typeof fn === "boolean";
55286370
55296371 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
@@ -5535,15 +6377,15 @@
55366378 });
55376379
55386380 } else {
5539 - this.animate(genFx("toggle", 3), fn, fn2);
 6381+ this.animate(genFx("toggle", 3), fn, fn2, callback);
55406382 }
55416383
55426384 return this;
55436385 },
55446386
5545 - fadeTo: function( speed, to, callback ) {
 6387+ fadeTo: function( speed, to, easing, callback ) {
55466388 return this.filter(":hidden").css("opacity", 0).show().end()
5547 - .animate({opacity: to}, speed, callback);
 6389+ .animate({opacity: to}, speed, easing, callback);
55486390 },
55496391
55506392 animate: function( prop, speed, easing, callback ) {
@@ -5554,12 +6396,16 @@
55556397 }
55566398
55576399 return this[ optall.queue === false ? "each" : "queue" ](function() {
 6400+ // XXX 'this' does not always have a nodeName when running the
 6401+ // test suite
 6402+
55586403 var opt = jQuery.extend({}, optall), p,
5559 - hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
 6404+ isElement = this.nodeType === 1,
 6405+ hidden = isElement && jQuery(this).is(":hidden"),
55606406 self = this;
55616407
55626408 for ( p in prop ) {
5563 - var name = p.replace(rdashAlpha, fcamelCase);
 6409+ var name = jQuery.camelCase( p );
55646410
55656411 if ( p !== name ) {
55666412 prop[ name ] = prop[ p ];
@@ -5571,12 +6417,35 @@
55726418 return opt.complete.call(this);
55736419 }
55746420
5575 - if ( ( p === "height" || p === "width" ) && this.style ) {
5576 - // Store display property
5577 - opt.display = jQuery.css(this, "display");
 6421+ if ( isElement && ( p === "height" || p === "width" ) ) {
 6422+ // Make sure that nothing sneaks out
 6423+ // Record all 3 overflow attributes because IE does not
 6424+ // change the overflow attribute when overflowX and
 6425+ // overflowY are set to the same value
 6426+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
55786427
5579 - // Make sure that nothing sneaks out
5580 - opt.overflow = this.style.overflow;
 6428+ // Set display property to inline-block for height/width
 6429+ // animations on inline elements that are having width/height
 6430+ // animated
 6431+ if ( jQuery.css( this, "display" ) === "inline" &&
 6432+ jQuery.css( this, "float" ) === "none" ) {
 6433+ if ( !jQuery.support.inlineBlockNeedsLayout ) {
 6434+ this.style.display = "inline-block";
 6435+
 6436+ } else {
 6437+ var display = defaultDisplay(this.nodeName);
 6438+
 6439+ // inline-level elements accept inline-block;
 6440+ // block-level elements need to be inline with layout
 6441+ if ( display === "inline" ) {
 6442+ this.style.display = "inline-block";
 6443+
 6444+ } else {
 6445+ this.style.display = "inline";
 6446+ this.style.zoom = 1;
 6447+ }
 6448+ }
 6449+ }
55816450 }
55826451
55836452 if ( jQuery.isArray( prop[p] ) ) {
@@ -5600,7 +6469,7 @@
56016470
56026471 } else {
56036472 var parts = rfxnum.exec(val),
5604 - start = e.cur(true) || 0;
 6473+ start = e.cur() || 0;
56056474
56066475 if ( parts ) {
56076476 var end = parseFloat( parts[2] ),
@@ -5608,9 +6477,9 @@
56096478
56106479 // We need to compute starting value
56116480 if ( unit !== "px" ) {
5612 - self.style[ name ] = (end || 1) + unit;
5613 - start = ((end || 1) / e.cur(true)) * start;
5614 - self.style[ name ] = start + unit;
 6481+ jQuery.style( self, name, (end || 1) + unit);
 6482+ start = ((end || 1) / e.cur()) * start;
 6483+ jQuery.style( self, name, start + unit);
56156484 }
56166485
56176486 // If a +=/-= token was provided, we're doing a relative animation
@@ -5662,22 +6531,33 @@
56636532
56646533 });
56656534
 6535+function genFx( type, num ) {
 6536+ var obj = {};
 6537+
 6538+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
 6539+ obj[ this ] = type;
 6540+ });
 6541+
 6542+ return obj;
 6543+}
 6544+
56666545 // Generate shortcuts for custom animations
56676546 jQuery.each({
56686547 slideDown: genFx("show", 1),
56696548 slideUp: genFx("hide", 1),
56706549 slideToggle: genFx("toggle", 1),
56716550 fadeIn: { opacity: "show" },
5672 - fadeOut: { opacity: "hide" }
 6551+ fadeOut: { opacity: "hide" },
 6552+ fadeToggle: { opacity: "toggle" }
56736553 }, function( name, props ) {
5674 - jQuery.fn[ name ] = function( speed, callback ) {
5675 - return this.animate( props, speed, callback );
 6554+ jQuery.fn[ name ] = function( speed, easing, callback ) {
 6555+ return this.animate( props, speed, easing, callback );
56766556 };
56776557 });
56786558
56796559 jQuery.extend({
56806560 speed: function( speed, easing, fn ) {
5681 - var opt = speed && typeof speed === "object" ? speed : {
 6561+ var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
56826562 complete: fn || !fn && easing ||
56836563 jQuery.isFunction( speed ) && speed,
56846564 duration: speed,
@@ -5685,7 +6565,7 @@
56866566 };
56876567
56886568 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
5689 - jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
 6569+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
56906570
56916571 // Queueing
56926572 opt.old = opt.complete;
@@ -5732,33 +6612,30 @@
57336613 }
57346614
57356615 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
5736 -
5737 - // Set display property to block for height/width animations
5738 - if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
5739 - this.elem.style.display = "block";
5740 - }
57416616 },
57426617
57436618 // Get the current size
5744 - cur: function( force ) {
 6619+ cur: function() {
57456620 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
57466621 return this.elem[ this.prop ];
57476622 }
57486623
5749 - var r = parseFloat(jQuery.css(this.elem, this.prop, force));
5750 - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
 6624+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
 6625+ return r && r > -10000 ? r : 0;
57516626 },
57526627
57536628 // Start an animation from one number to another
57546629 custom: function( from, to, unit ) {
5755 - this.startTime = now();
 6630+ var self = this,
 6631+ fx = jQuery.fx;
 6632+
 6633+ this.startTime = jQuery.now();
57566634 this.start = from;
57576635 this.end = to;
57586636 this.unit = unit || this.unit || "px";
57596637 this.now = this.start;
57606638 this.pos = this.state = 0;
57616639
5762 - var self = this;
57636640 function t( gotoEnd ) {
57646641 return self.step(gotoEnd);
57656642 }
@@ -5766,7 +6643,7 @@
57676644 t.elem = this.elem;
57686645
57696646 if ( t() && jQuery.timers.push(t) && !timerId ) {
5770 - timerId = setInterval(jQuery.fx.tick, 13);
 6647+ timerId = setInterval(fx.tick, fx.interval);
57716648 }
57726649 },
57736650
@@ -5797,7 +6674,7 @@
57986675
57996676 // Each step of an animation
58006677 step: function( gotoEnd ) {
5801 - var t = now(), done = true;
 6678+ var t = jQuery.now(), done = true;
58026679
58036680 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
58046681 this.now = this.end;
@@ -5813,17 +6690,14 @@
58146691 }
58156692
58166693 if ( done ) {
5817 - if ( this.options.display != null ) {
5818 - // Reset the overflow
5819 - this.elem.style.overflow = this.options.overflow;
 6694+ // Reset the overflow
 6695+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
 6696+ var elem = this.elem,
 6697+ options = this.options;
58206698
5821 - // Reset the display
5822 - var old = jQuery.data(this.elem, "olddisplay");
5823 - this.elem.style.display = old ? old : this.options.display;
5824 -
5825 - if ( jQuery.css(this.elem, "display") === "none" ) {
5826 - this.elem.style.display = "block";
5827 - }
 6699+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
 6700+ elem.style[ "overflow" + value ] = options.overflow[index];
 6701+ } );
58286702 }
58296703
58306704 // Hide the element if the "hide" operation was done
@@ -5834,7 +6708,7 @@
58356709 // Reset the properties, if the item has been hidden or shown
58366710 if ( this.options.hide || this.options.show ) {
58376711 for ( var p in this.options.curAnim ) {
5838 - jQuery.style(this.elem, p, this.options.orig[p]);
 6712+ jQuery.style( this.elem, p, this.options.orig[p] );
58396713 }
58406714 }
58416715
@@ -5876,22 +6750,24 @@
58776751 jQuery.fx.stop();
58786752 }
58796753 },
5880 -
 6754+
 6755+ interval: 13,
 6756+
58816757 stop: function() {
58826758 clearInterval( timerId );
58836759 timerId = null;
58846760 },
5885 -
 6761+
58866762 speeds: {
58876763 slow: 600,
5888 - fast: 200,
5889 - // Default speed
5890 - _default: 400
 6764+ fast: 200,
 6765+ // Default speed
 6766+ _default: 400
58916767 },
58926768
58936769 step: {
58946770 opacity: function( fx ) {
5895 - jQuery.style(fx.elem, "opacity", fx.now);
 6771+ jQuery.style( fx.elem, "opacity", fx.now );
58966772 },
58976773
58986774 _default: function( fx ) {
@@ -5912,18 +6788,32 @@
59136789 };
59146790 }
59156791
5916 -function genFx( type, num ) {
5917 - var obj = {};
 6792+function defaultDisplay( nodeName ) {
 6793+ if ( !elemdisplay[ nodeName ] ) {
 6794+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
 6795+ display = elem.css("display");
59186796
5919 - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
5920 - obj[ this ] = type;
5921 - });
 6797+ elem.remove();
59226798
5923 - return obj;
 6799+ if ( display === "none" || display === "" ) {
 6800+ display = "block";
 6801+ }
 6802+
 6803+ elemdisplay[ nodeName ] = display;
 6804+ }
 6805+
 6806+ return elemdisplay[ nodeName ];
59246807 }
 6808+
 6809+
 6810+
 6811+
 6812+var rtable = /^t(?:able|d|h)$/i,
 6813+ rroot = /^(?:body|html)$/i;
 6814+
59256815 if ( "getBoundingClientRect" in document.documentElement ) {
59266816 jQuery.fn.offset = function( options ) {
5927 - var elem = this[0];
 6817+ var elem = this[0], box;
59286818
59296819 if ( options ) {
59306820 return this.each(function( i ) {
@@ -5939,11 +6829,27 @@
59406830 return jQuery.offset.bodyOffset( elem );
59416831 }
59426832
5943 - var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
5944 - clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
5945 - top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
5946 - left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
 6833+ try {
 6834+ box = elem.getBoundingClientRect();
 6835+ } catch(e) {}
59476836
 6837+ var doc = elem.ownerDocument,
 6838+ docElem = doc.documentElement;
 6839+
 6840+ // Make sure we're not dealing with a disconnected DOM node
 6841+ if ( !box || !jQuery.contains( docElem, elem ) ) {
 6842+ return box || { top: 0, left: 0 };
 6843+ }
 6844+
 6845+ var body = doc.body,
 6846+ win = getWindow(doc),
 6847+ clientTop = docElem.clientTop || body.clientTop || 0,
 6848+ 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),
 6851+ top = box.top + scrollTop - clientTop,
 6852+ left = box.left + scrollLeft - clientLeft;
 6853+
59486854 return { top: top, left: left };
59496855 };
59506856
@@ -5967,11 +6873,16 @@
59686874
59696875 jQuery.offset.initialize();
59706876
5971 - var offsetParent = elem.offsetParent, prevOffsetParent = elem,
5972 - doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
5973 - body = doc.body, defaultView = doc.defaultView,
 6877+ var computedStyle,
 6878+ offsetParent = elem.offsetParent,
 6879+ prevOffsetParent = elem,
 6880+ doc = elem.ownerDocument,
 6881+ docElem = doc.documentElement,
 6882+ body = doc.body,
 6883+ defaultView = doc.defaultView,
59746884 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
5975 - top = elem.offsetTop, left = elem.offsetLeft;
 6885+ top = elem.offsetTop,
 6886+ left = elem.offsetLeft;
59766887
59776888 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
59786889 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
@@ -5986,12 +6897,13 @@
59876898 top += elem.offsetTop;
59886899 left += elem.offsetLeft;
59896900
5990 - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
 6901+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
59916902 top += parseFloat( computedStyle.borderTopWidth ) || 0;
59926903 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
59936904 }
59946905
5995 - prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
 6906+ prevOffsetParent = offsetParent;
 6907+ offsetParent = elem.offsetParent;
59966908 }
59976909
59986910 if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
@@ -6018,7 +6930,7 @@
60196931
60206932 jQuery.offset = {
60216933 initialize: function() {
6022 - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
 6934+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
60236935 html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
60246936
60256937 jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
@@ -6032,12 +6944,16 @@
60336945 this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
60346946 this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
60356947
6036 - checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
 6948+ checkDiv.style.position = "fixed";
 6949+ checkDiv.style.top = "20px";
 6950+
60376951 // safari subtracts parent border width here which is 5px
60386952 this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
60396953 checkDiv.style.position = checkDiv.style.top = "";
60406954
6041 - innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
 6955+ innerDiv.style.overflow = "hidden";
 6956+ innerDiv.style.position = "relative";
 6957+
60426958 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
60436959
60446960 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
@@ -6048,36 +6964,52 @@
60496965 },
60506966
60516967 bodyOffset: function( body ) {
6052 - var top = body.offsetTop, left = body.offsetLeft;
 6968+ var top = body.offsetTop,
 6969+ left = body.offsetLeft;
60536970
60546971 jQuery.offset.initialize();
60556972
60566973 if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
6057 - top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
6058 - left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
 6974+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
 6975+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
60596976 }
60606977
60616978 return { top: top, left: left };
60626979 },
60636980
60646981 setOffset: function( elem, options, i ) {
 6982+ var position = jQuery.css( elem, "position" );
 6983+
60656984 // set position first, in-case top/left are set even on static elem
6066 - if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
 6985+ if ( position === "static" ) {
60676986 elem.style.position = "relative";
60686987 }
6069 - var curElem = jQuery( elem ),
 6988+
 6989+ var curElem = jQuery( elem ),
60706990 curOffset = curElem.offset(),
6071 - curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
6072 - curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
 6991+ curCSSTop = jQuery.css( elem, "top" ),
 6992+ curCSSLeft = jQuery.css( elem, "left" ),
 6993+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
 6994+ props = {}, curPosition = {}, curTop, curLeft;
60736995
 6996+ // need to be able to calculate position if either top or left is auto and position is absolute
 6997+ if ( calculatePosition ) {
 6998+ curPosition = curElem.position();
 6999+ }
 7000+
 7001+ curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
 7002+ curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
 7003+
60747004 if ( jQuery.isFunction( options ) ) {
60757005 options = options.call( elem, i, curOffset );
60767006 }
60777007
6078 - var props = {
6079 - top: (options.top - curOffset.top) + curTop,
6080 - left: (options.left - curOffset.left) + curLeft
6081 - };
 7008+ if (options.top != null) {
 7009+ props.top = (options.top - curOffset.top) + curTop;
 7010+ }
 7011+ if (options.left != null) {
 7012+ props.left = (options.left - curOffset.left) + curLeft;
 7013+ }
60827014
60837015 if ( "using" in options ) {
60847016 options.using.call( elem, props );
@@ -6101,17 +7033,17 @@
61027034
61037035 // Get correct offsets
61047036 offset = this.offset(),
6105 - parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
 7037+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
61067038
61077039 // Subtract element margins
61087040 // note: when an element has margin: auto the offsetLeft and marginLeft
61097041 // are the same in Safari causing offset.left to incorrectly be 0
6110 - offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
6111 - offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
 7042+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
 7043+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
61127044
61137045 // Add offsetParent borders
6114 - parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
6115 - parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
 7046+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
 7047+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
61167048
61177049 // Subtract the two offsets
61187050 return {
@@ -6123,7 +7055,7 @@
61247056 offsetParent: function() {
61257057 return this.map(function() {
61267058 var offsetParent = this.offsetParent || document.body;
6127 - while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
 7059+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
61287060 offsetParent = offsetParent.offsetParent;
61297061 }
61307062 return offsetParent;
@@ -6171,12 +7103,16 @@
61727104 });
61737105
61747106 function getWindow( elem ) {
6175 - return ("scrollTo" in elem && elem.document) ?
 7107+ return jQuery.isWindow( elem ) ?
61767108 elem :
61777109 elem.nodeType === 9 ?
61787110 elem.defaultView || elem.parentWindow :
61797111 false;
61807112 }
 7113+
 7114+
 7115+
 7116+
61817117 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
61827118 jQuery.each([ "Height", "Width" ], function( i, name ) {
61837119
@@ -6185,14 +7121,14 @@
61867122 // innerHeight and innerWidth
61877123 jQuery.fn["inner" + name] = function() {
61887124 return this[0] ?
6189 - jQuery.css( this[0], type, false, "padding" ) :
 7125+ parseFloat( jQuery.css( this[0], type, "padding" ) ) :
61907126 null;
61917127 };
61927128
61937129 // outerHeight and outerWidth
61947130 jQuery.fn["outer" + name] = function( margin ) {
61957131 return this[0] ?
6196 - jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
 7132+ parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
61977133 null;
61987134 };
61997135
@@ -6210,31 +7146,34 @@
62117147 });
62127148 }
62137149
6214 - return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
 7150+ if ( jQuery.isWindow( elem ) ) {
62157151 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
6216 - elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
6217 - elem.document.body[ "client" + name ] :
 7152+ return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
 7153+ elem.document.body[ "client" + name ];
62187154
6219 - // Get document width or height
6220 - (elem.nodeType === 9) ? // is it a document
6221 - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
6222 - Math.max(
6223 - elem.documentElement["client" + name],
6224 - elem.body["scroll" + name], elem.documentElement["scroll" + name],
6225 - elem.body["offset" + name], elem.documentElement["offset" + name]
6226 - ) :
 7155+ // Get document width or height
 7156+ } else if ( elem.nodeType === 9 ) {
 7157+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
 7158+ return Math.max(
 7159+ elem.documentElement["client" + name],
 7160+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
 7161+ elem.body["offset" + name], elem.documentElement["offset" + name]
 7162+ );
62277163
6228 - // Get or set width or height on the element
6229 - size === undefined ?
6230 - // Get width or height on the element
6231 - jQuery.css( elem, type ) :
 7164+ // Get or set width or height on the element
 7165+ } else if ( size === undefined ) {
 7166+ var orig = jQuery.css( elem, type ),
 7167+ ret = parseFloat( orig );
62327168
6233 - // Set the width or height on the element (default to pixels if value is unitless)
6234 - this.css( type, typeof size === "string" ? size : ( parseInt( size ) || 0 ) + "px" );
 7169+ return jQuery.isNaN( ret ) ? orig : ret;
 7170+
 7171+ // Set the width or height on the element (default to pixels if value is unitless)
 7172+ } else {
 7173+ return this.css( type, typeof size === "string" ? size : size + "px" );
 7174+ }
62357175 };
62367176
62377177 });
6238 -// Expose jQuery to the global object
6239 -window.jQuery = window.$ = jQuery;
62407178
 7179+
62417180 })(window);

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r74326Fixed jQuery bug/enahnced jQuery to not blindly convert anything that's not a...tparscal21:51, 5 October 2010

Status & tagging log