Make WordPress Core

Ticket #24132: 24132.diff

File 24132.diff, 244.1 KB (added by ryanduff, 12 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