Make WordPress Core

Ticket #24132: 24132.diff

File 24132.diff, 244.1 KB (added by ryanduff, 13 years ago)
  • .

  • wp-includes/js/jquery/jquery2.js

     
     1/*!
     2 * jQuery JavaScript Library v2.0.0
     3 * http://jquery.com/
     4 *
     5 * Includes Sizzle.js
     6 * http://sizzlejs.com/
     7 *
     8 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
     9 * Released under the MIT license
     10 * http://jquery.org/license
     11 *
     12 * Date: 2013-04-18
     13 */
     14(function( window, undefined ) {
     15
     16// Can't do this because several apps including ASP.NET trace
     17// the stack via arguments.caller.callee and Firefox dies if
     18// you try to trace through "use strict" call chains. (#13335)
     19// Support: Firefox 18+
     20//"use strict";
     21var
     22        // A central reference to the root jQuery(document)
     23        rootjQuery,
     24
     25        // The deferred used on DOM ready
     26        readyList,
     27
     28        // Support: IE9
     29        // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
     30        core_strundefined = typeof undefined,
     31
     32        // Use the correct document accordingly with window argument (sandbox)
     33        location = window.location,
     34        document = window.document,
     35        docElem = document.documentElement,
     36
     37        // Map over jQuery in case of overwrite
     38        _jQuery = window.jQuery,
     39
     40        // Map over the $ in case of overwrite
     41        _$ = window.$,
     42
     43        // [[Class]] -> type pairs
     44        class2type = {},
     45
     46        // List of deleted data cache ids, so we can reuse them
     47        core_deletedIds = [],
     48
     49        core_version = "2.0.0",
     50
     51        // Save a reference to some core methods
     52        core_concat = core_deletedIds.concat,
     53        core_push = core_deletedIds.push,
     54        core_slice = core_deletedIds.slice,
     55        core_indexOf = core_deletedIds.indexOf,
     56        core_toString = class2type.toString,
     57        core_hasOwn = class2type.hasOwnProperty,
     58        core_trim = core_version.trim,
     59
     60        // Define a local copy of jQuery
     61        jQuery = function( selector, context ) {
     62                // The jQuery object is actually just the init constructor 'enhanced'
     63                return new jQuery.fn.init( selector, context, rootjQuery );
     64        },
     65
     66        // Used for matching numbers
     67        core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
     68
     69        // Used for splitting on whitespace
     70        core_rnotwhite = /\S+/g,
     71
     72        // A simple way to check for HTML strings
     73        // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
     74        // Strict HTML recognition (#11290: must start with <)
     75        rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
     76
     77        // Match a standalone tag
     78        rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
     79
     80        // Matches dashed string for camelizing
     81        rmsPrefix = /^-ms-/,
     82        rdashAlpha = /-([\da-z])/gi,
     83
     84        // Used by jQuery.camelCase as callback to replace()
     85        fcamelCase = function( all, letter ) {
     86                return letter.toUpperCase();
     87        },
     88
     89        // The ready event handler and self cleanup method
     90        completed = function() {
     91                document.removeEventListener( "DOMContentLoaded", completed, false );
     92                window.removeEventListener( "load", completed, false );
     93                jQuery.ready();
     94        };
     95
     96jQuery.fn = jQuery.prototype = {
     97        // The current version of jQuery being used
     98        jquery: core_version,
     99
     100        constructor: jQuery,
     101        init: function( selector, context, rootjQuery ) {
     102                var match, elem;
     103
     104                // HANDLE: $(""), $(null), $(undefined), $(false)
     105                if ( !selector ) {
     106                        return this;
     107                }
     108
     109                // Handle HTML strings
     110                if ( typeof selector === "string" ) {
     111                        if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
     112                                // Assume that strings that start and end with <> are HTML and skip the regex check
     113                                match = [ null, selector, null ];
     114
     115                        } else {
     116                                match = rquickExpr.exec( selector );
     117                        }
     118
     119                        // Match html or make sure no context is specified for #id
     120                        if ( match && (match[1] || !context) ) {
     121
     122                                // HANDLE: $(html) -> $(array)
     123                                if ( match[1] ) {
     124                                        context = context instanceof jQuery ? context[0] : context;
     125
     126                                        // scripts is true for back-compat
     127                                        jQuery.merge( this, jQuery.parseHTML(
     128                                                match[1],
     129                                                context && context.nodeType ? context.ownerDocument || context : document,
     130                                                true
     131                                        ) );
     132
     133                                        // HANDLE: $(html, props)
     134                                        if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
     135                                                for ( match in context ) {
     136                                                        // Properties of context are called as methods if possible
     137                                                        if ( jQuery.isFunction( this[ match ] ) ) {
     138                                                                this[ match ]( context[ match ] );
     139
     140                                                        // ...and otherwise set as attributes
     141                                                        } else {
     142                                                                this.attr( match, context[ match ] );
     143                                                        }
     144                                                }
     145                                        }
     146
     147                                        return this;
     148
     149                                // HANDLE: $(#id)
     150                                } else {
     151                                        elem = document.getElementById( match[2] );
     152
     153                                        // Check parentNode to catch when Blackberry 4.6 returns
     154                                        // nodes that are no longer in the document #6963
     155                                        if ( elem && elem.parentNode ) {
     156                                                // Inject the element directly into the jQuery object
     157                                                this.length = 1;
     158                                                this[0] = elem;
     159                                        }
     160
     161                                        this.context = document;
     162                                        this.selector = selector;
     163                                        return this;
     164                                }
     165
     166                        // HANDLE: $(expr, $(...))
     167                        } else if ( !context || context.jquery ) {
     168                                return ( context || rootjQuery ).find( selector );
     169
     170                        // HANDLE: $(expr, context)
     171                        // (which is just equivalent to: $(context).find(expr)
     172                        } else {
     173                                return this.constructor( context ).find( selector );
     174                        }
     175
     176                // HANDLE: $(DOMElement)
     177                } else if ( selector.nodeType ) {
     178                        this.context = this[0] = selector;
     179                        this.length = 1;
     180                        return this;
     181
     182                // HANDLE: $(function)
     183                // Shortcut for document ready
     184                } else if ( jQuery.isFunction( selector ) ) {
     185                        return rootjQuery.ready( selector );
     186                }
     187
     188                if ( selector.selector !== undefined ) {
     189                        this.selector = selector.selector;
     190                        this.context = selector.context;
     191                }
     192
     193                return jQuery.makeArray( selector, this );
     194        },
     195
     196        // Start with an empty selector
     197        selector: "",
     198
     199        // The default length of a jQuery object is 0
     200        length: 0,
     201
     202        toArray: function() {
     203                return core_slice.call( this );
     204        },
     205
     206        // Get the Nth element in the matched element set OR
     207        // Get the whole matched element set as a clean array
     208        get: function( num ) {
     209                return num == null ?
     210
     211                        // Return a 'clean' array
     212                        this.toArray() :
     213
     214                        // Return just the object
     215                        ( num < 0 ? this[ this.length + num ] : this[ num ] );
     216        },
     217
     218        // Take an array of elements and push it onto the stack
     219        // (returning the new matched element set)
     220        pushStack: function( elems ) {
     221
     222                // Build a new jQuery matched element set
     223                var ret = jQuery.merge( this.constructor(), elems );
     224
     225                // Add the old object onto the stack (as a reference)
     226                ret.prevObject = this;
     227                ret.context = this.context;
     228
     229                // Return the newly-formed element set
     230                return ret;
     231        },
     232
     233        // Execute a callback for every element in the matched set.
     234        // (You can seed the arguments with an array of args, but this is
     235        // only used internally.)
     236        each: function( callback, args ) {
     237                return jQuery.each( this, callback, args );
     238        },
     239
     240        ready: function( fn ) {
     241                // Add the callback
     242                jQuery.ready.promise().done( fn );
     243
     244                return this;
     245        },
     246
     247        slice: function() {
     248                return this.pushStack( core_slice.apply( this, arguments ) );
     249        },
     250
     251        first: function() {
     252                return this.eq( 0 );
     253        },
     254
     255        last: function() {
     256                return this.eq( -1 );
     257        },
     258
     259        eq: function( i ) {
     260                var len = this.length,
     261                        j = +i + ( i < 0 ? len : 0 );
     262                return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
     263        },
     264
     265        map: function( callback ) {
     266                return this.pushStack( jQuery.map(this, function( elem, i ) {
     267                        return callback.call( elem, i, elem );
     268                }));
     269        },
     270
     271        end: function() {
     272                return this.prevObject || this.constructor(null);
     273        },
     274
     275        // For internal use only.
     276        // Behaves like an Array's method, not like a jQuery method.
     277        push: core_push,
     278        sort: [].sort,
     279        splice: [].splice
     280};
     281
     282// Give the init function the jQuery prototype for later instantiation
     283jQuery.fn.init.prototype = jQuery.fn;
     284
     285jQuery.extend = jQuery.fn.extend = function() {
     286        var options, name, src, copy, copyIsArray, clone,
     287                target = arguments[0] || {},
     288                i = 1,
     289                length = arguments.length,
     290                deep = false;
     291
     292        // Handle a deep copy situation
     293        if ( typeof target === "boolean" ) {
     294                deep = target;
     295                target = arguments[1] || {};
     296                // skip the boolean and the target
     297                i = 2;
     298        }
     299
     300        // Handle case when target is a string or something (possible in deep copy)
     301        if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
     302                target = {};
     303        }
     304
     305        // extend jQuery itself if only one argument is passed
     306        if ( length === i ) {
     307                target = this;
     308                --i;
     309        }
     310
     311        for ( ; i < length; i++ ) {
     312                // Only deal with non-null/undefined values
     313                if ( (options = arguments[ i ]) != null ) {
     314                        // Extend the base object
     315                        for ( name in options ) {
     316                                src = target[ name ];
     317                                copy = options[ name ];
     318
     319                                // Prevent never-ending loop
     320                                if ( target === copy ) {
     321                                        continue;
     322                                }
     323
     324                                // Recurse if we're merging plain objects or arrays
     325                                if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
     326                                        if ( copyIsArray ) {
     327                                                copyIsArray = false;
     328                                                clone = src && jQuery.isArray(src) ? src : [];
     329
     330                                        } else {
     331                                                clone = src && jQuery.isPlainObject(src) ? src : {};
     332                                        }
     333
     334                                        // Never move original objects, clone them
     335                                        target[ name ] = jQuery.extend( deep, clone, copy );
     336
     337                                // Don't bring in undefined values
     338                                } else if ( copy !== undefined ) {
     339                                        target[ name ] = copy;
     340                                }
     341                        }
     342                }
     343        }
     344
     345        // Return the modified object
     346        return target;
     347};
     348
     349jQuery.extend({
     350        // Unique for each copy of jQuery on the page
     351        expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
     352
     353        noConflict: function( deep ) {
     354                if ( window.$ === jQuery ) {
     355                        window.$ = _$;
     356                }
     357
     358                if ( deep && window.jQuery === jQuery ) {
     359                        window.jQuery = _jQuery;
     360                }
     361
     362                return jQuery;
     363        },
     364
     365        // Is the DOM ready to be used? Set to true once it occurs.
     366        isReady: false,
     367
     368        // A counter to track how many items to wait for before
     369        // the ready event fires. See #6781
     370        readyWait: 1,
     371
     372        // Hold (or release) the ready event
     373        holdReady: function( hold ) {
     374                if ( hold ) {
     375                        jQuery.readyWait++;
     376                } else {
     377                        jQuery.ready( true );
     378                }
     379        },
     380
     381        // Handle when the DOM is ready
     382        ready: function( wait ) {
     383
     384                // Abort if there are pending holds or we're already ready
     385                if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
     386                        return;
     387                }
     388
     389                // Remember that the DOM is ready
     390                jQuery.isReady = true;
     391
     392                // If a normal DOM Ready event fired, decrement, and wait if need be
     393                if ( wait !== true && --jQuery.readyWait > 0 ) {
     394                        return;
     395                }
     396
     397                // If there are functions bound, to execute
     398                readyList.resolveWith( document, [ jQuery ] );
     399
     400                // Trigger any bound ready events
     401                if ( jQuery.fn.trigger ) {
     402                        jQuery( document ).trigger("ready").off("ready");
     403                }
     404        },
     405
     406        // See test/unit/core.js for details concerning isFunction.
     407        // Since version 1.3, DOM methods and functions like alert
     408        // aren't supported. They return false on IE (#2968).
     409        isFunction: function( obj ) {
     410                return jQuery.type(obj) === "function";
     411        },
     412
     413        isArray: Array.isArray,
     414
     415        isWindow: function( obj ) {
     416                return obj != null && obj === obj.window;
     417        },
     418
     419        isNumeric: function( obj ) {
     420                return !isNaN( parseFloat(obj) ) && isFinite( obj );
     421        },
     422
     423        type: function( obj ) {
     424                if ( obj == null ) {
     425                        return String( obj );
     426                }
     427                // Support: Safari <= 5.1 (functionish RegExp)
     428                return typeof obj === "object" || typeof obj === "function" ?
     429                        class2type[ core_toString.call(obj) ] || "object" :
     430                        typeof obj;
     431        },
     432
     433        isPlainObject: function( obj ) {
     434                // Not plain objects:
     435                // - Any object or value whose internal [[Class]] property is not "[object Object]"
     436                // - DOM nodes
     437                // - window
     438                if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
     439                        return false;
     440                }
     441
     442                // Support: Firefox <20
     443                // The try/catch suppresses exceptions thrown when attempting to access
     444                // the "constructor" property of certain host objects, ie. |window.location|
     445                // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
     446                try {
     447                        if ( obj.constructor &&
     448                                        !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
     449                                return false;
     450                        }
     451                } catch ( e ) {
     452                        return false;
     453                }
     454
     455                // If the function hasn't returned already, we're confident that
     456                // |obj| is a plain object, created by {} or constructed with new Object
     457                return true;
     458        },
     459
     460        isEmptyObject: function( obj ) {
     461                var name;
     462                for ( name in obj ) {
     463                        return false;
     464                }
     465                return true;
     466        },
     467
     468        error: function( msg ) {
     469                throw new Error( msg );
     470        },
     471
     472        // data: string of html
     473        // context (optional): If specified, the fragment will be created in this context, defaults to document
     474        // keepScripts (optional): If true, will include scripts passed in the html string
     475        parseHTML: function( data, context, keepScripts ) {
     476                if ( !data || typeof data !== "string" ) {
     477                        return null;
     478                }
     479                if ( typeof context === "boolean" ) {
     480                        keepScripts = context;
     481                        context = false;
     482                }
     483                context = context || document;
     484
     485                var parsed = rsingleTag.exec( data ),
     486                        scripts = !keepScripts && [];
     487
     488                // Single tag
     489                if ( parsed ) {
     490                        return [ context.createElement( parsed[1] ) ];
     491                }
     492
     493                parsed = jQuery.buildFragment( [ data ], context, scripts );
     494
     495                if ( scripts ) {
     496                        jQuery( scripts ).remove();
     497                }
     498
     499                return jQuery.merge( [], parsed.childNodes );
     500        },
     501
     502        parseJSON: JSON.parse,
     503
     504        // Cross-browser xml parsing
     505        parseXML: function( data ) {
     506                var xml, tmp;
     507                if ( !data || typeof data !== "string" ) {
     508                        return null;
     509                }
     510
     511                // Support: IE9
     512                try {
     513                        tmp = new DOMParser();
     514                        xml = tmp.parseFromString( data , "text/xml" );
     515                } catch ( e ) {
     516                        xml = undefined;
     517                }
     518
     519                if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
     520                        jQuery.error( "Invalid XML: " + data );
     521                }
     522                return xml;
     523        },
     524
     525        noop: function() {},
     526
     527        // Evaluates a script in a global context
     528        globalEval: function( code ) {
     529                var script,
     530                                indirect = eval;
     531
     532                code = jQuery.trim( code );
     533
     534                if ( code ) {
     535                        // If the code includes a valid, prologue position
     536                        // strict mode pragma, execute code by injecting a
     537                        // script tag into the document.
     538                        if ( code.indexOf("use strict") === 1 ) {
     539                                script = document.createElement("script");
     540                                script.text = code;
     541                                document.head.appendChild( script ).parentNode.removeChild( script );
     542                        } else {
     543                        // Otherwise, avoid the DOM node creation, insertion
     544                        // and removal by using an indirect global eval
     545                                indirect( code );
     546                        }
     547                }
     548        },
     549
     550        // Convert dashed to camelCase; used by the css and data modules
     551        // Microsoft forgot to hump their vendor prefix (#9572)
     552        camelCase: function( string ) {
     553                return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
     554        },
     555
     556        nodeName: function( elem, name ) {
     557                return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
     558        },
     559
     560        // args is for internal usage only
     561        each: function( obj, callback, args ) {
     562                var value,
     563                        i = 0,
     564                        length = obj.length,
     565                        isArray = isArraylike( obj );
     566
     567                if ( args ) {
     568                        if ( isArray ) {
     569                                for ( ; i < length; i++ ) {
     570                                        value = callback.apply( obj[ i ], args );
     571
     572                                        if ( value === false ) {
     573                                                break;
     574                                        }
     575                                }
     576                        } else {
     577                                for ( i in obj ) {
     578                                        value = callback.apply( obj[ i ], args );
     579
     580                                        if ( value === false ) {
     581                                                break;
     582                                        }
     583                                }
     584                        }
     585
     586                // A special, fast, case for the most common use of each
     587                } else {
     588                        if ( isArray ) {
     589                                for ( ; i < length; i++ ) {
     590                                        value = callback.call( obj[ i ], i, obj[ i ] );
     591
     592                                        if ( value === false ) {
     593                                                break;
     594                                        }
     595                                }
     596                        } else {
     597                                for ( i in obj ) {
     598                                        value = callback.call( obj[ i ], i, obj[ i ] );
     599
     600                                        if ( value === false ) {
     601                                                break;
     602                                        }
     603                                }
     604                        }
     605                }
     606
     607                return obj;
     608        },
     609
     610        trim: function( text ) {
     611                return text == null ? "" : core_trim.call( text );
     612        },
     613
     614        // results is for internal usage only
     615        makeArray: function( arr, results ) {
     616                var ret = results || [];
     617
     618                if ( arr != null ) {
     619                        if ( isArraylike( Object(arr) ) ) {
     620                                jQuery.merge( ret,
     621                                        typeof arr === "string" ?
     622                                        [ arr ] : arr
     623                                );
     624                        } else {
     625                                core_push.call( ret, arr );
     626                        }
     627                }
     628
     629                return ret;
     630        },
     631
     632        inArray: function( elem, arr, i ) {
     633                return arr == null ? -1 : core_indexOf.call( arr, elem, i );
     634        },
     635
     636        merge: function( first, second ) {
     637                var l = second.length,
     638                        i = first.length,
     639                        j = 0;
     640
     641                if ( typeof l === "number" ) {
     642                        for ( ; j < l; j++ ) {
     643                                first[ i++ ] = second[ j ];
     644                        }
     645                } else {
     646                        while ( second[j] !== undefined ) {
     647                                first[ i++ ] = second[ j++ ];
     648                        }
     649                }
     650
     651                first.length = i;
     652
     653                return first;
     654        },
     655
     656        grep: function( elems, callback, inv ) {
     657                var retVal,
     658                        ret = [],
     659                        i = 0,
     660                        length = elems.length;
     661                inv = !!inv;
     662
     663                // Go through the array, only saving the items
     664                // that pass the validator function
     665                for ( ; i < length; i++ ) {
     666                        retVal = !!callback( elems[ i ], i );
     667                        if ( inv !== retVal ) {
     668                                ret.push( elems[ i ] );
     669                        }
     670                }
     671
     672                return ret;
     673        },
     674
     675        // arg is for internal usage only
     676        map: function( elems, callback, arg ) {
     677                var value,
     678                        i = 0,
     679                        length = elems.length,
     680                        isArray = isArraylike( elems ),
     681                        ret = [];
     682
     683                // Go through the array, translating each of the items to their
     684                if ( isArray ) {
     685                        for ( ; i < length; i++ ) {
     686                                value = callback( elems[ i ], i, arg );
     687
     688                                if ( value != null ) {
     689                                        ret[ ret.length ] = value;
     690                                }
     691                        }
     692
     693                // Go through every key on the object,
     694                } else {
     695                        for ( i in elems ) {
     696                                value = callback( elems[ i ], i, arg );
     697
     698                                if ( value != null ) {
     699                                        ret[ ret.length ] = value;
     700                                }
     701                        }
     702                }
     703
     704                // Flatten any nested arrays
     705                return core_concat.apply( [], ret );
     706        },
     707
     708        // A global GUID counter for objects
     709        guid: 1,
     710
     711        // Bind a function to a context, optionally partially applying any
     712        // arguments.
     713        proxy: function( fn, context ) {
     714                var tmp, args, proxy;
     715
     716                if ( typeof context === "string" ) {
     717                        tmp = fn[ context ];
     718                        context = fn;
     719                        fn = tmp;
     720                }
     721
     722                // Quick check to determine if target is callable, in the spec
     723                // this throws a TypeError, but we will just return undefined.
     724                if ( !jQuery.isFunction( fn ) ) {
     725                        return undefined;
     726                }
     727
     728                // Simulated bind
     729                args = core_slice.call( arguments, 2 );
     730                proxy = function() {
     731                        return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
     732                };
     733
     734                // Set the guid of unique handler to the same of original handler, so it can be removed
     735                proxy.guid = fn.guid = fn.guid || jQuery.guid++;
     736
     737                return proxy;
     738        },
     739
     740        // Multifunctional method to get and set values of a collection
     741        // The value/s can optionally be executed if it's a function
     742        access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
     743                var i = 0,
     744                        length = elems.length,
     745                        bulk = key == null;
     746
     747                // Sets many values
     748                if ( jQuery.type( key ) === "object" ) {
     749                        chainable = true;
     750                        for ( i in key ) {
     751                                jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
     752                        }
     753
     754                // Sets one value
     755                } else if ( value !== undefined ) {
     756                        chainable = true;
     757
     758                        if ( !jQuery.isFunction( value ) ) {
     759                                raw = true;
     760                        }
     761
     762                        if ( bulk ) {
     763                                // Bulk operations run against the entire set
     764                                if ( raw ) {
     765                                        fn.call( elems, value );
     766                                        fn = null;
     767
     768                                // ...except when executing function values
     769                                } else {
     770                                        bulk = fn;
     771                                        fn = function( elem, key, value ) {
     772                                                return bulk.call( jQuery( elem ), value );
     773                                        };
     774                                }
     775                        }
     776
     777                        if ( fn ) {
     778                                for ( ; i < length; i++ ) {
     779                                        fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
     780                                }
     781                        }
     782                }
     783
     784                return chainable ?
     785                        elems :
     786
     787                        // Gets
     788                        bulk ?
     789                                fn.call( elems ) :
     790                                length ? fn( elems[0], key ) : emptyGet;
     791        },
     792
     793        now: Date.now,
     794
     795        // A method for quickly swapping in/out CSS properties to get correct calculations.
     796        // Note: this method belongs to the css module but it's needed here for the support module.
     797        // If support gets modularized, this method should be moved back to the css module.
     798        swap: function( elem, options, callback, args ) {
     799                var ret, name,
     800                        old = {};
     801
     802                // Remember the old values, and insert the new ones
     803                for ( name in options ) {
     804                        old[ name ] = elem.style[ name ];
     805                        elem.style[ name ] = options[ name ];
     806                }
     807
     808                ret = callback.apply( elem, args || [] );
     809
     810                // Revert the old values
     811                for ( name in options ) {
     812                        elem.style[ name ] = old[ name ];
     813                }
     814
     815                return ret;
     816        }
     817});
     818
     819jQuery.ready.promise = function( obj ) {
     820        if ( !readyList ) {
     821
     822                readyList = jQuery.Deferred();
     823
     824                // Catch cases where $(document).ready() is called after the browser event has already occurred.
     825                // we once tried to use readyState "interactive" here, but it caused issues like the one
     826                // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
     827                if ( document.readyState === "complete" ) {
     828                        // Handle it asynchronously to allow scripts the opportunity to delay ready
     829                        setTimeout( jQuery.ready );
     830
     831                } else {
     832
     833                        // Use the handy event callback
     834                        document.addEventListener( "DOMContentLoaded", completed, false );
     835
     836                        // A fallback to window.onload, that will always work
     837                        window.addEventListener( "load", completed, false );
     838                }
     839        }
     840        return readyList.promise( obj );
     841};
     842
     843// Populate the class2type map
     844jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
     845        class2type[ "[object " + name + "]" ] = name.toLowerCase();
     846});
     847
     848function isArraylike( obj ) {
     849        var length = obj.length,
     850                type = jQuery.type( obj );
     851
     852        if ( jQuery.isWindow( obj ) ) {
     853                return false;
     854        }
     855
     856        if ( obj.nodeType === 1 && length ) {
     857                return true;
     858        }
     859
     860        return type === "array" || type !== "function" &&
     861                ( length === 0 ||
     862                typeof length === "number" && length > 0 && ( length - 1 ) in obj );
     863}
     864
     865// All jQuery objects should point back to these
     866rootjQuery = jQuery(document);
     867/*!
     868 * Sizzle CSS Selector Engine v1.9.2-pre
     869 * http://sizzlejs.com/
     870 *
     871 * Copyright 2013 jQuery Foundation, Inc. and other contributors
     872 * Released under the MIT license
     873 * http://jquery.org/license
     874 *
     875 * Date: 2013-04-16
     876 */
     877(function( window, undefined ) {
     878
     879var i,
     880        cachedruns,
     881        Expr,
     882        getText,
     883        isXML,
     884        compile,
     885        outermostContext,
     886        sortInput,
     887
     888        // Local document vars
     889        setDocument,
     890        document,
     891        docElem,
     892        documentIsHTML,
     893        rbuggyQSA,
     894        rbuggyMatches,
     895        matches,
     896        contains,
     897
     898        // Instance-specific data
     899        expando = "sizzle" + -(new Date()),
     900        preferredDoc = window.document,
     901        support = {},
     902        dirruns = 0,
     903        done = 0,
     904        classCache = createCache(),
     905        tokenCache = createCache(),
     906        compilerCache = createCache(),
     907        hasDuplicate = false,
     908        sortOrder = function() { return 0; },
     909
     910        // General-purpose constants
     911        strundefined = typeof undefined,
     912        MAX_NEGATIVE = 1 << 31,
     913
     914        // Array methods
     915        arr = [],
     916        pop = arr.pop,
     917        push_native = arr.push,
     918        push = arr.push,
     919        slice = arr.slice,
     920        // Use a stripped-down indexOf if we can't use a native one
     921        indexOf = arr.indexOf || function( elem ) {
     922                var i = 0,
     923                        len = this.length;
     924                for ( ; i < len; i++ ) {
     925                        if ( this[i] === elem ) {
     926                                return i;
     927                        }
     928                }
     929                return -1;
     930        },
     931
     932        booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
     933
     934        // Regular expressions
     935
     936        // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
     937        whitespace = "[\\x20\\t\\r\\n\\f]",
     938        // http://www.w3.org/TR/css3-syntax/#characters
     939        characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
     940
     941        // Loosely modeled on CSS identifier characters
     942        // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
     943        // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
     944        identifier = characterEncoding.replace( "w", "w#" ),
     945
     946        // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
     947        attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
     948                "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
     949
     950        // Prefer arguments quoted,
     951        //   then not containing pseudos/brackets,
     952        //   then attribute selectors/non-parenthetical expressions,
     953        //   then anything else
     954        // These preferences are here to reduce the number of selectors
     955        //   needing tokenize in the PSEUDO preFilter
     956        pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
     957
     958        // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
     959        rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
     960
     961        rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
     962        rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
     963
     964        rsibling = new RegExp( whitespace + "*[+~]" ),
     965        rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
     966
     967        rpseudo = new RegExp( pseudos ),
     968        ridentifier = new RegExp( "^" + identifier + "$" ),
     969
     970        matchExpr = {
     971                "ID": new RegExp( "^#(" + characterEncoding + ")" ),
     972                "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
     973                "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
     974                "ATTR": new RegExp( "^" + attributes ),
     975                "PSEUDO": new RegExp( "^" + pseudos ),
     976                "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
     977                        "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
     978                        "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
     979                "boolean": new RegExp( "^(?:" + booleans + ")$", "i" ),
     980                // For use in libraries implementing .is()
     981                // We use this for POS matching in `select`
     982                "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
     983                        whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
     984        },
     985
     986        rnative = /^[^{]+\{\s*\[native \w/,
     987
     988        // Easily-parseable/retrievable ID or TAG or CLASS selectors
     989        rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
     990
     991        rinputs = /^(?:input|select|textarea|button)$/i,
     992        rheader = /^h\d$/i,
     993
     994        rescape = /'|\\/g,
     995
     996        // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
     997        runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
     998        funescape = function( _, escaped ) {
     999                var high = "0x" + escaped - 0x10000;
     1000                // NaN means non-codepoint
     1001                return high !== high ?
     1002                        escaped :
     1003                        // BMP codepoint
     1004                        high < 0 ?
     1005                                String.fromCharCode( high + 0x10000 ) :
     1006                                // Supplemental Plane codepoint (surrogate pair)
     1007                                String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
     1008        };
     1009
     1010// Optimize for push.apply( _, NodeList )
     1011try {
     1012        push.apply(
     1013                (arr = slice.call( preferredDoc.childNodes )),
     1014                preferredDoc.childNodes
     1015        );
     1016        // Support: Android<4.0
     1017        // Detect silently failing push.apply
     1018        arr[ preferredDoc.childNodes.length ].nodeType;
     1019} catch ( e ) {
     1020        push = { apply: arr.length ?
     1021
     1022                // Leverage slice if possible
     1023                function( target, els ) {
     1024                        push_native.apply( target, slice.call(els) );
     1025                } :
     1026
     1027                // Support: IE<9
     1028                // Otherwise append directly
     1029                function( target, els ) {
     1030                        var j = target.length,
     1031                                i = 0;
     1032                        // Can't trust NodeList.length
     1033                        while ( (target[j++] = els[i++]) ) {}
     1034                        target.length = j - 1;
     1035                }
     1036        };
     1037}
     1038
     1039/**
     1040 * For feature detection
     1041 * @param {Function} fn The function to test for native support
     1042 */
     1043function isNative( fn ) {
     1044        return rnative.test( fn + "" );
     1045}
     1046
     1047/**
     1048 * Create key-value caches of limited size
     1049 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
     1050 *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
     1051 *      deleting the oldest entry
     1052 */
     1053function createCache() {
     1054        var cache,
     1055                keys = [];
     1056
     1057        return (cache = function( key, value ) {
     1058                // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
     1059                if ( keys.push( key += " " ) > Expr.cacheLength ) {
     1060                        // Only keep the most recent entries
     1061                        delete cache[ keys.shift() ];
     1062                }
     1063                return (cache[ key ] = value);
     1064        });
     1065}
     1066
     1067/**
     1068 * Mark a function for special use by Sizzle
     1069 * @param {Function} fn The function to mark
     1070 */
     1071function markFunction( fn ) {
     1072        fn[ expando ] = true;
     1073        return fn;
     1074}
     1075
     1076/**
     1077 * Support testing using an element
     1078 * @param {Function} fn Passed the created div and expects a boolean result
     1079 */
     1080function assert( fn ) {
     1081        var div = document.createElement("div");
     1082
     1083        try {
     1084                return !!fn( div );
     1085        } catch (e) {
     1086                return false;
     1087        } finally {
     1088                if ( div.parentNode ) {
     1089                        div.parentNode.removeChild( div );
     1090                }
     1091                // release memory in IE
     1092                div = null;
     1093        }
     1094}
     1095
     1096function Sizzle( selector, context, results, seed ) {
     1097        var match, elem, m, nodeType,
     1098                // QSA vars
     1099                i, groups, old, nid, newContext, newSelector;
     1100
     1101        if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
     1102                setDocument( context );
     1103        }
     1104
     1105        context = context || document;
     1106        results = results || [];
     1107
     1108        if ( !selector || typeof selector !== "string" ) {
     1109                return results;
     1110        }
     1111
     1112        if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
     1113                return [];
     1114        }
     1115
     1116        if ( documentIsHTML && !seed ) {
     1117
     1118                // Shortcuts
     1119                if ( (match = rquickExpr.exec( selector )) ) {
     1120                        // Speed-up: Sizzle("#ID")
     1121                        if ( (m = match[1]) ) {
     1122                                if ( nodeType === 9 ) {
     1123                                        elem = context.getElementById( m );
     1124                                        // Check parentNode to catch when Blackberry 4.6 returns
     1125                                        // nodes that are no longer in the document #6963
     1126                                        if ( elem && elem.parentNode ) {
     1127                                                // Handle the case where IE, Opera, and Webkit return items
     1128                                                // by name instead of ID
     1129                                                if ( elem.id === m ) {
     1130                                                        results.push( elem );
     1131                                                        return results;
     1132                                                }
     1133                                        } else {
     1134                                                return results;
     1135                                        }
     1136                                } else {
     1137                                        // Context is not a document
     1138                                        if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
     1139                                                contains( context, elem ) && elem.id === m ) {
     1140                                                results.push( elem );
     1141                                                return results;
     1142                                        }
     1143                                }
     1144
     1145                        // Speed-up: Sizzle("TAG")
     1146                        } else if ( match[2] ) {
     1147                                push.apply( results, context.getElementsByTagName( selector ) );
     1148                                return results;
     1149
     1150                        // Speed-up: Sizzle(".CLASS")
     1151                        } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
     1152                                push.apply( results, context.getElementsByClassName( m ) );
     1153                                return results;
     1154                        }
     1155                }
     1156
     1157                // QSA path
     1158                if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
     1159                        nid = old = expando;
     1160                        newContext = context;
     1161                        newSelector = nodeType === 9 && selector;
     1162
     1163                        // qSA works strangely on Element-rooted queries
     1164                        // We can work around this by specifying an extra ID on the root
     1165                        // and working up from there (Thanks to Andrew Dupont for the technique)
     1166                        // IE 8 doesn't work on object elements
     1167                        if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
     1168                                groups = tokenize( selector );
     1169
     1170                                if ( (old = context.getAttribute("id")) ) {
     1171                                        nid = old.replace( rescape, "\\$&" );
     1172                                } else {
     1173                                        context.setAttribute( "id", nid );
     1174                                }
     1175                                nid = "[id='" + nid + "'] ";
     1176
     1177                                i = groups.length;
     1178                                while ( i-- ) {
     1179                                        groups[i] = nid + toSelector( groups[i] );
     1180                                }
     1181                                newContext = rsibling.test( selector ) && context.parentNode || context;
     1182                                newSelector = groups.join(",");
     1183                        }
     1184
     1185                        if ( newSelector ) {
     1186                                try {
     1187                                        push.apply( results,
     1188                                                newContext.querySelectorAll( newSelector )
     1189                                        );
     1190                                        return results;
     1191                                } catch(qsaError) {
     1192                                } finally {
     1193                                        if ( !old ) {
     1194                                                context.removeAttribute("id");
     1195                                        }
     1196                                }
     1197                        }
     1198                }
     1199        }
     1200
     1201        // All others
     1202        return select( selector.replace( rtrim, "$1" ), context, results, seed );
     1203}
     1204
     1205/**
     1206 * Detect xml
     1207 * @param {Element|Object} elem An element or a document
     1208 */
     1209isXML = Sizzle.isXML = function( elem ) {
     1210        // documentElement is verified for cases where it doesn't yet exist
     1211        // (such as loading iframes in IE - #4833)
     1212        var documentElement = elem && (elem.ownerDocument || elem).documentElement;
     1213        return documentElement ? documentElement.nodeName !== "HTML" : false;
     1214};
     1215
     1216/**
     1217 * Sets document-related variables once based on the current document
     1218 * @param {Element|Object} [doc] An element or document object to use to set the document
     1219 * @returns {Object} Returns the current document
     1220 */
     1221setDocument = Sizzle.setDocument = function( node ) {
     1222        var doc = node ? node.ownerDocument || node : preferredDoc;
     1223
     1224        // If no document and documentElement is available, return
     1225        if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
     1226                return document;
     1227        }
     1228
     1229        // Set our document
     1230        document = doc;
     1231        docElem = doc.documentElement;
     1232
     1233        // Support tests
     1234        documentIsHTML = !isXML( doc );
     1235
     1236        // Check if getElementsByTagName("*") returns only elements
     1237        support.getElementsByTagName = assert(function( div ) {
     1238                div.appendChild( doc.createComment("") );
     1239                return !div.getElementsByTagName("*").length;
     1240        });
     1241
     1242        // Support: IE<8
     1243        // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
     1244        support.attributes = assert(function( div ) {
     1245                div.className = "i";
     1246                return !div.getAttribute("className");
     1247        });
     1248
     1249        // Check if getElementsByClassName can be trusted
     1250        support.getElementsByClassName = assert(function( div ) {
     1251                div.innerHTML = "<div class='a'></div><div class='a i'></div>";
     1252
     1253                // Support: Safari<4
     1254                // Catch class over-caching
     1255                div.firstChild.className = "i";
     1256                // Support: Opera<10
     1257                // Catch gEBCN failure to find non-leading classes
     1258                return div.getElementsByClassName("i").length === 2;
     1259        });
     1260
     1261        // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
     1262        // Detached nodes confoundingly follow *each other*
     1263        support.sortDetached = assert(function( div1 ) {
     1264                // Should return 1, but returns 4 (following)
     1265                return div1.compareDocumentPosition( document.createElement("div") ) & 1;
     1266        });
     1267
     1268        // Support: IE<10
     1269        // Check if getElementById returns elements by name
     1270        // Support: Windows 8 Native Apps
     1271        // Assigning innerHTML with "name" attributes throws uncatchable exceptions
     1272        // (http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx)
     1273        // and the broken getElementById methods don't pick up programatically-set names,
     1274        // so use a roundabout getElementsByName test
     1275        support.getById = assert(function( div ) {
     1276                docElem.appendChild( div ).id = expando;
     1277                return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
     1278        });
     1279
     1280        // ID find and filter
     1281        if ( support.getById ) {
     1282                Expr.find["ID"] = function( id, context ) {
     1283                        if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
     1284                                var m = context.getElementById( id );
     1285                                // Check parentNode to catch when Blackberry 4.6 returns
     1286                                // nodes that are no longer in the document #6963
     1287                                return m && m.parentNode ? [m] : [];
     1288                        }
     1289                };
     1290                Expr.filter["ID"] = function( id ) {
     1291                        var attrId = id.replace( runescape, funescape );
     1292                        return function( elem ) {
     1293                                return elem.getAttribute("id") === attrId;
     1294                        };
     1295                };
     1296        } else {
     1297                Expr.find["ID"] = function( id, context ) {
     1298                        if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
     1299                                var m = context.getElementById( id );
     1300
     1301                                return m ?
     1302                                        m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
     1303                                                [m] :
     1304                                                undefined :
     1305                                        [];
     1306                        }
     1307                };
     1308                Expr.filter["ID"] =  function( id ) {
     1309                        var attrId = id.replace( runescape, funescape );
     1310                        return function( elem ) {
     1311                                var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
     1312                                return node && node.value === attrId;
     1313                        };
     1314                };
     1315        }
     1316
     1317        // Tag
     1318        Expr.find["TAG"] = support.getElementsByTagName ?
     1319                function( tag, context ) {
     1320                        if ( typeof context.getElementsByTagName !== strundefined ) {
     1321                                return context.getElementsByTagName( tag );
     1322                        }
     1323                } :
     1324                function( tag, context ) {
     1325                        var elem,
     1326                                tmp = [],
     1327                                i = 0,
     1328                                results = context.getElementsByTagName( tag );
     1329
     1330                        // Filter out possible comments
     1331                        if ( tag === "*" ) {
     1332                                while ( (elem = results[i++]) ) {
     1333                                        if ( elem.nodeType === 1 ) {
     1334                                                tmp.push( elem );
     1335                                        }
     1336                                }
     1337
     1338                                return tmp;
     1339                        }
     1340                        return results;
     1341                };
     1342
     1343        // Class
     1344        Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
     1345                if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
     1346                        return context.getElementsByClassName( className );
     1347                }
     1348        };
     1349
     1350        // QSA and matchesSelector support
     1351
     1352        // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
     1353        rbuggyMatches = [];
     1354
     1355        // qSa(:focus) reports false when true (Chrome 21)
     1356        // We allow this because of a bug in IE8/9 that throws an error
     1357        // whenever `document.activeElement` is accessed on an iframe
     1358        // So, we allow :focus to pass through QSA all the time to avoid the IE error
     1359        // See http://bugs.jquery.com/ticket/13378
     1360        rbuggyQSA = [];
     1361
     1362        if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
     1363                // Build QSA regex
     1364                // Regex strategy adopted from Diego Perini
     1365                assert(function( div ) {
     1366                        // Select is set to empty string on purpose
     1367                        // This is to test IE's treatment of not explicitly
     1368                        // setting a boolean content attribute,
     1369                        // since its presence should be enough
     1370                        // http://bugs.jquery.com/ticket/12359
     1371                        div.innerHTML = "<select><option selected=''></option></select>";
     1372
     1373                        // Support: IE8
     1374                        // Boolean attributes and "value" are not treated correctly
     1375                        if ( !div.querySelectorAll("[selected]").length ) {
     1376                                rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
     1377                        }
     1378
     1379                        // Webkit/Opera - :checked should return selected option elements
     1380                        // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
     1381                        // IE8 throws error here and will not see later tests
     1382                        if ( !div.querySelectorAll(":checked").length ) {
     1383                                rbuggyQSA.push(":checked");
     1384                        }
     1385                });
     1386
     1387                assert(function( div ) {
     1388
     1389                        // Support: Opera 10-12/IE8
     1390                        // ^= $= *= and empty values
     1391                        // Should not select anything
     1392                        // Support: Windows 8 Native Apps
     1393                        // The type attribute is restricted during .innerHTML assignment
     1394                        var input = document.createElement("input");
     1395                        input.setAttribute( "type", "hidden" );
     1396                        div.appendChild( input ).setAttribute( "t", "" );
     1397
     1398                        if ( div.querySelectorAll("[t^='']").length ) {
     1399                                rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
     1400                        }
     1401
     1402                        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
     1403                        // IE8 throws error here and will not see later tests
     1404                        if ( !div.querySelectorAll(":enabled").length ) {
     1405                                rbuggyQSA.push( ":enabled", ":disabled" );
     1406                        }
     1407
     1408                        // Opera 10-11 does not throw on post-comma invalid pseudos
     1409                        div.querySelectorAll("*,:x");
     1410                        rbuggyQSA.push(",.*:");
     1411                });
     1412        }
     1413
     1414        if ( (support.matchesSelector = isNative( (matches = docElem.webkitMatchesSelector ||
     1415                docElem.mozMatchesSelector ||
     1416                docElem.oMatchesSelector ||
     1417                docElem.msMatchesSelector) )) ) {
     1418
     1419                assert(function( div ) {
     1420                        // Check to see if it's possible to do matchesSelector
     1421                        // on a disconnected node (IE 9)
     1422                        support.disconnectedMatch = matches.call( div, "div" );
     1423
     1424                        // This should fail with an exception
     1425                        // Gecko does not error, returns false instead
     1426                        matches.call( div, "[s!='']:x" );
     1427                        rbuggyMatches.push( "!=", pseudos );
     1428                });
     1429        }
     1430
     1431        rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
     1432        rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
     1433
     1434        // Element contains another
     1435        // Purposefully does not implement inclusive descendent
     1436        // As in, an element does not contain itself
     1437        contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
     1438                function( a, b ) {
     1439                        var adown = a.nodeType === 9 ? a.documentElement : a,
     1440                                bup = b && b.parentNode;
     1441                        return a === bup || !!( bup && bup.nodeType === 1 && (
     1442                                adown.contains ?
     1443                                        adown.contains( bup ) :
     1444                                        a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
     1445                        ));
     1446                } :
     1447                function( a, b ) {
     1448                        if ( b ) {
     1449                                while ( (b = b.parentNode) ) {
     1450                                        if ( b === a ) {
     1451                                                return true;
     1452                                        }
     1453                                }
     1454                        }
     1455                        return false;
     1456                };
     1457
     1458        // Document order sorting
     1459        sortOrder = docElem.compareDocumentPosition ?
     1460        function( a, b ) {
     1461
     1462                // Flag for duplicate removal
     1463                if ( a === b ) {
     1464                        hasDuplicate = true;
     1465                        return 0;
     1466                }
     1467
     1468                var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
     1469
     1470                if ( compare ) {
     1471                        // Disconnected nodes
     1472                        if ( compare & 1 ||
     1473                                (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
     1474
     1475                                // Choose the first element that is related to our preferred document
     1476                                if ( a === doc || contains(preferredDoc, a) ) {
     1477                                        return -1;
     1478                                }
     1479                                if ( b === doc || contains(preferredDoc, b) ) {
     1480                                        return 1;
     1481                                }
     1482
     1483                                // Maintain original order
     1484                                return sortInput ?
     1485                                        ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
     1486                                        0;
     1487                        }
     1488
     1489                        return compare & 4 ? -1 : 1;
     1490                }
     1491
     1492                // Not directly comparable, sort on existence of method
     1493                return a.compareDocumentPosition ? -1 : 1;
     1494        } :
     1495        function( a, b ) {
     1496                var cur,
     1497                        i = 0,
     1498                        aup = a.parentNode,
     1499                        bup = b.parentNode,
     1500                        ap = [ a ],
     1501                        bp = [ b ];
     1502
     1503                // Exit early if the nodes are identical
     1504                if ( a === b ) {
     1505                        hasDuplicate = true;
     1506                        return 0;
     1507
     1508                // Parentless nodes are either documents or disconnected
     1509                } else if ( !aup || !bup ) {
     1510                        return a === doc ? -1 :
     1511                                b === doc ? 1 :
     1512                                aup ? -1 :
     1513                                bup ? 1 :
     1514                                sortInput ?
     1515                                ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
     1516                                0;
     1517
     1518                // If the nodes are siblings, we can do a quick check
     1519                } else if ( aup === bup ) {
     1520                        return siblingCheck( a, b );
     1521                }
     1522
     1523                // Otherwise we need full lists of their ancestors for comparison
     1524                cur = a;
     1525                while ( (cur = cur.parentNode) ) {
     1526                        ap.unshift( cur );
     1527                }
     1528                cur = b;
     1529                while ( (cur = cur.parentNode) ) {
     1530                        bp.unshift( cur );
     1531                }
     1532
     1533                // Walk down the tree looking for a discrepancy
     1534                while ( ap[i] === bp[i] ) {
     1535                        i++;
     1536                }
     1537
     1538                return i ?
     1539                        // Do a sibling check if the nodes have a common ancestor
     1540                        siblingCheck( ap[i], bp[i] ) :
     1541
     1542                        // Otherwise nodes in our document sort first
     1543                        ap[i] === preferredDoc ? -1 :
     1544                        bp[i] === preferredDoc ? 1 :
     1545                        0;
     1546        };
     1547
     1548        return document;
     1549};
     1550
     1551Sizzle.matches = function( expr, elements ) {
     1552        return Sizzle( expr, null, null, elements );
     1553};
     1554
     1555Sizzle.matchesSelector = function( elem, expr ) {
     1556        // Set document vars if needed
     1557        if ( ( elem.ownerDocument || elem ) !== document ) {
     1558                setDocument( elem );
     1559        }
     1560
     1561        // Make sure that attribute selectors are quoted
     1562        expr = expr.replace( rattributeQuotes, "='$1']" );
     1563
     1564        // rbuggyQSA always contains :focus, so no need for an existence check
     1565        if ( support.matchesSelector && documentIsHTML &&
     1566                (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
     1567                (!rbuggyQSA     || !rbuggyQSA.test(expr)) ) {
     1568
     1569                try {
     1570                        var ret = matches.call( elem, expr );
     1571
     1572                        // IE 9's matchesSelector returns false on disconnected nodes
     1573                        if ( ret || support.disconnectedMatch ||
     1574                                        // As well, disconnected nodes are said to be in a document
     1575                                        // fragment in IE 9
     1576                                        elem.document && elem.document.nodeType !== 11 ) {
     1577                                return ret;
     1578                        }
     1579                } catch(e) {}
     1580        }
     1581
     1582        return Sizzle( expr, document, null, [elem] ).length > 0;
     1583};
     1584
     1585Sizzle.contains = function( context, elem ) {
     1586        // Set document vars if needed
     1587        if ( ( context.ownerDocument || context ) !== document ) {
     1588                setDocument( context );
     1589        }
     1590        return contains( context, elem );
     1591};
     1592
     1593Sizzle.attr = function( elem, name ) {
     1594        // Set document vars if needed
     1595        if ( ( elem.ownerDocument || elem ) !== document ) {
     1596                setDocument( elem );
     1597        }
     1598
     1599        var fn = Expr.attrHandle[ name.toLowerCase() ],
     1600                val = fn && fn( elem, name, !documentIsHTML );
     1601
     1602        return val === undefined ?
     1603                support.attributes || !documentIsHTML ?
     1604                        elem.getAttribute( name ) :
     1605                        (val = elem.getAttributeNode(name)) && val.specified ?
     1606                                val.value :
     1607                                null :
     1608                val;
     1609};
     1610
     1611Sizzle.error = function( msg ) {
     1612        throw new Error( "Syntax error, unrecognized expression: " + msg );
     1613};
     1614
     1615// Document sorting and removing duplicates
     1616Sizzle.uniqueSort = function( results ) {
     1617        var elem,
     1618                duplicates = [],
     1619                j = 0,
     1620                i = 0;
     1621
     1622        // Unless we *know* we can detect duplicates, assume their presence
     1623        hasDuplicate = !support.detectDuplicates;
     1624        sortInput = !support.sortStable && results.slice( 0 );
     1625        results.sort( sortOrder );
     1626
     1627        if ( hasDuplicate ) {
     1628                while ( (elem = results[i++]) ) {
     1629                        if ( elem === results[ i ] ) {
     1630                                j = duplicates.push( i );
     1631                        }
     1632                }
     1633                while ( j-- ) {
     1634                        results.splice( duplicates[ j ], 1 );
     1635                }
     1636        }
     1637
     1638        return results;
     1639};
     1640
     1641/**
     1642 * Checks document order of two siblings
     1643 * @param {Element} a
     1644 * @param {Element} b
     1645 * @returns Returns -1 if a precedes b, 1 if a follows b
     1646 */
     1647function siblingCheck( a, b ) {
     1648        var cur = b && a,
     1649                diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
     1650
     1651        // Use IE sourceIndex if available on both nodes
     1652        if ( diff ) {
     1653                return diff;
     1654        }
     1655
     1656        // Check if b follows a
     1657        if ( cur ) {
     1658                while ( (cur = cur.nextSibling) ) {
     1659                        if ( cur === b ) {
     1660                                return -1;
     1661                        }
     1662                }
     1663        }
     1664
     1665        return a ? 1 : -1;
     1666}
     1667
     1668// Fetches boolean attributes by node
     1669function boolHandler( elem, name, isXML ) {
     1670        var val;
     1671        return isXML ?
     1672                undefined :
     1673                (val = elem.getAttributeNode( name )) && val.specified ?
     1674                        val.value :
     1675                        elem[ name ] === true ? name.toLowerCase() : null;
     1676}
     1677
     1678// Fetches attributes without interpolation
     1679// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
     1680function interpolationHandler( elem, name, isXML ) {
     1681        var val;
     1682        return isXML ?
     1683                undefined :
     1684                (val = elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ));
     1685}
     1686
     1687// Returns a function to use in pseudos for input types
     1688function createInputPseudo( type ) {
     1689        return function( elem ) {
     1690                var name = elem.nodeName.toLowerCase();
     1691                return name === "input" && elem.type === type;
     1692        };
     1693}
     1694
     1695// Returns a function to use in pseudos for buttons
     1696function createButtonPseudo( type ) {
     1697        return function( elem ) {
     1698                var name = elem.nodeName.toLowerCase();
     1699                return (name === "input" || name === "button") && elem.type === type;
     1700        };
     1701}
     1702
     1703// Returns a function to use in pseudos for positionals
     1704function createPositionalPseudo( fn ) {
     1705        return markFunction(function( argument ) {
     1706                argument = +argument;
     1707                return markFunction(function( seed, matches ) {
     1708                        var j,
     1709                                matchIndexes = fn( [], seed.length, argument ),
     1710                                i = matchIndexes.length;
     1711
     1712                        // Match elements found at the specified indexes
     1713                        while ( i-- ) {
     1714                                if ( seed[ (j = matchIndexes[i]) ] ) {
     1715                                        seed[j] = !(matches[j] = seed[j]);
     1716                                }
     1717                        }
     1718                });
     1719        });
     1720}
     1721
     1722/**
     1723 * Utility function for retrieving the text value of an array of DOM nodes
     1724 * @param {Array|Element} elem
     1725 */
     1726getText = Sizzle.getText = function( elem ) {
     1727        var node,
     1728                ret = "",
     1729                i = 0,
     1730                nodeType = elem.nodeType;
     1731
     1732        if ( !nodeType ) {
     1733                // If no nodeType, this is expected to be an array
     1734                for ( ; (node = elem[i]); i++ ) {
     1735                        // Do not traverse comment nodes
     1736                        ret += getText( node );
     1737                }
     1738        } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
     1739                // Use textContent for elements
     1740                // innerText usage removed for consistency of new lines (see #11153)
     1741                if ( typeof elem.textContent === "string" ) {
     1742                        return elem.textContent;
     1743                } else {
     1744                        // Traverse its children
     1745                        for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
     1746                                ret += getText( elem );
     1747                        }
     1748                }
     1749        } else if ( nodeType === 3 || nodeType === 4 ) {
     1750                return elem.nodeValue;
     1751        }
     1752        // Do not include comment or processing instruction nodes
     1753
     1754        return ret;
     1755};
     1756
     1757Expr = Sizzle.selectors = {
     1758
     1759        // Can be adjusted by the user
     1760        cacheLength: 50,
     1761
     1762        createPseudo: markFunction,
     1763
     1764        match: matchExpr,
     1765
     1766        attrHandle: {},
     1767
     1768        find: {},
     1769
     1770        relative: {
     1771                ">": { dir: "parentNode", first: true },
     1772                " ": { dir: "parentNode" },
     1773                "+": { dir: "previousSibling", first: true },
     1774                "~": { dir: "previousSibling" }
     1775        },
     1776
     1777        preFilter: {
     1778                "ATTR": function( match ) {
     1779                        match[1] = match[1].replace( runescape, funescape );
     1780
     1781                        // Move the given value to match[3] whether quoted or unquoted
     1782                        match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
     1783
     1784                        if ( match[2] === "~=" ) {
     1785                                match[3] = " " + match[3] + " ";
     1786                        }
     1787
     1788                        return match.slice( 0, 4 );
     1789                },
     1790
     1791                "CHILD": function( match ) {
     1792                        /* matches from matchExpr["CHILD"]
     1793                                1 type (only|nth|...)
     1794                                2 what (child|of-type)
     1795                                3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
     1796                                4 xn-component of xn+y argument ([+-]?\d*n|)
     1797                                5 sign of xn-component
     1798                                6 x of xn-component
     1799                                7 sign of y-component
     1800                                8 y of y-component
     1801                        */
     1802                        match[1] = match[1].toLowerCase();
     1803
     1804                        if ( match[1].slice( 0, 3 ) === "nth" ) {
     1805                                // nth-* requires argument
     1806                                if ( !match[3] ) {
     1807                                        Sizzle.error( match[0] );
     1808                                }
     1809
     1810                                // numeric x and y parameters for Expr.filter.CHILD
     1811                                // remember that false/true cast respectively to 0/1
     1812                                match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
     1813                                match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
     1814
     1815                        // other types prohibit arguments
     1816                        } else if ( match[3] ) {
     1817                                Sizzle.error( match[0] );
     1818                        }
     1819
     1820                        return match;
     1821                },
     1822
     1823                "PSEUDO": function( match ) {
     1824                        var excess,
     1825                                unquoted = !match[5] && match[2];
     1826
     1827                        if ( matchExpr["CHILD"].test( match[0] ) ) {
     1828                                return null;
     1829                        }
     1830
     1831                        // Accept quoted arguments as-is
     1832                        if ( match[4] ) {
     1833                                match[2] = match[4];
     1834
     1835                        // Strip excess characters from unquoted arguments
     1836                        } else if ( unquoted && rpseudo.test( unquoted ) &&
     1837                                // Get excess from tokenize (recursively)
     1838                                (excess = tokenize( unquoted, true )) &&
     1839                                // advance to the next closing parenthesis
     1840                                (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
     1841
     1842                                // excess is a negative index
     1843                                match[0] = match[0].slice( 0, excess );
     1844                                match[2] = unquoted.slice( 0, excess );
     1845                        }
     1846
     1847                        // Return only captures needed by the pseudo filter method (type and argument)
     1848                        return match.slice( 0, 3 );
     1849                }
     1850        },
     1851
     1852        filter: {
     1853
     1854                "TAG": function( nodeNameSelector ) {
     1855                        var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
     1856                        return nodeNameSelector === "*" ?
     1857                                function() { return true; } :
     1858                                function( elem ) {
     1859                                        return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
     1860                                };
     1861                },
     1862
     1863                "CLASS": function( className ) {
     1864                        var pattern = classCache[ className + " " ];
     1865
     1866                        return pattern ||
     1867                                (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
     1868                                classCache( className, function( elem ) {
     1869                                        return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
     1870                                });
     1871                },
     1872
     1873                "ATTR": function( name, operator, check ) {
     1874                        return function( elem ) {
     1875                                var result = Sizzle.attr( elem, name );
     1876
     1877                                if ( result == null ) {
     1878                                        return operator === "!=";
     1879                                }
     1880                                if ( !operator ) {
     1881                                        return true;
     1882                                }
     1883
     1884                                result += "";
     1885
     1886                                return operator === "=" ? result === check :
     1887                                        operator === "!=" ? result !== check :
     1888                                        operator === "^=" ? check && result.indexOf( check ) === 0 :
     1889                                        operator === "*=" ? check && result.indexOf( check ) > -1 :
     1890                                        operator === "$=" ? check && result.slice( -check.length ) === check :
     1891                                        operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
     1892                                        operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
     1893                                        false;
     1894                        };
     1895                },
     1896
     1897                "CHILD": function( type, what, argument, first, last ) {
     1898                        var simple = type.slice( 0, 3 ) !== "nth",
     1899                                forward = type.slice( -4 ) !== "last",
     1900                                ofType = what === "of-type";
     1901
     1902                        return first === 1 && last === 0 ?
     1903
     1904                                // Shortcut for :nth-*(n)
     1905                                function( elem ) {
     1906                                        return !!elem.parentNode;
     1907                                } :
     1908
     1909                                function( elem, context, xml ) {
     1910                                        var cache, outerCache, node, diff, nodeIndex, start,
     1911                                                dir = simple !== forward ? "nextSibling" : "previousSibling",
     1912                                                parent = elem.parentNode,
     1913                                                name = ofType && elem.nodeName.toLowerCase(),
     1914                                                useCache = !xml && !ofType;
     1915
     1916                                        if ( parent ) {
     1917
     1918                                                // :(first|last|only)-(child|of-type)
     1919                                                if ( simple ) {
     1920                                                        while ( dir ) {
     1921                                                                node = elem;
     1922                                                                while ( (node = node[ dir ]) ) {
     1923                                                                        if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
     1924                                                                                return false;
     1925                                                                        }
     1926                                                                }
     1927                                                                // Reverse direction for :only-* (if we haven't yet done so)
     1928                                                                start = dir = type === "only" && !start && "nextSibling";
     1929                                                        }
     1930                                                        return true;
     1931                                                }
     1932
     1933                                                start = [ forward ? parent.firstChild : parent.lastChild ];
     1934
     1935                                                // non-xml :nth-child(...) stores cache data on `parent`
     1936                                                if ( forward && useCache ) {
     1937                                                        // Seek `elem` from a previously-cached index
     1938                                                        outerCache = parent[ expando ] || (parent[ expando ] = {});
     1939                                                        cache = outerCache[ type ] || [];
     1940                                                        nodeIndex = cache[0] === dirruns && cache[1];
     1941                                                        diff = cache[0] === dirruns && cache[2];
     1942                                                        node = nodeIndex && parent.childNodes[ nodeIndex ];
     1943
     1944                                                        while ( (node = ++nodeIndex && node && node[ dir ] ||
     1945
     1946                                                                // Fallback to seeking `elem` from the start
     1947                                                                (diff = nodeIndex = 0) || start.pop()) ) {
     1948
     1949                                                                // When found, cache indexes on `parent` and break
     1950                                                                if ( node.nodeType === 1 && ++diff && node === elem ) {
     1951                                                                        outerCache[ type ] = [ dirruns, nodeIndex, diff ];
     1952                                                                        break;
     1953                                                                }
     1954                                                        }
     1955
     1956                                                // Use previously-cached element index if available
     1957                                                } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
     1958                                                        diff = cache[1];
     1959
     1960                                                // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
     1961                                                } else {
     1962                                                        // Use the same loop as above to seek `elem` from the start
     1963                                                        while ( (node = ++nodeIndex && node && node[ dir ] ||
     1964                                                                (diff = nodeIndex = 0) || start.pop()) ) {
     1965
     1966                                                                if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
     1967                                                                        // Cache the index of each encountered element
     1968                                                                        if ( useCache ) {
     1969                                                                                (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
     1970                                                                        }
     1971
     1972                                                                        if ( node === elem ) {
     1973                                                                                break;
     1974                                                                        }
     1975                                                                }
     1976                                                        }
     1977                                                }
     1978
     1979                                                // Incorporate the offset, then check against cycle size
     1980                                                diff -= last;
     1981                                                return diff === first || ( diff % first === 0 && diff / first >= 0 );
     1982                                        }
     1983                                };
     1984                },
     1985
     1986                "PSEUDO": function( pseudo, argument ) {
     1987                        // pseudo-class names are case-insensitive
     1988                        // http://www.w3.org/TR/selectors/#pseudo-classes
     1989                        // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
     1990                        // Remember that setFilters inherits from pseudos
     1991                        var args,
     1992                                fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
     1993                                        Sizzle.error( "unsupported pseudo: " + pseudo );
     1994
     1995                        // The user may use createPseudo to indicate that
     1996                        // arguments are needed to create the filter function
     1997                        // just as Sizzle does
     1998                        if ( fn[ expando ] ) {
     1999                                return fn( argument );
     2000                        }
     2001
     2002                        // But maintain support for old signatures
     2003                        if ( fn.length > 1 ) {
     2004                                args = [ pseudo, pseudo, "", argument ];
     2005                                return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
     2006                                        markFunction(function( seed, matches ) {
     2007                                                var idx,
     2008                                                        matched = fn( seed, argument ),
     2009                                                        i = matched.length;
     2010                                                while ( i-- ) {
     2011                                                        idx = indexOf.call( seed, matched[i] );
     2012                                                        seed[ idx ] = !( matches[ idx ] = matched[i] );
     2013                                                }
     2014                                        }) :
     2015                                        function( elem ) {
     2016                                                return fn( elem, 0, args );
     2017                                        };
     2018                        }
     2019
     2020                        return fn;
     2021                }
     2022        },
     2023
     2024        pseudos: {
     2025                // Potentially complex pseudos
     2026                "not": markFunction(function( selector ) {
     2027                        // Trim the selector passed to compile
     2028                        // to avoid treating leading and trailing
     2029                        // spaces as combinators
     2030                        var input = [],
     2031                                results = [],
     2032                                matcher = compile( selector.replace( rtrim, "$1" ) );
     2033
     2034                        return matcher[ expando ] ?
     2035                                markFunction(function( seed, matches, context, xml ) {
     2036                                        var elem,
     2037                                                unmatched = matcher( seed, null, xml, [] ),
     2038                                                i = seed.length;
     2039
     2040                                        // Match elements unmatched by `matcher`
     2041                                        while ( i-- ) {
     2042                                                if ( (elem = unmatched[i]) ) {
     2043                                                        seed[i] = !(matches[i] = elem);
     2044                                                }
     2045                                        }
     2046                                }) :
     2047                                function( elem, context, xml ) {
     2048                                        input[0] = elem;
     2049                                        matcher( input, null, xml, results );
     2050                                        return !results.pop();
     2051                                };
     2052                }),
     2053
     2054                "has": markFunction(function( selector ) {
     2055                        return function( elem ) {
     2056                                return Sizzle( selector, elem ).length > 0;
     2057                        };
     2058                }),
     2059
     2060                "contains": markFunction(function( text ) {
     2061                        return function( elem ) {
     2062                                return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
     2063                        };
     2064                }),
     2065
     2066                // "Whether an element is represented by a :lang() selector
     2067                // is based solely on the element's language value
     2068                // being equal to the identifier C,
     2069                // or beginning with the identifier C immediately followed by "-".
     2070                // The matching of C against the element's language value is performed case-insensitively.
     2071                // The identifier C does not have to be a valid language name."
     2072                // http://www.w3.org/TR/selectors/#lang-pseudo
     2073                "lang": markFunction( function( lang ) {
     2074                        // lang value must be a valid identifier
     2075                        if ( !ridentifier.test(lang || "") ) {
     2076                                Sizzle.error( "unsupported lang: " + lang );
     2077                        }
     2078                        lang = lang.replace( runescape, funescape ).toLowerCase();
     2079                        return function( elem ) {
     2080                                var elemLang;
     2081                                do {
     2082                                        if ( (elemLang = documentIsHTML ?
     2083                                                elem.lang :
     2084                                                elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
     2085
     2086                                                elemLang = elemLang.toLowerCase();
     2087                                                return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
     2088                                        }
     2089                                } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
     2090                                return false;
     2091                        };
     2092                }),
     2093
     2094                // Miscellaneous
     2095                "target": function( elem ) {
     2096                        var hash = window.location && window.location.hash;
     2097                        return hash && hash.slice( 1 ) === elem.id;
     2098                },
     2099
     2100                "root": function( elem ) {
     2101                        return elem === docElem;
     2102                },
     2103
     2104                "focus": function( elem ) {
     2105                        return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
     2106                },
     2107
     2108                // Boolean properties
     2109                "enabled": function( elem ) {
     2110                        return elem.disabled === false;
     2111                },
     2112
     2113                "disabled": function( elem ) {
     2114                        return elem.disabled === true;
     2115                },
     2116
     2117                "checked": function( elem ) {
     2118                        // In CSS3, :checked should return both checked and selected elements
     2119                        // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
     2120                        var nodeName = elem.nodeName.toLowerCase();
     2121                        return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
     2122                },
     2123
     2124                "selected": function( elem ) {
     2125                        // Accessing this property makes selected-by-default
     2126                        // options in Safari work properly
     2127                        if ( elem.parentNode ) {
     2128                                elem.parentNode.selectedIndex;
     2129                        }
     2130
     2131                        return elem.selected === true;
     2132                },
     2133
     2134                // Contents
     2135                "empty": function( elem ) {
     2136                        // http://www.w3.org/TR/selectors/#empty-pseudo
     2137                        // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
     2138                        //   not comment, processing instructions, or others
     2139                        // Thanks to Diego Perini for the nodeName shortcut
     2140                        //   Greater than "@" means alpha characters (specifically not starting with "#" or "?")
     2141                        for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
     2142                                if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
     2143                                        return false;
     2144                                }
     2145                        }
     2146                        return true;
     2147                },
     2148
     2149                "parent": function( elem ) {
     2150                        return !Expr.pseudos["empty"]( elem );
     2151                },
     2152
     2153                // Element/input types
     2154                "header": function( elem ) {
     2155                        return rheader.test( elem.nodeName );
     2156                },
     2157
     2158                "input": function( elem ) {
     2159                        return rinputs.test( elem.nodeName );
     2160                },
     2161
     2162                "button": function( elem ) {
     2163                        var name = elem.nodeName.toLowerCase();
     2164                        return name === "input" && elem.type === "button" || name === "button";
     2165                },
     2166
     2167                "text": function( elem ) {
     2168                        var attr;
     2169                        // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
     2170                        // use getAttribute instead to test this case
     2171                        return elem.nodeName.toLowerCase() === "input" &&
     2172                                elem.type === "text" &&
     2173                                ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
     2174                },
     2175
     2176                // Position-in-collection
     2177                "first": createPositionalPseudo(function() {
     2178                        return [ 0 ];
     2179                }),
     2180
     2181                "last": createPositionalPseudo(function( matchIndexes, length ) {
     2182                        return [ length - 1 ];
     2183                }),
     2184
     2185                "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
     2186                        return [ argument < 0 ? argument + length : argument ];
     2187                }),
     2188
     2189                "even": createPositionalPseudo(function( matchIndexes, length ) {
     2190                        var i = 0;
     2191                        for ( ; i < length; i += 2 ) {
     2192                                matchIndexes.push( i );
     2193                        }
     2194                        return matchIndexes;
     2195                }),
     2196
     2197                "odd": createPositionalPseudo(function( matchIndexes, length ) {
     2198                        var i = 1;
     2199                        for ( ; i < length; i += 2 ) {
     2200                                matchIndexes.push( i );
     2201                        }
     2202                        return matchIndexes;
     2203                }),
     2204
     2205                "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
     2206                        var i = argument < 0 ? argument + length : argument;
     2207                        for ( ; --i >= 0; ) {
     2208                                matchIndexes.push( i );
     2209                        }
     2210                        return matchIndexes;
     2211                }),
     2212
     2213                "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
     2214                        var i = argument < 0 ? argument + length : argument;
     2215                        for ( ; ++i < length; ) {
     2216                                matchIndexes.push( i );
     2217                        }
     2218                        return matchIndexes;
     2219                })
     2220        }
     2221};
     2222
     2223// Add button/input type pseudos
     2224for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
     2225        Expr.pseudos[ i ] = createInputPseudo( i );
     2226}
     2227for ( i in { submit: true, reset: true } ) {
     2228        Expr.pseudos[ i ] = createButtonPseudo( i );
     2229}
     2230
     2231function tokenize( selector, parseOnly ) {
     2232        var matched, match, tokens, type,
     2233                soFar, groups, preFilters,
     2234                cached = tokenCache[ selector + " " ];
     2235
     2236        if ( cached ) {
     2237                return parseOnly ? 0 : cached.slice( 0 );
     2238        }
     2239
     2240        soFar = selector;
     2241        groups = [];
     2242        preFilters = Expr.preFilter;
     2243
     2244        while ( soFar ) {
     2245
     2246                // Comma and first run
     2247                if ( !matched || (match = rcomma.exec( soFar )) ) {
     2248                        if ( match ) {
     2249                                // Don't consume trailing commas as valid
     2250                                soFar = soFar.slice( match[0].length ) || soFar;
     2251                        }
     2252                        groups.push( tokens = [] );
     2253                }
     2254
     2255                matched = false;
     2256
     2257                // Combinators
     2258                if ( (match = rcombinators.exec( soFar )) ) {
     2259                        matched = match.shift();
     2260                        tokens.push( {
     2261                                value: matched,
     2262                                // Cast descendant combinators to space
     2263                                type: match[0].replace( rtrim, " " )
     2264                        } );
     2265                        soFar = soFar.slice( matched.length );
     2266                }
     2267
     2268                // Filters
     2269                for ( type in Expr.filter ) {
     2270                        if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
     2271                                (match = preFilters[ type ]( match ))) ) {
     2272                                matched = match.shift();
     2273                                tokens.push( {
     2274                                        value: matched,
     2275                                        type: type,
     2276                                        matches: match
     2277                                } );
     2278                                soFar = soFar.slice( matched.length );
     2279                        }
     2280                }
     2281
     2282                if ( !matched ) {
     2283                        break;
     2284                }
     2285        }
     2286
     2287        // Return the length of the invalid excess
     2288        // if we're just parsing
     2289        // Otherwise, throw an error or return tokens
     2290        return parseOnly ?
     2291                soFar.length :
     2292                soFar ?
     2293                        Sizzle.error( selector ) :
     2294                        // Cache the tokens
     2295                        tokenCache( selector, groups ).slice( 0 );
     2296}
     2297
     2298function toSelector( tokens ) {
     2299        var i = 0,
     2300                len = tokens.length,
     2301                selector = "";
     2302        for ( ; i < len; i++ ) {
     2303                selector += tokens[i].value;
     2304        }
     2305        return selector;
     2306}
     2307
     2308function addCombinator( matcher, combinator, base ) {
     2309        var dir = combinator.dir,
     2310                checkNonElements = base && dir === "parentNode",
     2311                doneName = done++;
     2312
     2313        return combinator.first ?
     2314                // Check against closest ancestor/preceding element
     2315                function( elem, context, xml ) {
     2316                        while ( (elem = elem[ dir ]) ) {
     2317                                if ( elem.nodeType === 1 || checkNonElements ) {
     2318                                        return matcher( elem, context, xml );
     2319                                }
     2320                        }
     2321                } :
     2322
     2323                // Check against all ancestor/preceding elements
     2324                function( elem, context, xml ) {
     2325                        var data, cache, outerCache,
     2326                                dirkey = dirruns + " " + doneName;
     2327
     2328                        // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
     2329                        if ( xml ) {
     2330                                while ( (elem = elem[ dir ]) ) {
     2331                                        if ( elem.nodeType === 1 || checkNonElements ) {
     2332                                                if ( matcher( elem, context, xml ) ) {
     2333                                                        return true;
     2334                                                }
     2335                                        }
     2336                                }
     2337                        } else {
     2338                                while ( (elem = elem[ dir ]) ) {
     2339                                        if ( elem.nodeType === 1 || checkNonElements ) {
     2340                                                outerCache = elem[ expando ] || (elem[ expando ] = {});
     2341                                                if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
     2342                                                        if ( (data = cache[1]) === true || data === cachedruns ) {
     2343                                                                return data === true;
     2344                                                        }
     2345                                                } else {
     2346                                                        cache = outerCache[ dir ] = [ dirkey ];
     2347                                                        cache[1] = matcher( elem, context, xml ) || cachedruns;
     2348                                                        if ( cache[1] === true ) {
     2349                                                                return true;
     2350                                                        }
     2351                                                }
     2352                                        }
     2353                                }
     2354                        }
     2355                };
     2356}
     2357
     2358function elementMatcher( matchers ) {
     2359        return matchers.length > 1 ?
     2360                function( elem, context, xml ) {
     2361                        var i = matchers.length;
     2362                        while ( i-- ) {
     2363                                if ( !matchers[i]( elem, context, xml ) ) {
     2364                                        return false;
     2365                                }
     2366                        }
     2367                        return true;
     2368                } :
     2369                matchers[0];
     2370}
     2371
     2372function condense( unmatched, map, filter, context, xml ) {
     2373        var elem,
     2374                newUnmatched = [],
     2375                i = 0,
     2376                len = unmatched.length,
     2377                mapped = map != null;
     2378
     2379        for ( ; i < len; i++ ) {
     2380                if ( (elem = unmatched[i]) ) {
     2381                        if ( !filter || filter( elem, context, xml ) ) {
     2382                                newUnmatched.push( elem );
     2383                                if ( mapped ) {
     2384                                        map.push( i );
     2385                                }
     2386                        }
     2387                }
     2388        }
     2389
     2390        return newUnmatched;
     2391}
     2392
     2393function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
     2394        if ( postFilter && !postFilter[ expando ] ) {
     2395                postFilter = setMatcher( postFilter );
     2396        }
     2397        if ( postFinder && !postFinder[ expando ] ) {
     2398                postFinder = setMatcher( postFinder, postSelector );
     2399        }
     2400        return markFunction(function( seed, results, context, xml ) {
     2401                var temp, i, elem,
     2402                        preMap = [],
     2403                        postMap = [],
     2404                        preexisting = results.length,
     2405
     2406                        // Get initial elements from seed or context
     2407                        elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
     2408
     2409                        // Prefilter to get matcher input, preserving a map for seed-results synchronization
     2410                        matcherIn = preFilter && ( seed || !selector ) ?
     2411                                condense( elems, preMap, preFilter, context, xml ) :
     2412                                elems,
     2413
     2414                        matcherOut = matcher ?
     2415                                // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
     2416                                postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
     2417
     2418                                        // ...intermediate processing is necessary
     2419                                        [] :
     2420
     2421                                        // ...otherwise use results directly
     2422                                        results :
     2423                                matcherIn;
     2424
     2425                // Find primary matches
     2426                if ( matcher ) {
     2427                        matcher( matcherIn, matcherOut, context, xml );
     2428                }
     2429
     2430                // Apply postFilter
     2431                if ( postFilter ) {
     2432                        temp = condense( matcherOut, postMap );
     2433                        postFilter( temp, [], context, xml );
     2434
     2435                        // Un-match failing elements by moving them back to matcherIn
     2436                        i = temp.length;
     2437                        while ( i-- ) {
     2438                                if ( (elem = temp[i]) ) {
     2439                                        matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
     2440                                }
     2441                        }
     2442                }
     2443
     2444                if ( seed ) {
     2445                        if ( postFinder || preFilter ) {
     2446                                if ( postFinder ) {
     2447                                        // Get the final matcherOut by condensing this intermediate into postFinder contexts
     2448                                        temp = [];
     2449                                        i = matcherOut.length;
     2450                                        while ( i-- ) {
     2451                                                if ( (elem = matcherOut[i]) ) {
     2452                                                        // Restore matcherIn since elem is not yet a final match
     2453                                                        temp.push( (matcherIn[i] = elem) );
     2454                                                }
     2455                                        }
     2456                                        postFinder( null, (matcherOut = []), temp, xml );
     2457                                }
     2458
     2459                                // Move matched elements from seed to results to keep them synchronized
     2460                                i = matcherOut.length;
     2461                                while ( i-- ) {
     2462                                        if ( (elem = matcherOut[i]) &&
     2463                                                (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
     2464
     2465                                                seed[temp] = !(results[temp] = elem);
     2466                                        }
     2467                                }
     2468                        }
     2469
     2470                // Add elements to results, through postFinder if defined
     2471                } else {
     2472                        matcherOut = condense(
     2473                                matcherOut === results ?
     2474                                        matcherOut.splice( preexisting, matcherOut.length ) :
     2475                                        matcherOut
     2476                        );
     2477                        if ( postFinder ) {
     2478                                postFinder( null, results, matcherOut, xml );
     2479                        } else {
     2480                                push.apply( results, matcherOut );
     2481                        }
     2482                }
     2483        });
     2484}
     2485
     2486function matcherFromTokens( tokens ) {
     2487        var checkContext, matcher, j,
     2488                len = tokens.length,
     2489                leadingRelative = Expr.relative[ tokens[0].type ],
     2490                implicitRelative = leadingRelative || Expr.relative[" "],
     2491                i = leadingRelative ? 1 : 0,
     2492
     2493                // The foundational matcher ensures that elements are reachable from top-level context(s)
     2494                matchContext = addCombinator( function( elem ) {
     2495                        return elem === checkContext;
     2496                }, implicitRelative, true ),
     2497                matchAnyContext = addCombinator( function( elem ) {
     2498                        return indexOf.call( checkContext, elem ) > -1;
     2499                }, implicitRelative, true ),
     2500                matchers = [ function( elem, context, xml ) {
     2501                        return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
     2502                                (checkContext = context).nodeType ?
     2503                                        matchContext( elem, context, xml ) :
     2504                                        matchAnyContext( elem, context, xml ) );
     2505                } ];
     2506
     2507        for ( ; i < len; i++ ) {
     2508                if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
     2509                        matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
     2510                } else {
     2511                        matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
     2512
     2513                        // Return special upon seeing a positional matcher
     2514                        if ( matcher[ expando ] ) {
     2515                                // Find the next relative operator (if any) for proper handling
     2516                                j = ++i;
     2517                                for ( ; j < len; j++ ) {
     2518                                        if ( Expr.relative[ tokens[j].type ] ) {
     2519                                                break;
     2520                                        }
     2521                                }
     2522                                return setMatcher(
     2523                                        i > 1 && elementMatcher( matchers ),
     2524                                        i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
     2525                                        matcher,
     2526                                        i < j && matcherFromTokens( tokens.slice( i, j ) ),
     2527                                        j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
     2528                                        j < len && toSelector( tokens )
     2529                                );
     2530                        }
     2531                        matchers.push( matcher );
     2532                }
     2533        }
     2534
     2535        return elementMatcher( matchers );
     2536}
     2537
     2538function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
     2539        // A counter to specify which element is currently being matched
     2540        var matcherCachedRuns = 0,
     2541                bySet = setMatchers.length > 0,
     2542                byElement = elementMatchers.length > 0,
     2543                superMatcher = function( seed, context, xml, results, expandContext ) {
     2544                        var elem, j, matcher,
     2545                                setMatched = [],
     2546                                matchedCount = 0,
     2547                                i = "0",
     2548                                unmatched = seed && [],
     2549                                outermost = expandContext != null,
     2550                                contextBackup = outermostContext,
     2551                                // We must always have either seed elements or context
     2552                                elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
     2553                                // Use integer dirruns iff this is the outermost matcher
     2554                                dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
     2555
     2556                        if ( outermost ) {
     2557                                outermostContext = context !== document && context;
     2558                                cachedruns = matcherCachedRuns;
     2559                        }
     2560
     2561                        // Add elements passing elementMatchers directly to results
     2562                        // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
     2563                        for ( ; (elem = elems[i]) != null; i++ ) {
     2564                                if ( byElement && elem ) {
     2565                                        j = 0;
     2566                                        while ( (matcher = elementMatchers[j++]) ) {
     2567                                                if ( matcher( elem, context, xml ) ) {
     2568                                                        results.push( elem );
     2569                                                        break;
     2570                                                }
     2571                                        }
     2572                                        if ( outermost ) {
     2573                                                dirruns = dirrunsUnique;
     2574                                                cachedruns = ++matcherCachedRuns;
     2575                                        }
     2576                                }
     2577
     2578                                // Track unmatched elements for set filters
     2579                                if ( bySet ) {
     2580                                        // They will have gone through all possible matchers
     2581                                        if ( (elem = !matcher && elem) ) {
     2582                                                matchedCount--;
     2583                                        }
     2584
     2585                                        // Lengthen the array for every element, matched or not
     2586                                        if ( seed ) {
     2587                                                unmatched.push( elem );
     2588                                        }
     2589                                }
     2590                        }
     2591
     2592                        // Apply set filters to unmatched elements
     2593                        matchedCount += i;
     2594                        if ( bySet && i !== matchedCount ) {
     2595                                j = 0;
     2596                                while ( (matcher = setMatchers[j++]) ) {
     2597                                        matcher( unmatched, setMatched, context, xml );
     2598                                }
     2599
     2600                                if ( seed ) {
     2601                                        // Reintegrate element matches to eliminate the need for sorting
     2602                                        if ( matchedCount > 0 ) {
     2603                                                while ( i-- ) {
     2604                                                        if ( !(unmatched[i] || setMatched[i]) ) {
     2605                                                                setMatched[i] = pop.call( results );
     2606                                                        }
     2607                                                }
     2608                                        }
     2609
     2610                                        // Discard index placeholder values to get only actual matches
     2611                                        setMatched = condense( setMatched );
     2612                                }
     2613
     2614                                // Add matches to results
     2615                                push.apply( results, setMatched );
     2616
     2617                                // Seedless set matches succeeding multiple successful matchers stipulate sorting
     2618                                if ( outermost && !seed && setMatched.length > 0 &&
     2619                                        ( matchedCount + setMatchers.length ) > 1 ) {
     2620
     2621                                        Sizzle.uniqueSort( results );
     2622                                }
     2623                        }
     2624
     2625                        // Override manipulation of globals by nested matchers
     2626                        if ( outermost ) {
     2627                                dirruns = dirrunsUnique;
     2628                                outermostContext = contextBackup;
     2629                        }
     2630
     2631                        return unmatched;
     2632                };
     2633
     2634        return bySet ?
     2635                markFunction( superMatcher ) :
     2636                superMatcher;
     2637}
     2638
     2639compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
     2640        var i,
     2641                setMatchers = [],
     2642                elementMatchers = [],
     2643                cached = compilerCache[ selector + " " ];
     2644
     2645        if ( !cached ) {
     2646                // Generate a function of recursive functions that can be used to check each element
     2647                if ( !group ) {
     2648                        group = tokenize( selector );
     2649                }
     2650                i = group.length;
     2651                while ( i-- ) {
     2652                        cached = matcherFromTokens( group[i] );
     2653                        if ( cached[ expando ] ) {
     2654                                setMatchers.push( cached );
     2655                        } else {
     2656                                elementMatchers.push( cached );
     2657                        }
     2658                }
     2659
     2660                // Cache the compiled function
     2661                cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
     2662        }
     2663        return cached;
     2664};
     2665
     2666function multipleContexts( selector, contexts, results ) {
     2667        var i = 0,
     2668                len = contexts.length;
     2669        for ( ; i < len; i++ ) {
     2670                Sizzle( selector, contexts[i], results );
     2671        }
     2672        return results;
     2673}
     2674
     2675function select( selector, context, results, seed ) {
     2676        var i, tokens, token, type, find,
     2677                match = tokenize( selector );
     2678
     2679        if ( !seed ) {
     2680                // Try to minimize operations if there is only one group
     2681                if ( match.length === 1 ) {
     2682
     2683                        // Take a shortcut and set the context if the root selector is an ID
     2684                        tokens = match[0] = match[0].slice( 0 );
     2685                        if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
     2686                                        context.nodeType === 9 && documentIsHTML &&
     2687                                        Expr.relative[ tokens[1].type ] ) {
     2688
     2689                                context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
     2690                                if ( !context ) {
     2691                                        return results;
     2692                                }
     2693
     2694                                selector = selector.slice( tokens.shift().value.length );
     2695                        }
     2696
     2697                        // Fetch a seed set for right-to-left matching
     2698                        i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
     2699                        while ( i-- ) {
     2700                                token = tokens[i];
     2701
     2702                                // Abort if we hit a combinator
     2703                                if ( Expr.relative[ (type = token.type) ] ) {
     2704                                        break;
     2705                                }
     2706                                if ( (find = Expr.find[ type ]) ) {
     2707                                        // Search, expanding context for leading sibling combinators
     2708                                        if ( (seed = find(
     2709                                                token.matches[0].replace( runescape, funescape ),
     2710                                                rsibling.test( tokens[0].type ) && context.parentNode || context
     2711                                        )) ) {
     2712
     2713                                                // If seed is empty or no tokens remain, we can return early
     2714                                                tokens.splice( i, 1 );
     2715                                                selector = seed.length && toSelector( tokens );
     2716                                                if ( !selector ) {
     2717                                                        push.apply( results, seed );
     2718                                                        return results;
     2719                                                }
     2720
     2721                                                break;
     2722                                        }
     2723                                }
     2724                        }
     2725                }
     2726        }
     2727
     2728        // Compile and execute a filtering function
     2729        // Provide `match` to avoid retokenization if we modified the selector above
     2730        compile( selector, match )(
     2731                seed,
     2732                context,
     2733                !documentIsHTML,
     2734                results,
     2735                rsibling.test( selector )
     2736        );
     2737        return results;
     2738}
     2739
     2740// Deprecated
     2741Expr.pseudos["nth"] = Expr.pseudos["eq"];
     2742
     2743// Easy API for creating new setFilters
     2744function setFilters() {}
     2745setFilters.prototype = Expr.filters = Expr.pseudos;
     2746Expr.setFilters = new setFilters();
     2747
     2748// One-time assignments
     2749
     2750// Sort stability
     2751support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
     2752
     2753// Initialize against the default document
     2754setDocument();
     2755
     2756// Support: Chrome<<14
     2757// Always assume duplicates if they aren't passed to the comparison function
     2758[0, 0].sort( sortOrder );
     2759support.detectDuplicates = hasDuplicate;
     2760
     2761// Support: IE<8
     2762// Prevent attribute/property "interpolation"
     2763assert(function( div ) {
     2764        div.innerHTML = "<a href='#'></a>";
     2765        if ( div.firstChild.getAttribute("href") !== "#" ) {
     2766                var attrs = "type|href|height|width".split("|"),
     2767                        i = attrs.length;
     2768                while ( i-- ) {
     2769                        Expr.attrHandle[ attrs[i] ] = interpolationHandler;
     2770                }
     2771        }
     2772});
     2773
     2774// Support: IE<9
     2775// Use getAttributeNode to fetch booleans when getAttribute lies
     2776assert(function( div ) {
     2777        if ( div.getAttribute("disabled") != null ) {
     2778                var attrs = booleans.split("|"),
     2779                        i = attrs.length;
     2780                while ( i-- ) {
     2781                        Expr.attrHandle[ attrs[i] ] = boolHandler;
     2782                }
     2783        }
     2784});
     2785
     2786jQuery.find = Sizzle;
     2787jQuery.expr = Sizzle.selectors;
     2788jQuery.expr[":"] = jQuery.expr.pseudos;
     2789jQuery.unique = Sizzle.uniqueSort;
     2790jQuery.text = Sizzle.getText;
     2791jQuery.isXMLDoc = Sizzle.isXML;
     2792jQuery.contains = Sizzle.contains;
     2793
     2794
     2795})( window );
     2796// String to Object options format cache
     2797var optionsCache = {};
     2798
     2799// Convert String-formatted options into Object-formatted ones and store in cache
     2800function createOptions( options ) {
     2801        var object = optionsCache[ options ] = {};
     2802        jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
     2803                object[ flag ] = true;
     2804        });
     2805        return object;
     2806}
     2807
     2808/*
     2809 * Create a callback list using the following parameters:
     2810 *
     2811 *      options: an optional list of space-separated options that will change how
     2812 *                      the callback list behaves or a more traditional option object
     2813 *
     2814 * By default a callback list will act like an event callback list and can be
     2815 * "fired" multiple times.
     2816 *
     2817 * Possible options:
     2818 *
     2819 *      once:                   will ensure the callback list can only be fired once (like a Deferred)
     2820 *
     2821 *      memory:                 will keep track of previous values and will call any callback added
     2822 *                                      after the list has been fired right away with the latest "memorized"
     2823 *                                      values (like a Deferred)
     2824 *
     2825 *      unique:                 will ensure a callback can only be added once (no duplicate in the list)
     2826 *
     2827 *      stopOnFalse:    interrupt callings when a callback returns false
     2828 *
     2829 */
     2830jQuery.Callbacks = function( options ) {
     2831
     2832        // Convert options from String-formatted to Object-formatted if needed
     2833        // (we check in cache first)
     2834        options = typeof options === "string" ?
     2835                ( optionsCache[ options ] || createOptions( options ) ) :
     2836                jQuery.extend( {}, options );
     2837
     2838        var // Last fire value (for non-forgettable lists)
     2839                memory,
     2840                // Flag to know if list was already fired
     2841                fired,
     2842                // Flag to know if list is currently firing
     2843                firing,
     2844                // First callback to fire (used internally by add and fireWith)
     2845                firingStart,
     2846                // End of the loop when firing
     2847                firingLength,
     2848                // Index of currently firing callback (modified by remove if needed)
     2849                firingIndex,
     2850                // Actual callback list
     2851                list = [],
     2852                // Stack of fire calls for repeatable lists
     2853                stack = !options.once && [],
     2854                // Fire callbacks
     2855                fire = function( data ) {
     2856                        memory = options.memory && data;
     2857                        fired = true;
     2858                        firingIndex = firingStart || 0;
     2859                        firingStart = 0;
     2860                        firingLength = list.length;
     2861                        firing = true;
     2862                        for ( ; list && firingIndex < firingLength; firingIndex++ ) {
     2863                                if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
     2864                                        memory = false; // To prevent further calls using add
     2865                                        break;
     2866                                }
     2867                        }
     2868                        firing = false;
     2869                        if ( list ) {
     2870                                if ( stack ) {
     2871                                        if ( stack.length ) {
     2872                                                fire( stack.shift() );
     2873                                        }
     2874                                } else if ( memory ) {
     2875                                        list = [];
     2876                                } else {
     2877                                        self.disable();
     2878                                }
     2879                        }
     2880                },
     2881                // Actual Callbacks object
     2882                self = {
     2883                        // Add a callback or a collection of callbacks to the list
     2884                        add: function() {
     2885                                if ( list ) {
     2886                                        // First, we save the current length
     2887                                        var start = list.length;
     2888                                        (function add( args ) {
     2889                                                jQuery.each( args, function( _, arg ) {
     2890                                                        var type = jQuery.type( arg );
     2891                                                        if ( type === "function" ) {
     2892                                                                if ( !options.unique || !self.has( arg ) ) {
     2893                                                                        list.push( arg );
     2894                                                                }
     2895                                                        } else if ( arg && arg.length && type !== "string" ) {
     2896                                                                // Inspect recursively
     2897                                                                add( arg );
     2898                                                        }
     2899                                                });
     2900                                        })( arguments );
     2901                                        // Do we need to add the callbacks to the
     2902                                        // current firing batch?
     2903                                        if ( firing ) {
     2904                                                firingLength = list.length;
     2905                                        // With memory, if we're not firing then
     2906                                        // we should call right away
     2907                                        } else if ( memory ) {
     2908                                                firingStart = start;
     2909                                                fire( memory );
     2910                                        }
     2911                                }
     2912                                return this;
     2913                        },
     2914                        // Remove a callback from the list
     2915                        remove: function() {
     2916                                if ( list ) {
     2917                                        jQuery.each( arguments, function( _, arg ) {
     2918                                                var index;
     2919                                                while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
     2920                                                        list.splice( index, 1 );
     2921                                                        // Handle firing indexes
     2922                                                        if ( firing ) {
     2923                                                                if ( index <= firingLength ) {
     2924                                                                        firingLength--;
     2925                                                                }
     2926                                                                if ( index <= firingIndex ) {
     2927                                                                        firingIndex--;
     2928                                                                }
     2929                                                        }
     2930                                                }
     2931                                        });
     2932                                }
     2933                                return this;
     2934                        },
     2935                        // Check if a given callback is in the list.
     2936                        // If no argument is given, return whether or not list has callbacks attached.
     2937                        has: function( fn ) {
     2938                                return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
     2939                        },
     2940                        // Remove all callbacks from the list
     2941                        empty: function() {
     2942                                list = [];
     2943                                firingLength = 0;
     2944                                return this;
     2945                        },
     2946                        // Have the list do nothing anymore
     2947                        disable: function() {
     2948                                list = stack = memory = undefined;
     2949                                return this;
     2950                        },
     2951                        // Is it disabled?
     2952                        disabled: function() {
     2953                                return !list;
     2954                        },
     2955                        // Lock the list in its current state
     2956                        lock: function() {
     2957                                stack = undefined;
     2958                                if ( !memory ) {
     2959                                        self.disable();
     2960                                }
     2961                                return this;
     2962                        },
     2963                        // Is it locked?
     2964                        locked: function() {
     2965                                return !stack;
     2966                        },
     2967                        // Call all callbacks with the given context and arguments
     2968                        fireWith: function( context, args ) {
     2969                                args = args || [];
     2970                                args = [ context, args.slice ? args.slice() : args ];
     2971                                if ( list && ( !fired || stack ) ) {
     2972                                        if ( firing ) {
     2973                                                stack.push( args );
     2974                                        } else {
     2975                                                fire( args );
     2976                                        }
     2977                                }
     2978                                return this;
     2979                        },
     2980                        // Call all the callbacks with the given arguments
     2981                        fire: function() {
     2982                                self.fireWith( this, arguments );
     2983                                return this;
     2984                        },
     2985                        // To know if the callbacks have already been called at least once
     2986                        fired: function() {
     2987                                return !!fired;
     2988                        }
     2989                };
     2990
     2991        return self;
     2992};
     2993jQuery.extend({
     2994
     2995        Deferred: function( func ) {
     2996                var tuples = [
     2997                                // action, add listener, listener list, final state
     2998                                [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
     2999                                [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
     3000                                [ "notify", "progress", jQuery.Callbacks("memory") ]
     3001                        ],
     3002                        state = "pending",
     3003                        promise = {
     3004                                state: function() {
     3005                                        return state;
     3006                                },
     3007                                always: function() {
     3008                                        deferred.done( arguments ).fail( arguments );
     3009                                        return this;
     3010                                },
     3011                                then: function( /* fnDone, fnFail, fnProgress */ ) {
     3012                                        var fns = arguments;
     3013                                        return jQuery.Deferred(function( newDefer ) {
     3014                                                jQuery.each( tuples, function( i, tuple ) {
     3015                                                        var action = tuple[ 0 ],
     3016                                                                fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
     3017                                                        // deferred[ done | fail | progress ] for forwarding actions to newDefer
     3018                                                        deferred[ tuple[1] ](function() {
     3019                                                                var returned = fn && fn.apply( this, arguments );
     3020                                                                if ( returned && jQuery.isFunction( returned.promise ) ) {
     3021                                                                        returned.promise()
     3022                                                                                .done( newDefer.resolve )
     3023                                                                                .fail( newDefer.reject )
     3024                                                                                .progress( newDefer.notify );
     3025                                                                } else {
     3026                                                                        newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
     3027                                                                }
     3028                                                        });
     3029                                                });
     3030                                                fns = null;
     3031                                        }).promise();
     3032                                },
     3033                                // Get a promise for this deferred
     3034                                // If obj is provided, the promise aspect is added to the object
     3035                                promise: function( obj ) {
     3036                                        return obj != null ? jQuery.extend( obj, promise ) : promise;
     3037                                }
     3038                        },
     3039                        deferred = {};
     3040
     3041                // Keep pipe for back-compat
     3042                promise.pipe = promise.then;
     3043
     3044                // Add list-specific methods
     3045                jQuery.each( tuples, function( i, tuple ) {
     3046                        var list = tuple[ 2 ],
     3047                                stateString = tuple[ 3 ];
     3048
     3049                        // promise[ done | fail | progress ] = list.add
     3050                        promise[ tuple[1] ] = list.add;
     3051
     3052                        // Handle state
     3053                        if ( stateString ) {
     3054                                list.add(function() {
     3055                                        // state = [ resolved | rejected ]
     3056                                        state = stateString;
     3057
     3058                                // [ reject_list | resolve_list ].disable; progress_list.lock
     3059                                }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
     3060                        }
     3061
     3062                        // deferred[ resolve | reject | notify ]
     3063                        deferred[ tuple[0] ] = function() {
     3064                                deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
     3065                                return this;
     3066                        };
     3067                        deferred[ tuple[0] + "With" ] = list.fireWith;
     3068                });
     3069
     3070                // Make the deferred a promise
     3071                promise.promise( deferred );
     3072
     3073                // Call given func if any
     3074                if ( func ) {
     3075                        func.call( deferred, deferred );
     3076                }
     3077
     3078                // All done!
     3079                return deferred;
     3080        },
     3081
     3082        // Deferred helper
     3083        when: function( subordinate /* , ..., subordinateN */ ) {
     3084                var i = 0,
     3085                        resolveValues = core_slice.call( arguments ),
     3086                        length = resolveValues.length,
     3087
     3088                        // the count of uncompleted subordinates
     3089                        remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
     3090
     3091                        // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
     3092                        deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
     3093
     3094                        // Update function for both resolve and progress values
     3095                        updateFunc = function( i, contexts, values ) {
     3096                                return function( value ) {
     3097                                        contexts[ i ] = this;
     3098                                        values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
     3099                                        if( values === progressValues ) {
     3100                                                deferred.notifyWith( contexts, values );
     3101                                        } else if ( !( --remaining ) ) {
     3102                                                deferred.resolveWith( contexts, values );
     3103                                        }
     3104                                };
     3105                        },
     3106
     3107                        progressValues, progressContexts, resolveContexts;
     3108
     3109                // add listeners to Deferred subordinates; treat others as resolved
     3110                if ( length > 1 ) {
     3111                        progressValues = new Array( length );
     3112                        progressContexts = new Array( length );
     3113                        resolveContexts = new Array( length );
     3114                        for ( ; i < length; i++ ) {
     3115                                if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
     3116                                        resolveValues[ i ].promise()
     3117                                                .done( updateFunc( i, resolveContexts, resolveValues ) )
     3118                                                .fail( deferred.reject )
     3119                                                .progress( updateFunc( i, progressContexts, progressValues ) );
     3120                                } else {
     3121                                        --remaining;
     3122                                }
     3123                        }
     3124                }
     3125
     3126                // if we're not waiting on anything, resolve the master
     3127                if ( !remaining ) {
     3128                        deferred.resolveWith( resolveContexts, resolveValues );
     3129                }
     3130
     3131                return deferred.promise();
     3132        }
     3133});
     3134jQuery.support = (function( support ) {
     3135        var input = document.createElement("input"),
     3136                fragment = document.createDocumentFragment(),
     3137                div = document.createElement("div"),
     3138                select = document.createElement("select"),
     3139                opt = select.appendChild( document.createElement("option") );
     3140
     3141        // Finish early in limited environments
     3142        if ( !input.type ) {
     3143                return support;
     3144        }
     3145
     3146        input.type = "checkbox";
     3147
     3148        // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
     3149        // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
     3150        support.checkOn = input.value !== "";
     3151
     3152        // Must access the parent to make an option select properly
     3153        // Support: IE9, IE10
     3154        support.optSelected = opt.selected;
     3155
     3156        // Will be defined later
     3157        support.reliableMarginRight = true;
     3158        support.boxSizingReliable = true;
     3159        support.pixelPosition = false;
     3160
     3161        // Make sure checked status is properly cloned
     3162        // Support: IE9, IE10
     3163        input.checked = true;
     3164        support.noCloneChecked = input.cloneNode( true ).checked;
     3165
     3166        // Make sure that the options inside disabled selects aren't marked as disabled
     3167        // (WebKit marks them as disabled)
     3168        select.disabled = true;
     3169        support.optDisabled = !opt.disabled;
     3170
     3171        // Check if an input maintains its value after becoming a radio
     3172        // Support: IE9, IE10
     3173        input = document.createElement("input");
     3174        input.value = "t";
     3175        input.type = "radio";
     3176        support.radioValue = input.value === "t";
     3177
     3178        // #11217 - WebKit loses check when the name is after the checked attribute
     3179        input.setAttribute( "checked", "t" );
     3180        input.setAttribute( "name", "t" );
     3181
     3182        fragment.appendChild( input );
     3183
     3184        // Support: Safari 5.1, Android 4.x, Android 2.3
     3185        // old WebKit doesn't clone checked state correctly in fragments
     3186        support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
     3187
     3188        // Support: Firefox, Chrome, Safari
     3189        // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
     3190        support.focusinBubbles = "onfocusin" in window;
     3191
     3192        div.style.backgroundClip = "content-box";
     3193        div.cloneNode( true ).style.backgroundClip = "";
     3194        support.clearCloneStyle = div.style.backgroundClip === "content-box";
     3195
     3196        // Run tests that need a body at doc ready
     3197        jQuery(function() {
     3198                var container, marginDiv,
     3199                        // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
     3200                        divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
     3201                        body = document.getElementsByTagName("body")[ 0 ];
     3202
     3203                if ( !body ) {
     3204                        // Return for frameset docs that don't have a body
     3205                        return;
     3206                }
     3207
     3208                container = document.createElement("div");
     3209                container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
     3210
     3211                // Check box-sizing and margin behavior.
     3212                body.appendChild( container ).appendChild( div );
     3213                div.innerHTML = "";
     3214                // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
     3215                div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%";
     3216
     3217                // Workaround failing boxSizing test due to offsetWidth returning wrong value
     3218                // with some non-1 values of body zoom, ticket #13543
     3219                jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
     3220                        support.boxSizing = div.offsetWidth === 4;
     3221                });
     3222
     3223                // Use window.getComputedStyle because jsdom on node.js will break without it.
     3224                if ( window.getComputedStyle ) {
     3225                        support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
     3226                        support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
     3227
     3228                        // Support: Android 2.3
     3229                        // Check if div with explicit width and no margin-right incorrectly
     3230                        // gets computed margin-right based on width of container. (#3333)
     3231                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
     3232                        marginDiv = div.appendChild( document.createElement("div") );
     3233                        marginDiv.style.cssText = div.style.cssText = divReset;
     3234                        marginDiv.style.marginRight = marginDiv.style.width = "0";
     3235                        div.style.width = "1px";
     3236
     3237                        support.reliableMarginRight =
     3238                                !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
     3239                }
     3240
     3241                body.removeChild( container );
     3242        });
     3243
     3244        return support;
     3245})( {} );
     3246
     3247/*
     3248        Implementation Summary
     3249
     3250        1. Enforce API surface and semantic compatibility with 1.9.x branch
     3251        2. Improve the module's maintainability by reducing the storage
     3252                paths to a single mechanism.
     3253        3. Use the same single mechanism to support "private" and "user" data.
     3254        4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
     3255        5. Avoid exposing implementation details on user objects (eg. expando properties)
     3256        6. Provide a clear path for implementation upgrade to WeakMap in 2014
     3257*/
     3258var data_user, data_priv,
     3259        rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
     3260        rmultiDash = /([A-Z])/g;
     3261
     3262function Data() {
     3263        // Support: Android < 4,
     3264        // Old WebKit does not have Object.preventExtensions/freeze method,
     3265        // return new empty object instead with no [[set]] accessor
     3266        Object.defineProperty( this.cache = {}, 0, {
     3267                get: function() {
     3268                        return {};
     3269                }
     3270        });
     3271
     3272        this.expando = jQuery.expando + Math.random();
     3273}
     3274
     3275Data.uid = 1;
     3276
     3277Data.accepts = function( owner ) {
     3278        // Accepts only:
     3279        //  - Node
     3280        //    - Node.ELEMENT_NODE
     3281        //    - Node.DOCUMENT_NODE
     3282        //  - Object
     3283        //    - Any
     3284        return owner.nodeType ?
     3285                owner.nodeType === 1 || owner.nodeType === 9 : true;
     3286};
     3287
     3288Data.prototype = {
     3289        key: function( owner ) {
     3290                // We can accept data for non-element nodes in modern browsers,
     3291                // but we should not, see #8335.
     3292                // Always return the key for a frozen object.
     3293                if ( !Data.accepts( owner ) ) {
     3294                        return 0;
     3295                }
     3296
     3297                var descriptor = {},
     3298                        // Check if the owner object already has a cache key
     3299                        unlock = owner[ this.expando ];
     3300
     3301                // If not, create one
     3302                if ( !unlock ) {
     3303                        unlock = Data.uid++;
     3304
     3305                        // Secure it in a non-enumerable, non-writable property
     3306                        try {
     3307                                descriptor[ this.expando ] = { value: unlock };
     3308                                Object.defineProperties( owner, descriptor );
     3309
     3310                        // Support: Android < 4
     3311                        // Fallback to a less secure definition
     3312                        } catch ( e ) {
     3313                                descriptor[ this.expando ] = unlock;
     3314                                jQuery.extend( owner, descriptor );
     3315                        }
     3316                }
     3317
     3318                // Ensure the cache object
     3319                if ( !this.cache[ unlock ] ) {
     3320                        this.cache[ unlock ] = {};
     3321                }
     3322
     3323                return unlock;
     3324        },
     3325        set: function( owner, data, value ) {
     3326                var prop,
     3327                        // There may be an unlock assigned to this node,
     3328                        // if there is no entry for this "owner", create one inline
     3329                        // and set the unlock as though an owner entry had always existed
     3330                        unlock = this.key( owner ),
     3331                        cache = this.cache[ unlock ];
     3332
     3333                // Handle: [ owner, key, value ] args
     3334                if ( typeof data === "string" ) {
     3335                        cache[ data ] = value;
     3336
     3337                // Handle: [ owner, { properties } ] args
     3338                } else {
     3339                        // Support an expectation from the old data system where plain
     3340                        // objects used to initialize would be set to the cache by
     3341                        // reference, instead of having properties and values copied.
     3342                        // Note, this will kill the connection between
     3343                        // "this.cache[ unlock ]" and "cache"
     3344                        if ( jQuery.isEmptyObject( cache ) ) {
     3345                                this.cache[ unlock ] = data;
     3346                        // Otherwise, copy the properties one-by-one to the cache object
     3347                        } else {
     3348                                for ( prop in data ) {
     3349                                        cache[ prop ] = data[ prop ];
     3350                                }
     3351                        }
     3352                }
     3353        },
     3354        get: function( owner, key ) {
     3355                // Either a valid cache is found, or will be created.
     3356                // New caches will be created and the unlock returned,
     3357                // allowing direct access to the newly created
     3358                // empty data object. A valid owner object must be provided.
     3359                var cache = this.cache[ this.key( owner ) ];
     3360
     3361                return key === undefined ?
     3362                        cache : cache[ key ];
     3363        },
     3364        access: function( owner, key, value ) {
     3365                // In cases where either:
     3366                //
     3367                //   1. No key was specified
     3368                //   2. A string key was specified, but no value provided
     3369                //
     3370                // Take the "read" path and allow the get method to determine
     3371                // which value to return, respectively either:
     3372                //
     3373                //   1. The entire cache object
     3374                //   2. The data stored at the key
     3375                //
     3376                if ( key === undefined ||
     3377                                ((key && typeof key === "string") && value === undefined) ) {
     3378                        return this.get( owner, key );
     3379                }
     3380
     3381                // [*]When the key is not a string, or both a key and value
     3382                // are specified, set or extend (existing objects) with either:
     3383                //
     3384                //   1. An object of properties
     3385                //   2. A key and value
     3386                //
     3387                this.set( owner, key, value );
     3388
     3389                // Since the "set" path can have two possible entry points
     3390                // return the expected data based on which path was taken[*]
     3391                return value !== undefined ? value : key;
     3392        },
     3393        remove: function( owner, key ) {
     3394                var i, name,
     3395                        unlock = this.key( owner ),
     3396                        cache = this.cache[ unlock ];
     3397
     3398                if ( key === undefined ) {
     3399                        this.cache[ unlock ] = {};
     3400
     3401                } else {
     3402                        // Support array or space separated string of keys
     3403                        if ( jQuery.isArray( key ) ) {
     3404                                // If "name" is an array of keys...
     3405                                // When data is initially created, via ("key", "val") signature,
     3406                                // keys will be converted to camelCase.
     3407                                // Since there is no way to tell _how_ a key was added, remove
     3408                                // both plain key and camelCase key. #12786
     3409                                // This will only penalize the array argument path.
     3410                                name = key.concat( key.map( jQuery.camelCase ) );
     3411                        } else {
     3412                                // Try the string as a key before any manipulation
     3413                                if ( key in cache ) {
     3414                                        name = [ key ];
     3415                                } else {
     3416                                        // If a key with the spaces exists, use it.
     3417                                        // Otherwise, create an array by matching non-whitespace
     3418                                        name = jQuery.camelCase( key );
     3419                                        name = name in cache ?
     3420                                                [ name ] : ( name.match( core_rnotwhite ) || [] );
     3421                                }
     3422                        }
     3423
     3424                        i = name.length;
     3425                        while ( i-- ) {
     3426                                delete cache[ name[ i ] ];
     3427                        }
     3428                }
     3429        },
     3430        hasData: function( owner ) {
     3431                return !jQuery.isEmptyObject(
     3432                        this.cache[ owner[ this.expando ] ] || {}
     3433                );
     3434        },
     3435        discard: function( owner ) {
     3436                delete this.cache[ this.key( owner ) ];
     3437        }
     3438};
     3439
     3440// These may be used throughout the jQuery core codebase
     3441data_user = new Data();
     3442data_priv = new Data();
     3443
     3444
     3445jQuery.extend({
     3446        acceptData: Data.accepts,
     3447
     3448        hasData: function( elem ) {
     3449                return data_user.hasData( elem ) || data_priv.hasData( elem );
     3450        },
     3451
     3452        data: function( elem, name, data ) {
     3453                return data_user.access( elem, name, data );
     3454        },
     3455
     3456        removeData: function( elem, name ) {
     3457                data_user.remove( elem, name );
     3458        },
     3459
     3460        // TODO: Now that all calls to _data and _removeData have been replaced
     3461        // with direct calls to data_priv methods, these can be deprecated.
     3462        _data: function( elem, name, data ) {
     3463                return data_priv.access( elem, name, data );
     3464        },
     3465
     3466        _removeData: function( elem, name ) {
     3467                data_priv.remove( elem, name );
     3468        }
     3469});
     3470
     3471jQuery.fn.extend({
     3472        data: function( key, value ) {
     3473                var attrs, name,
     3474                        elem = this[ 0 ],
     3475                        i = 0,
     3476                        data = null;
     3477
     3478                // Gets all values
     3479                if ( key === undefined ) {
     3480                        if ( this.length ) {
     3481                                data = data_user.get( elem );
     3482
     3483                                if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
     3484                                        attrs = elem.attributes;
     3485                                        for ( ; i < attrs.length; i++ ) {
     3486                                                name = attrs[ i ].name;
     3487
     3488                                                if ( name.indexOf( "data-" ) === 0 ) {
     3489                                                        name = jQuery.camelCase( name.substring(5) );
     3490                                                        dataAttr( elem, name, data[ name ] );
     3491                                                }
     3492                                        }
     3493                                        data_priv.set( elem, "hasDataAttrs", true );
     3494                                }
     3495                        }
     3496
     3497                        return data;
     3498                }
     3499
     3500                // Sets multiple values
     3501                if ( typeof key === "object" ) {
     3502                        return this.each(function() {
     3503                                data_user.set( this, key );
     3504                        });
     3505                }
     3506
     3507                return jQuery.access( this, function( value ) {
     3508                        var data,
     3509                                camelKey = jQuery.camelCase( key );
     3510
     3511                        // The calling jQuery object (element matches) is not empty
     3512                        // (and therefore has an element appears at this[ 0 ]) and the
     3513                        // `value` parameter was not undefined. An empty jQuery object
     3514                        // will result in `undefined` for elem = this[ 0 ] which will
     3515                        // throw an exception if an attempt to read a data cache is made.
     3516                        if ( elem && value === undefined ) {
     3517                                // Attempt to get data from the cache
     3518                                // with the key as-is
     3519                                data = data_user.get( elem, key );
     3520                                if ( data !== undefined ) {
     3521                                        return data;
     3522                                }
     3523
     3524                                // Attempt to get data from the cache
     3525                                // with the key camelized
     3526                                data = data_user.get( elem, camelKey );
     3527                                if ( data !== undefined ) {
     3528                                        return data;
     3529                                }
     3530
     3531                                // Attempt to "discover" the data in
     3532                                // HTML5 custom data-* attrs
     3533                                data = dataAttr( elem, camelKey, undefined );
     3534                                if ( data !== undefined ) {
     3535                                        return data;
     3536                                }
     3537
     3538                                // We tried really hard, but the data doesn't exist.
     3539                                return;
     3540                        }
     3541
     3542                        // Set the data...
     3543                        this.each(function() {
     3544                                // First, attempt to store a copy or reference of any
     3545                                // data that might've been store with a camelCased key.
     3546                                var data = data_user.get( this, camelKey );
     3547
     3548                                // For HTML5 data-* attribute interop, we have to
     3549                                // store property names with dashes in a camelCase form.
     3550                                // This might not apply to all properties...*
     3551                                data_user.set( this, camelKey, value );
     3552
     3553                                // *... In the case of properties that might _actually_
     3554                                // have dashes, we need to also store a copy of that
     3555                                // unchanged property.
     3556                                if ( key.indexOf("-") !== -1 && data !== undefined ) {
     3557                                        data_user.set( this, key, value );
     3558                                }
     3559                        });
     3560                }, null, value, arguments.length > 1, null, true );
     3561        },
     3562
     3563        removeData: function( key ) {
     3564                return this.each(function() {
     3565                        data_user.remove( this, key );
     3566                });
     3567        }
     3568});
     3569
     3570function dataAttr( elem, key, data ) {
     3571        var name;
     3572
     3573        // If nothing was found internally, try to fetch any
     3574        // data from the HTML5 data-* attribute
     3575        if ( data === undefined && elem.nodeType === 1 ) {
     3576                name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
     3577                data = elem.getAttribute( name );
     3578
     3579                if ( typeof data === "string" ) {
     3580                        try {
     3581                                data = data === "true" ? true :
     3582                                        data === "false" ? false :
     3583                                        data === "null" ? null :
     3584                                        // Only convert to a number if it doesn't change the string
     3585                                        +data + "" === data ? +data :
     3586                                        rbrace.test( data ) ? JSON.parse( data ) :
     3587                                        data;
     3588                        } catch( e ) {}
     3589
     3590                        // Make sure we set the data so it isn't changed later
     3591                        data_user.set( elem, key, data );
     3592                } else {
     3593                        data = undefined;
     3594                }
     3595        }
     3596        return data;
     3597}
     3598jQuery.extend({
     3599        queue: function( elem, type, data ) {
     3600                var queue;
     3601
     3602                if ( elem ) {
     3603                        type = ( type || "fx" ) + "queue";
     3604                        queue = data_priv.get( elem, type );
     3605
     3606                        // Speed up dequeue by getting out quickly if this is just a lookup
     3607                        if ( data ) {
     3608                                if ( !queue || jQuery.isArray( data ) ) {
     3609                                        queue = data_priv.access( elem, type, jQuery.makeArray(data) );
     3610                                } else {
     3611                                        queue.push( data );
     3612                                }
     3613                        }
     3614                        return queue || [];
     3615                }
     3616        },
     3617
     3618        dequeue: function( elem, type ) {
     3619                type = type || "fx";
     3620
     3621                var queue = jQuery.queue( elem, type ),
     3622                        startLength = queue.length,
     3623                        fn = queue.shift(),
     3624                        hooks = jQuery._queueHooks( elem, type ),
     3625                        next = function() {
     3626                                jQuery.dequeue( elem, type );
     3627                        };
     3628
     3629                // If the fx queue is dequeued, always remove the progress sentinel
     3630                if ( fn === "inprogress" ) {
     3631                        fn = queue.shift();
     3632                        startLength--;
     3633                }
     3634
     3635                hooks.cur = fn;
     3636                if ( fn ) {
     3637
     3638                        // Add a progress sentinel to prevent the fx queue from being
     3639                        // automatically dequeued
     3640                        if ( type === "fx" ) {
     3641                                queue.unshift( "inprogress" );
     3642                        }
     3643
     3644                        // clear up the last queue stop function
     3645                        delete hooks.stop;
     3646                        fn.call( elem, next, hooks );
     3647                }
     3648
     3649                if ( !startLength && hooks ) {
     3650                        hooks.empty.fire();
     3651                }
     3652        },
     3653
     3654        // not intended for public consumption - generates a queueHooks object, or returns the current one
     3655        _queueHooks: function( elem, type ) {
     3656                var key = type + "queueHooks";
     3657                return data_priv.get( elem, key ) || data_priv.access( elem, key, {
     3658                        empty: jQuery.Callbacks("once memory").add(function() {
     3659                                data_priv.remove( elem, [ type + "queue", key ] );
     3660                        })
     3661                });
     3662        }
     3663});
     3664
     3665jQuery.fn.extend({
     3666        queue: function( type, data ) {
     3667                var setter = 2;
     3668
     3669                if ( typeof type !== "string" ) {
     3670                        data = type;
     3671                        type = "fx";
     3672                        setter--;
     3673                }
     3674
     3675                if ( arguments.length < setter ) {
     3676                        return jQuery.queue( this[0], type );
     3677                }
     3678
     3679                return data === undefined ?
     3680                        this :
     3681                        this.each(function() {
     3682                                var queue = jQuery.queue( this, type, data );
     3683
     3684                                // ensure a hooks for this queue
     3685                                jQuery._queueHooks( this, type );
     3686
     3687                                if ( type === "fx" && queue[0] !== "inprogress" ) {
     3688                                        jQuery.dequeue( this, type );
     3689                                }
     3690                        });
     3691        },
     3692        dequeue: function( type ) {
     3693                return this.each(function() {
     3694                        jQuery.dequeue( this, type );
     3695                });
     3696        },
     3697        // Based off of the plugin by Clint Helfers, with permission.
     3698        // http://blindsignals.com/index.php/2009/07/jquery-delay/
     3699        delay: function( time, type ) {
     3700                time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
     3701                type = type || "fx";
     3702
     3703                return this.queue( type, function( next, hooks ) {
     3704                        var timeout = setTimeout( next, time );
     3705                        hooks.stop = function() {
     3706                                clearTimeout( timeout );
     3707                        };
     3708                });
     3709        },
     3710        clearQueue: function( type ) {
     3711                return this.queue( type || "fx", [] );
     3712        },
     3713        // Get a promise resolved when queues of a certain type
     3714        // are emptied (fx is the type by default)
     3715        promise: function( type, obj ) {
     3716                var tmp,
     3717                        count = 1,
     3718                        defer = jQuery.Deferred(),
     3719                        elements = this,
     3720                        i = this.length,
     3721                        resolve = function() {
     3722                                if ( !( --count ) ) {
     3723                                        defer.resolveWith( elements, [ elements ] );
     3724                                }
     3725                        };
     3726
     3727                if ( typeof type !== "string" ) {
     3728                        obj = type;
     3729                        type = undefined;
     3730                }
     3731                type = type || "fx";
     3732
     3733                while( i-- ) {
     3734                        tmp = data_priv.get( elements[ i ], type + "queueHooks" );
     3735                        if ( tmp && tmp.empty ) {
     3736                                count++;
     3737                                tmp.empty.add( resolve );
     3738                        }
     3739                }
     3740                resolve();
     3741                return defer.promise( obj );
     3742        }
     3743});
     3744var nodeHook, boolHook,
     3745        rclass = /[\t\r\n]/g,
     3746        rreturn = /\r/g,
     3747        rfocusable = /^(?:input|select|textarea|button)$/i;
     3748
     3749jQuery.fn.extend({
     3750        attr: function( name, value ) {
     3751                return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
     3752        },
     3753
     3754        removeAttr: function( name ) {
     3755                return this.each(function() {
     3756                        jQuery.removeAttr( this, name );
     3757                });
     3758        },
     3759
     3760        prop: function( name, value ) {
     3761                return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
     3762        },
     3763
     3764        removeProp: function( name ) {
     3765                return this.each(function() {
     3766                        delete this[ jQuery.propFix[ name ] || name ];
     3767                });
     3768        },
     3769
     3770        addClass: function( value ) {
     3771                var classes, elem, cur, clazz, j,
     3772                        i = 0,
     3773                        len = this.length,
     3774                        proceed = typeof value === "string" && value;
     3775
     3776                if ( jQuery.isFunction( value ) ) {
     3777                        return this.each(function( j ) {
     3778                                jQuery( this ).addClass( value.call( this, j, this.className ) );
     3779                        });
     3780                }
     3781
     3782                if ( proceed ) {
     3783                        // The disjunction here is for better compressibility (see removeClass)
     3784                        classes = ( value || "" ).match( core_rnotwhite ) || [];
     3785
     3786                        for ( ; i < len; i++ ) {
     3787                                elem = this[ i ];
     3788                                cur = elem.nodeType === 1 && ( elem.className ?
     3789                                        ( " " + elem.className + " " ).replace( rclass, " " ) :
     3790                                        " "
     3791                                );
     3792
     3793                                if ( cur ) {
     3794                                        j = 0;
     3795                                        while ( (clazz = classes[j++]) ) {
     3796                                                if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
     3797                                                        cur += clazz + " ";
     3798                                                }
     3799                                        }
     3800                                        elem.className = jQuery.trim( cur );
     3801
     3802                                }
     3803                        }
     3804                }
     3805
     3806                return this;
     3807        },
     3808
     3809        removeClass: function( value ) {
     3810                var classes, elem, cur, clazz, j,
     3811                        i = 0,
     3812                        len = this.length,
     3813                        proceed = arguments.length === 0 || typeof value === "string" && value;
     3814
     3815                if ( jQuery.isFunction( value ) ) {
     3816                        return this.each(function( j ) {
     3817                                jQuery( this ).removeClass( value.call( this, j, this.className ) );
     3818                        });
     3819                }
     3820                if ( proceed ) {
     3821                        classes = ( value || "" ).match( core_rnotwhite ) || [];
     3822
     3823                        for ( ; i < len; i++ ) {
     3824                                elem = this[ i ];
     3825                                // This expression is here for better compressibility (see addClass)
     3826                                cur = elem.nodeType === 1 && ( elem.className ?
     3827                                        ( " " + elem.className + " " ).replace( rclass, " " ) :
     3828                                        ""
     3829                                );
     3830
     3831                                if ( cur ) {
     3832                                        j = 0;
     3833                                        while ( (clazz = classes[j++]) ) {
     3834                                                // Remove *all* instances
     3835                                                while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
     3836                                                        cur = cur.replace( " " + clazz + " ", " " );
     3837                                                }
     3838                                        }
     3839                                        elem.className = value ? jQuery.trim( cur ) : "";
     3840                                }
     3841                        }
     3842                }
     3843
     3844                return this;
     3845        },
     3846
     3847        toggleClass: function( value, stateVal ) {
     3848                var type = typeof value,
     3849                        isBool = typeof stateVal === "boolean";
     3850
     3851                if ( jQuery.isFunction( value ) ) {
     3852                        return this.each(function( i ) {
     3853                                jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
     3854                        });
     3855                }
     3856
     3857                return this.each(function() {
     3858                        if ( type === "string" ) {
     3859                                // toggle individual class names
     3860                                var className,
     3861                                        i = 0,
     3862                                        self = jQuery( this ),
     3863                                        state = stateVal,
     3864                                        classNames = value.match( core_rnotwhite ) || [];
     3865
     3866                                while ( (className = classNames[ i++ ]) ) {
     3867                                        // check each className given, space separated list
     3868                                        state = isBool ? state : !self.hasClass( className );
     3869                                        self[ state ? "addClass" : "removeClass" ]( className );
     3870                                }
     3871
     3872                        // Toggle whole class name
     3873                        } else if ( type === core_strundefined || type === "boolean" ) {
     3874                                if ( this.className ) {
     3875                                        // store className if set
     3876                                        data_priv.set( this, "__className__", this.className );
     3877                                }
     3878
     3879                                // If the element has a class name or if we're passed "false",
     3880                                // then remove the whole classname (if there was one, the above saved it).
     3881                                // Otherwise bring back whatever was previously saved (if anything),
     3882                                // falling back to the empty string if nothing was stored.
     3883                                this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
     3884                        }
     3885                });
     3886        },
     3887
     3888        hasClass: function( selector ) {
     3889                var className = " " + selector + " ",
     3890                        i = 0,
     3891                        l = this.length;
     3892                for ( ; i < l; i++ ) {
     3893                        if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
     3894                                return true;
     3895                        }
     3896                }
     3897
     3898                return false;
     3899        },
     3900
     3901        val: function( value ) {
     3902                var hooks, ret, isFunction,
     3903                        elem = this[0];
     3904
     3905                if ( !arguments.length ) {
     3906                        if ( elem ) {
     3907                                hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
     3908
     3909                                if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
     3910                                        return ret;
     3911                                }
     3912
     3913                                ret = elem.value;
     3914
     3915                                return typeof ret === "string" ?
     3916                                        // handle most common string cases
     3917                                        ret.replace(rreturn, "") :
     3918                                        // handle cases where value is null/undef or number
     3919                                        ret == null ? "" : ret;
     3920                        }
     3921
     3922                        return;
     3923                }
     3924
     3925                isFunction = jQuery.isFunction( value );
     3926
     3927                return this.each(function( i ) {
     3928                        var val,
     3929                                self = jQuery(this);
     3930
     3931                        if ( this.nodeType !== 1 ) {
     3932                                return;
     3933                        }
     3934
     3935                        if ( isFunction ) {
     3936                                val = value.call( this, i, self.val() );
     3937                        } else {
     3938                                val = value;
     3939                        }
     3940
     3941                        // Treat null/undefined as ""; convert numbers to string
     3942                        if ( val == null ) {
     3943                                val = "";
     3944                        } else if ( typeof val === "number" ) {
     3945                                val += "";
     3946                        } else if ( jQuery.isArray( val ) ) {
     3947                                val = jQuery.map(val, function ( value ) {
     3948                                        return value == null ? "" : value + "";
     3949                                });
     3950                        }
     3951
     3952                        hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
     3953
     3954                        // If set returns undefined, fall back to normal setting
     3955                        if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
     3956                                this.value = val;
     3957                        }
     3958                });
     3959        }
     3960});
     3961
     3962jQuery.extend({
     3963        valHooks: {
     3964                option: {
     3965                        get: function( elem ) {
     3966                                // attributes.value is undefined in Blackberry 4.7 but
     3967                                // uses .value. See #6932
     3968                                var val = elem.attributes.value;
     3969                                return !val || val.specified ? elem.value : elem.text;
     3970                        }
     3971                },
     3972                select: {
     3973                        get: function( elem ) {
     3974                                var value, option,
     3975                                        options = elem.options,
     3976                                        index = elem.selectedIndex,
     3977                                        one = elem.type === "select-one" || index < 0,
     3978                                        values = one ? null : [],
     3979                                        max = one ? index + 1 : options.length,
     3980                                        i = index < 0 ?
     3981                                                max :
     3982                                                one ? index : 0;
     3983
     3984                                // Loop through all the selected options
     3985                                for ( ; i < max; i++ ) {
     3986                                        option = options[ i ];
     3987
     3988                                        // IE6-9 doesn't update selected after form reset (#2551)
     3989                                        if ( ( option.selected || i === index ) &&
     3990                                                        // Don't return options that are disabled or in a disabled optgroup
     3991                                                        ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
     3992                                                        ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
     3993
     3994                                                // Get the specific value for the option
     3995                                                value = jQuery( option ).val();
     3996
     3997                                                // We don't need an array for one selects
     3998                                                if ( one ) {
     3999                                                        return value;
     4000                                                }
     4001
     4002                                                // Multi-Selects return an array
     4003                                                values.push( value );
     4004                                        }
     4005                                }
     4006
     4007                                return values;
     4008                        },
     4009
     4010                        set: function( elem, value ) {
     4011                                var optionSet, option,
     4012                                        options = elem.options,
     4013                                        values = jQuery.makeArray( value ),
     4014                                        i = options.length;
     4015
     4016                                while ( i-- ) {
     4017                                        option = options[ i ];
     4018                                        if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
     4019                                                optionSet = true;
     4020                                        }
     4021                                }
     4022
     4023                                // force browsers to behave consistently when non-matching value is set
     4024                                if ( !optionSet ) {
     4025                                        elem.selectedIndex = -1;
     4026                                }
     4027                                return values;
     4028                        }
     4029                }
     4030        },
     4031
     4032        attr: function( elem, name, value ) {
     4033                var hooks, ret,
     4034                        nType = elem.nodeType;
     4035
     4036                // don't get/set attributes on text, comment and attribute nodes
     4037                if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
     4038                        return;
     4039                }
     4040
     4041                // Fallback to prop when attributes are not supported
     4042                if ( typeof elem.getAttribute === core_strundefined ) {
     4043                        return jQuery.prop( elem, name, value );
     4044                }
     4045
     4046                // All attributes are lowercase
     4047                // Grab necessary hook if one is defined
     4048                if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
     4049                        name = name.toLowerCase();
     4050                        hooks = jQuery.attrHooks[ name ] ||
     4051                                ( jQuery.expr.match.boolean.test( name ) ? boolHook : nodeHook );
     4052                }
     4053
     4054                if ( value !== undefined ) {
     4055
     4056                        if ( value === null ) {
     4057                                jQuery.removeAttr( elem, name );
     4058
     4059                        } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
     4060                                return ret;
     4061
     4062                        } else {
     4063                                elem.setAttribute( name, value + "" );
     4064                                return value;
     4065                        }
     4066
     4067                } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
     4068                        return ret;
     4069
     4070                } else {
     4071                        ret = jQuery.find.attr( elem, name );
     4072
     4073                        // Non-existent attributes return null, we normalize to undefined
     4074                        return ret == null ?
     4075                                undefined :
     4076                                ret;
     4077                }
     4078        },
     4079
     4080        removeAttr: function( elem, value ) {
     4081                var name, propName,
     4082                        i = 0,
     4083                        attrNames = value && value.match( core_rnotwhite );
     4084
     4085                if ( attrNames && elem.nodeType === 1 ) {
     4086                        while ( (name = attrNames[i++]) ) {
     4087                                propName = jQuery.propFix[ name ] || name;
     4088
     4089                                // Boolean attributes get special treatment (#10870)
     4090                                if ( jQuery.expr.match.boolean.test( name ) ) {
     4091                                        // Set corresponding property to false
     4092                                        elem[ propName ] = false;
     4093                                }
     4094
     4095                                elem.removeAttribute( name );
     4096                        }
     4097                }
     4098        },
     4099
     4100        attrHooks: {
     4101                type: {
     4102                        set: function( elem, value ) {
     4103                                if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
     4104                                        // Setting the type on a radio button after the value resets the value in IE6-9
     4105                                        // Reset value to default in case type is set after value during creation
     4106                                        var val = elem.value;
     4107                                        elem.setAttribute( "type", value );
     4108                                        if ( val ) {
     4109                                                elem.value = val;
     4110                                        }
     4111                                        return value;
     4112                                }
     4113                        }
     4114                }
     4115        },
     4116
     4117        propFix: {
     4118                "for": "htmlFor",
     4119                "class": "className"
     4120        },
     4121
     4122        prop: function( elem, name, value ) {
     4123                var ret, hooks, notxml,
     4124                        nType = elem.nodeType;
     4125
     4126                // don't get/set properties on text, comment and attribute nodes
     4127                if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
     4128                        return;
     4129                }
     4130
     4131                notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
     4132
     4133                if ( notxml ) {
     4134                        // Fix name and attach hooks
     4135                        name = jQuery.propFix[ name ] || name;
     4136                        hooks = jQuery.propHooks[ name ];
     4137                }
     4138
     4139                if ( value !== undefined ) {
     4140                        return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
     4141                                ret :
     4142                                ( elem[ name ] = value );
     4143
     4144                } else {
     4145                        return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
     4146                                ret :
     4147                                elem[ name ];
     4148                }
     4149        },
     4150
     4151        propHooks: {
     4152                tabIndex: {
     4153                        get: function( elem ) {
     4154                                return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
     4155                                        elem.tabIndex :
     4156                                        -1;
     4157                        }
     4158                }
     4159        }
     4160});
     4161
     4162// Hooks for boolean attributes
     4163boolHook = {
     4164        set: function( elem, value, name ) {
     4165                if ( value === false ) {
     4166                        // Remove boolean attributes when set to false
     4167                        jQuery.removeAttr( elem, name );
     4168                } else {
     4169                        elem.setAttribute( name, name );
     4170                }
     4171                return name;
     4172        }
     4173};
     4174jQuery.each( jQuery.expr.match.boolean.source.match( /\w+/g ), function( i, name ) {
     4175        var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
     4176
     4177        jQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) {
     4178                var fn = jQuery.expr.attrHandle[ name ],
     4179                        ret = isXML ?
     4180                                undefined :
     4181                                /* jshint eqeqeq: false */
     4182                                // Temporarily disable this handler to check existence
     4183                                (jQuery.expr.attrHandle[ name ] = undefined) !=
     4184                                        getter( elem, name, isXML ) ?
     4185
     4186                                        name.toLowerCase() :
     4187                                        null;
     4188
     4189                // Restore handler
     4190                jQuery.expr.attrHandle[ name ] = fn;
     4191
     4192                return ret;
     4193        };
     4194});
     4195
     4196// Support: IE9+
     4197// Selectedness for an option in an optgroup can be inaccurate
     4198if ( !jQuery.support.optSelected ) {
     4199        jQuery.propHooks.selected = {
     4200                get: function( elem ) {
     4201                        var parent = elem.parentNode;
     4202                        if ( parent && parent.parentNode ) {
     4203                                parent.parentNode.selectedIndex;
     4204                        }
     4205                        return null;
     4206                }
     4207        };
     4208}
     4209
     4210jQuery.each([
     4211        "tabIndex",
     4212        "readOnly",
     4213        "maxLength",
     4214        "cellSpacing",
     4215        "cellPadding",
     4216        "rowSpan",
     4217        "colSpan",
     4218        "useMap",
     4219        "frameBorder",
     4220        "contentEditable"
     4221], function() {
     4222        jQuery.propFix[ this.toLowerCase() ] = this;
     4223});
     4224
     4225// Radios and checkboxes getter/setter
     4226jQuery.each([ "radio", "checkbox" ], function() {
     4227        jQuery.valHooks[ this ] = {
     4228                set: function( elem, value ) {
     4229                        if ( jQuery.isArray( value ) ) {
     4230                                return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
     4231                        }
     4232                }
     4233        };
     4234        if ( !jQuery.support.checkOn ) {
     4235                jQuery.valHooks[ this ].get = function( elem ) {
     4236                        // Support: Webkit
     4237                        // "" is returned instead of "on" if a value isn't specified
     4238                        return elem.getAttribute("value") === null ? "on" : elem.value;
     4239                };
     4240        }
     4241});
     4242var rkeyEvent = /^key/,
     4243        rmouseEvent = /^(?:mouse|contextmenu)|click/,
     4244        rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
     4245        rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
     4246
     4247function returnTrue() {
     4248        return true;
     4249}
     4250
     4251function returnFalse() {
     4252        return false;
     4253}
     4254
     4255function safeActiveElement() {
     4256        try {
     4257                return document.activeElement;
     4258        } catch ( err ) { }
     4259}
     4260
     4261/*
     4262 * Helper functions for managing events -- not part of the public interface.
     4263 * Props to Dean Edwards' addEvent library for many of the ideas.
     4264 */
     4265jQuery.event = {
     4266
     4267        global: {},
     4268
     4269        add: function( elem, types, handler, data, selector ) {
     4270
     4271                var handleObjIn, eventHandle, tmp,
     4272                        events, t, handleObj,
     4273                        special, handlers, type, namespaces, origType,
     4274                        elemData = data_priv.get( elem );
     4275
     4276                // Don't attach events to noData or text/comment nodes (but allow plain objects)
     4277                if ( !elemData ) {
     4278                        return;
     4279                }
     4280
     4281                // Caller can pass in an object of custom data in lieu of the handler
     4282                if ( handler.handler ) {
     4283                        handleObjIn = handler;
     4284                        handler = handleObjIn.handler;
     4285                        selector = handleObjIn.selector;
     4286                }
     4287
     4288                // Make sure that the handler has a unique ID, used to find/remove it later
     4289                if ( !handler.guid ) {
     4290                        handler.guid = jQuery.guid++;
     4291                }
     4292
     4293                // Init the element's event structure and main handler, if this is the first
     4294                if ( !(events = elemData.events) ) {
     4295                        events = elemData.events = {};
     4296                }
     4297                if ( !(eventHandle = elemData.handle) ) {
     4298                        eventHandle = elemData.handle = function( e ) {
     4299                                // Discard the second event of a jQuery.event.trigger() and
     4300                                // when an event is called after a page has unloaded
     4301                                return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
     4302                                        jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
     4303                                        undefined;
     4304                        };
     4305                        // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
     4306                        eventHandle.elem = elem;
     4307                }
     4308
     4309                // Handle multiple events separated by a space
     4310                types = ( types || "" ).match( core_rnotwhite ) || [""];
     4311                t = types.length;
     4312                while ( t-- ) {
     4313                        tmp = rtypenamespace.exec( types[t] ) || [];
     4314                        type = origType = tmp[1];
     4315                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
     4316
     4317                        // There *must* be a type, no attaching namespace-only handlers
     4318                        if ( !type ) {
     4319                                continue;
     4320                        }
     4321
     4322                        // If event changes its type, use the special event handlers for the changed type
     4323                        special = jQuery.event.special[ type ] || {};
     4324
     4325                        // If selector defined, determine special event api type, otherwise given type
     4326                        type = ( selector ? special.delegateType : special.bindType ) || type;
     4327
     4328                        // Update special based on newly reset type
     4329                        special = jQuery.event.special[ type ] || {};
     4330
     4331                        // handleObj is passed to all event handlers
     4332                        handleObj = jQuery.extend({
     4333                                type: type,
     4334                                origType: origType,
     4335                                data: data,
     4336                                handler: handler,
     4337                                guid: handler.guid,
     4338                                selector: selector,
     4339                                needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
     4340                                namespace: namespaces.join(".")
     4341                        }, handleObjIn );
     4342
     4343                        // Init the event handler queue if we're the first
     4344                        if ( !(handlers = events[ type ]) ) {
     4345                                handlers = events[ type ] = [];
     4346                                handlers.delegateCount = 0;
     4347
     4348                                // Only use addEventListener if the special events handler returns false
     4349                                if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
     4350                                        if ( elem.addEventListener ) {
     4351                                                elem.addEventListener( type, eventHandle, false );
     4352                                        }
     4353                                }
     4354                        }
     4355
     4356                        if ( special.add ) {
     4357                                special.add.call( elem, handleObj );
     4358
     4359                                if ( !handleObj.handler.guid ) {
     4360                                        handleObj.handler.guid = handler.guid;
     4361                                }
     4362                        }
     4363
     4364                        // Add to the element's handler list, delegates in front
     4365                        if ( selector ) {
     4366                                handlers.splice( handlers.delegateCount++, 0, handleObj );
     4367                        } else {
     4368                                handlers.push( handleObj );
     4369                        }
     4370
     4371                        // Keep track of which events have ever been used, for event optimization
     4372                        jQuery.event.global[ type ] = true;
     4373                }
     4374
     4375                // Nullify elem to prevent memory leaks in IE
     4376                elem = null;
     4377        },
     4378
     4379        // Detach an event or set of events from an element
     4380        remove: function( elem, types, handler, selector, mappedTypes ) {
     4381
     4382                var j, origCount, tmp,
     4383                        events, t, handleObj,
     4384                        special, handlers, type, namespaces, origType,
     4385                        elemData = data_priv.hasData( elem ) && data_priv.get( elem );
     4386
     4387                if ( !elemData || !(events = elemData.events) ) {
     4388                        return;
     4389                }
     4390
     4391                // Once for each type.namespace in types; type may be omitted
     4392                types = ( types || "" ).match( core_rnotwhite ) || [""];
     4393                t = types.length;
     4394                while ( t-- ) {
     4395                        tmp = rtypenamespace.exec( types[t] ) || [];
     4396                        type = origType = tmp[1];
     4397                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
     4398
     4399                        // Unbind all events (on this namespace, if provided) for the element
     4400                        if ( !type ) {
     4401                                for ( type in events ) {
     4402                                        jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
     4403                                }
     4404                                continue;
     4405                        }
     4406
     4407                        special = jQuery.event.special[ type ] || {};
     4408                        type = ( selector ? special.delegateType : special.bindType ) || type;
     4409                        handlers = events[ type ] || [];
     4410                        tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
     4411
     4412                        // Remove matching events
     4413                        origCount = j = handlers.length;
     4414                        while ( j-- ) {
     4415                                handleObj = handlers[ j ];
     4416
     4417                                if ( ( mappedTypes || origType === handleObj.origType ) &&
     4418                                        ( !handler || handler.guid === handleObj.guid ) &&
     4419                                        ( !tmp || tmp.test( handleObj.namespace ) ) &&
     4420                                        ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
     4421                                        handlers.splice( j, 1 );
     4422
     4423                                        if ( handleObj.selector ) {
     4424                                                handlers.delegateCount--;
     4425                                        }
     4426                                        if ( special.remove ) {
     4427                                                special.remove.call( elem, handleObj );
     4428                                        }
     4429                                }
     4430                        }
     4431
     4432                        // Remove generic event handler if we removed something and no more handlers exist
     4433                        // (avoids potential for endless recursion during removal of special event handlers)
     4434                        if ( origCount && !handlers.length ) {
     4435                                if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
     4436                                        jQuery.removeEvent( elem, type, elemData.handle );
     4437                                }
     4438
     4439                                delete events[ type ];
     4440                        }
     4441                }
     4442
     4443                // Remove the expando if it's no longer used
     4444                if ( jQuery.isEmptyObject( events ) ) {
     4445                        delete elemData.handle;
     4446                        data_priv.remove( elem, "events" );
     4447                }
     4448        },
     4449
     4450        trigger: function( event, data, elem, onlyHandlers ) {
     4451
     4452                var i, cur, tmp, bubbleType, ontype, handle, special,
     4453                        eventPath = [ elem || document ],
     4454                        type = core_hasOwn.call( event, "type" ) ? event.type : event,
     4455                        namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
     4456
     4457                cur = tmp = elem = elem || document;
     4458
     4459                // Don't do events on text and comment nodes
     4460                if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
     4461                        return;
     4462                }
     4463
     4464                // focus/blur morphs to focusin/out; ensure we're not firing them right now
     4465                if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
     4466                        return;
     4467                }
     4468
     4469                if ( type.indexOf(".") >= 0 ) {
     4470                        // Namespaced trigger; create a regexp to match event type in handle()
     4471                        namespaces = type.split(".");
     4472                        type = namespaces.shift();
     4473                        namespaces.sort();
     4474                }
     4475                ontype = type.indexOf(":") < 0 && "on" + type;
     4476
     4477                // Caller can pass in a jQuery.Event object, Object, or just an event type string
     4478                event = event[ jQuery.expando ] ?
     4479                        event :
     4480                        new jQuery.Event( type, typeof event === "object" && event );
     4481
     4482                // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
     4483                event.isTrigger = onlyHandlers ? 2 : 3;
     4484                event.namespace = namespaces.join(".");
     4485                event.namespace_re = event.namespace ?
     4486                        new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
     4487                        null;
     4488
     4489                // Clean up the event in case it is being reused
     4490                event.result = undefined;
     4491                if ( !event.target ) {
     4492                        event.target = elem;
     4493                }
     4494
     4495                // Clone any incoming data and prepend the event, creating the handler arg list
     4496                data = data == null ?
     4497                        [ event ] :
     4498                        jQuery.makeArray( data, [ event ] );
     4499
     4500                // Allow special events to draw outside the lines
     4501                special = jQuery.event.special[ type ] || {};
     4502                if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
     4503                        return;
     4504                }
     4505
     4506                // Determine event propagation path in advance, per W3C events spec (#9951)
     4507                // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
     4508                if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
     4509
     4510                        bubbleType = special.delegateType || type;
     4511                        if ( !rfocusMorph.test( bubbleType + type ) ) {
     4512                                cur = cur.parentNode;
     4513                        }
     4514                        for ( ; cur; cur = cur.parentNode ) {
     4515                                eventPath.push( cur );
     4516                                tmp = cur;
     4517                        }
     4518
     4519                        // Only add window if we got to document (e.g., not plain obj or detached DOM)
     4520                        if ( tmp === (elem.ownerDocument || document) ) {
     4521                                eventPath.push( tmp.defaultView || tmp.parentWindow || window );
     4522                        }
     4523                }
     4524
     4525                // Fire handlers on the event path
     4526                i = 0;
     4527                while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
     4528
     4529                        event.type = i > 1 ?
     4530                                bubbleType :
     4531                                special.bindType || type;
     4532
     4533                        // jQuery handler
     4534                        handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
     4535                        if ( handle ) {
     4536                                handle.apply( cur, data );
     4537                        }
     4538
     4539                        // Native handler
     4540                        handle = ontype && cur[ ontype ];
     4541                        if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
     4542                                event.preventDefault();
     4543                        }
     4544                }
     4545                event.type = type;
     4546
     4547                // If nobody prevented the default action, do it now
     4548                if ( !onlyHandlers && !event.isDefaultPrevented() ) {
     4549
     4550                        if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
     4551                                jQuery.acceptData( elem ) ) {
     4552
     4553                                // Call a native DOM method on the target with the same name name as the event.
     4554                                // Don't do default actions on window, that's where global variables be (#6170)
     4555                                if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
     4556
     4557                                        // Don't re-trigger an onFOO event when we call its FOO() method
     4558                                        tmp = elem[ ontype ];
     4559
     4560                                        if ( tmp ) {
     4561                                                elem[ ontype ] = null;
     4562                                        }
     4563
     4564                                        // Prevent re-triggering of the same event, since we already bubbled it above
     4565                                        jQuery.event.triggered = type;
     4566                                        elem[ type ]();
     4567                                        jQuery.event.triggered = undefined;
     4568
     4569                                        if ( tmp ) {
     4570                                                elem[ ontype ] = tmp;
     4571                                        }
     4572                                }
     4573                        }
     4574                }
     4575
     4576                return event.result;
     4577        },
     4578
     4579        dispatch: function( event ) {
     4580
     4581                // Make a writable jQuery.Event from the native event object
     4582                event = jQuery.event.fix( event );
     4583
     4584                var i, j, ret, matched, handleObj,
     4585                        handlerQueue = [],
     4586                        args = core_slice.call( arguments ),
     4587                        handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
     4588                        special = jQuery.event.special[ event.type ] || {};
     4589
     4590                // Use the fix-ed jQuery.Event rather than the (read-only) native event
     4591                args[0] = event;
     4592                event.delegateTarget = this;
     4593
     4594                // Call the preDispatch hook for the mapped type, and let it bail if desired
     4595                if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
     4596                        return;
     4597                }
     4598
     4599                // Determine handlers
     4600                handlerQueue = jQuery.event.handlers.call( this, event, handlers );
     4601
     4602                // Run delegates first; they may want to stop propagation beneath us
     4603                i = 0;
     4604                while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
     4605                        event.currentTarget = matched.elem;
     4606
     4607                        j = 0;
     4608                        while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
     4609
     4610                                // Triggered event must either 1) have no namespace, or
     4611                                // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
     4612                                if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
     4613
     4614                                        event.handleObj = handleObj;
     4615                                        event.data = handleObj.data;
     4616
     4617                                        ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
     4618                                                        .apply( matched.elem, args );
     4619
     4620                                        if ( ret !== undefined ) {
     4621                                                if ( (event.result = ret) === false ) {
     4622                                                        event.preventDefault();
     4623                                                        event.stopPropagation();
     4624                                                }
     4625                                        }
     4626                                }
     4627                        }
     4628                }
     4629
     4630                // Call the postDispatch hook for the mapped type
     4631                if ( special.postDispatch ) {
     4632                        special.postDispatch.call( this, event );
     4633                }
     4634
     4635                return event.result;
     4636        },
     4637
     4638        handlers: function( event, handlers ) {
     4639                var i, matches, sel, handleObj,
     4640                        handlerQueue = [],
     4641                        delegateCount = handlers.delegateCount,
     4642                        cur = event.target;
     4643
     4644                // Find delegate handlers
     4645                // Black-hole SVG <use> instance trees (#13180)
     4646                // Avoid non-left-click bubbling in Firefox (#3861)
     4647                if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
     4648
     4649                        for ( ; cur !== this; cur = cur.parentNode || this ) {
     4650
     4651                                // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
     4652                                if ( cur.disabled !== true || event.type !== "click" ) {
     4653                                        matches = [];
     4654                                        for ( i = 0; i < delegateCount; i++ ) {
     4655                                                handleObj = handlers[ i ];
     4656
     4657                                                // Don't conflict with Object.prototype properties (#13203)
     4658                                                sel = handleObj.selector + " ";
     4659
     4660                                                if ( matches[ sel ] === undefined ) {
     4661                                                        matches[ sel ] = handleObj.needsContext ?
     4662                                                                jQuery( sel, this ).index( cur ) >= 0 :
     4663                                                                jQuery.find( sel, this, null, [ cur ] ).length;
     4664                                                }
     4665                                                if ( matches[ sel ] ) {
     4666                                                        matches.push( handleObj );
     4667                                                }
     4668                                        }
     4669                                        if ( matches.length ) {
     4670                                                handlerQueue.push({ elem: cur, handlers: matches });
     4671                                        }
     4672                                }
     4673                        }
     4674                }
     4675
     4676                // Add the remaining (directly-bound) handlers
     4677                if ( delegateCount < handlers.length ) {
     4678                        handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
     4679                }
     4680
     4681                return handlerQueue;
     4682        },
     4683
     4684        // Includes some event props shared by KeyEvent and MouseEvent
     4685        props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
     4686
     4687        fixHooks: {},
     4688
     4689        keyHooks: {
     4690                props: "char charCode key keyCode".split(" "),
     4691                filter: function( event, original ) {
     4692
     4693                        // Add which for key events
     4694                        if ( event.which == null ) {
     4695                                event.which = original.charCode != null ? original.charCode : original.keyCode;
     4696                        }
     4697
     4698                        return event;
     4699                }
     4700        },
     4701
     4702        mouseHooks: {
     4703                props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
     4704                filter: function( event, original ) {
     4705                        var eventDoc, doc, body,
     4706                                button = original.button;
     4707
     4708                        // Calculate pageX/Y if missing and clientX/Y available
     4709                        if ( event.pageX == null && original.clientX != null ) {
     4710                                eventDoc = event.target.ownerDocument || document;
     4711                                doc = eventDoc.documentElement;
     4712                                body = eventDoc.body;
     4713
     4714                                event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
     4715                                event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
     4716                        }
     4717
     4718                        // Add which for click: 1 === left; 2 === middle; 3 === right
     4719                        // Note: button is not normalized, so don't use it
     4720                        if ( !event.which && button !== undefined ) {
     4721                                event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
     4722                        }
     4723
     4724                        return event;
     4725                }
     4726        },
     4727
     4728        fix: function( event ) {
     4729                if ( event[ jQuery.expando ] ) {
     4730                        return event;
     4731                }
     4732
     4733                // Create a writable copy of the event object and normalize some properties
     4734                var i, prop, copy,
     4735                        type = event.type,
     4736                        originalEvent = event,
     4737                        fixHook = this.fixHooks[ type ];
     4738
     4739                if ( !fixHook ) {
     4740                        this.fixHooks[ type ] = fixHook =
     4741                                rmouseEvent.test( type ) ? this.mouseHooks :
     4742                                rkeyEvent.test( type ) ? this.keyHooks :
     4743                                {};
     4744                }
     4745                copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
     4746
     4747                event = new jQuery.Event( originalEvent );
     4748
     4749                i = copy.length;
     4750                while ( i-- ) {
     4751                        prop = copy[ i ];
     4752                        event[ prop ] = originalEvent[ prop ];
     4753                }
     4754
     4755                // Support: Safari 6.0+, Chrome < 28
     4756                // Target should not be a text node (#504, #13143)
     4757                if ( event.target.nodeType === 3 ) {
     4758                        event.target = event.target.parentNode;
     4759                }
     4760
     4761                return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
     4762        },
     4763
     4764        special: {
     4765                load: {
     4766                        // Prevent triggered image.load events from bubbling to window.load
     4767                        noBubble: true
     4768                },
     4769                focus: {
     4770                        // Fire native event if possible so blur/focus sequence is correct
     4771                        trigger: function() {
     4772                                if ( this !== safeActiveElement() && this.focus ) {
     4773                                        this.focus();
     4774                                        return false;
     4775                                }
     4776                        },
     4777                        delegateType: "focusin"
     4778                },
     4779                blur: {
     4780                        trigger: function() {
     4781                                if ( this === safeActiveElement() && this.blur ) {
     4782                                        this.blur();
     4783                                        return false;
     4784                                }
     4785                        },
     4786                        delegateType: "focusout"
     4787                },
     4788                click: {
     4789                        // For checkbox, fire native event so checked state will be right
     4790                        trigger: function() {
     4791                                if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
     4792                                        this.click();
     4793                                        return false;
     4794                                }
     4795                        },
     4796
     4797                        // For cross-browser consistency, don't fire native .click() on links
     4798                        _default: function( event ) {
     4799                                return jQuery.nodeName( event.target, "a" );
     4800                        }
     4801                },
     4802
     4803                beforeunload: {
     4804                        postDispatch: function( event ) {
     4805
     4806                                // Support: Firefox 20+
     4807                                // Firefox doesn't alert if the returnValue field is not set.
     4808                                if ( event.result !== undefined ) {
     4809                                        event.originalEvent.returnValue = event.result;
     4810                                }
     4811                        }
     4812                }
     4813        },
     4814
     4815        simulate: function( type, elem, event, bubble ) {
     4816                // Piggyback on a donor event to simulate a different one.
     4817                // Fake originalEvent to avoid donor's stopPropagation, but if the
     4818                // simulated event prevents default then we do the same on the donor.
     4819                var e = jQuery.extend(
     4820                        new jQuery.Event(),
     4821                        event,
     4822                        {
     4823                                type: type,
     4824                                isSimulated: true,
     4825                                originalEvent: {}
     4826                        }
     4827                );
     4828                if ( bubble ) {
     4829                        jQuery.event.trigger( e, null, elem );
     4830                } else {
     4831                        jQuery.event.dispatch.call( elem, e );
     4832                }
     4833                if ( e.isDefaultPrevented() ) {
     4834                        event.preventDefault();
     4835                }
     4836        }
     4837};
     4838
     4839jQuery.removeEvent = function( elem, type, handle ) {
     4840        if ( elem.removeEventListener ) {
     4841                elem.removeEventListener( type, handle, false );
     4842        }
     4843};
     4844
     4845jQuery.Event = function( src, props ) {
     4846        // Allow instantiation without the 'new' keyword
     4847        if ( !(this instanceof jQuery.Event) ) {
     4848                return new jQuery.Event( src, props );
     4849        }
     4850
     4851        // Event object
     4852        if ( src && src.type ) {
     4853                this.originalEvent = src;
     4854                this.type = src.type;
     4855
     4856                // Events bubbling up the document may have been marked as prevented
     4857                // by a handler lower down the tree; reflect the correct value.
     4858                this.isDefaultPrevented = ( src.defaultPrevented ||
     4859                        src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
     4860
     4861        // Event type
     4862        } else {
     4863                this.type = src;
     4864        }
     4865
     4866        // Put explicitly provided properties onto the event object
     4867        if ( props ) {
     4868                jQuery.extend( this, props );
     4869        }
     4870
     4871        // Create a timestamp if incoming event doesn't have one
     4872        this.timeStamp = src && src.timeStamp || jQuery.now();
     4873
     4874        // Mark it as fixed
     4875        this[ jQuery.expando ] = true;
     4876};
     4877
     4878// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
     4879// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
     4880jQuery.Event.prototype = {
     4881        isDefaultPrevented: returnFalse,
     4882        isPropagationStopped: returnFalse,
     4883        isImmediatePropagationStopped: returnFalse,
     4884
     4885        preventDefault: function() {
     4886                var e = this.originalEvent;
     4887
     4888                this.isDefaultPrevented = returnTrue;
     4889
     4890                if ( e && e.preventDefault ) {
     4891                        e.preventDefault();
     4892                }
     4893        },
     4894        stopPropagation: function() {
     4895                var e = this.originalEvent;
     4896
     4897                this.isPropagationStopped = returnTrue;
     4898
     4899                if ( e && e.stopPropagation ) {
     4900                        e.stopPropagation();
     4901                }
     4902        },
     4903        stopImmediatePropagation: function() {
     4904                this.isImmediatePropagationStopped = returnTrue;
     4905                this.stopPropagation();
     4906        }
     4907};
     4908
     4909// Create mouseenter/leave events using mouseover/out and event-time checks
     4910// Support: Chrome 15+
     4911jQuery.each({
     4912        mouseenter: "mouseover",
     4913        mouseleave: "mouseout"
     4914}, function( orig, fix ) {
     4915        jQuery.event.special[ orig ] = {
     4916                delegateType: fix,
     4917                bindType: fix,
     4918
     4919                handle: function( event ) {
     4920                        var ret,
     4921                                target = this,
     4922                                related = event.relatedTarget,
     4923                                handleObj = event.handleObj;
     4924
     4925                        // For mousenter/leave call the handler if related is outside the target.
     4926                        // NB: No relatedTarget if the mouse left/entered the browser window
     4927                        if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
     4928                                event.type = handleObj.origType;
     4929                                ret = handleObj.handler.apply( this, arguments );
     4930                                event.type = fix;
     4931                        }
     4932                        return ret;
     4933                }
     4934        };
     4935});
     4936
     4937// Create "bubbling" focus and blur events
     4938// Support: Firefox, Chrome, Safari
     4939if ( !jQuery.support.focusinBubbles ) {
     4940        jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
     4941
     4942                // Attach a single capturing handler while someone wants focusin/focusout
     4943                var attaches = 0,
     4944                        handler = function( event ) {
     4945                                jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
     4946                        };
     4947
     4948                jQuery.event.special[ fix ] = {
     4949                        setup: function() {
     4950                                if ( attaches++ === 0 ) {
     4951                                        document.addEventListener( orig, handler, true );
     4952                                }
     4953                        },
     4954                        teardown: function() {
     4955                                if ( --attaches === 0 ) {
     4956                                        document.removeEventListener( orig, handler, true );
     4957                                }
     4958                        }
     4959                };
     4960        });
     4961}
     4962
     4963jQuery.fn.extend({
     4964
     4965        on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
     4966                var origFn, type;
     4967
     4968                // Types can be a map of types/handlers
     4969                if ( typeof types === "object" ) {
     4970                        // ( types-Object, selector, data )
     4971                        if ( typeof selector !== "string" ) {
     4972                                // ( types-Object, data )
     4973                                data = data || selector;
     4974                                selector = undefined;
     4975                        }
     4976                        for ( type in types ) {
     4977                                this.on( type, selector, data, types[ type ], one );
     4978                        }
     4979                        return this;
     4980                }
     4981
     4982                if ( data == null && fn == null ) {
     4983                        // ( types, fn )
     4984                        fn = selector;
     4985                        data = selector = undefined;
     4986                } else if ( fn == null ) {
     4987                        if ( typeof selector === "string" ) {
     4988                                // ( types, selector, fn )
     4989                                fn = data;
     4990                                data = undefined;
     4991                        } else {
     4992                                // ( types, data, fn )
     4993                                fn = data;
     4994                                data = selector;
     4995                                selector = undefined;
     4996                        }
     4997                }
     4998                if ( fn === false ) {
     4999                        fn = returnFalse;
     5000                } else if ( !fn ) {
     5001                        return this;
     5002                }
     5003
     5004                if ( one === 1 ) {
     5005                        origFn = fn;
     5006                        fn = function( event ) {
     5007                                // Can use an empty set, since event contains the info
     5008                                jQuery().off( event );
     5009                                return origFn.apply( this, arguments );
     5010                        };
     5011                        // Use same guid so caller can remove using origFn
     5012                        fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
     5013                }
     5014                return this.each( function() {
     5015                        jQuery.event.add( this, types, fn, data, selector );
     5016                });
     5017        },
     5018        one: function( types, selector, data, fn ) {
     5019                return this.on( types, selector, data, fn, 1 );
     5020        },
     5021        off: function( types, selector, fn ) {
     5022                var handleObj, type;
     5023                if ( types && types.preventDefault && types.handleObj ) {
     5024                        // ( event )  dispatched jQuery.Event
     5025                        handleObj = types.handleObj;
     5026                        jQuery( types.delegateTarget ).off(
     5027                                handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
     5028                                handleObj.selector,
     5029                                handleObj.handler
     5030                        );
     5031                        return this;
     5032                }
     5033                if ( typeof types === "object" ) {
     5034                        // ( types-object [, selector] )
     5035                        for ( type in types ) {
     5036                                this.off( type, selector, types[ type ] );
     5037                        }
     5038                        return this;
     5039                }
     5040                if ( selector === false || typeof selector === "function" ) {
     5041                        // ( types [, fn] )
     5042                        fn = selector;
     5043                        selector = undefined;
     5044                }
     5045                if ( fn === false ) {
     5046                        fn = returnFalse;
     5047                }
     5048                return this.each(function() {
     5049                        jQuery.event.remove( this, types, fn, selector );
     5050                });
     5051        },
     5052
     5053        trigger: function( type, data ) {
     5054                return this.each(function() {
     5055                        jQuery.event.trigger( type, data, this );
     5056                });
     5057        },
     5058        triggerHandler: function( type, data ) {
     5059                var elem = this[0];
     5060                if ( elem ) {
     5061                        return jQuery.event.trigger( type, data, elem, true );
     5062                }
     5063        }
     5064});
     5065var isSimple = /^.[^:#\[\.,]*$/,
     5066        rneedsContext = jQuery.expr.match.needsContext,
     5067        // methods guaranteed to produce a unique set when starting from a unique set
     5068        guaranteedUnique = {
     5069                children: true,
     5070                contents: true,
     5071                next: true,
     5072                prev: true
     5073        };
     5074
     5075jQuery.fn.extend({
     5076        find: function( selector ) {
     5077                var self, matched, i,
     5078                        l = this.length;
     5079
     5080                if ( typeof selector !== "string" ) {
     5081                        self = this;
     5082                        return this.pushStack( jQuery( selector ).filter(function() {
     5083                                for ( i = 0; i < l; i++ ) {
     5084                                        if ( jQuery.contains( self[ i ], this ) ) {
     5085                                                return true;
     5086                                        }
     5087                                }
     5088                        }) );
     5089                }
     5090
     5091                matched = [];
     5092                for ( i = 0; i < l; i++ ) {
     5093                        jQuery.find( selector, this[ i ], matched );
     5094                }
     5095
     5096                // Needed because $( selector, context ) becomes $( context ).find( selector )
     5097                matched = this.pushStack( l > 1 ? jQuery.unique( matched ) : matched );
     5098                matched.selector = ( this.selector ? this.selector + " " : "" ) + selector;
     5099                return matched;
     5100        },
     5101
     5102        has: function( target ) {
     5103                var targets = jQuery( target, this ),
     5104                        l = targets.length;
     5105
     5106                return this.filter(function() {
     5107                        var i = 0;
     5108                        for ( ; i < l; i++ ) {
     5109                                if ( jQuery.contains( this, targets[i] ) ) {
     5110                                        return true;
     5111                                }
     5112                        }
     5113                });
     5114        },
     5115
     5116        not: function( selector ) {
     5117                return this.pushStack( winnow(this, selector || [], true) );
     5118        },
     5119
     5120        filter: function( selector ) {
     5121                return this.pushStack( winnow(this, selector || [], false) );
     5122        },
     5123
     5124        is: function( selector ) {
     5125                return !!selector && (
     5126                        typeof selector === "string" ?
     5127                                // If this is a positional/relative selector, check membership in the returned set
     5128                                // so $("p:first").is("p:last") won't return true for a doc with two "p".
     5129                                rneedsContext.test( selector ) ?
     5130                                        jQuery( selector, this.context ).index( this[ 0 ] ) >= 0 :
     5131                                        jQuery.filter( selector, this ).length > 0 :
     5132                                this.filter( selector ).length > 0 );
     5133        },
     5134
     5135        closest: function( selectors, context ) {
     5136                var cur,
     5137                        i = 0,
     5138                        l = this.length,
     5139                        matched = [],
     5140                        pos = ( rneedsContext.test( selectors ) || typeof selectors !== "string" ) ?
     5141                                jQuery( selectors, context || this.context ) :
     5142                                0;
     5143
     5144                for ( ; i < l; i++ ) {
     5145                        for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
     5146                                // Always skip document fragments
     5147                                if ( cur.nodeType < 11 && (pos ?
     5148                                        pos.index(cur) > -1 :
     5149
     5150                                        // Don't pass non-elements to Sizzle
     5151                                        cur.nodeType === 1 &&
     5152                                                jQuery.find.matchesSelector(cur, selectors)) ) {
     5153
     5154                                        cur = matched.push( cur );
     5155                                        break;
     5156                                }
     5157                        }
     5158                }
     5159
     5160                return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
     5161        },
     5162
     5163        // Determine the position of an element within
     5164        // the matched set of elements
     5165        index: function( elem ) {
     5166
     5167                // No argument, return index in parent
     5168                if ( !elem ) {
     5169                        return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
     5170                }
     5171
     5172                // index in selector
     5173                if ( typeof elem === "string" ) {
     5174                        return core_indexOf.call( jQuery( elem ), this[ 0 ] );
     5175                }
     5176
     5177                // Locate the position of the desired element
     5178                return core_indexOf.call( this,
     5179
     5180                        // If it receives a jQuery object, the first element is used
     5181                        elem.jquery ? elem[ 0 ] : elem
     5182                );
     5183        },
     5184
     5185        add: function( selector, context ) {
     5186                var set = typeof selector === "string" ?
     5187                                jQuery( selector, context ) :
     5188                                jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
     5189                        all = jQuery.merge( this.get(), set );
     5190
     5191                return this.pushStack( jQuery.unique(all) );
     5192        },
     5193
     5194        addBack: function( selector ) {
     5195                return this.add( selector == null ?
     5196                        this.prevObject : this.prevObject.filter(selector)
     5197                );
     5198        }
     5199});
     5200
     5201function sibling( cur, dir ) {
     5202        while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
     5203
     5204        return cur;
     5205}
     5206
     5207jQuery.each({
     5208        parent: function( elem ) {
     5209                var parent = elem.parentNode;
     5210                return parent && parent.nodeType !== 11 ? parent : null;
     5211        },
     5212        parents: function( elem ) {
     5213                return jQuery.dir( elem, "parentNode" );
     5214        },
     5215        parentsUntil: function( elem, i, until ) {
     5216                return jQuery.dir( elem, "parentNode", until );
     5217        },
     5218        next: function( elem ) {
     5219                return sibling( elem, "nextSibling" );
     5220        },
     5221        prev: function( elem ) {
     5222                return sibling( elem, "previousSibling" );
     5223        },
     5224        nextAll: function( elem ) {
     5225                return jQuery.dir( elem, "nextSibling" );
     5226        },
     5227        prevAll: function( elem ) {
     5228                return jQuery.dir( elem, "previousSibling" );
     5229        },
     5230        nextUntil: function( elem, i, until ) {
     5231                return jQuery.dir( elem, "nextSibling", until );
     5232        },
     5233        prevUntil: function( elem, i, until ) {
     5234                return jQuery.dir( elem, "previousSibling", until );
     5235        },
     5236        siblings: function( elem ) {
     5237                return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
     5238        },
     5239        children: function( elem ) {
     5240                return jQuery.sibling( elem.firstChild );
     5241        },
     5242        contents: function( elem ) {
     5243                return jQuery.nodeName( elem, "iframe" ) ?
     5244                        elem.contentDocument || elem.contentWindow.document :
     5245                        jQuery.merge( [], elem.childNodes );
     5246        }
     5247}, function( name, fn ) {
     5248        jQuery.fn[ name ] = function( until, selector ) {
     5249                var matched = jQuery.map( this, fn, until );
     5250
     5251                if ( name.slice( -5 ) !== "Until" ) {
     5252                        selector = until;
     5253                }
     5254
     5255                if ( selector && typeof selector === "string" ) {
     5256                        matched = jQuery.filter( selector, matched );
     5257                }
     5258
     5259                if ( this.length > 1 ) {
     5260                        // Remove duplicates
     5261                        if ( !guaranteedUnique[ name ] ) {
     5262                                jQuery.unique( matched );
     5263                        }
     5264
     5265                        // Reverse order for parents* and prev*
     5266                        if ( name[ 0 ] === "p" ) {
     5267                                matched.reverse();
     5268                        }
     5269                }
     5270
     5271                return this.pushStack( matched );
     5272        };
     5273});
     5274
     5275jQuery.extend({
     5276        filter: function( expr, elems, not ) {
     5277                var elem = elems[ 0 ];
     5278
     5279                if ( not ) {
     5280                        expr = ":not(" + expr + ")";
     5281                }
     5282
     5283                return elems.length === 1 && elem.nodeType === 1 ?
     5284                        jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
     5285                        jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
     5286                                return elem.nodeType === 1;
     5287                        }));
     5288        },
     5289
     5290        dir: function( elem, dir, until ) {
     5291                var matched = [],
     5292                        truncate = until !== undefined;
     5293
     5294                while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
     5295                        if ( elem.nodeType === 1 ) {
     5296                                if ( truncate && jQuery( elem ).is( until ) ) {
     5297                                        break;
     5298                                }
     5299                                matched.push( elem );
     5300                        }
     5301                }
     5302                return matched;
     5303        },
     5304
     5305        sibling: function( n, elem ) {
     5306                var matched = [];
     5307
     5308                for ( ; n; n = n.nextSibling ) {
     5309                        if ( n.nodeType === 1 && n !== elem ) {
     5310                                matched.push( n );
     5311                        }
     5312                }
     5313
     5314                return matched;
     5315        }
     5316});
     5317
     5318// Implement the identical functionality for filter and not
     5319function winnow( elements, qualifier, not ) {
     5320        if ( jQuery.isFunction( qualifier ) ) {
     5321                return jQuery.grep( elements, function( elem, i ) {
     5322                        /* jshint -W018 */
     5323                        return !!qualifier.call( elem, i, elem ) !== not;
     5324                });
     5325
     5326        }
     5327
     5328        if ( qualifier.nodeType ) {
     5329                return jQuery.grep( elements, function( elem ) {
     5330                        return ( elem === qualifier ) !== not;
     5331                });
     5332
     5333        }
     5334
     5335        if ( typeof qualifier === "string" ) {
     5336                if ( isSimple.test( qualifier ) ) {
     5337                        return jQuery.filter( qualifier, elements, not );
     5338                }
     5339
     5340                qualifier = jQuery.filter( qualifier, elements );
     5341        }
     5342
     5343        return jQuery.grep( elements, function( elem ) {
     5344                return ( core_indexOf.call( qualifier, elem ) >= 0 ) !== not;
     5345        });
     5346}
     5347var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
     5348        rtagName = /<([\w:]+)/,
     5349        rhtml = /<|&#?\w+;/,
     5350        rnoInnerhtml = /<(?:script|style|link)/i,
     5351        manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
     5352        // checked="checked" or checked
     5353        rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
     5354        rscriptType = /^$|\/(?:java|ecma)script/i,
     5355        rscriptTypeMasked = /^true\/(.*)/,
     5356        rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
     5357
     5358        // We have to close these tags to support XHTML (#13200)
     5359        wrapMap = {
     5360
     5361                // Support: IE 9
     5362                option: [ 1, "<select multiple='multiple'>", "</select>" ],
     5363
     5364                thead: [ 1, "<table>", "</table>" ],
     5365                tr: [ 2, "<table><tbody>", "</tbody></table>" ],
     5366                td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
     5367
     5368                _default: [ 0, "", "" ]
     5369        };
     5370
     5371// Support: IE 9
     5372wrapMap.optgroup = wrapMap.option;
     5373
     5374wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.col = wrapMap.thead;
     5375wrapMap.th = wrapMap.td;
     5376
     5377jQuery.fn.extend({
     5378        text: function( value ) {
     5379                return jQuery.access( this, function( value ) {
     5380                        return value === undefined ?
     5381                                jQuery.text( this ) :
     5382                                this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) );
     5383                }, null, value, arguments.length );
     5384        },
     5385
     5386        append: function() {
     5387                return this.domManip( arguments, function( elem ) {
     5388                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
     5389                                var target = manipulationTarget( this, elem );
     5390                                target.appendChild( elem );
     5391                        }
     5392                });
     5393        },
     5394
     5395        prepend: function() {
     5396                return this.domManip( arguments, function( elem ) {
     5397                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
     5398                                var target = manipulationTarget( this, elem );
     5399                                target.insertBefore( elem, target.firstChild );
     5400                        }
     5401                });
     5402        },
     5403
     5404        before: function() {
     5405                return this.domManip( arguments, function( elem ) {
     5406                        if ( this.parentNode ) {
     5407                                this.parentNode.insertBefore( elem, this );
     5408                        }
     5409                });
     5410        },
     5411
     5412        after: function() {
     5413                return this.domManip( arguments, function( elem ) {
     5414                        if ( this.parentNode ) {
     5415                                this.parentNode.insertBefore( elem, this.nextSibling );
     5416                        }
     5417                });
     5418        },
     5419
     5420        // keepData is for internal use only--do not document
     5421        remove: function( selector, keepData ) {
     5422                var elem,
     5423                        elems = selector ? jQuery.filter( selector, this ) : this,
     5424                        i = 0;
     5425
     5426                for ( ; (elem = elems[i]) != null; i++ ) {
     5427                        if ( !keepData && elem.nodeType === 1 ) {
     5428                                jQuery.cleanData( getAll( elem ) );
     5429                        }
     5430
     5431                        if ( elem.parentNode ) {
     5432                                if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
     5433                                        setGlobalEval( getAll( elem, "script" ) );
     5434                                }
     5435                                elem.parentNode.removeChild( elem );
     5436                        }
     5437                }
     5438
     5439                return this;
     5440        },
     5441
     5442        empty: function() {
     5443                var elem,
     5444                        i = 0;
     5445
     5446                for ( ; (elem = this[i]) != null; i++ ) {
     5447                        if ( elem.nodeType === 1 ) {
     5448
     5449                                // Prevent memory leaks
     5450                                jQuery.cleanData( getAll( elem, false ) );
     5451
     5452                                // Remove any remaining nodes
     5453                                elem.textContent = "";
     5454                        }
     5455                }
     5456
     5457                return this;
     5458        },
     5459
     5460        clone: function( dataAndEvents, deepDataAndEvents ) {
     5461                dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
     5462                deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
     5463
     5464                return this.map( function () {
     5465                        return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
     5466                });
     5467        },
     5468
     5469        html: function( value ) {
     5470                return jQuery.access( this, function( value ) {
     5471                        var elem = this[ 0 ] || {},
     5472                                i = 0,
     5473                                l = this.length;
     5474
     5475                        if ( value === undefined && elem.nodeType === 1 ) {
     5476                                return elem.innerHTML;
     5477                        }
     5478
     5479                        // See if we can take a shortcut and just use innerHTML
     5480                        if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
     5481                                !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
     5482
     5483                                value = value.replace( rxhtmlTag, "<$1></$2>" );
     5484
     5485                                try {
     5486                                        for ( ; i < l; i++ ) {
     5487                                                elem = this[ i ] || {};
     5488
     5489                                                // Remove element nodes and prevent memory leaks
     5490                                                if ( elem.nodeType === 1 ) {
     5491                                                        jQuery.cleanData( getAll( elem, false ) );
     5492                                                        elem.innerHTML = value;
     5493                                                }
     5494                                        }
     5495
     5496                                        elem = 0;
     5497
     5498                                // If using innerHTML throws an exception, use the fallback method
     5499                                } catch( e ) {}
     5500                        }
     5501
     5502                        if ( elem ) {
     5503                                this.empty().append( value );
     5504                        }
     5505                }, null, value, arguments.length );
     5506        },
     5507
     5508        replaceWith: function() {
     5509                var
     5510                        // Snapshot the DOM in case .domManip sweeps something relevant into its fragment
     5511                        args = jQuery.map( this, function( elem ) {
     5512                                return [ elem.nextSibling, elem.parentNode ];
     5513                        }),
     5514                        i = 0;
     5515
     5516                // Make the changes, replacing each context element with the new content
     5517                this.domManip( arguments, function( elem ) {
     5518                        var next = args[ i++ ],
     5519                                parent = args[ i++ ];
     5520
     5521                        if ( parent ) {
     5522                                jQuery( this ).remove();
     5523                                parent.insertBefore( elem, next );
     5524                        }
     5525                // Allow new content to include elements from the context set
     5526                }, true );
     5527
     5528                // Force removal if there was no new content (e.g., from empty arguments)
     5529                return i ? this : this.remove();
     5530        },
     5531
     5532        detach: function( selector ) {
     5533                return this.remove( selector, true );
     5534        },
     5535
     5536        domManip: function( args, callback, allowIntersection ) {
     5537
     5538                // Flatten any nested arrays
     5539                args = core_concat.apply( [], args );
     5540
     5541                var fragment, first, scripts, hasScripts, node, doc,
     5542                        i = 0,
     5543                        l = this.length,
     5544                        set = this,
     5545                        iNoClone = l - 1,
     5546                        value = args[ 0 ],
     5547                        isFunction = jQuery.isFunction( value );
     5548
     5549                // We can't cloneNode fragments that contain checked, in WebKit
     5550                if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
     5551                        return this.each(function( index ) {
     5552                                var self = set.eq( index );
     5553                                if ( isFunction ) {
     5554                                        args[ 0 ] = value.call( this, index, self.html() );
     5555                                }
     5556                                self.domManip( args, callback, allowIntersection );
     5557                        });
     5558                }
     5559
     5560                if ( l ) {
     5561                        fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
     5562                        first = fragment.firstChild;
     5563
     5564                        if ( fragment.childNodes.length === 1 ) {
     5565                                fragment = first;
     5566                        }
     5567
     5568                        if ( first ) {
     5569                                scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
     5570                                hasScripts = scripts.length;
     5571
     5572                                // Use the original fragment for the last item instead of the first because it can end up
     5573                                // being emptied incorrectly in certain situations (#8070).
     5574                                for ( ; i < l; i++ ) {
     5575                                        node = fragment;
     5576
     5577                                        if ( i !== iNoClone ) {
     5578                                                node = jQuery.clone( node, true, true );
     5579
     5580                                                // Keep references to cloned scripts for later restoration
     5581                                                if ( hasScripts ) {
     5582                                                        // Support: QtWebKit
     5583                                                        // jQuery.merge because core_push.apply(_, arraylike) throws
     5584                                                        jQuery.merge( scripts, getAll( node, "script" ) );
     5585                                                }
     5586                                        }
     5587
     5588                                        callback.call( this[ i ], node, i );
     5589                                }
     5590
     5591                                if ( hasScripts ) {
     5592                                        doc = scripts[ scripts.length - 1 ].ownerDocument;
     5593
     5594                                        // Reenable scripts
     5595                                        jQuery.map( scripts, restoreScript );
     5596
     5597                                        // Evaluate executable scripts on first document insertion
     5598                                        for ( i = 0; i < hasScripts; i++ ) {
     5599                                                node = scripts[ i ];
     5600                                                if ( rscriptType.test( node.type || "" ) &&
     5601                                                        !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
     5602
     5603                                                        if ( node.src ) {
     5604                                                                // Hope ajax is available...
     5605                                                                jQuery._evalUrl( node.src );
     5606                                                        } else {
     5607                                                                jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
     5608                                                        }
     5609                                                }
     5610                                        }
     5611                                }
     5612                        }
     5613                }
     5614
     5615                return this;
     5616        }
     5617});
     5618
     5619jQuery.each({
     5620        appendTo: "append",
     5621        prependTo: "prepend",
     5622        insertBefore: "before",
     5623        insertAfter: "after",
     5624        replaceAll: "replaceWith"
     5625}, function( name, original ) {
     5626        jQuery.fn[ name ] = function( selector ) {
     5627                var elems,
     5628                        ret = [],
     5629                        insert = jQuery( selector ),
     5630                        last = insert.length - 1,
     5631                        i = 0;
     5632
     5633                for ( ; i <= last; i++ ) {
     5634                        elems = i === last ? this : this.clone( true );
     5635                        jQuery( insert[ i ] )[ original ]( elems );
     5636
     5637                        // Support: QtWebKit
     5638                        // .get() because core_push.apply(_, arraylike) throws
     5639                        core_push.apply( ret, elems.get() );
     5640                }
     5641
     5642                return this.pushStack( ret );
     5643        };
     5644});
     5645
     5646jQuery.extend({
     5647        clone: function( elem, dataAndEvents, deepDataAndEvents ) {
     5648                var i, l, srcElements, destElements,
     5649                        clone = elem.cloneNode( true ),
     5650                        inPage = jQuery.contains( elem.ownerDocument, elem );
     5651
     5652                // Support: IE >= 9
     5653                // Fix Cloning issues
     5654                if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
     5655
     5656                        // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
     5657                        destElements = getAll( clone );
     5658                        srcElements = getAll( elem );
     5659
     5660                        for ( i = 0, l = srcElements.length; i < l; i++ ) {
     5661                                fixInput( srcElements[ i ], destElements[ i ] );
     5662                        }
     5663                }
     5664
     5665                // Copy the events from the original to the clone
     5666                if ( dataAndEvents ) {
     5667                        if ( deepDataAndEvents ) {
     5668                                srcElements = srcElements || getAll( elem );
     5669                                destElements = destElements || getAll( clone );
     5670
     5671                                for ( i = 0, l = srcElements.length; i < l; i++ ) {
     5672                                        cloneCopyEvent( srcElements[ i ], destElements[ i ] );
     5673                                }
     5674                        } else {
     5675                                cloneCopyEvent( elem, clone );
     5676                        }
     5677                }
     5678
     5679                // Preserve script evaluation history
     5680                destElements = getAll( clone, "script" );
     5681                if ( destElements.length > 0 ) {
     5682                        setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
     5683                }
     5684
     5685                // Return the cloned set
     5686                return clone;
     5687        },
     5688
     5689        buildFragment: function( elems, context, scripts, selection ) {
     5690                var elem, tmp, tag, wrap, contains, j,
     5691                        i = 0,
     5692                        l = elems.length,
     5693                        fragment = context.createDocumentFragment(),
     5694                        nodes = [];
     5695
     5696                for ( ; i < l; i++ ) {
     5697                        elem = elems[ i ];
     5698
     5699                        if ( elem || elem === 0 ) {
     5700
     5701                                // Add nodes directly
     5702                                if ( jQuery.type( elem ) === "object" ) {
     5703                                        // Support: QtWebKit
     5704                                        // jQuery.merge because core_push.apply(_, arraylike) throws
     5705                                        jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
     5706
     5707                                // Convert non-html into a text node
     5708                                } else if ( !rhtml.test( elem ) ) {
     5709                                        nodes.push( context.createTextNode( elem ) );
     5710
     5711                                // Convert html into DOM nodes
     5712                                } else {
     5713                                        tmp = tmp || fragment.appendChild( context.createElement("div") );
     5714
     5715                                        // Deserialize a standard representation
     5716                                        tag = ( rtagName.exec( elem ) || ["", ""] )[ 1 ].toLowerCase();
     5717                                        wrap = wrapMap[ tag ] || wrapMap._default;
     5718                                        tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
     5719
     5720                                        // Descend through wrappers to the right content
     5721                                        j = wrap[ 0 ];
     5722                                        while ( j-- ) {
     5723                                                tmp = tmp.firstChild;
     5724                                        }
     5725
     5726                                        // Support: QtWebKit
     5727                                        // jQuery.merge because core_push.apply(_, arraylike) throws
     5728                                        jQuery.merge( nodes, tmp.childNodes );
     5729
     5730                                        // Remember the top-level container
     5731                                        tmp = fragment.firstChild;
     5732
     5733                                        // Fixes #12346
     5734                                        // Support: Webkit, IE
     5735                                        tmp.textContent = "";
     5736                                }
     5737                        }
     5738                }
     5739
     5740                // Remove wrapper from fragment
     5741                fragment.textContent = "";
     5742
     5743                i = 0;
     5744                while ( (elem = nodes[ i++ ]) ) {
     5745
     5746                        // #4087 - If origin and destination elements are the same, and this is
     5747                        // that element, do not do anything
     5748                        if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
     5749                                continue;
     5750                        }
     5751
     5752                        contains = jQuery.contains( elem.ownerDocument, elem );
     5753
     5754                        // Append to fragment
     5755                        tmp = getAll( fragment.appendChild( elem ), "script" );
     5756
     5757                        // Preserve script evaluation history
     5758                        if ( contains ) {
     5759                                setGlobalEval( tmp );
     5760                        }
     5761
     5762                        // Capture executables
     5763                        if ( scripts ) {
     5764                                j = 0;
     5765                                while ( (elem = tmp[ j++ ]) ) {
     5766                                        if ( rscriptType.test( elem.type || "" ) ) {
     5767                                                scripts.push( elem );
     5768                                        }
     5769                                }
     5770                        }
     5771                }
     5772
     5773                return fragment;
     5774        },
     5775
     5776        cleanData: function( elems ) {
     5777                var data, elem, type,
     5778                        l = elems.length,
     5779                        i = 0,
     5780                        special = jQuery.event.special;
     5781
     5782                for ( ; i < l; i++ ) {
     5783                        elem = elems[ i ];
     5784
     5785                        if ( jQuery.acceptData( elem ) ) {
     5786
     5787                                data = data_priv.access( elem );
     5788
     5789                                if ( data ) {
     5790                                        for ( type in data.events ) {
     5791                                                if ( special[ type ] ) {
     5792                                                        jQuery.event.remove( elem, type );
     5793
     5794                                                // This is a shortcut to avoid jQuery.event.remove's overhead
     5795                                                } else {
     5796                                                        jQuery.removeEvent( elem, type, data.handle );
     5797                                                }
     5798                                        }
     5799                                }
     5800                        }
     5801                        // Discard any remaining `private` and `user` data
     5802                        // One day we'll replace the dual arrays with a WeakMap and this won't be an issue.
     5803                        // (Splices the data objects out of the internal cache arrays)
     5804                        data_user.discard( elem );
     5805                        data_priv.discard( elem );
     5806                }
     5807        },
     5808
     5809        _evalUrl: function( url ) {
     5810                return jQuery.ajax({
     5811                        url: url,
     5812                        type: "GET",
     5813                        dataType: "text",
     5814                        async: false,
     5815                        global: false,
     5816                        success: jQuery.globalEval
     5817                });
     5818        }
     5819});
     5820
     5821// Support: 1.x compatibility
     5822// Manipulating tables requires a tbody
     5823function manipulationTarget( elem, content ) {
     5824        return jQuery.nodeName( elem, "table" ) &&
     5825                jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
     5826
     5827                elem.getElementsByTagName("tbody")[0] ||
     5828                        elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
     5829                elem;
     5830}
     5831
     5832// Replace/restore the type attribute of script elements for safe DOM manipulation
     5833function disableScript( elem ) {
     5834        elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
     5835        return elem;
     5836}
     5837function restoreScript( elem ) {
     5838        var match = rscriptTypeMasked.exec( elem.type );
     5839
     5840        if ( match ) {
     5841                elem.type = match[ 1 ];
     5842        } else {
     5843                elem.removeAttribute("type");
     5844        }
     5845
     5846        return elem;
     5847}
     5848
     5849// Mark scripts as having already been evaluated
     5850function setGlobalEval( elems, refElements ) {
     5851        var l = elems.length,
     5852                i = 0;
     5853
     5854        for ( ; i < l; i++ ) {
     5855                data_priv.set(
     5856                        elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
     5857                );
     5858        }
     5859}
     5860
     5861function cloneCopyEvent( src, dest ) {
     5862        var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
     5863
     5864        if ( dest.nodeType !== 1 ) {
     5865                return;
     5866        }
     5867
     5868        // 1. Copy private data: events, handlers, etc.
     5869        if ( data_priv.hasData( src ) ) {
     5870                pdataOld = data_priv.access( src );
     5871                pdataCur = jQuery.extend( {}, pdataOld );
     5872                events = pdataOld.events;
     5873
     5874                data_priv.set( dest, pdataCur );
     5875
     5876                if ( events ) {
     5877                        delete pdataCur.handle;
     5878                        pdataCur.events = {};
     5879
     5880                        for ( type in events ) {
     5881                                for ( i = 0, l = events[ type ].length; i < l; i++ ) {
     5882                                        jQuery.event.add( dest, type, events[ type ][ i ] );
     5883                                }
     5884                        }
     5885                }
     5886        }
     5887
     5888        // 2. Copy user data
     5889        if ( data_user.hasData( src ) ) {
     5890                udataOld = data_user.access( src );
     5891                udataCur = jQuery.extend( {}, udataOld );
     5892
     5893                data_user.set( dest, udataCur );
     5894        }
     5895}
     5896
     5897
     5898function getAll( context, tag ) {
     5899        var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
     5900                        context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
     5901                        [];
     5902
     5903        return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
     5904                jQuery.merge( [ context ], ret ) :
     5905                ret;
     5906}
     5907
     5908// Support: IE >= 9
     5909function fixInput( src, dest ) {
     5910        var nodeName = dest.nodeName.toLowerCase();
     5911
     5912        // Fails to persist the checked state of a cloned checkbox or radio button.
     5913        if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
     5914                dest.checked = src.checked;
     5915
     5916        // Fails to return the selected option to the default selected state when cloning options
     5917        } else if ( nodeName === "input" || nodeName === "textarea" ) {
     5918                dest.defaultValue = src.defaultValue;
     5919        }
     5920}
     5921jQuery.fn.extend({
     5922        wrapAll: function( html ) {
     5923                var wrap;
     5924
     5925                if ( jQuery.isFunction( html ) ) {
     5926                        return this.each(function( i ) {
     5927                                jQuery( this ).wrapAll( html.call(this, i) );
     5928                        });
     5929                }
     5930
     5931                if ( this[ 0 ] ) {
     5932
     5933                        // The elements to wrap the target around
     5934                        wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
     5935
     5936                        if ( this[ 0 ].parentNode ) {
     5937                                wrap.insertBefore( this[ 0 ] );
     5938                        }
     5939
     5940                        wrap.map(function() {
     5941                                var elem = this;
     5942
     5943                                while ( elem.firstElementChild ) {
     5944                                        elem = elem.firstElementChild;
     5945                                }
     5946
     5947                                return elem;
     5948                        }).append( this );
     5949                }
     5950
     5951                return this;
     5952        },
     5953
     5954        wrapInner: function( html ) {
     5955                if ( jQuery.isFunction( html ) ) {
     5956                        return this.each(function( i ) {
     5957                                jQuery( this ).wrapInner( html.call(this, i) );
     5958                        });
     5959                }
     5960
     5961                return this.each(function() {
     5962                        var self = jQuery( this ),
     5963                                contents = self.contents();
     5964
     5965                        if ( contents.length ) {
     5966                                contents.wrapAll( html );
     5967
     5968                        } else {
     5969                                self.append( html );
     5970                        }
     5971                });
     5972        },
     5973
     5974        wrap: function( html ) {
     5975                var isFunction = jQuery.isFunction( html );
     5976
     5977                return this.each(function( i ) {
     5978                        jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
     5979                });
     5980        },
     5981
     5982        unwrap: function() {
     5983                return this.parent().each(function() {
     5984                        if ( !jQuery.nodeName( this, "body" ) ) {
     5985                                jQuery( this ).replaceWith( this.childNodes );
     5986                        }
     5987                }).end();
     5988        }
     5989});
     5990var curCSS, iframe,
     5991        // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
     5992        // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
     5993        rdisplayswap = /^(none|table(?!-c[ea]).+)/,
     5994        rmargin = /^margin/,
     5995        rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
     5996        rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
     5997        rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
     5998        elemdisplay = { BODY: "block" },
     5999
     6000        cssShow = { position: "absolute", visibility: "hidden", display: "block" },
     6001        cssNormalTransform = {
     6002                letterSpacing: 0,
     6003                fontWeight: 400
     6004        },
     6005
     6006        cssExpand = [ "Top", "Right", "Bottom", "Left" ],
     6007        cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
     6008
     6009// return a css property mapped to a potentially vendor prefixed property
     6010function vendorPropName( style, name ) {
     6011
     6012        // shortcut for names that are not vendor prefixed
     6013        if ( name in style ) {
     6014                return name;
     6015        }
     6016
     6017        // check for vendor prefixed names
     6018        var capName = name.charAt(0).toUpperCase() + name.slice(1),
     6019                origName = name,
     6020                i = cssPrefixes.length;
     6021
     6022        while ( i-- ) {
     6023                name = cssPrefixes[ i ] + capName;
     6024                if ( name in style ) {
     6025                        return name;
     6026                }
     6027        }
     6028
     6029        return origName;
     6030}
     6031
     6032function isHidden( elem, el ) {
     6033        // isHidden might be called from jQuery#filter function;
     6034        // in that case, element will be second argument
     6035        elem = el || elem;
     6036        return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
     6037}
     6038
     6039// NOTE: we've included the "window" in window.getComputedStyle
     6040// because jsdom on node.js will break without it.
     6041function getStyles( elem ) {
     6042        return window.getComputedStyle( elem, null );
     6043}
     6044
     6045function showHide( elements, show ) {
     6046        var display, elem, hidden,
     6047                values = [],
     6048                index = 0,
     6049                length = elements.length;
     6050
     6051        for ( ; index < length; index++ ) {
     6052                elem = elements[ index ];
     6053                if ( !elem.style ) {
     6054                        continue;
     6055                }
     6056
     6057                values[ index ] = data_priv.get( elem, "olddisplay" );
     6058                display = elem.style.display;
     6059                if ( show ) {
     6060                        // Reset the inline display of this element to learn if it is
     6061                        // being hidden by cascaded rules or not
     6062                        if ( !values[ index ] && display === "none" ) {
     6063                                elem.style.display = "";
     6064                        }
     6065
     6066                        // Set elements which have been overridden with display: none
     6067                        // in a stylesheet to whatever the default browser style is
     6068                        // for such an element
     6069                        if ( elem.style.display === "" && isHidden( elem ) ) {
     6070                                values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
     6071                        }
     6072                } else {
     6073
     6074                        if ( !values[ index ] ) {
     6075                                hidden = isHidden( elem );
     6076
     6077                                if ( display && display !== "none" || !hidden ) {
     6078                                        data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") );
     6079                                }
     6080                        }
     6081                }
     6082        }
     6083
     6084        // Set the display of most of the elements in a second loop
     6085        // to avoid the constant reflow
     6086        for ( index = 0; index < length; index++ ) {
     6087                elem = elements[ index ];
     6088                if ( !elem.style ) {
     6089                        continue;
     6090                }
     6091                if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
     6092                        elem.style.display = show ? values[ index ] || "" : "none";
     6093                }
     6094        }
     6095
     6096        return elements;
     6097}
     6098
     6099jQuery.fn.extend({
     6100        css: function( name, value ) {
     6101                return jQuery.access( this, function( elem, name, value ) {
     6102                        var styles, len,
     6103                                map = {},
     6104                                i = 0;
     6105
     6106                        if ( jQuery.isArray( name ) ) {
     6107                                styles = getStyles( elem );
     6108                                len = name.length;
     6109
     6110                                for ( ; i < len; i++ ) {
     6111                                        map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
     6112                                }
     6113
     6114                                return map;
     6115                        }
     6116
     6117                        return value !== undefined ?
     6118                                jQuery.style( elem, name, value ) :
     6119                                jQuery.css( elem, name );
     6120                }, name, value, arguments.length > 1 );
     6121        },
     6122        show: function() {
     6123                return showHide( this, true );
     6124        },
     6125        hide: function() {
     6126                return showHide( this );
     6127        },
     6128        toggle: function( state ) {
     6129                var bool = typeof state === "boolean";
     6130
     6131                return this.each(function() {
     6132                        if ( bool ? state : isHidden( this ) ) {
     6133                                jQuery( this ).show();
     6134                        } else {
     6135                                jQuery( this ).hide();
     6136                        }
     6137                });
     6138        }
     6139});
     6140
     6141jQuery.extend({
     6142        // Add in style property hooks for overriding the default
     6143        // behavior of getting and setting a style property
     6144        cssHooks: {
     6145                opacity: {
     6146                        get: function( elem, computed ) {
     6147                                if ( computed ) {
     6148                                        // We should always get a number back from opacity
     6149                                        var ret = curCSS( elem, "opacity" );
     6150                                        return ret === "" ? "1" : ret;
     6151                                }
     6152                        }
     6153                }
     6154        },
     6155
     6156        // Exclude the following css properties to add px
     6157        cssNumber: {
     6158                "columnCount": true,
     6159                "fillOpacity": true,
     6160                "fontWeight": true,
     6161                "lineHeight": true,
     6162                "opacity": true,
     6163                "orphans": true,
     6164                "widows": true,
     6165                "zIndex": true,
     6166                "zoom": true
     6167        },
     6168
     6169        // Add in properties whose names you wish to fix before
     6170        // setting or getting the value
     6171        cssProps: {
     6172                // normalize float css property
     6173                "float": "cssFloat"
     6174        },
     6175
     6176        // Get and set the style property on a DOM Node
     6177        style: function( elem, name, value, extra ) {
     6178                // Don't set styles on text and comment nodes
     6179                if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
     6180                        return;
     6181                }
     6182
     6183                // Make sure that we're working with the right name
     6184                var ret, type, hooks,
     6185                        origName = jQuery.camelCase( name ),
     6186                        style = elem.style;
     6187
     6188                name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
     6189
     6190                // gets hook for the prefixed version
     6191                // followed by the unprefixed version
     6192                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
     6193
     6194                // Check if we're setting a value
     6195                if ( value !== undefined ) {
     6196                        type = typeof value;
     6197
     6198                        // convert relative number strings (+= or -=) to relative numbers. #7345
     6199                        if ( type === "string" && (ret = rrelNum.exec( value )) ) {
     6200                                value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
     6201                                // Fixes bug #9237
     6202                                type = "number";
     6203                        }
     6204
     6205                        // Make sure that NaN and null values aren't set. See: #7116
     6206                        if ( value == null || type === "number" && isNaN( value ) ) {
     6207                                return;
     6208                        }
     6209
     6210                        // If a number was passed in, add 'px' to the (except for certain CSS properties)
     6211                        if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
     6212                                value += "px";
     6213                        }
     6214
     6215                        // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
     6216                        // but it would mean to define eight (for every problematic property) identical functions
     6217                        if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
     6218                                style[ name ] = "inherit";
     6219                        }
     6220
     6221                        // If a hook was provided, use that value, otherwise just set the specified value
     6222                        if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
     6223                                style[ name ] = value;
     6224                        }
     6225
     6226                } else {
     6227                        // If a hook was provided get the non-computed value from there
     6228                        if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
     6229                                return ret;
     6230                        }
     6231
     6232                        // Otherwise just get the value from the style object
     6233                        return style[ name ];
     6234                }
     6235        },
     6236
     6237        css: function( elem, name, extra, styles ) {
     6238                var val, num, hooks,
     6239                        origName = jQuery.camelCase( name );
     6240
     6241                // Make sure that we're working with the right name
     6242                name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
     6243
     6244                // gets hook for the prefixed version
     6245                // followed by the unprefixed version
     6246                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
     6247
     6248                // If a hook was provided get the computed value from there
     6249                if ( hooks && "get" in hooks ) {
     6250                        val = hooks.get( elem, true, extra );
     6251                }
     6252
     6253                // Otherwise, if a way to get the computed value exists, use that
     6254                if ( val === undefined ) {
     6255                        val = curCSS( elem, name, styles );
     6256                }
     6257
     6258                //convert "normal" to computed value
     6259                if ( val === "normal" && name in cssNormalTransform ) {
     6260                        val = cssNormalTransform[ name ];
     6261                }
     6262
     6263                // Return, converting to number if forced or a qualifier was provided and val looks numeric
     6264                if ( extra === "" || extra ) {
     6265                        num = parseFloat( val );
     6266                        return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
     6267                }
     6268                return val;
     6269        }
     6270});
     6271
     6272curCSS = function( elem, name, _computed ) {
     6273        var width, minWidth, maxWidth,
     6274                computed = _computed || getStyles( elem ),
     6275
     6276                // Support: IE9
     6277                // getPropertyValue is only needed for .css('filter') in IE9, see #12537
     6278                ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
     6279                style = elem.style;
     6280
     6281        if ( computed ) {
     6282
     6283                if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
     6284                        ret = jQuery.style( elem, name );
     6285                }
     6286
     6287                // Support: Safari 5.1
     6288                // A tribute to the "awesome hack by Dean Edwards"
     6289                // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
     6290                // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
     6291                if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
     6292
     6293                        // Remember the original values
     6294                        width = style.width;
     6295                        minWidth = style.minWidth;
     6296                        maxWidth = style.maxWidth;
     6297
     6298                        // Put in the new values to get a computed value out
     6299                        style.minWidth = style.maxWidth = style.width = ret;
     6300                        ret = computed.width;
     6301
     6302                        // Revert the changed values
     6303                        style.width = width;
     6304                        style.minWidth = minWidth;
     6305                        style.maxWidth = maxWidth;
     6306                }
     6307        }
     6308
     6309        return ret;
     6310};
     6311
     6312
     6313function setPositiveNumber( elem, value, subtract ) {
     6314        var matches = rnumsplit.exec( value );
     6315        return matches ?
     6316                // Guard against undefined "subtract", e.g., when used as in cssHooks
     6317                Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
     6318                value;
     6319}
     6320
     6321function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
     6322        var i = extra === ( isBorderBox ? "border" : "content" ) ?
     6323                // If we already have the right measurement, avoid augmentation
     6324                4 :
     6325                // Otherwise initialize for horizontal or vertical properties
     6326                name === "width" ? 1 : 0,
     6327
     6328                val = 0;
     6329
     6330        for ( ; i < 4; i += 2 ) {
     6331                // both box models exclude margin, so add it if we want it
     6332                if ( extra === "margin" ) {
     6333                        val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
     6334                }
     6335
     6336                if ( isBorderBox ) {
     6337                        // border-box includes padding, so remove it if we want content
     6338                        if ( extra === "content" ) {
     6339                                val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
     6340                        }
     6341
     6342                        // at this point, extra isn't border nor margin, so remove border
     6343                        if ( extra !== "margin" ) {
     6344                                val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
     6345                        }
     6346                } else {
     6347                        // at this point, extra isn't content, so add padding
     6348                        val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
     6349
     6350                        // at this point, extra isn't content nor padding, so add border
     6351                        if ( extra !== "padding" ) {
     6352                                val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
     6353                        }
     6354                }
     6355        }
     6356
     6357        return val;
     6358}
     6359
     6360function getWidthOrHeight( elem, name, extra ) {
     6361
     6362        // Start with offset property, which is equivalent to the border-box value
     6363        var valueIsBorderBox = true,
     6364                val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
     6365                styles = getStyles( elem ),
     6366                isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
     6367
     6368        // some non-html elements return undefined for offsetWidth, so check for null/undefined
     6369        // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
     6370        // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
     6371        if ( val <= 0 || val == null ) {
     6372                // Fall back to computed then uncomputed css if necessary
     6373                val = curCSS( elem, name, styles );
     6374                if ( val < 0 || val == null ) {
     6375                        val = elem.style[ name ];
     6376                }
     6377
     6378                // Computed unit is not pixels. Stop here and return.
     6379                if ( rnumnonpx.test(val) ) {
     6380                        return val;
     6381                }
     6382
     6383                // we need the check for style in case a browser which returns unreliable values
     6384                // for getComputedStyle silently falls back to the reliable elem.style
     6385                valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
     6386
     6387                // Normalize "", auto, and prepare for extra
     6388                val = parseFloat( val ) || 0;
     6389        }
     6390
     6391        // use the active box-sizing model to add/subtract irrelevant styles
     6392        return ( val +
     6393                augmentWidthOrHeight(
     6394                        elem,
     6395                        name,
     6396                        extra || ( isBorderBox ? "border" : "content" ),
     6397                        valueIsBorderBox,
     6398                        styles
     6399                )
     6400        ) + "px";
     6401}
     6402
     6403// Try to determine the default display value of an element
     6404function css_defaultDisplay( nodeName ) {
     6405        var doc = document,
     6406                display = elemdisplay[ nodeName ];
     6407
     6408        if ( !display ) {
     6409                display = actualDisplay( nodeName, doc );
     6410
     6411                // If the simple way fails, read from inside an iframe
     6412                if ( display === "none" || !display ) {
     6413                        // Use the already-created iframe if possible
     6414                        iframe = ( iframe ||
     6415                                jQuery("<iframe frameborder='0' width='0' height='0'/>")
     6416                                .css( "cssText", "display:block !important" )
     6417                        ).appendTo( doc.documentElement );
     6418
     6419                        // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
     6420                        doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
     6421                        doc.write("<!doctype html><html><body>");
     6422                        doc.close();
     6423
     6424                        display = actualDisplay( nodeName, doc );
     6425                        iframe.detach();
     6426                }
     6427
     6428                // Store the correct default display
     6429                elemdisplay[ nodeName ] = display;
     6430        }
     6431
     6432        return display;
     6433}
     6434
     6435// Called ONLY from within css_defaultDisplay
     6436function actualDisplay( name, doc ) {
     6437        var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
     6438                display = jQuery.css( elem[0], "display" );
     6439        elem.remove();
     6440        return display;
     6441}
     6442
     6443jQuery.each([ "height", "width" ], function( i, name ) {
     6444        jQuery.cssHooks[ name ] = {
     6445                get: function( elem, computed, extra ) {
     6446                        if ( computed ) {
     6447                                // certain elements can have dimension info if we invisibly show them
     6448                                // however, it must have a current display style that would benefit from this
     6449                                return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
     6450                                        jQuery.swap( elem, cssShow, function() {
     6451                                                return getWidthOrHeight( elem, name, extra );
     6452                                        }) :
     6453                                        getWidthOrHeight( elem, name, extra );
     6454                        }
     6455                },
     6456
     6457                set: function( elem, value, extra ) {
     6458                        var styles = extra && getStyles( elem );
     6459                        return setPositiveNumber( elem, value, extra ?
     6460                                augmentWidthOrHeight(
     6461                                        elem,
     6462                                        name,
     6463                                        extra,
     6464                                        jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
     6465                                        styles
     6466                                ) : 0
     6467                        );
     6468                }
     6469        };
     6470});
     6471
     6472// These hooks cannot be added until DOM ready because the support test
     6473// for it is not run until after DOM ready
     6474jQuery(function() {
     6475        // Support: Android 2.3
     6476        if ( !jQuery.support.reliableMarginRight ) {
     6477                jQuery.cssHooks.marginRight = {
     6478                        get: function( elem, computed ) {
     6479                                if ( computed ) {
     6480                                        // Support: Android 2.3
     6481                                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
     6482                                        // Work around by temporarily setting element display to inline-block
     6483                                        return jQuery.swap( elem, { "display": "inline-block" },
     6484                                                curCSS, [ elem, "marginRight" ] );
     6485                                }
     6486                        }
     6487                };
     6488        }
     6489
     6490        // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
     6491        // getComputedStyle returns percent when specified for top/left/bottom/right
     6492        // rather than make the css module depend on the offset module, we just check for it here
     6493        if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
     6494                jQuery.each( [ "top", "left" ], function( i, prop ) {
     6495                        jQuery.cssHooks[ prop ] = {
     6496                                get: function( elem, computed ) {
     6497                                        if ( computed ) {
     6498                                                computed = curCSS( elem, prop );
     6499                                                // if curCSS returns percentage, fallback to offset
     6500                                                return rnumnonpx.test( computed ) ?
     6501                                                        jQuery( elem ).position()[ prop ] + "px" :
     6502                                                        computed;
     6503                                        }
     6504                                }
     6505                        };
     6506                });
     6507        }
     6508
     6509});
     6510
     6511if ( jQuery.expr && jQuery.expr.filters ) {
     6512        jQuery.expr.filters.hidden = function( elem ) {
     6513                // Support: Opera <= 12.12
     6514                // Opera reports offsetWidths and offsetHeights less than zero on some elements
     6515                return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
     6516        };
     6517
     6518        jQuery.expr.filters.visible = function( elem ) {
     6519                return !jQuery.expr.filters.hidden( elem );
     6520        };
     6521}
     6522
     6523// These hooks are used by animate to expand properties
     6524jQuery.each({
     6525        margin: "",
     6526        padding: "",
     6527        border: "Width"
     6528}, function( prefix, suffix ) {
     6529        jQuery.cssHooks[ prefix + suffix ] = {
     6530                expand: function( value ) {
     6531                        var i = 0,
     6532                                expanded = {},
     6533
     6534                                // assumes a single number if not a string
     6535                                parts = typeof value === "string" ? value.split(" ") : [ value ];
     6536
     6537                        for ( ; i < 4; i++ ) {
     6538                                expanded[ prefix + cssExpand[ i ] + suffix ] =
     6539                                        parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
     6540                        }
     6541
     6542                        return expanded;
     6543                }
     6544        };
     6545
     6546        if ( !rmargin.test( prefix ) ) {
     6547                jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
     6548        }
     6549});
     6550var r20 = /%20/g,
     6551        rbracket = /\[\]$/,
     6552        rCRLF = /\r?\n/g,
     6553        rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
     6554        rsubmittable = /^(?:input|select|textarea|keygen)/i;
     6555
     6556jQuery.fn.extend({
     6557        serialize: function() {
     6558                return jQuery.param( this.serializeArray() );
     6559        },
     6560        serializeArray: function() {
     6561                return this.map(function(){
     6562                        // Can add propHook for "elements" to filter or add form elements
     6563                        var elements = jQuery.prop( this, "elements" );
     6564                        return elements ? jQuery.makeArray( elements ) : this;
     6565                })
     6566                .filter(function(){
     6567                        var type = this.type;
     6568                        // Use .is(":disabled") so that fieldset[disabled] works
     6569                        return this.name && !jQuery( this ).is( ":disabled" ) &&
     6570                                rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
     6571                                ( this.checked || !manipulation_rcheckableType.test( type ) );
     6572                })
     6573                .map(function( i, elem ){
     6574                        var val = jQuery( this ).val();
     6575
     6576                        return val == null ?
     6577                                null :
     6578                                jQuery.isArray( val ) ?
     6579                                        jQuery.map( val, function( val ){
     6580                                                return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
     6581                                        }) :
     6582                                        { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
     6583                }).get();
     6584        }
     6585});
     6586
     6587//Serialize an array of form elements or a set of
     6588//key/values into a query string
     6589jQuery.param = function( a, traditional ) {
     6590        var prefix,
     6591                s = [],
     6592                add = function( key, value ) {
     6593                        // If value is a function, invoke it and return its value
     6594                        value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
     6595                        s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
     6596                };
     6597
     6598        // Set traditional to true for jQuery <= 1.3.2 behavior.
     6599        if ( traditional === undefined ) {
     6600                traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
     6601        }
     6602
     6603        // If an array was passed in, assume that it is an array of form elements.
     6604        if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
     6605                // Serialize the form elements
     6606                jQuery.each( a, function() {
     6607                        add( this.name, this.value );
     6608                });
     6609
     6610        } else {
     6611                // If traditional, encode the "old" way (the way 1.3.2 or older
     6612                // did it), otherwise encode params recursively.
     6613                for ( prefix in a ) {
     6614                        buildParams( prefix, a[ prefix ], traditional, add );
     6615                }
     6616        }
     6617
     6618        // Return the resulting serialization
     6619        return s.join( "&" ).replace( r20, "+" );
     6620};
     6621
     6622function buildParams( prefix, obj, traditional, add ) {
     6623        var name;
     6624
     6625        if ( jQuery.isArray( obj ) ) {
     6626                // Serialize array item.
     6627                jQuery.each( obj, function( i, v ) {
     6628                        if ( traditional || rbracket.test( prefix ) ) {
     6629                                // Treat each array item as a scalar.
     6630                                add( prefix, v );
     6631
     6632                        } else {
     6633                                // Item is non-scalar (array or object), encode its numeric index.
     6634                                buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
     6635                        }
     6636                });
     6637
     6638        } else if ( !traditional && jQuery.type( obj ) === "object" ) {
     6639                // Serialize object item.
     6640                for ( name in obj ) {
     6641                        buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
     6642                }
     6643
     6644        } else {
     6645                // Serialize scalar item.
     6646                add( prefix, obj );
     6647        }
     6648}
     6649jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
     6650        "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
     6651        "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
     6652
     6653        // Handle event binding
     6654        jQuery.fn[ name ] = function( data, fn ) {
     6655                return arguments.length > 0 ?
     6656                        this.on( name, null, data, fn ) :
     6657                        this.trigger( name );
     6658        };
     6659});
     6660
     6661jQuery.fn.extend({
     6662        hover: function( fnOver, fnOut ) {
     6663                return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
     6664        },
     6665
     6666        bind: function( types, data, fn ) {
     6667                return this.on( types, null, data, fn );
     6668        },
     6669        unbind: function( types, fn ) {
     6670                return this.off( types, null, fn );
     6671        },
     6672
     6673        delegate: function( selector, types, data, fn ) {
     6674                return this.on( types, selector, data, fn );
     6675        },
     6676        undelegate: function( selector, types, fn ) {
     6677                // ( namespace ) or ( selector, types [, fn] )
     6678                return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
     6679        }
     6680});
     6681var
     6682        // Document location
     6683        ajaxLocParts,
     6684        ajaxLocation,
     6685
     6686        ajax_nonce = jQuery.now(),
     6687
     6688        ajax_rquery = /\?/,
     6689        rhash = /#.*$/,
     6690        rts = /([?&])_=[^&]*/,
     6691        rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
     6692        // #7653, #8125, #8152: local protocol detection
     6693        rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
     6694        rnoContent = /^(?:GET|HEAD)$/,
     6695        rprotocol = /^\/\//,
     6696        rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
     6697
     6698        // Keep a copy of the old load method
     6699        _load = jQuery.fn.load,
     6700
     6701        /* Prefilters
     6702         * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
     6703         * 2) These are called:
     6704         *    - BEFORE asking for a transport
     6705         *    - AFTER param serialization (s.data is a string if s.processData is true)
     6706         * 3) key is the dataType
     6707         * 4) the catchall symbol "*" can be used
     6708         * 5) execution will start with transport dataType and THEN continue down to "*" if needed
     6709         */
     6710        prefilters = {},
     6711
     6712        /* Transports bindings
     6713         * 1) key is the dataType
     6714         * 2) the catchall symbol "*" can be used
     6715         * 3) selection will start with transport dataType and THEN go to "*" if needed
     6716         */
     6717        transports = {},
     6718
     6719        // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
     6720        allTypes = "*/".concat("*");
     6721
     6722// #8138, IE may throw an exception when accessing
     6723// a field from window.location if document.domain has been set
     6724try {
     6725        ajaxLocation = location.href;
     6726} catch( e ) {
     6727        // Use the href attribute of an A element
     6728        // since IE will modify it given document.location
     6729        ajaxLocation = document.createElement( "a" );
     6730        ajaxLocation.href = "";
     6731        ajaxLocation = ajaxLocation.href;
     6732}
     6733
     6734// Segment location into parts
     6735ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
     6736
     6737// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
     6738function addToPrefiltersOrTransports( structure ) {
     6739
     6740        // dataTypeExpression is optional and defaults to "*"
     6741        return function( dataTypeExpression, func ) {
     6742
     6743                if ( typeof dataTypeExpression !== "string" ) {
     6744                        func = dataTypeExpression;
     6745                        dataTypeExpression = "*";
     6746                }
     6747
     6748                var dataType,
     6749                        i = 0,
     6750                        dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
     6751
     6752                if ( jQuery.isFunction( func ) ) {
     6753                        // For each dataType in the dataTypeExpression
     6754                        while ( (dataType = dataTypes[i++]) ) {
     6755                                // Prepend if requested
     6756                                if ( dataType[0] === "+" ) {
     6757                                        dataType = dataType.slice( 1 ) || "*";
     6758                                        (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
     6759
     6760                                // Otherwise append
     6761                                } else {
     6762                                        (structure[ dataType ] = structure[ dataType ] || []).push( func );
     6763                                }
     6764                        }
     6765                }
     6766        };
     6767}
     6768
     6769// Base inspection function for prefilters and transports
     6770function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
     6771
     6772        var inspected = {},
     6773                seekingTransport = ( structure === transports );
     6774
     6775        function inspect( dataType ) {
     6776                var selected;
     6777                inspected[ dataType ] = true;
     6778                jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
     6779                        var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
     6780                        if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
     6781                                options.dataTypes.unshift( dataTypeOrTransport );
     6782                                inspect( dataTypeOrTransport );
     6783                                return false;
     6784                        } else if ( seekingTransport ) {
     6785                                return !( selected = dataTypeOrTransport );
     6786                        }
     6787                });
     6788                return selected;
     6789        }
     6790
     6791        return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
     6792}
     6793
     6794// A special extend for ajax options
     6795// that takes "flat" options (not to be deep extended)
     6796// Fixes #9887
     6797function ajaxExtend( target, src ) {
     6798        var key, deep,
     6799                flatOptions = jQuery.ajaxSettings.flatOptions || {};
     6800
     6801        for ( key in src ) {
     6802                if ( src[ key ] !== undefined ) {
     6803                        ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
     6804                }
     6805        }
     6806        if ( deep ) {
     6807                jQuery.extend( true, target, deep );
     6808        }
     6809
     6810        return target;
     6811}
     6812
     6813jQuery.fn.load = function( url, params, callback ) {
     6814        if ( typeof url !== "string" && _load ) {
     6815                return _load.apply( this, arguments );
     6816        }
     6817
     6818        var selector, type, response,
     6819                self = this,
     6820                off = url.indexOf(" ");
     6821
     6822        if ( off >= 0 ) {
     6823                selector = url.slice( off );
     6824                url = url.slice( 0, off );
     6825        }
     6826
     6827        // If it's a function
     6828        if ( jQuery.isFunction( params ) ) {
     6829
     6830                // We assume that it's the callback
     6831                callback = params;
     6832                params = undefined;
     6833
     6834        // Otherwise, build a param string
     6835        } else if ( params && typeof params === "object" ) {
     6836                type = "POST";
     6837        }
     6838
     6839        // If we have elements to modify, make the request
     6840        if ( self.length > 0 ) {
     6841                jQuery.ajax({
     6842                        url: url,
     6843
     6844                        // if "type" variable is undefined, then "GET" method will be used
     6845                        type: type,
     6846                        dataType: "html",
     6847                        data: params
     6848                }).done(function( responseText ) {
     6849
     6850                        // Save response for use in complete callback
     6851                        response = arguments;
     6852
     6853                        self.html( selector ?
     6854
     6855                                // If a selector was specified, locate the right elements in a dummy div
     6856                                // Exclude scripts to avoid IE 'Permission Denied' errors
     6857                                jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
     6858
     6859                                // Otherwise use the full result
     6860                                responseText );
     6861
     6862                }).complete( callback && function( jqXHR, status ) {
     6863                        self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
     6864                });
     6865        }
     6866
     6867        return this;
     6868};
     6869
     6870// Attach a bunch of functions for handling common AJAX events
     6871jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
     6872        jQuery.fn[ type ] = function( fn ){
     6873                return this.on( type, fn );
     6874        };
     6875});
     6876
     6877jQuery.extend({
     6878
     6879        // Counter for holding the number of active queries
     6880        active: 0,
     6881
     6882        // Last-Modified header cache for next request
     6883        lastModified: {},
     6884        etag: {},
     6885
     6886        ajaxSettings: {
     6887                url: ajaxLocation,
     6888                type: "GET",
     6889                isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
     6890                global: true,
     6891                processData: true,
     6892                async: true,
     6893                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
     6894                /*
     6895                timeout: 0,
     6896                data: null,
     6897                dataType: null,
     6898                username: null,
     6899                password: null,
     6900                cache: null,
     6901                throws: false,
     6902                traditional: false,
     6903                headers: {},
     6904                */
     6905
     6906                accepts: {
     6907                        "*": allTypes,
     6908                        text: "text/plain",
     6909                        html: "text/html",
     6910                        xml: "application/xml, text/xml",
     6911                        json: "application/json, text/javascript"
     6912                },
     6913
     6914                contents: {
     6915                        xml: /xml/,
     6916                        html: /html/,
     6917                        json: /json/
     6918                },
     6919
     6920                responseFields: {
     6921                        xml: "responseXML",
     6922                        text: "responseText",
     6923                        json: "responseJSON"
     6924                },
     6925
     6926                // Data converters
     6927                // Keys separate source (or catchall "*") and destination types with a single space
     6928                converters: {
     6929
     6930                        // Convert anything to text
     6931                        "* text": String,
     6932
     6933                        // Text to html (true = no transformation)
     6934                        "text html": true,
     6935
     6936                        // Evaluate text as a json expression
     6937                        "text json": jQuery.parseJSON,
     6938
     6939                        // Parse text as xml
     6940                        "text xml": jQuery.parseXML
     6941                },
     6942
     6943                // For options that shouldn't be deep extended:
     6944                // you can add your own custom options here if
     6945                // and when you create one that shouldn't be
     6946                // deep extended (see ajaxExtend)
     6947                flatOptions: {
     6948                        url: true,
     6949                        context: true
     6950                }
     6951        },
     6952
     6953        // Creates a full fledged settings object into target
     6954        // with both ajaxSettings and settings fields.
     6955        // If target is omitted, writes into ajaxSettings.
     6956        ajaxSetup: function( target, settings ) {
     6957                return settings ?
     6958
     6959                        // Building a settings object
     6960                        ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
     6961
     6962                        // Extending ajaxSettings
     6963                        ajaxExtend( jQuery.ajaxSettings, target );
     6964        },
     6965
     6966        ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
     6967        ajaxTransport: addToPrefiltersOrTransports( transports ),
     6968
     6969        // Main method
     6970        ajax: function( url, options ) {
     6971
     6972                // If url is an object, simulate pre-1.5 signature
     6973                if ( typeof url === "object" ) {
     6974                        options = url;
     6975                        url = undefined;
     6976                }
     6977
     6978                // Force options to be an object
     6979                options = options || {};
     6980
     6981                var transport,
     6982                        // URL without anti-cache param
     6983                        cacheURL,
     6984                        // Response headers
     6985                        responseHeadersString,
     6986                        responseHeaders,
     6987                        // timeout handle
     6988                        timeoutTimer,
     6989                        // Cross-domain detection vars
     6990                        parts,
     6991                        // To know if global events are to be dispatched
     6992                        fireGlobals,
     6993                        // Loop variable
     6994                        i,
     6995                        // Create the final options object
     6996                        s = jQuery.ajaxSetup( {}, options ),
     6997                        // Callbacks context
     6998                        callbackContext = s.context || s,
     6999                        // Context for global events is callbackContext if it is a DOM node or jQuery collection
     7000                        globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
     7001                                jQuery( callbackContext ) :
     7002                                jQuery.event,
     7003                        // Deferreds
     7004                        deferred = jQuery.Deferred(),
     7005                        completeDeferred = jQuery.Callbacks("once memory"),
     7006                        // Status-dependent callbacks
     7007                        statusCode = s.statusCode || {},
     7008                        // Headers (they are sent all at once)
     7009                        requestHeaders = {},
     7010                        requestHeadersNames = {},
     7011                        // The jqXHR state
     7012                        state = 0,
     7013                        // Default abort message
     7014                        strAbort = "canceled",
     7015                        // Fake xhr
     7016                        jqXHR = {
     7017                                readyState: 0,
     7018
     7019                                // Builds headers hashtable if needed
     7020                                getResponseHeader: function( key ) {
     7021                                        var match;
     7022                                        if ( state === 2 ) {
     7023                                                if ( !responseHeaders ) {
     7024                                                        responseHeaders = {};
     7025                                                        while ( (match = rheaders.exec( responseHeadersString )) ) {
     7026                                                                responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
     7027                                                        }
     7028                                                }
     7029                                                match = responseHeaders[ key.toLowerCase() ];
     7030                                        }
     7031                                        return match == null ? null : match;
     7032                                },
     7033
     7034                                // Raw string
     7035                                getAllResponseHeaders: function() {
     7036                                        return state === 2 ? responseHeadersString : null;
     7037                                },
     7038
     7039                                // Caches the header
     7040                                setRequestHeader: function( name, value ) {
     7041                                        var lname = name.toLowerCase();
     7042                                        if ( !state ) {
     7043                                                name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
     7044                                                requestHeaders[ name ] = value;
     7045                                        }
     7046                                        return this;
     7047                                },
     7048
     7049                                // Overrides response content-type header
     7050                                overrideMimeType: function( type ) {
     7051                                        if ( !state ) {
     7052                                                s.mimeType = type;
     7053                                        }
     7054                                        return this;
     7055                                },
     7056
     7057                                // Status-dependent callbacks
     7058                                statusCode: function( map ) {
     7059                                        var code;
     7060                                        if ( map ) {
     7061                                                if ( state < 2 ) {
     7062                                                        for ( code in map ) {
     7063                                                                // Lazy-add the new callback in a way that preserves old ones
     7064                                                                statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
     7065                                                        }
     7066                                                } else {
     7067                                                        // Execute the appropriate callbacks
     7068                                                        jqXHR.always( map[ jqXHR.status ] );
     7069                                                }
     7070                                        }
     7071                                        return this;
     7072                                },
     7073
     7074                                // Cancel the request
     7075                                abort: function( statusText ) {
     7076                                        var finalText = statusText || strAbort;
     7077                                        if ( transport ) {
     7078                                                transport.abort( finalText );
     7079                                        }
     7080                                        done( 0, finalText );
     7081                                        return this;
     7082                                }
     7083                        };
     7084
     7085                // Attach deferreds
     7086                deferred.promise( jqXHR ).complete = completeDeferred.add;
     7087                jqXHR.success = jqXHR.done;
     7088                jqXHR.error = jqXHR.fail;
     7089
     7090                // Remove hash character (#7531: and string promotion)
     7091                // Add protocol if not provided (prefilters might expect it)
     7092                // Handle falsy url in the settings object (#10093: consistency with old signature)
     7093                // We also use the url parameter if available
     7094                s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
     7095                        .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
     7096
     7097                // Alias method option to type as per ticket #12004
     7098                s.type = options.method || options.type || s.method || s.type;
     7099
     7100                // Extract dataTypes list
     7101                s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
     7102
     7103                // A cross-domain request is in order when we have a protocol:host:port mismatch
     7104                if ( s.crossDomain == null ) {
     7105                        parts = rurl.exec( s.url.toLowerCase() );
     7106                        s.crossDomain = !!( parts &&
     7107                                ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
     7108                                        ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
     7109                                                ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
     7110                        );
     7111                }
     7112
     7113                // Convert data if not already a string
     7114                if ( s.data && s.processData && typeof s.data !== "string" ) {
     7115                        s.data = jQuery.param( s.data, s.traditional );
     7116                }
     7117
     7118                // Apply prefilters
     7119                inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
     7120
     7121                // If request was aborted inside a prefilter, stop there
     7122                if ( state === 2 ) {
     7123                        return jqXHR;
     7124                }
     7125
     7126                // We can fire global events as of now if asked to
     7127                fireGlobals = s.global;
     7128
     7129                // Watch for a new set of requests
     7130                if ( fireGlobals && jQuery.active++ === 0 ) {
     7131                        jQuery.event.trigger("ajaxStart");
     7132                }
     7133
     7134                // Uppercase the type
     7135                s.type = s.type.toUpperCase();
     7136
     7137                // Determine if request has content
     7138                s.hasContent = !rnoContent.test( s.type );
     7139
     7140                // Save the URL in case we're toying with the If-Modified-Since
     7141                // and/or If-None-Match header later on
     7142                cacheURL = s.url;
     7143
     7144                // More options handling for requests with no content
     7145                if ( !s.hasContent ) {
     7146
     7147                        // If data is available, append data to url
     7148                        if ( s.data ) {
     7149                                cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
     7150                                // #9682: remove data so that it's not used in an eventual retry
     7151                                delete s.data;
     7152                        }
     7153
     7154                        // Add anti-cache in url if needed
     7155                        if ( s.cache === false ) {
     7156                                s.url = rts.test( cacheURL ) ?
     7157
     7158                                        // If there is already a '_' parameter, set its value
     7159                                        cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
     7160
     7161                                        // Otherwise add one to the end
     7162                                        cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
     7163                        }
     7164                }
     7165
     7166                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
     7167                if ( s.ifModified ) {
     7168                        if ( jQuery.lastModified[ cacheURL ] ) {
     7169                                jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
     7170                        }
     7171                        if ( jQuery.etag[ cacheURL ] ) {
     7172                                jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
     7173                        }
     7174                }
     7175
     7176                // Set the correct header, if data is being sent
     7177                if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
     7178                        jqXHR.setRequestHeader( "Content-Type", s.contentType );
     7179                }
     7180
     7181                // Set the Accepts header for the server, depending on the dataType
     7182                jqXHR.setRequestHeader(
     7183                        "Accept",
     7184                        s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
     7185                                s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
     7186                                s.accepts[ "*" ]
     7187                );
     7188
     7189                // Check for headers option
     7190                for ( i in s.headers ) {
     7191                        jqXHR.setRequestHeader( i, s.headers[ i ] );
     7192                }
     7193
     7194                // Allow custom headers/mimetypes and early abort
     7195                if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
     7196                        // Abort if not done already and return
     7197                        return jqXHR.abort();
     7198                }
     7199
     7200                // aborting is no longer a cancellation
     7201                strAbort = "abort";
     7202
     7203                // Install callbacks on deferreds
     7204                for ( i in { success: 1, error: 1, complete: 1 } ) {
     7205                        jqXHR[ i ]( s[ i ] );
     7206                }
     7207
     7208                // Get transport
     7209                transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
     7210
     7211                // If no transport, we auto-abort
     7212                if ( !transport ) {
     7213                        done( -1, "No Transport" );
     7214                } else {
     7215                        jqXHR.readyState = 1;
     7216
     7217                        // Send global event
     7218                        if ( fireGlobals ) {
     7219                                globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
     7220                        }
     7221                        // Timeout
     7222                        if ( s.async && s.timeout > 0 ) {
     7223                                timeoutTimer = setTimeout(function() {
     7224                                        jqXHR.abort("timeout");
     7225                                }, s.timeout );
     7226                        }
     7227
     7228                        try {
     7229                                state = 1;
     7230                                transport.send( requestHeaders, done );
     7231                        } catch ( e ) {
     7232                                // Propagate exception as error if not done
     7233                                if ( state < 2 ) {
     7234                                        done( -1, e );
     7235                                // Simply rethrow otherwise
     7236                                } else {
     7237                                        throw e;
     7238                                }
     7239                        }
     7240                }
     7241
     7242                // Callback for when everything is done
     7243                function done( status, nativeStatusText, responses, headers ) {
     7244                        var isSuccess, success, error, response, modified,
     7245                                statusText = nativeStatusText;
     7246
     7247                        // Called once
     7248                        if ( state === 2 ) {
     7249                                return;
     7250                        }
     7251
     7252                        // State is "done" now
     7253                        state = 2;
     7254
     7255                        // Clear timeout if it exists
     7256                        if ( timeoutTimer ) {
     7257                                clearTimeout( timeoutTimer );
     7258                        }
     7259
     7260                        // Dereference transport for early garbage collection
     7261                        // (no matter how long the jqXHR object will be used)
     7262                        transport = undefined;
     7263
     7264                        // Cache response headers
     7265                        responseHeadersString = headers || "";
     7266
     7267                        // Set readyState
     7268                        jqXHR.readyState = status > 0 ? 4 : 0;
     7269
     7270                        // Determine if successful
     7271                        isSuccess = status >= 200 && status < 300 || status === 304;
     7272
     7273                        // Get response data
     7274                        if ( responses ) {
     7275                                response = ajaxHandleResponses( s, jqXHR, responses );
     7276                        }
     7277
     7278                        // Convert no matter what (that way responseXXX fields are always set)
     7279                        response = ajaxConvert( s, response, jqXHR, isSuccess );
     7280
     7281                        // If successful, handle type chaining
     7282                        if ( isSuccess ) {
     7283
     7284                                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
     7285                                if ( s.ifModified ) {
     7286                                        modified = jqXHR.getResponseHeader("Last-Modified");
     7287                                        if ( modified ) {
     7288                                                jQuery.lastModified[ cacheURL ] = modified;
     7289                                        }
     7290                                        modified = jqXHR.getResponseHeader("etag");
     7291                                        if ( modified ) {
     7292                                                jQuery.etag[ cacheURL ] = modified;
     7293                                        }
     7294                                }
     7295
     7296                                // if no content
     7297                                if ( status === 204 ) {
     7298                                        statusText = "nocontent";
     7299
     7300                                // if not modified
     7301                                } else if ( status === 304 ) {
     7302                                        statusText = "notmodified";
     7303
     7304                                // If we have data, let's convert it
     7305                                } else {
     7306                                        statusText = response.state;
     7307                                        success = response.data;
     7308                                        error = response.error;
     7309                                        isSuccess = !error;
     7310                                }
     7311                        } else {
     7312                                // We extract error from statusText
     7313                                // then normalize statusText and status for non-aborts
     7314                                error = statusText;
     7315                                if ( status || !statusText ) {
     7316                                        statusText = "error";
     7317                                        if ( status < 0 ) {
     7318                                                status = 0;
     7319                                        }
     7320                                }
     7321                        }
     7322
     7323                        // Set data for the fake xhr object
     7324                        jqXHR.status = status;
     7325                        jqXHR.statusText = ( nativeStatusText || statusText ) + "";
     7326
     7327                        // Success/Error
     7328                        if ( isSuccess ) {
     7329                                deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
     7330                        } else {
     7331                                deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
     7332                        }
     7333
     7334                        // Status-dependent callbacks
     7335                        jqXHR.statusCode( statusCode );
     7336                        statusCode = undefined;
     7337
     7338                        if ( fireGlobals ) {
     7339                                globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
     7340                                        [ jqXHR, s, isSuccess ? success : error ] );
     7341                        }
     7342
     7343                        // Complete
     7344                        completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
     7345
     7346                        if ( fireGlobals ) {
     7347                                globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
     7348                                // Handle the global AJAX counter
     7349                                if ( !( --jQuery.active ) ) {
     7350                                        jQuery.event.trigger("ajaxStop");
     7351                                }
     7352                        }
     7353                }
     7354
     7355                return jqXHR;
     7356        },
     7357
     7358        getJSON: function( url, data, callback ) {
     7359                return jQuery.get( url, data, callback, "json" );
     7360        },
     7361
     7362        getScript: function( url, callback ) {
     7363                return jQuery.get( url, undefined, callback, "script" );
     7364        }
     7365});
     7366
     7367jQuery.each( [ "get", "post" ], function( i, method ) {
     7368        jQuery[ method ] = function( url, data, callback, type ) {
     7369                // shift arguments if data argument was omitted
     7370                if ( jQuery.isFunction( data ) ) {
     7371                        type = type || callback;
     7372                        callback = data;
     7373                        data = undefined;
     7374                }
     7375
     7376                return jQuery.ajax({
     7377                        url: url,
     7378                        type: method,
     7379                        dataType: type,
     7380                        data: data,
     7381                        success: callback
     7382                });
     7383        };
     7384});
     7385
     7386/* Handles responses to an ajax request:
     7387 * - finds the right dataType (mediates between content-type and expected dataType)
     7388 * - returns the corresponding response
     7389 */
     7390function ajaxHandleResponses( s, jqXHR, responses ) {
     7391
     7392        var ct, type, finalDataType, firstDataType,
     7393                contents = s.contents,
     7394                dataTypes = s.dataTypes;
     7395
     7396        // Remove auto dataType and get content-type in the process
     7397        while( dataTypes[ 0 ] === "*" ) {
     7398                dataTypes.shift();
     7399                if ( ct === undefined ) {
     7400                        ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
     7401                }
     7402        }
     7403
     7404        // Check if we're dealing with a known content-type
     7405        if ( ct ) {
     7406                for ( type in contents ) {
     7407                        if ( contents[ type ] && contents[ type ].test( ct ) ) {
     7408                                dataTypes.unshift( type );
     7409                                break;
     7410                        }
     7411                }
     7412        }
     7413
     7414        // Check to see if we have a response for the expected dataType
     7415        if ( dataTypes[ 0 ] in responses ) {
     7416                finalDataType = dataTypes[ 0 ];
     7417        } else {
     7418                // Try convertible dataTypes
     7419                for ( type in responses ) {
     7420                        if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
     7421                                finalDataType = type;
     7422                                break;
     7423                        }
     7424                        if ( !firstDataType ) {
     7425                                firstDataType = type;
     7426                        }
     7427                }
     7428                // Or just use first one
     7429                finalDataType = finalDataType || firstDataType;
     7430        }
     7431
     7432        // If we found a dataType
     7433        // We add the dataType to the list if needed
     7434        // and return the corresponding response
     7435        if ( finalDataType ) {
     7436                if ( finalDataType !== dataTypes[ 0 ] ) {
     7437                        dataTypes.unshift( finalDataType );
     7438                }
     7439                return responses[ finalDataType ];
     7440        }
     7441}
     7442
     7443/* Chain conversions given the request and the original response
     7444 * Also sets the responseXXX fields on the jqXHR instance
     7445 */
     7446function ajaxConvert( s, response, jqXHR, isSuccess ) {
     7447        var conv2, current, conv, tmp, prev,
     7448                converters = {},
     7449                // Work with a copy of dataTypes in case we need to modify it for conversion
     7450                dataTypes = s.dataTypes.slice();
     7451
     7452        // Create converters map with lowercased keys
     7453        if ( dataTypes[ 1 ] ) {
     7454                for ( conv in s.converters ) {
     7455                        converters[ conv.toLowerCase() ] = s.converters[ conv ];
     7456                }
     7457        }
     7458
     7459        current = dataTypes.shift();
     7460
     7461        // Convert to each sequential dataType
     7462        while ( current ) {
     7463
     7464                if ( s.responseFields[ current ] ) {
     7465                        jqXHR[ s.responseFields[ current ] ] = response;
     7466                }
     7467
     7468                // Apply the dataFilter if provided
     7469                if ( !prev && isSuccess && s.dataFilter ) {
     7470                        response = s.dataFilter( response, s.dataType );
     7471                }
     7472
     7473                prev = current;
     7474                current = dataTypes.shift();
     7475
     7476                if ( current ) {
     7477
     7478                // There's only work to do if current dataType is non-auto
     7479                        if ( current === "*" ) {
     7480
     7481                                current = prev;
     7482
     7483                        // Convert response if prev dataType is non-auto and differs from current
     7484                        } else if ( prev !== "*" && prev !== current ) {
     7485
     7486                                // Seek a direct converter
     7487                                conv = converters[ prev + " " + current ] || converters[ "* " + current ];
     7488
     7489                                // If none found, seek a pair
     7490                                if ( !conv ) {
     7491                                        for ( conv2 in converters ) {
     7492
     7493                                                // If conv2 outputs current
     7494                                                tmp = conv2.split( " " );
     7495                                                if ( tmp[ 1 ] === current ) {
     7496
     7497                                                        // If prev can be converted to accepted input
     7498                                                        conv = converters[ prev + " " + tmp[ 0 ] ] ||
     7499                                                                converters[ "* " + tmp[ 0 ] ];
     7500                                                        if ( conv ) {
     7501                                                                // Condense equivalence converters
     7502                                                                if ( conv === true ) {
     7503                                                                        conv = converters[ conv2 ];
     7504
     7505                                                                // Otherwise, insert the intermediate dataType
     7506                                                                } else if ( converters[ conv2 ] !== true ) {
     7507                                                                        current = tmp[ 0 ];
     7508                                                                        dataTypes.unshift( tmp[ 1 ] );
     7509                                                                }
     7510                                                                break;
     7511                                                        }
     7512                                                }
     7513                                        }
     7514                                }
     7515
     7516                                // Apply converter (if not an equivalence)
     7517                                if ( conv !== true ) {
     7518
     7519                                        // Unless errors are allowed to bubble, catch and return them
     7520                                        if ( conv && s[ "throws" ] ) {
     7521                                                response = conv( response );
     7522                                        } else {
     7523                                                try {
     7524                                                        response = conv( response );
     7525                                                } catch ( e ) {
     7526                                                        return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
     7527                                                }
     7528                                        }
     7529                                }
     7530                        }
     7531                }
     7532        }
     7533
     7534        return { state: "success", data: response };
     7535}
     7536// Install script dataType
     7537jQuery.ajaxSetup({
     7538        accepts: {
     7539                script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
     7540        },
     7541        contents: {
     7542                script: /(?:java|ecma)script/
     7543        },
     7544        converters: {
     7545                "text script": function( text ) {
     7546                        jQuery.globalEval( text );
     7547                        return text;
     7548                }
     7549        }
     7550});
     7551
     7552// Handle cache's special case and crossDomain
     7553jQuery.ajaxPrefilter( "script", function( s ) {
     7554        if ( s.cache === undefined ) {
     7555                s.cache = false;
     7556        }
     7557        if ( s.crossDomain ) {
     7558                s.type = "GET";
     7559        }
     7560});
     7561
     7562// Bind script tag hack transport
     7563jQuery.ajaxTransport( "script", function( s ) {
     7564        // This transport only deals with cross domain requests
     7565        if ( s.crossDomain ) {
     7566                var script, callback;
     7567                return {
     7568                        send: function( _, complete ) {
     7569                                script = jQuery("<script>").prop({
     7570                                        async: true,
     7571                                        charset: s.scriptCharset,
     7572                                        src: s.url
     7573                                }).on(
     7574                                        "load error",
     7575                                        callback = function( evt ) {
     7576                                                script.remove();
     7577                                                callback = null;
     7578                                                if ( evt ) {
     7579                                                        complete( evt.type === "error" ? 404 : 200, evt.type );
     7580                                                }
     7581                                        }
     7582                                );
     7583                                document.head.appendChild( script[ 0 ] );
     7584                        },
     7585                        abort: function() {
     7586                                if ( callback ) {
     7587                                        callback();
     7588                                }
     7589                        }
     7590                };
     7591        }
     7592});
     7593var oldCallbacks = [],
     7594        rjsonp = /(=)\?(?=&|$)|\?\?/;
     7595
     7596// Default jsonp settings
     7597jQuery.ajaxSetup({
     7598        jsonp: "callback",
     7599        jsonpCallback: function() {
     7600                var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
     7601                this[ callback ] = true;
     7602                return callback;
     7603        }
     7604});
     7605
     7606// Detect, normalize options and install callbacks for jsonp requests
     7607jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
     7608
     7609        var callbackName, overwritten, responseContainer,
     7610                jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
     7611                        "url" :
     7612                        typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
     7613                );
     7614
     7615        // Handle iff the expected data type is "jsonp" or we have a parameter to set
     7616        if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
     7617
     7618                // Get callback name, remembering preexisting value associated with it
     7619                callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
     7620                        s.jsonpCallback() :
     7621                        s.jsonpCallback;
     7622
     7623                // Insert callback into url or form data
     7624                if ( jsonProp ) {
     7625                        s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
     7626                } else if ( s.jsonp !== false ) {
     7627                        s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
     7628                }
     7629
     7630                // Use data converter to retrieve json after script execution
     7631                s.converters["script json"] = function() {
     7632                        if ( !responseContainer ) {
     7633                                jQuery.error( callbackName + " was not called" );
     7634                        }
     7635                        return responseContainer[ 0 ];
     7636                };
     7637
     7638                // force json dataType
     7639                s.dataTypes[ 0 ] = "json";
     7640
     7641                // Install callback
     7642                overwritten = window[ callbackName ];
     7643                window[ callbackName ] = function() {
     7644                        responseContainer = arguments;
     7645                };
     7646
     7647                // Clean-up function (fires after converters)
     7648                jqXHR.always(function() {
     7649                        // Restore preexisting value
     7650                        window[ callbackName ] = overwritten;
     7651
     7652                        // Save back as free
     7653                        if ( s[ callbackName ] ) {
     7654                                // make sure that re-using the options doesn't screw things around
     7655                                s.jsonpCallback = originalSettings.jsonpCallback;
     7656
     7657                                // save the callback name for future use
     7658                                oldCallbacks.push( callbackName );
     7659                        }
     7660
     7661                        // Call if it was a function and we have a response
     7662                        if ( responseContainer && jQuery.isFunction( overwritten ) ) {
     7663                                overwritten( responseContainer[ 0 ] );
     7664                        }
     7665
     7666                        responseContainer = overwritten = undefined;
     7667                });
     7668
     7669                // Delegate to script
     7670                return "script";
     7671        }
     7672});
     7673jQuery.ajaxSettings.xhr = function() {
     7674        try {
     7675                return new XMLHttpRequest();
     7676        } catch( e ) {}
     7677};
     7678
     7679var xhrSupported = jQuery.ajaxSettings.xhr(),
     7680        xhrSuccessStatus = {
     7681                // file protocol always yields status code 0, assume 200
     7682                0: 200,
     7683                // Support: IE9
     7684                // #1450: sometimes IE returns 1223 when it should be 204
     7685                1223: 204
     7686        },
     7687        // Support: IE9
     7688        // We need to keep track of outbound xhr and abort them manually
     7689        // because IE is not smart enough to do it all by itself
     7690        xhrId = 0,
     7691        xhrCallbacks = {};
     7692
     7693if ( window.ActiveXObject ) {
     7694        jQuery( window ).on( "unload", function() {
     7695                for( var key in xhrCallbacks ) {
     7696                        xhrCallbacks[ key ]();
     7697                }
     7698                xhrCallbacks = undefined;
     7699        });
     7700}
     7701
     7702jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
     7703jQuery.support.ajax = xhrSupported = !!xhrSupported;
     7704
     7705jQuery.ajaxTransport(function( options ) {
     7706        var callback;
     7707        // Cross domain only allowed if supported through XMLHttpRequest
     7708        if ( jQuery.support.cors || xhrSupported && !options.crossDomain ) {
     7709                return {
     7710                        send: function( headers, complete ) {
     7711                                var i, id,
     7712                                        xhr = options.xhr();
     7713                                xhr.open( options.type, options.url, options.async, options.username, options.password );
     7714                                // Apply custom fields if provided
     7715                                if ( options.xhrFields ) {
     7716                                        for ( i in options.xhrFields ) {
     7717                                                xhr[ i ] = options.xhrFields[ i ];
     7718                                        }
     7719                                }
     7720                                // Override mime type if needed
     7721                                if ( options.mimeType && xhr.overrideMimeType ) {
     7722                                        xhr.overrideMimeType( options.mimeType );
     7723                                }
     7724                                // X-Requested-With header
     7725                                // For cross-domain requests, seeing as conditions for a preflight are
     7726                                // akin to a jigsaw puzzle, we simply never set it to be sure.
     7727                                // (it can always be set on a per-request basis or even using ajaxSetup)
     7728                                // For same-domain requests, won't change header if already provided.
     7729                                if ( !options.crossDomain && !headers["X-Requested-With"] ) {
     7730                                        headers["X-Requested-With"] = "XMLHttpRequest";
     7731                                }
     7732                                // Set headers
     7733                                for ( i in headers ) {
     7734                                        xhr.setRequestHeader( i, headers[ i ] );
     7735                                }
     7736                                // Callback
     7737                                callback = function( type ) {
     7738                                        return function() {
     7739                                                if ( callback ) {
     7740                                                        delete xhrCallbacks[ id ];
     7741                                                        callback = xhr.onload = xhr.onerror = null;
     7742                                                        if ( type === "abort" ) {
     7743                                                                xhr.abort();
     7744                                                        } else if ( type === "error" ) {
     7745                                                                complete(
     7746                                                                        // file protocol always yields status 0, assume 404
     7747                                                                        xhr.status || 404,
     7748                                                                        xhr.statusText
     7749                                                                );
     7750                                                        } else {
     7751                                                                complete(
     7752                                                                        xhrSuccessStatus[ xhr.status ] || xhr.status,
     7753                                                                        xhr.statusText,
     7754                                                                        // Support: IE9
     7755                                                                        // #11426: When requesting binary data, IE9 will throw an exception
     7756                                                                        // on any attempt to access responseText
     7757                                                                        typeof xhr.responseText === "string" ? {
     7758                                                                                text: xhr.responseText
     7759                                                                        } : undefined,
     7760                                                                        xhr.getAllResponseHeaders()
     7761                                                                );
     7762                                                        }
     7763                                                }
     7764                                        };
     7765                                };
     7766                                // Listen to events
     7767                                xhr.onload = callback();
     7768                                xhr.onerror = callback("error");
     7769                                // Create the abort callback
     7770                                callback = xhrCallbacks[( id = xhrId++ )] = callback("abort");
     7771                                // Do send the request
     7772                                // This may raise an exception which is actually
     7773                                // handled in jQuery.ajax (so no try/catch here)
     7774                                xhr.send( options.hasContent && options.data || null );
     7775                        },
     7776                        abort: function() {
     7777                                if ( callback ) {
     7778                                        callback();
     7779                                }
     7780                        }
     7781                };
     7782        }
     7783});
     7784var fxNow, timerId,
     7785        rfxtypes = /^(?:toggle|show|hide)$/,
     7786        rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
     7787        rrun = /queueHooks$/,
     7788        animationPrefilters = [ defaultPrefilter ],
     7789        tweeners = {
     7790                "*": [function( prop, value ) {
     7791                        var end, unit,
     7792                                tween = this.createTween( prop, value ),
     7793                                parts = rfxnum.exec( value ),
     7794                                target = tween.cur(),
     7795                                start = +target || 0,
     7796                                scale = 1,
     7797                                maxIterations = 20;
     7798
     7799                        if ( parts ) {
     7800                                end = +parts[2];
     7801                                unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
     7802
     7803                                // We need to compute starting value
     7804                                if ( unit !== "px" && start ) {
     7805                                        // Iteratively approximate from a nonzero starting point
     7806                                        // Prefer the current property, because this process will be trivial if it uses the same units
     7807                                        // Fallback to end or a simple constant
     7808                                        start = jQuery.css( tween.elem, prop, true ) || end || 1;
     7809
     7810                                        do {
     7811                                                // If previous iteration zeroed out, double until we get *something*
     7812                                                // Use a string for doubling factor so we don't accidentally see scale as unchanged below
     7813                                                scale = scale || ".5";
     7814
     7815                                                // Adjust and apply
     7816                                                start = start / scale;
     7817                                                jQuery.style( tween.elem, prop, start + unit );
     7818
     7819                                        // Update scale, tolerating zero or NaN from tween.cur()
     7820                                        // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
     7821                                        } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
     7822                                }
     7823
     7824                                tween.unit = unit;
     7825                                tween.start = start;
     7826                                // If a +=/-= token was provided, we're doing a relative animation
     7827                                tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
     7828                        }
     7829                        return tween;
     7830                }]
     7831        };
     7832
     7833// Animations created synchronously will run synchronously
     7834function createFxNow() {
     7835        setTimeout(function() {
     7836                fxNow = undefined;
     7837        });
     7838        return ( fxNow = jQuery.now() );
     7839}
     7840
     7841function createTweens( animation, props ) {
     7842        jQuery.each( props, function( prop, value ) {
     7843                var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
     7844                        index = 0,
     7845                        length = collection.length;
     7846                for ( ; index < length; index++ ) {
     7847                        if ( collection[ index ].call( animation, prop, value ) ) {
     7848
     7849                                // we're done with this property
     7850                                return;
     7851                        }
     7852                }
     7853        });
     7854}
     7855
     7856function Animation( elem, properties, options ) {
     7857        var result,
     7858                stopped,
     7859                index = 0,
     7860                length = animationPrefilters.length,
     7861                deferred = jQuery.Deferred().always( function() {
     7862                        // don't match elem in the :animated selector
     7863                        delete tick.elem;
     7864                }),
     7865                tick = function() {
     7866                        if ( stopped ) {
     7867                                return false;
     7868                        }
     7869                        var currentTime = fxNow || createFxNow(),
     7870                                remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
     7871                                // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
     7872                                temp = remaining / animation.duration || 0,
     7873                                percent = 1 - temp,
     7874                                index = 0,
     7875                                length = animation.tweens.length;
     7876
     7877                        for ( ; index < length ; index++ ) {
     7878                                animation.tweens[ index ].run( percent );
     7879                        }
     7880
     7881                        deferred.notifyWith( elem, [ animation, percent, remaining ]);
     7882
     7883                        if ( percent < 1 && length ) {
     7884                                return remaining;
     7885                        } else {
     7886                                deferred.resolveWith( elem, [ animation ] );
     7887                                return false;
     7888                        }
     7889                },
     7890                animation = deferred.promise({
     7891                        elem: elem,
     7892                        props: jQuery.extend( {}, properties ),
     7893                        opts: jQuery.extend( true, { specialEasing: {} }, options ),
     7894                        originalProperties: properties,
     7895                        originalOptions: options,
     7896                        startTime: fxNow || createFxNow(),
     7897                        duration: options.duration,
     7898                        tweens: [],
     7899                        createTween: function( prop, end ) {
     7900                                var tween = jQuery.Tween( elem, animation.opts, prop, end,
     7901                                                animation.opts.specialEasing[ prop ] || animation.opts.easing );
     7902                                animation.tweens.push( tween );
     7903                                return tween;
     7904                        },
     7905                        stop: function( gotoEnd ) {
     7906                                var index = 0,
     7907                                        // if we are going to the end, we want to run all the tweens
     7908                                        // otherwise we skip this part
     7909                                        length = gotoEnd ? animation.tweens.length : 0;
     7910                                if ( stopped ) {
     7911                                        return this;
     7912                                }
     7913                                stopped = true;
     7914                                for ( ; index < length ; index++ ) {
     7915                                        animation.tweens[ index ].run( 1 );
     7916                                }
     7917
     7918                                // resolve when we played the last frame
     7919                                // otherwise, reject
     7920                                if ( gotoEnd ) {
     7921                                        deferred.resolveWith( elem, [ animation, gotoEnd ] );
     7922                                } else {
     7923                                        deferred.rejectWith( elem, [ animation, gotoEnd ] );
     7924                                }
     7925                                return this;
     7926                        }
     7927                }),
     7928                props = animation.props;
     7929
     7930        propFilter( props, animation.opts.specialEasing );
     7931
     7932        for ( ; index < length ; index++ ) {
     7933                result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
     7934                if ( result ) {
     7935                        return result;
     7936                }
     7937        }
     7938
     7939        createTweens( animation, props );
     7940
     7941        if ( jQuery.isFunction( animation.opts.start ) ) {
     7942                animation.opts.start.call( elem, animation );
     7943        }
     7944
     7945        jQuery.fx.timer(
     7946                jQuery.extend( tick, {
     7947                        elem: elem,
     7948                        anim: animation,
     7949                        queue: animation.opts.queue
     7950                })
     7951        );
     7952
     7953        // attach callbacks from options
     7954        return animation.progress( animation.opts.progress )
     7955                .done( animation.opts.done, animation.opts.complete )
     7956                .fail( animation.opts.fail )
     7957                .always( animation.opts.always );
     7958}
     7959
     7960function propFilter( props, specialEasing ) {
     7961        var index, name, easing, value, hooks;
     7962
     7963        // camelCase, specialEasing and expand cssHook pass
     7964        for ( index in props ) {
     7965                name = jQuery.camelCase( index );
     7966                easing = specialEasing[ name ];
     7967                value = props[ index ];
     7968                if ( jQuery.isArray( value ) ) {
     7969                        easing = value[ 1 ];
     7970                        value = props[ index ] = value[ 0 ];
     7971                }
     7972
     7973                if ( index !== name ) {
     7974                        props[ name ] = value;
     7975                        delete props[ index ];
     7976                }
     7977
     7978                hooks = jQuery.cssHooks[ name ];
     7979                if ( hooks && "expand" in hooks ) {
     7980                        value = hooks.expand( value );
     7981                        delete props[ name ];
     7982
     7983                        // not quite $.extend, this wont overwrite keys already present.
     7984                        // also - reusing 'index' from above because we have the correct "name"
     7985                        for ( index in value ) {
     7986                                if ( !( index in props ) ) {
     7987                                        props[ index ] = value[ index ];
     7988                                        specialEasing[ index ] = easing;
     7989                                }
     7990                        }
     7991                } else {
     7992                        specialEasing[ name ] = easing;
     7993                }
     7994        }
     7995}
     7996
     7997jQuery.Animation = jQuery.extend( Animation, {
     7998
     7999        tweener: function( props, callback ) {
     8000                if ( jQuery.isFunction( props ) ) {
     8001                        callback = props;
     8002                        props = [ "*" ];
     8003                } else {
     8004                        props = props.split(" ");
     8005                }
     8006
     8007                var prop,
     8008                        index = 0,
     8009                        length = props.length;
     8010
     8011                for ( ; index < length ; index++ ) {
     8012                        prop = props[ index ];
     8013                        tweeners[ prop ] = tweeners[ prop ] || [];
     8014                        tweeners[ prop ].unshift( callback );
     8015                }
     8016        },
     8017
     8018        prefilter: function( callback, prepend ) {
     8019                if ( prepend ) {
     8020                        animationPrefilters.unshift( callback );
     8021                } else {
     8022                        animationPrefilters.push( callback );
     8023                }
     8024        }
     8025});
     8026
     8027function defaultPrefilter( elem, props, opts ) {
     8028        /* jshint validthis: true */
     8029        var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
     8030                anim = this,
     8031                style = elem.style,
     8032                orig = {},
     8033                handled = [],
     8034                hidden = elem.nodeType && isHidden( elem );
     8035
     8036        // handle queue: false promises
     8037        if ( !opts.queue ) {
     8038                hooks = jQuery._queueHooks( elem, "fx" );
     8039                if ( hooks.unqueued == null ) {
     8040                        hooks.unqueued = 0;
     8041                        oldfire = hooks.empty.fire;
     8042                        hooks.empty.fire = function() {
     8043                                if ( !hooks.unqueued ) {
     8044                                        oldfire();
     8045                                }
     8046                        };
     8047                }
     8048                hooks.unqueued++;
     8049
     8050                anim.always(function() {
     8051                        // doing this makes sure that the complete handler will be called
     8052                        // before this completes
     8053                        anim.always(function() {
     8054                                hooks.unqueued--;
     8055                                if ( !jQuery.queue( elem, "fx" ).length ) {
     8056                                        hooks.empty.fire();
     8057                                }
     8058                        });
     8059                });
     8060        }
     8061
     8062        // height/width overflow pass
     8063        if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
     8064                // Make sure that nothing sneaks out
     8065                // Record all 3 overflow attributes because IE9-10 do not
     8066                // change the overflow attribute when overflowX and
     8067                // overflowY are set to the same value
     8068                opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
     8069
     8070                // Set display property to inline-block for height/width
     8071                // animations on inline elements that are having width/height animated
     8072                if ( jQuery.css( elem, "display" ) === "inline" &&
     8073                                jQuery.css( elem, "float" ) === "none" ) {
     8074
     8075                        style.display = "inline-block";
     8076                }
     8077        }
     8078
     8079        if ( opts.overflow ) {
     8080                style.overflow = "hidden";
     8081                anim.always(function() {
     8082                        style.overflow = opts.overflow[ 0 ];
     8083                        style.overflowX = opts.overflow[ 1 ];
     8084                        style.overflowY = opts.overflow[ 2 ];
     8085                });
     8086        }
     8087
     8088
     8089        // show/hide pass
     8090        dataShow = data_priv.get( elem, "fxshow" );
     8091        for ( index in props ) {
     8092                value = props[ index ];
     8093                if ( rfxtypes.exec( value ) ) {
     8094                        delete props[ index ];
     8095                        toggle = toggle || value === "toggle";
     8096                        if ( value === ( hidden ? "hide" : "show" ) ) {
     8097
     8098                                // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
     8099                                if( value === "show" && dataShow !== undefined && dataShow[ index ] !== undefined ) {
     8100                                        hidden = true;
     8101                                } else {
     8102                                        continue;
     8103                                }
     8104                        }
     8105                        handled.push( index );
     8106                }
     8107        }
     8108
     8109        length = handled.length;
     8110        if ( length ) {
     8111                dataShow = data_priv.get( elem, "fxshow" ) || data_priv.access( elem, "fxshow", {} );
     8112                if ( "hidden" in dataShow ) {
     8113                        hidden = dataShow.hidden;
     8114                }
     8115
     8116                // store state if its toggle - enables .stop().toggle() to "reverse"
     8117                if ( toggle ) {
     8118                        dataShow.hidden = !hidden;
     8119                }
     8120                if ( hidden ) {
     8121                        jQuery( elem ).show();
     8122                } else {
     8123                        anim.done(function() {
     8124                                jQuery( elem ).hide();
     8125                        });
     8126                }
     8127                anim.done(function() {
     8128                        var prop;
     8129
     8130                        data_priv.remove( elem, "fxshow" );
     8131                        for ( prop in orig ) {
     8132                                jQuery.style( elem, prop, orig[ prop ] );
     8133                        }
     8134                });
     8135                for ( index = 0 ; index < length ; index++ ) {
     8136                        prop = handled[ index ];
     8137                        tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
     8138                        orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
     8139
     8140                        if ( !( prop in dataShow ) ) {
     8141                                dataShow[ prop ] = tween.start;
     8142                                if ( hidden ) {
     8143                                        tween.end = tween.start;
     8144                                        tween.start = prop === "width" || prop === "height" ? 1 : 0;
     8145                                }
     8146                        }
     8147                }
     8148        }
     8149}
     8150
     8151function Tween( elem, options, prop, end, easing ) {
     8152        return new Tween.prototype.init( elem, options, prop, end, easing );
     8153}
     8154jQuery.Tween = Tween;
     8155
     8156Tween.prototype = {
     8157        constructor: Tween,
     8158        init: function( elem, options, prop, end, easing, unit ) {
     8159                this.elem = elem;
     8160                this.prop = prop;
     8161                this.easing = easing || "swing";
     8162                this.options = options;
     8163                this.start = this.now = this.cur();
     8164                this.end = end;
     8165                this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
     8166        },
     8167        cur: function() {
     8168                var hooks = Tween.propHooks[ this.prop ];
     8169
     8170                return hooks && hooks.get ?
     8171                        hooks.get( this ) :
     8172                        Tween.propHooks._default.get( this );
     8173        },
     8174        run: function( percent ) {
     8175                var eased,
     8176                        hooks = Tween.propHooks[ this.prop ];
     8177
     8178                if ( this.options.duration ) {
     8179                        this.pos = eased = jQuery.easing[ this.easing ](
     8180                                percent, this.options.duration * percent, 0, 1, this.options.duration
     8181                        );
     8182                } else {
     8183                        this.pos = eased = percent;
     8184                }
     8185                this.now = ( this.end - this.start ) * eased + this.start;
     8186
     8187                if ( this.options.step ) {
     8188                        this.options.step.call( this.elem, this.now, this );
     8189                }
     8190
     8191                if ( hooks && hooks.set ) {
     8192                        hooks.set( this );
     8193                } else {
     8194                        Tween.propHooks._default.set( this );
     8195                }
     8196                return this;
     8197        }
     8198};
     8199
     8200Tween.prototype.init.prototype = Tween.prototype;
     8201
     8202Tween.propHooks = {
     8203        _default: {
     8204                get: function( tween ) {
     8205                        var result;
     8206
     8207                        if ( tween.elem[ tween.prop ] != null &&
     8208                                (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
     8209                                return tween.elem[ tween.prop ];
     8210                        }
     8211
     8212                        // passing an empty string as a 3rd parameter to .css will automatically
     8213                        // attempt a parseFloat and fallback to a string if the parse fails
     8214                        // so, simple values such as "10px" are parsed to Float.
     8215                        // complex values such as "rotate(1rad)" are returned as is.
     8216                        result = jQuery.css( tween.elem, tween.prop, "" );
     8217                        // Empty strings, null, undefined and "auto" are converted to 0.
     8218                        return !result || result === "auto" ? 0 : result;
     8219                },
     8220                set: function( tween ) {
     8221                        // use step hook for back compat - use cssHook if its there - use .style if its
     8222                        // available and use plain properties where available
     8223                        if ( jQuery.fx.step[ tween.prop ] ) {
     8224                                jQuery.fx.step[ tween.prop ]( tween );
     8225                        } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
     8226                                jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
     8227                        } else {
     8228                                tween.elem[ tween.prop ] = tween.now;
     8229                        }
     8230                }
     8231        }
     8232};
     8233
     8234// Support: IE9
     8235// Panic based approach to setting things on disconnected nodes
     8236
     8237Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
     8238        set: function( tween ) {
     8239                if ( tween.elem.nodeType && tween.elem.parentNode ) {
     8240                        tween.elem[ tween.prop ] = tween.now;
     8241                }
     8242        }
     8243};
     8244
     8245jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
     8246        var cssFn = jQuery.fn[ name ];
     8247        jQuery.fn[ name ] = function( speed, easing, callback ) {
     8248                return speed == null || typeof speed === "boolean" ?
     8249                        cssFn.apply( this, arguments ) :
     8250                        this.animate( genFx( name, true ), speed, easing, callback );
     8251        };
     8252});
     8253
     8254jQuery.fn.extend({
     8255        fadeTo: function( speed, to, easing, callback ) {
     8256
     8257                // show any hidden elements after setting opacity to 0
     8258                return this.filter( isHidden ).css( "opacity", 0 ).show()
     8259
     8260                        // animate to the value specified
     8261                        .end().animate({ opacity: to }, speed, easing, callback );
     8262        },
     8263        animate: function( prop, speed, easing, callback ) {
     8264                var empty = jQuery.isEmptyObject( prop ),
     8265                        optall = jQuery.speed( speed, easing, callback ),
     8266                        doAnimation = function() {
     8267                                // Operate on a copy of prop so per-property easing won't be lost
     8268                                var anim = Animation( this, jQuery.extend( {}, prop ), optall );
     8269                                doAnimation.finish = function() {
     8270                                        anim.stop( true );
     8271                                };
     8272                                // Empty animations, or finishing resolves immediately
     8273                                if ( empty || data_priv.get( this, "finish" ) ) {
     8274                                        anim.stop( true );
     8275                                }
     8276                        };
     8277                        doAnimation.finish = doAnimation;
     8278
     8279                return empty || optall.queue === false ?
     8280                        this.each( doAnimation ) :
     8281                        this.queue( optall.queue, doAnimation );
     8282        },
     8283        stop: function( type, clearQueue, gotoEnd ) {
     8284                var stopQueue = function( hooks ) {
     8285                        var stop = hooks.stop;
     8286                        delete hooks.stop;
     8287                        stop( gotoEnd );
     8288                };
     8289
     8290                if ( typeof type !== "string" ) {
     8291                        gotoEnd = clearQueue;
     8292                        clearQueue = type;
     8293                        type = undefined;
     8294                }
     8295                if ( clearQueue && type !== false ) {
     8296                        this.queue( type || "fx", [] );
     8297                }
     8298
     8299                return this.each(function() {
     8300                        var dequeue = true,
     8301                                index = type != null && type + "queueHooks",
     8302                                timers = jQuery.timers,
     8303                                data = data_priv.get( this );
     8304
     8305                        if ( index ) {
     8306                                if ( data[ index ] && data[ index ].stop ) {
     8307                                        stopQueue( data[ index ] );
     8308                                }
     8309                        } else {
     8310                                for ( index in data ) {
     8311                                        if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
     8312                                                stopQueue( data[ index ] );
     8313                                        }
     8314                                }
     8315                        }
     8316
     8317                        for ( index = timers.length; index--; ) {
     8318                                if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
     8319                                        timers[ index ].anim.stop( gotoEnd );
     8320                                        dequeue = false;
     8321                                        timers.splice( index, 1 );
     8322                                }
     8323                        }
     8324
     8325                        // start the next in the queue if the last step wasn't forced
     8326                        // timers currently will call their complete callbacks, which will dequeue
     8327                        // but only if they were gotoEnd
     8328                        if ( dequeue || !gotoEnd ) {
     8329                                jQuery.dequeue( this, type );
     8330                        }
     8331                });
     8332        },
     8333        finish: function( type ) {
     8334                if ( type !== false ) {
     8335                        type = type || "fx";
     8336                }
     8337                return this.each(function() {
     8338                        var index,
     8339                                data = data_priv.get( this ),
     8340                                queue = data[ type + "queue" ],
     8341                                hooks = data[ type + "queueHooks" ],
     8342                                timers = jQuery.timers,
     8343                                length = queue ? queue.length : 0;
     8344
     8345                        // enable finishing flag on private data
     8346                        data.finish = true;
     8347
     8348                        // empty the queue first
     8349                        jQuery.queue( this, type, [] );
     8350
     8351                        if ( hooks && hooks.cur && hooks.cur.finish ) {
     8352                                hooks.cur.finish.call( this );
     8353                        }
     8354
     8355                        // look for any active animations, and finish them
     8356                        for ( index = timers.length; index--; ) {
     8357                                if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
     8358                                        timers[ index ].anim.stop( true );
     8359                                        timers.splice( index, 1 );
     8360                                }
     8361                        }
     8362
     8363                        // look for any animations in the old queue and finish them
     8364                        for ( index = 0; index < length; index++ ) {
     8365                                if ( queue[ index ] && queue[ index ].finish ) {
     8366                                        queue[ index ].finish.call( this );
     8367                                }
     8368                        }
     8369
     8370                        // turn off finishing flag
     8371                        delete data.finish;
     8372                });
     8373        }
     8374});
     8375
     8376// Generate parameters to create a standard animation
     8377function genFx( type, includeWidth ) {
     8378        var which,
     8379                attrs = { height: type },
     8380                i = 0;
     8381
     8382        // if we include width, step value is 1 to do all cssExpand values,
     8383        // if we don't include width, step value is 2 to skip over Left and Right
     8384        includeWidth = includeWidth? 1 : 0;
     8385        for( ; i < 4 ; i += 2 - includeWidth ) {
     8386                which = cssExpand[ i ];
     8387                attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
     8388        }
     8389
     8390        if ( includeWidth ) {
     8391                attrs.opacity = attrs.width = type;
     8392        }
     8393
     8394        return attrs;
     8395}
     8396
     8397// Generate shortcuts for custom animations
     8398jQuery.each({
     8399        slideDown: genFx("show"),
     8400        slideUp: genFx("hide"),
     8401        slideToggle: genFx("toggle"),
     8402        fadeIn: { opacity: "show" },
     8403        fadeOut: { opacity: "hide" },
     8404        fadeToggle: { opacity: "toggle" }
     8405}, function( name, props ) {
     8406        jQuery.fn[ name ] = function( speed, easing, callback ) {
     8407                return this.animate( props, speed, easing, callback );
     8408        };
     8409});
     8410
     8411jQuery.speed = function( speed, easing, fn ) {
     8412        var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
     8413                complete: fn || !fn && easing ||
     8414                        jQuery.isFunction( speed ) && speed,
     8415                duration: speed,
     8416                easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
     8417        };
     8418
     8419        opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
     8420                opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
     8421
     8422        // normalize opt.queue - true/undefined/null -> "fx"
     8423        if ( opt.queue == null || opt.queue === true ) {
     8424                opt.queue = "fx";
     8425        }
     8426
     8427        // Queueing
     8428        opt.old = opt.complete;
     8429
     8430        opt.complete = function() {
     8431                if ( jQuery.isFunction( opt.old ) ) {
     8432                        opt.old.call( this );
     8433                }
     8434
     8435                if ( opt.queue ) {
     8436                        jQuery.dequeue( this, opt.queue );
     8437                }
     8438        };
     8439
     8440        return opt;
     8441};
     8442
     8443jQuery.easing = {
     8444        linear: function( p ) {
     8445                return p;
     8446        },
     8447        swing: function( p ) {
     8448                return 0.5 - Math.cos( p*Math.PI ) / 2;
     8449        }
     8450};
     8451
     8452jQuery.timers = [];
     8453jQuery.fx = Tween.prototype.init;
     8454jQuery.fx.tick = function() {
     8455        var timer,
     8456                timers = jQuery.timers,
     8457                i = 0;
     8458
     8459        fxNow = jQuery.now();
     8460
     8461        for ( ; i < timers.length; i++ ) {
     8462                timer = timers[ i ];
     8463                // Checks the timer has not already been removed
     8464                if ( !timer() && timers[ i ] === timer ) {
     8465                        timers.splice( i--, 1 );
     8466                }
     8467        }
     8468
     8469        if ( !timers.length ) {
     8470                jQuery.fx.stop();
     8471        }
     8472        fxNow = undefined;
     8473};
     8474
     8475jQuery.fx.timer = function( timer ) {
     8476        if ( timer() && jQuery.timers.push( timer ) ) {
     8477                jQuery.fx.start();
     8478        }
     8479};
     8480
     8481jQuery.fx.interval = 13;
     8482
     8483jQuery.fx.start = function() {
     8484        if ( !timerId ) {
     8485                timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
     8486        }
     8487};
     8488
     8489jQuery.fx.stop = function() {
     8490        clearInterval( timerId );
     8491        timerId = null;
     8492};
     8493
     8494jQuery.fx.speeds = {
     8495        slow: 600,
     8496        fast: 200,
     8497        // Default speed
     8498        _default: 400
     8499};
     8500
     8501// Back Compat <1.8 extension point
     8502jQuery.fx.step = {};
     8503
     8504if ( jQuery.expr && jQuery.expr.filters ) {
     8505        jQuery.expr.filters.animated = function( elem ) {
     8506                return jQuery.grep(jQuery.timers, function( fn ) {
     8507                        return elem === fn.elem;
     8508                }).length;
     8509        };
     8510}
     8511jQuery.fn.offset = function( options ) {
     8512        if ( arguments.length ) {
     8513                return options === undefined ?
     8514                        this :
     8515                        this.each(function( i ) {
     8516                                jQuery.offset.setOffset( this, options, i );
     8517                        });
     8518        }
     8519
     8520        var docElem, win,
     8521                elem = this[ 0 ],
     8522                box = { top: 0, left: 0 },
     8523                doc = elem && elem.ownerDocument;
     8524
     8525        if ( !doc ) {
     8526                return;
     8527        }
     8528
     8529        docElem = doc.documentElement;
     8530
     8531        // Make sure it's not a disconnected DOM node
     8532        if ( !jQuery.contains( docElem, elem ) ) {
     8533                return box;
     8534        }
     8535
     8536        // If we don't have gBCR, just use 0,0 rather than error
     8537        // BlackBerry 5, iOS 3 (original iPhone)
     8538        if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
     8539                box = elem.getBoundingClientRect();
     8540        }
     8541        win = getWindow( doc );
     8542        return {
     8543                top: box.top + win.pageYOffset - docElem.clientTop,
     8544                left: box.left + win.pageXOffset - docElem.clientLeft
     8545        };
     8546};
     8547
     8548jQuery.offset = {
     8549
     8550        setOffset: function( elem, options, i ) {
     8551                var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
     8552                        position = jQuery.css( elem, "position" ),
     8553                        curElem = jQuery( elem ),
     8554                        props = {};
     8555
     8556                // Set position first, in-case top/left are set even on static elem
     8557                if ( position === "static" ) {
     8558                        elem.style.position = "relative";
     8559                }
     8560
     8561                curOffset = curElem.offset();
     8562                curCSSTop = jQuery.css( elem, "top" );
     8563                curCSSLeft = jQuery.css( elem, "left" );
     8564                calculatePosition = ( position === "absolute" || position === "fixed" ) && ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
     8565
     8566                // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
     8567                if ( calculatePosition ) {
     8568                        curPosition = curElem.position();
     8569                        curTop = curPosition.top;
     8570                        curLeft = curPosition.left;
     8571
     8572                } else {
     8573                        curTop = parseFloat( curCSSTop ) || 0;
     8574                        curLeft = parseFloat( curCSSLeft ) || 0;
     8575                }
     8576
     8577                if ( jQuery.isFunction( options ) ) {
     8578                        options = options.call( elem, i, curOffset );
     8579                }
     8580
     8581                if ( options.top != null ) {
     8582                        props.top = ( options.top - curOffset.top ) + curTop;
     8583                }
     8584                if ( options.left != null ) {
     8585                        props.left = ( options.left - curOffset.left ) + curLeft;
     8586                }
     8587
     8588                if ( "using" in options ) {
     8589                        options.using.call( elem, props );
     8590
     8591                } else {
     8592                        curElem.css( props );
     8593                }
     8594        }
     8595};
     8596
     8597
     8598jQuery.fn.extend({
     8599
     8600        position: function() {
     8601                if ( !this[ 0 ] ) {
     8602                        return;
     8603                }
     8604
     8605                var offsetParent, offset,
     8606                        elem = this[ 0 ],
     8607                        parentOffset = { top: 0, left: 0 };
     8608
     8609                // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
     8610                if ( jQuery.css( elem, "position" ) === "fixed" ) {
     8611                        // We assume that getBoundingClientRect is available when computed position is fixed
     8612                        offset = elem.getBoundingClientRect();
     8613
     8614                } else {
     8615                        // Get *real* offsetParent
     8616                        offsetParent = this.offsetParent();
     8617
     8618                        // Get correct offsets
     8619                        offset = this.offset();
     8620                        if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
     8621                                parentOffset = offsetParent.offset();
     8622                        }
     8623
     8624                        // Add offsetParent borders
     8625                        parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
     8626                        parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
     8627                }
     8628
     8629                // Subtract parent offsets and element margins
     8630                return {
     8631                        top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
     8632                        left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
     8633                };
     8634        },
     8635
     8636        offsetParent: function() {
     8637                return this.map(function() {
     8638                        var offsetParent = this.offsetParent || docElem;
     8639
     8640                        while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
     8641                                offsetParent = offsetParent.offsetParent;
     8642                        }
     8643
     8644                        return offsetParent || docElem;
     8645                });
     8646        }
     8647});
     8648
     8649
     8650// Create scrollLeft and scrollTop methods
     8651jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
     8652        var top = "pageYOffset" === prop;
     8653
     8654        jQuery.fn[ method ] = function( val ) {
     8655                return jQuery.access( this, function( elem, method, val ) {
     8656                        var win = getWindow( elem );
     8657
     8658                        if ( val === undefined ) {
     8659                                return win ? win[ prop ] : elem[ method ];
     8660                        }
     8661
     8662                        if ( win ) {
     8663                                win.scrollTo(
     8664                                        !top ? val : window.pageXOffset,
     8665                                        top ? val : window.pageYOffset
     8666                                );
     8667
     8668                        } else {
     8669                                elem[ method ] = val;
     8670                        }
     8671                }, method, val, arguments.length, null );
     8672        };
     8673});
     8674
     8675function getWindow( elem ) {
     8676        return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
     8677}
     8678// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
     8679jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
     8680        jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
     8681                // margin is only for outerHeight, outerWidth
     8682                jQuery.fn[ funcName ] = function( margin, value ) {
     8683                        var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
     8684                                extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
     8685
     8686                        return jQuery.access( this, function( elem, type, value ) {
     8687                                var doc;
     8688
     8689                                if ( jQuery.isWindow( elem ) ) {
     8690                                        // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
     8691                                        // isn't a whole lot we can do. See pull request at this URL for discussion:
     8692                                        // https://github.com/jquery/jquery/pull/764
     8693                                        return elem.document.documentElement[ "client" + name ];
     8694                                }
     8695
     8696                                // Get document width or height
     8697                                if ( elem.nodeType === 9 ) {
     8698                                        doc = elem.documentElement;
     8699
     8700                                        // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
     8701                                        // whichever is greatest
     8702                                        return Math.max(
     8703                                                elem.body[ "scroll" + name ], doc[ "scroll" + name ],
     8704                                                elem.body[ "offset" + name ], doc[ "offset" + name ],
     8705                                                doc[ "client" + name ]
     8706                                        );
     8707                                }
     8708
     8709                                return value === undefined ?
     8710                                        // Get width or height on the element, requesting but not forcing parseFloat
     8711                                        jQuery.css( elem, type, extra ) :
     8712
     8713                                        // Set width or height on the element
     8714                                        jQuery.style( elem, type, value, extra );
     8715                        }, type, chainable ? margin : undefined, chainable, null );
     8716                };
     8717        });
     8718});
     8719// Limit scope pollution from any deprecated API
     8720// (function() {
     8721
     8722// The number of elements contained in the matched element set
     8723jQuery.fn.size = function() {
     8724        return this.length;
     8725};
     8726
     8727jQuery.fn.andSelf = jQuery.fn.addBack;
     8728
     8729// })();
     8730if ( typeof module === "object" && typeof module.exports === "object" ) {
     8731        // Expose jQuery as module.exports in loaders that implement the Node
     8732        // module pattern (including browserify). Do not create the global, since
     8733        // the user will be storing it themselves locally, and globals are frowned
     8734        // upon in the Node module world.
     8735        module.exports = jQuery;
     8736} else {
     8737        // Register as a named AMD module, since jQuery can be concatenated with other
     8738        // files that may use define, but not via a proper concatenation script that
     8739        // understands anonymous AMD modules. A named AMD is safest and most robust
     8740        // way to register. Lowercase jquery is used because AMD module names are
     8741        // derived from file names, and jQuery is normally delivered in a lowercase
     8742        // file name. Do this after creating the global so that if an AMD module wants
     8743        // to call noConflict to hide this version of jQuery, it will work.
     8744        if ( typeof define === "function" && define.amd ) {
     8745                define( "jquery", [], function () { return jQuery; } );
     8746        }
     8747}
     8748
     8749// If there is a window object, that at least has a document property,
     8750// define jQuery and $ identifiers
     8751if ( typeof window === "object" && typeof window.document === "object" ) {
     8752        window.jQuery = window.$ = jQuery;
     8753}
     8754
     8755})( window );
  • wp-includes/script-loader.php

     
    136136
    137137        // jQuery
    138138        $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
     139        $scripts->add( 'jquery2', false, array( 'jquery2-core', 'jquery-migrate' ) );
    139140        $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.9.1' );
     141        $scripts->add( 'jquery2-core', '/wp-includes/js/jquery/jquery2.js', array(), '2.0.0' );
    140142        $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.1' );
    141143
    142144        // full jQuery UI