Make WordPress Core

Ticket #23204: jquery.diff

File jquery.diff, 74.6 KB (added by jorbin, 11 years ago)
  • wp-includes/js/jquery/jquery-migrate.js

     
    11/*!
    2  * jQuery Migrate - v1.0.0pre - 2012-12-17
     2 * jQuery Migrate - v1.0.0 - 2013-01-14
    33 * https://github.com/jquery/jquery-migrate
    4  * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT
     4 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
    55 */
    6 
    76(function( jQuery, window, undefined ) {
    87"use strict";
    98
    10 // Use Uglify to do conditional compilation of warning messages;
    11 // the minified version will set this to false and remove dead code.
    12 if ( typeof window.JQMIGRATE_WARN === "undefined" ) {
    13         window.JQMIGRATE_WARN = true;
    14 }
    159
    16 
    1710var warnedAbout = {};
    1811
    1912// List of warnings already given; public read only
    2013jQuery.migrateWarnings = [];
    2114
     15// Set to true to prevent console output; migrateWarnings still maintained
     16// jQuery.migrateMute = false;
     17
    2218// Forget any warnings we've already given; public
    2319jQuery.migrateReset = function() {
    2420        warnedAbout = {};
     
    2622};
    2723
    2824function migrateWarn( msg) {
    29         if ( window.JQMIGRATE_WARN ) {
    30                 if ( !warnedAbout[ msg ] ) {
    31                         warnedAbout[ msg ] = true;
    32                         jQuery.migrateWarnings.push( msg );
    33                         if ( window.console && console.warn ) {
    34                                 console.warn( "JQMIGRATE: " + msg );
    35                         }
     25        if ( !warnedAbout[ msg ] ) {
     26                warnedAbout[ msg ] = true;
     27                jQuery.migrateWarnings.push( msg );
     28                if ( window.console && console.warn && !jQuery.migrateMute ) {
     29                        console.warn( "JQMIGRATE: " + msg );
    3630                }
    3731        }
    3832}
    3933
    4034function migrateWarnProp( obj, prop, value, msg ) {
    41         if ( window.JQMIGRATE_WARN && Object.defineProperty ) {
     35        if ( Object.defineProperty ) {
    4236                // On ES5 browsers (non-oldIE), warn if the code tries to get prop;
    4337                // allow property to be overwritten in case some other plugin wants it
    4438                try {
     
    6559        obj[ prop ] = value;
    6660}
    6761
    68 if ( window.JQMIGRATE_WARN && document.compatMode === "BackCompat" ) {
     62if ( document.compatMode === "BackCompat" ) {
    6963        // jQuery has never supported or tested Quirks Mode
    7064        migrateWarn( "jQuery is not compatible with Quirks Mode" );
    7165}
     
    7872        valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
    7973                function() { return undefined; },
    8074        rnoType = /^(?:input|button)$/i,
    81         rnoAttrNodeType = /^[238]$/;
     75        rnoAttrNodeType = /^[238]$/,
     76        rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
     77        ruseDefault = /^(?:checked|selected)$/i;
    8278
    8379// jQuery.attrFn
    8480migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
    8581
    8682jQuery.attr = function( elem, name, value, pass ) {
     83        var lowerName = name.toLowerCase(),
     84                nType = elem && elem.nodeType;
     85
    8786        if ( pass ) {
    8887                migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
    89                 if ( elem && !rnoAttrNodeType.test( elem.nodeType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
     88                if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
    9089                        return jQuery( elem )[ name ]( value );
    9190                }
    9291        }
     
    9695                migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
    9796        }
    9897
     98        // Restore boolHook for boolean property/attribute synchronization
     99        if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
     100                jQuery.attrHooks[ lowerName ] = {
     101                        get: function( elem, name ) {
     102                                // Align boolean attributes with corresponding properties
     103                                // Fall back to attribute presence where some booleans are not supported
     104                                var attrNode,
     105                                        property = jQuery.prop( elem, name );
     106                                return property === true || typeof property !== "boolean" &&
     107                                        ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
     108
     109                                        name.toLowerCase() :
     110                                        undefined;
     111                        },
     112                        set: function( elem, value, name ) {
     113                                var propName;
     114                                if ( value === false ) {
     115                                        // Remove boolean attributes when set to false
     116                                        jQuery.removeAttr( elem, name );
     117                                } else {
     118                                        // value is true since we know at this point it's type boolean and not false
     119                                        // Set boolean attributes to the same name and set the DOM property
     120                                        propName = jQuery.propFix[ name ] || name;
     121                                        if ( propName in elem ) {
     122                                                // Only set the IDL specifically if it already exists on the element
     123                                                elem[ propName ] = true;
     124                                        }
     125
     126                                        elem.setAttribute( name, name.toLowerCase() );
     127                                }
     128                                return name;
     129                        }
     130                };
     131
     132                // Warn only for attributes that can remain distinct from their properties post-1.9
     133                if ( ruseDefault.test( lowerName ) ) {
     134                        migrateWarn( "jQuery.fn.attr(" + lowerName + ") may use property instead of attribute" );
     135                }
     136        }
     137
    99138        return attr.call( jQuery, elem, name, value );
    100139};
    101140
    102141// attrHooks: value
    103142jQuery.attrHooks.value = {
    104143        get: function( elem, name ) {
    105                 if ( jQuery.nodeName( elem, "button" ) ) {
     144                var nodeName = ( elem.nodeName || "" ).toLowerCase();
     145                if ( nodeName === "button" ) {
    106146                        return valueAttrGet.apply( this, arguments );
    107147                }
    108                 migrateWarn("property-based jQuery.fn.attr('value') is deprecated");
     148                if ( nodeName !== "input" && nodeName !== "option" ) {
     149                        migrateWarn("property-based jQuery.fn.attr('value') is deprecated");
     150                }
    109151                return name in elem ?
    110152                        elem.value :
    111153                        null;
    112154        },
    113         set: function( elem, value, name ) {
    114                 if ( jQuery.nodeName( elem, "button" ) ) {
     155        set: function( elem, value ) {
     156                var nodeName = ( elem.nodeName || "" ).toLowerCase();
     157                if ( nodeName === "button" ) {
    115158                        return valueAttrSet.apply( this, arguments );
    116159                }
    117                 migrateWarn("property-based jQuery.fn.attr('value', val) is deprecated");
     160                if ( nodeName !== "input" && nodeName !== "option" ) {
     161                        migrateWarn("property-based jQuery.fn.attr('value', val) is deprecated");
     162                }
    118163                // Does not return so that setAttribute is also used
    119164                elem.value = value;
    120165        }
     
    122167
    123168
    124169var matched, browser,
    125         oldAccess = jQuery.access,
    126170        oldInit = jQuery.fn.init,
    127171        // Note this does NOT include the # XSS fix from 1.7!
    128         rquickExpr = /^(?:.*(<[\w\W]+>)[^>]*|#([\w-]*))$/;
     172        rquickExpr = /^(?:.*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
    129173
    130174// $(html) "looks like html" rule change
    131175jQuery.fn.init = function( selector, context, rootjQuery ) {
     
    151195};
    152196jQuery.fn.init.prototype = jQuery.fn;
    153197
    154 if ( jQuery.fn.jquery >= "1.9" ) {
    155         // jQuery.access( ..., pass )
    156         jQuery.access = function( elems, fn, key, value, chainable, emptyGet, pass ) {
    157                 var i = 0,
    158                         length = elems.length;
    159 
    160                 if ( key && typeof key === "object" && value ) {
    161                         for ( i in key ) {
    162                                 jQuery.access( elems, fn, i, key[i], true, emptyGet, value );
    163                         }
    164                         return elems;
    165                 } else if ( pass && key != null && value !== undefined ) {
    166                         for ( ; i < length; i++ ) {
    167                                 fn( elems[i], key, value, true );
    168                         }
    169                         return elems;
    170                 }
    171                 return oldAccess.call( jQuery, elems, fn, key, value, chainable, emptyGet );
    172         };
    173 }
    174 
    175198jQuery.uaMatch = function( ua ) {
    176199        ua = ua.toLowerCase();
    177200
     
    250273};
    251274
    252275
    253 var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
     276var rscriptType = /\/(java|ecma)script/i,
     277        oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
    254278        oldFragment = jQuery.buildFragment;
    255279
    256280jQuery.fn.andSelf = function() {
     
    258282        return oldSelf.apply( this, arguments );
    259283};
    260284
    261 jQuery.buildFragment = function( args, context, scripts ) {
    262         var fragment;
    263 
    264         if ( !oldFragment ) {
    265                 // Set context from what may come in as undefined or a jQuery collection or a node
    266                 // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
    267                 // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
     285// Since jQuery.clean is used internally on older versions, we only shim if it's missing
     286if ( !jQuery.clean ) {
     287        jQuery.clean = function( elems, context, fragment, scripts ) {
     288                // Set context per 1.8 logic
    268289                context = context || document;
    269290                context = !context.nodeType && context[0] || context;
    270291                context = context.ownerDocument || context;
    271292
    272                 fragment = context.createDocumentFragment();
    273                 jQuery.clean( args, context, fragment, scripts );
     293                migrateWarn("jQuery.clean() is deprecated");
    274294
    275                 migrateWarn("jQuery.buildFragment() is deprecated");
    276                 return { fragment: fragment, cacheable: false };
     295                var i, elem, handleScript, jsTags,
     296                        ret = [];
     297
     298                jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
     299
     300                // Complex logic lifted directly from jQuery 1.8
     301                if ( fragment ) {
     302                        // Special handling of each script element
     303                        handleScript = function( elem ) {
     304                                // Check if we consider it executable
     305                                if ( !elem.type || rscriptType.test( elem.type ) ) {
     306                                        // Detach the script and store it in the scripts array (if provided) or the fragment
     307                                        // Return truthy to indicate that it has been handled
     308                                        return scripts ?
     309                                                scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
     310                                                fragment.appendChild( elem );
     311                                }
     312                        };
     313
     314                        for ( i = 0; (elem = ret[i]) != null; i++ ) {
     315                                // Check if we're done after handling an executable script
     316                                if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
     317                                        // Append to fragment and handle embedded scripts
     318                                        fragment.appendChild( elem );
     319                                        if ( typeof elem.getElementsByTagName !== "undefined" ) {
     320                                                // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
     321                                                jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
     322
     323                                                // Splice the scripts into ret after their former ancestor and advance our index beyond them
     324                                                ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
     325                                                i += jsTags.length;
     326                                        }
     327                                }
     328                        }
     329                }
     330
     331                return ret;
     332        };
     333}
     334
     335jQuery.buildFragment = function( elems, context, scripts, selection ) {
     336        var ret,
     337                warning = "jQuery.buildFragment() is deprecated";
     338
     339        // Set context per 1.8 logic
     340        context = context || document;
     341        context = !context.nodeType && context[0] || context;
     342        context = context.ownerDocument || context;
     343
     344        try {
     345                ret = oldFragment.call( jQuery, elems, context, scripts, selection );
     346
     347        // jQuery < 1.8 required arrayish context; jQuery 1.9 fails on it
     348        } catch( x ) {
     349                ret = oldFragment.call( jQuery, elems, context.nodeType ? [ context ] : context[ 0 ], scripts, selection );
     350
     351                // Success from tweaking context means buildFragment was called by the user
     352                migrateWarn( warning );
    277353        }
    278         // Don't warn if we are in a version where buildFragment is used internally
    279         return oldFragment.apply( this, arguments );
     354
     355        // jQuery < 1.9 returned an object instead of the fragment itself
     356        if ( !ret.fragment ) {
     357                migrateWarnProp( ret, "fragment", ret, warning );
     358                migrateWarnProp( ret, "cacheable", false, warning );
     359        }
     360
     361        return ret;
    280362};
    281363
    282364var eventAdd = jQuery.event.add,
     
    303385        jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
    304386}
    305387
     388// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
     389migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
     390
    306391// Support for 'hover' pseudo-event and ajax event warnings
    307392jQuery.event.add = function( elem, types, handler, data, selector ){
    308393        if ( elem !== document && rajaxEvent.test( types ) ) {
     
    314399        eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
    315400};
    316401
    317 jQuery.fn.error = function( data, fn ) {
     402jQuery.fn.error = function() {
    318403        var args = Array.prototype.slice.call( arguments, 0);
    319404        migrateWarn("jQuery.fn.error() is deprecated");
    320405        args.splice( 0, 0, "error" );
     
    387472jQuery.each( ajaxEvents.split("|"),
    388473        function( _, name ) {
    389474                jQuery.event.special[ name ] = {
    390                         setup: function( data ) {
     475                        setup: function() {
    391476                                var elem = this;
    392477
    393478                                // The document needs no shimming; must be !== for oldIE
    394479                                if ( elem !== document ) {
    395                                         jQuery.event.add( document, name + "." + jQuery.guid, function( event ) {
     480                                        jQuery.event.add( document, name + "." + jQuery.guid, function() {
    396481                                                jQuery.event.trigger( name, null, elem, true );
    397482                                        });
    398483                                        jQuery._data( this, name, jQuery.guid++ );
    399484                                }
    400485                                return false;
    401486                        },
    402                         teardown: function( data, handleObj ) {
     487                        teardown: function() {
    403488                                if ( this !== document ) {
    404489                                        jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
    405490                                }
    406491                                return false;
    407492                        }
    408                 }
     493                };
    409494        }
    410495);
    411496
  • wp-includes/js/jquery/jquery.js

     
    11/*!
    2  * jQuery JavaScript Library v1.9.0b1
     2 * jQuery JavaScript Library v1.9.0
    33 * http://jquery.com/
    44 *
    55 * Includes Sizzle.js
    66 * http://sizzlejs.com/
    77 *
    8  * Copyright 2012 jQuery Foundation and other contributors
     8 * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
    99 * Released under the MIT license
    1010 * http://jquery.org/license
    1111 *
    12  * Date: 2012-12-16
     12 * Date: 2013-1-14
    1313 */
    1414(function( window, undefined ) {
    1515"use strict";
     
    3636        // List of deleted data cache ids, so we can reuse them
    3737        core_deletedIds = [],
    3838
    39         core_version = "1.9.0b1",
     39        core_version = "1.9.0",
    4040
    4141        // Save a reference to some core methods
    4242        core_concat = core_deletedIds.concat,
     
    111111                        return this;
    112112                }
    113113
    114                 // HANDLE: $(DOMElement)
    115                 if ( selector.nodeType ) {
    116                         this.context = this[0] = selector;
    117                         this.length = 1;
    118                         return this;
    119                 }
    120 
    121114                // Handle HTML strings
    122115                if ( typeof selector === "string" ) {
    123116                        if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
     
    191184                                return this.constructor( context ).find( selector );
    192185                        }
    193186
     187                // HANDLE: $(DOMElement)
     188                } else if ( selector.nodeType ) {
     189                        this.context = this[0] = selector;
     190                        this.length = 1;
     191                        return this;
     192
    194193                // HANDLE: $(function)
    195194                // Shortcut for document ready
    196195                } else if ( jQuery.isFunction( selector ) ) {
     
    442441        },
    443442
    444443        type: function( obj ) {
    445                 return obj == null ?
    446                         String( obj ) :
    447                         class2type[ core_toString.call(obj) ] || "object";
     444                if ( obj == null ) {
     445                        return String( obj );
     446                }
     447                return typeof obj === "object" || typeof obj === "function" ?
     448                        class2type[ core_toString.call(obj) ] || "object" :
     449                        typeof obj;
    448450        },
    449451
    450452        isPlainObject: function( obj ) {
     
    509511                        return [ context.createElement( parsed[1] ) ];
    510512                }
    511513
    512                 parsed = context.createDocumentFragment();
    513                 jQuery.clean( [ data ], context, parsed, scripts );
     514                parsed = jQuery.buildFragment( [ data ], context, scripts );
    514515                if ( scripts ) {
    515516                        jQuery( scripts ).remove();
    516517                }
     
    11641165                                        return jQuery.Deferred(function( newDefer ) {
    11651166                                                jQuery.each( tuples, function( i, tuple ) {
    11661167                                                        var action = tuple[ 0 ],
    1167                                                                 fn = fns[ i ];
     1168                                                                fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
    11681169                                                        // deferred[ done | fail | progress ] for forwarding actions to newDefer
    1169                                                         deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
    1170                                                                 function() {
    1171                                                                         var returned = fn.apply( this, arguments );
    1172                                                                         if ( returned && jQuery.isFunction( returned.promise ) ) {
    1173                                                                                 returned.promise()
    1174                                                                                         .done( newDefer.resolve )
    1175                                                                                         .fail( newDefer.reject )
    1176                                                                                         .progress( newDefer.notify );
    1177                                                                         } else {
    1178                                                                                 newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, [ returned ] );
    1179                                                                         }
    1180                                                                 } :
    1181                                                                 newDefer[ action ]
    1182                                                         );
     1170                                                        deferred[ tuple[1] ](function() {
     1171                                                                var returned = fn && fn.apply( this, arguments );
     1172                                                                if ( returned && jQuery.isFunction( returned.promise ) ) {
     1173                                                                        returned.promise()
     1174                                                                                .done( newDefer.resolve )
     1175                                                                                .fail( newDefer.reject )
     1176                                                                                .progress( newDefer.notify );
     1177                                                                } else {
     1178                                                                        newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
     1179                                                                }
     1180                                                        });
    11831181                                                });
    11841182                                                fns = null;
    11851183                                        }).promise();
     
    12151213
    12161214                        // deferred[ resolve | reject | notify ]
    12171215                        deferred[ tuple[0] ] = function() {
    1218                                 deferred[ tuple[0] + "With" ]( promise, arguments );
     1216                                deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
    12191217                                return this;
    12201218                        };
    12211219                        deferred[ tuple[0] + "With" ] = list.fireWith;
     
    12871285});
    12881286jQuery.support = (function() {
    12891287
    1290         var support,
    1291                 all,
    1292                 a,
    1293                 select,
    1294                 opt,
    1295                 input,
    1296                 fragment,
    1297                 eventName,
    1298                 i,
    1299                 isSupported,
    1300                 clickFn,
     1288        var support, all, a, select, opt, input, fragment, eventName, isSupported, i,
    13011289                div = document.createElement("div");
    13021290
    13031291        // Setup
     
    13671355                boxModel: document.compatMode === "CSS1Compat",
    13681356
    13691357                // Will be defined later
    1370                 submitBubbles: true,
    1371                 changeBubbles: true,
    1372                 focusinBubbles: false,
    13731358                deleteExpando: true,
    13741359                noCloneEvent: true,
    13751360                inlineBlockNeedsLayout: false,
     
    13881373        select.disabled = true;
    13891374        support.optDisabled = !opt.disabled;
    13901375
    1391         // Test to see if it's possible to delete an expando from an element
    1392         // Fails in Internet Explorer
     1376        // Support: IE<9
    13931377        try {
    13941378                delete div.test;
    13951379        } catch( e ) {
    13961380                support.deleteExpando = false;
    13971381        }
    13981382
    1399         if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
    1400                 div.attachEvent( "onclick", clickFn = function() {
    1401                         // Cloning a node shouldn't copy over any
    1402                         // bound event handlers (IE does this)
    1403                         support.noCloneEvent = false;
    1404                 });
    1405                 div.cloneNode( true ).fireEvent("onclick");
    1406                 div.detachEvent( "onclick", clickFn );
    1407         }
    1408 
    14091383        // Check if we can trust getAttribute("value")
    14101384        input = document.createElement("input");
    14111385        input.setAttribute( "value", "" );
     
    14171391        support.radioValue = input.value === "t";
    14181392
    14191393        // #11217 - WebKit loses check when the name is after the checked attribute
    1420         input.setAttribute( "checked", "checked" );
     1394        input.setAttribute( "checked", "t" );
    14211395        input.setAttribute( "name", "t" );
    14221396
    1423         div.appendChild( input );
    14241397        fragment = document.createDocumentFragment();
    1425         fragment.appendChild( div.lastChild );
     1398        fragment.appendChild( input );
    14261399
    1427         // WebKit doesn't clone checked state correctly in fragments
    1428         support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
    1429 
    14301400        // Check if a disconnected checkbox will retain its checked
    14311401        // value of true after appended to the DOM (IE6/7)
    14321402        support.appendChecked = input.checked;
    14331403
    1434         fragment.removeChild( input );
    1435         fragment.appendChild( div );
     1404        // WebKit doesn't clone checked state correctly in fragments
     1405        support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
    14361406
    1437         // Technique from Juriy Zaytsev
    1438         // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
    1439         // We only care about the case where non-standard event systems
    1440         // are used, namely in IE. Short-circuiting here helps us to
    1441         // avoid an eval call (in setAttribute) which can cause CSP
    1442         // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
     1407        // Support: IE<9
     1408        // Opera does not clone events (and typeof div.attachEvent === undefined).
     1409        // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
    14431410        if ( div.attachEvent ) {
    1444                 for ( i in {
    1445                         submit: true,
    1446                         change: true,
    1447                         focusin: true
    1448                 }) {
    1449                         eventName = "on" + i;
    1450                         isSupported = ( eventName in div );
    1451                         if ( !isSupported ) {
    1452                                 div.setAttribute( eventName, "return;" );
    1453                                 isSupported = ( typeof div[ eventName ] === "function" );
    1454                         }
    1455                         support[ i + "Bubbles" ] = isSupported;
    1456                 }
     1411                div.attachEvent( "onclick", function() {
     1412                        support.noCloneEvent = false;
     1413                });
     1414
     1415                div.cloneNode( true ).click();
    14571416        }
    14581417
     1418        // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
     1419        // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
     1420        for ( i in { submit: true, change: true, focusin: true }) {
     1421                div.setAttribute( eventName = "on" + i, "t" );
     1422
     1423                support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
     1424        }
     1425
     1426        div.style.backgroundClip = "content-box";
     1427        div.cloneNode( true ).style.backgroundClip = "";
     1428        support.clearCloneStyle = div.style.backgroundClip === "content-box";
     1429
    14591430        // Run tests that need a body at doc ready
    14601431        jQuery(function() {
    1461                 var container, div, tds, marginDiv,
    1462                         divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
     1432                var container, marginDiv, tds,
     1433                        divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
    14631434                        body = document.getElementsByTagName("body")[0];
    14641435
    14651436                if ( !body ) {
     
    14681439                }
    14691440
    14701441                container = document.createElement("div");
    1471                 container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
    1472                 body.insertBefore( container, body.firstChild );
     1442                container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
    14731443
    1474                 // Construct the test element
    1475                 div = document.createElement("div");
    1476                 container.appendChild( div );
     1444                body.appendChild( container ).appendChild( div );
    14771445
     1446                // Support: IE8
    14781447                // Check if table cells still have offsetWidth/Height when they are set
    14791448                // to display:none and there are still other visible table cells in a
    14801449                // table row; if so, offsetWidth/Height are not reliable for use when
    14811450                // determining if an element has been hidden directly using
    14821451                // display:none (it is still safe to use offsets if a parent element is
    14831452                // hidden; don safety goggles and see bug #4512 for more information).
    1484                 // (only IE 8 fails this test)
    14851453                div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
    14861454                tds = div.getElementsByTagName("td");
    14871455                tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
     
    14901458                tds[ 0 ].style.display = "";
    14911459                tds[ 1 ].style.display = "none";
    14921460
     1461                // Support: IE8
    14931462                // Check if empty table cells still have offsetWidth/Height
    1494                 // (IE <= 8 fail this test)
    14951463                support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
    14961464
    14971465                // Check box-sizing and margin behavior
     
    15001468                support.boxSizing = ( div.offsetWidth === 4 );
    15011469                support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
    15021470
    1503                 // NOTE: To any future maintainer, we've window.getComputedStyle
    1504                 // because jsdom on node.js will break without it.
     1471                // Use window.getComputedStyle because jsdom on node.js will break without it.
    15051472                if ( window.getComputedStyle ) {
    15061473                        support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
    15071474                        support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
    15081475
    15091476                        // Check if div with explicit width and no margin-right incorrectly
    1510                         // gets computed margin-right based on width of container. For more
    1511                         // info see bug #3333
     1477                        // gets computed margin-right based on width of container. (#3333)
    15121478                        // Fails in WebKit before Feb 2011 nightlies
    15131479                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
    1514                         marginDiv = document.createElement("div");
     1480                        marginDiv = div.appendChild( document.createElement("div") );
    15151481                        marginDiv.style.cssText = div.style.cssText = divReset;
    15161482                        marginDiv.style.marginRight = marginDiv.style.width = "0";
    15171483                        div.style.width = "1px";
    1518                         div.appendChild( marginDiv );
     1484
    15191485                        support.reliableMarginRight =
    15201486                                !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
    15211487                }
    15221488
    15231489                if ( typeof div.style.zoom !== "undefined" ) {
     1490                        // Support: IE<8
    15241491                        // Check if natively block-level elements act like inline-block
    15251492                        // elements when setting their display to 'inline' and giving
    15261493                        // them layout
    1527                         // (IE < 8 does this)
    15281494                        div.innerHTML = "";
    15291495                        div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
    15301496                        support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
    15311497
     1498                        // Support: IE6
    15321499                        // Check if elements with layout shrink-wrap their children
    1533                         // (IE 6 does this)
    15341500                        div.style.display = "block";
    1535                         div.style.overflow = "visible";
    15361501                        div.innerHTML = "<div></div>";
    15371502                        div.firstChild.style.width = "5px";
    15381503                        support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
     
    15421507                        body.style.zoom = 1;
    15431508                }
    15441509
     1510                body.removeChild( container );
     1511
    15451512                // Null elements to avoid leaks in IE
    1546                 body.removeChild( container );
    15471513                container = div = tds = marginDiv = null;
    15481514        });
    15491515
    15501516        // Null elements to avoid leaks in IE
    1551         fragment.removeChild( div );
    1552         all = a = select = opt = input = fragment = div = null;
     1517        all = select = fragment = opt = a = input = null;
    15531518
    15541519        return support;
    15551520})();
     1521
    15561522var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
    15571523        rmultiDash = /([A-Z])/g;
    1558 
     1524       
    15591525function internalData( elem, name, data, pvt /* Internal Use Only */ ){
    15601526        if ( !jQuery.acceptData( elem ) ) {
    15611527                return;
     
    17711737        _data: function( elem, name, data ) {
    17721738                return internalData( elem, name, data, true );
    17731739        },
    1774 
     1740       
    17751741        _removeData: function( elem, name ) {
    17761742                return internalRemoveData( elem, name, true );
    17771743        },
     
    19261892                        startLength--;
    19271893                }
    19281894
     1895                hooks.cur = fn;
    19291896                if ( fn ) {
    19301897
    19311898                        // Add a progress sentinel to prevent the fx queue from being
     
    23672334
    23682335                } else {
    23692336
    2370                         ret = elem.getAttribute( name );
     2337                        // In IE9+, Flash objects don't have .getAttribute (#12945)
     2338                        // Support: IE9+
     2339                        if ( typeof elem.getAttribute !== "undefined" ) {
     2340                                ret =  elem.getAttribute( name );
     2341                        }
    23712342
    23722343                        // Non-existent attributes return null, we normalize to undefined
    23732344                        return ret == null ?
     
    26372608        jQuery.attrHooks.style = {
    26382609                get: function( elem ) {
    26392610                        // Return undefined in the case of empty string
    2640                         // Normalize to lowercase since IE uppercases css property names
    2641                         return elem.style.cssText.toLowerCase() || undefined;
     2611                        // Note: IE uppercases css property names, but if we were to .toLowerCase()
     2612                        // .cssText, that would destroy case senstitivity in URL's, like in "background"
     2613                        return elem.style.cssText || undefined;
    26422614                },
    26432615                set: function( elem, value ) {
    26442616                        return ( elem.style.cssText = value + "" );
     
    26972669        rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
    26982670        rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
    26992671
     2672function returnTrue() {
     2673        return true;
     2674}
     2675
     2676function returnFalse() {
     2677        return false;
     2678}
     2679
    27002680/*
    27012681 * Helper functions for managing events -- not part of the public interface.
    27022682 * Props to Dean Edwards' addEvent library for many of the ideas.
    27032683 */
    27042684jQuery.event = {
    27052685
     2686        global: {},
     2687
    27062688        add: function( elem, types, handler, data, selector ) {
    2707                 var elemData, eventHandle, events,
    2708                         tns, type, namespaces, handleObj,
    2709                         handleObjIn, handlers, special,
    2710                         t = 0;
    27112689
    2712                 // Don't attach events to noData or text/comment nodes (allow plain objects tho)
    2713                 if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
     2690                var handleObjIn, eventHandle, tmp,
     2691                        events, t, handleObj,
     2692                        special, handlers, type, namespaces, origType,
     2693                        // Don't attach events to noData or text/comment nodes (but allow plain objects)
     2694                        elemData = elem.nodeType !== 3 && elem.nodeType !== 8 && jQuery._data( elem );
     2695
     2696                if ( !elemData ) {
    27142697                        return;
    27152698                }
    27162699
     
    27272710                }
    27282711
    27292712                // Init the element's event structure and main handler, if this is the first
    2730                 events = elemData.events;
    2731                 if ( !events ) {
    2732                         elemData.events = events = {};
     2713                if ( !(events = elemData.events) ) {
     2714                        events = elemData.events = {};
    27332715                }
    2734                 eventHandle = elemData.handle;
    2735                 if ( !eventHandle ) {
    2736                         elemData.handle = eventHandle = function( e ) {
     2716                if ( !(eventHandle = elemData.handle) ) {
     2717                        eventHandle = elemData.handle = function( e ) {
    27372718                                // Discard the second event of a jQuery.event.trigger() and
    27382719                                // when an event is called after a page has unloaded
    27392720                                return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
     
    27472728                // Handle multiple events separated by a space
    27482729                // jQuery(...).bind("mouseover mouseout", fn);
    27492730                types = ( types || "" ).match( core_rnotwhite ) || [""];
    2750                 for ( ; t < types.length; t++ ) {
     2731                t = types.length;
     2732                while ( t-- ) {
     2733                        tmp = rtypenamespace.exec( types[t] ) || [];
     2734                        type = origType = tmp[1];
     2735                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
    27512736
    2752                         tns = rtypenamespace.exec( types[t] ) || [];
    2753                         type = tns[1];
    2754                         namespaces = ( tns[2] || "" ).split( "." ).sort();
    2755 
    27562737                        // If event changes its type, use the special event handlers for the changed type
    27572738                        special = jQuery.event.special[ type ] || {};
    27582739
     
    27652746                        // handleObj is passed to all event handlers
    27662747                        handleObj = jQuery.extend({
    27672748                                type: type,
    2768                                 origType: tns[1],
     2749                                origType: origType,
    27692750                                data: data,
    27702751                                handler: handler,
    27712752                                guid: handler.guid,
     
    27752756                        }, handleObjIn );
    27762757
    27772758                        // Init the event handler queue if we're the first
    2778                         handlers = events[ type ];
    2779                         if ( !handlers ) {
     2759                        if ( !(handlers = events[ type ]) ) {
    27802760                                handlers = events[ type ] = [];
    27812761                                handlers.delegateCount = 0;
    27822762
     
    28152795                elem = null;
    28162796        },
    28172797
    2818         global: {},
    2819 
    28202798        // Detach an event or set of events from an element
    28212799        remove: function( elem, types, handler, selector, mappedTypes ) {
    28222800
    2823                 var tns, type, origType, namespaces, origCount,
    2824                         j, events, special, eventType, handleObj,
    2825                         t = 0,
     2801                var j, origCount, tmp,
     2802                        events, t, handleObj,
     2803                        special, handlers, type, namespaces, origType,
    28262804                        elemData = jQuery.hasData( elem ) && jQuery._data( elem );
    28272805
    28282806                if ( !elemData || !(events = elemData.events) ) {
     
    28312809
    28322810                // Once for each type.namespace in types; type may be omitted
    28332811                types = ( types || "" ).match( core_rnotwhite ) || [""];
    2834                 for ( ; t < types.length; t++ ) {
    2835                         tns = rtypenamespace.exec( types[t] ) || [];
    2836                         type = origType = tns[1];
    2837                         namespaces = tns[2];
     2812                t = types.length;
     2813                while ( t-- ) {
     2814                        tmp = rtypenamespace.exec( types[t] ) || [];
     2815                        type = origType = tmp[1];
     2816                        namespaces = ( tmp[2] || "" ).split( "." ).sort();
    28382817
    28392818                        // Unbind all events (on this namespace, if provided) for the element
    28402819                        if ( !type ) {
     
    28452824                        }
    28462825
    28472826                        special = jQuery.event.special[ type ] || {};
    2848                         type = ( selector? special.delegateType : special.bindType ) || type;
    2849                         eventType = events[ type ] || [];
    2850                         origCount = eventType.length;
    2851                         namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
     2827                        type = ( selector ? special.delegateType : special.bindType ) || type;
     2828                        handlers = events[ type ] || [];
     2829                        tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
    28522830
    28532831                        // Remove matching events
    2854                         for ( j = 0; j < eventType.length; j++ ) {
    2855                                 handleObj = eventType[ j ];
     2832                        origCount = j = handlers.length;
     2833                        while ( j-- ) {
     2834                                handleObj = handlers[ j ];
    28562835
    28572836                                if ( ( mappedTypes || origType === handleObj.origType ) &&
    28582837                                        ( !handler || handler.guid === handleObj.guid ) &&
    2859                                         ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
     2838                                        ( !tmp || tmp.test( handleObj.namespace ) ) &&
    28602839                                        ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
    2861                                         eventType.splice( j--, 1 );
     2840                                        handlers.splice( j, 1 );
    28622841
    28632842                                        if ( handleObj.selector ) {
    2864                                                 eventType.delegateCount--;
     2843                                                handlers.delegateCount--;
    28652844                                        }
    28662845                                        if ( special.remove ) {
    28672846                                                special.remove.call( elem, handleObj );
     
    28712850
    28722851                        // Remove generic event handler if we removed something and no more handlers exist
    28732852                        // (avoids potential for endless recursion during removal of special event handlers)
    2874                         if ( eventType.length === 0 && origCount !== eventType.length ) {
     2853                        if ( origCount && !handlers.length ) {
    28752854                                if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
    28762855                                        jQuery.removeEvent( elem, type, elemData.handle );
    28772856                                }
     
    28922871
    28932872        trigger: function( event, data, elem, onlyHandlers ) {
    28942873
    2895                 var i, cur, old, ontype, special, handle, eventPath, bubbleType,
     2874                var i, cur, tmp, bubbleType, ontype, handle, special,
     2875                        eventPath = [ elem || document ],
    28962876                        type = event.type || event,
    28972877                        namespaces = event.namespace ? event.namespace.split(".") : [];
    28982878
    2899                 elem = elem || document;
     2879                cur = tmp = elem = elem || document;
    29002880
    29012881                // Don't do events on text and comment nodes
    29022882                if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
     
    29142894                        type = namespaces.shift();
    29152895                        namespaces.sort();
    29162896                }
     2897                ontype = type.indexOf(":") < 0 && "on" + type;
    29172898
    2918                 // Caller can pass in an Event, Object, or just an event type string
    2919                 event = typeof event === "object" ?
    2920                         // jQuery.Event object
    2921                         event[ jQuery.expando ] ? event :
    2922                         // Object literal
    2923                         new jQuery.Event( type, event ) :
    2924                         // Just the event type (string)
    2925                         new jQuery.Event( type );
     2899                // Caller can pass in a jQuery.Event object, Object, or just an event type string
     2900                event = event[ jQuery.expando ] ?
     2901                        event :
     2902                        new jQuery.Event( type, typeof event === "object" && event );
    29262903
    2927                 event.type = type;
    29282904                event.isTrigger = true;
    29292905                event.namespace = namespaces.join(".");
    2930                 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
    2931                 ontype = type.indexOf(":") < 0 ? "on" + type : "";
     2906                event.namespace_re = event.namespace ?
     2907                        new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
     2908                        null;
    29322909
    29332910                // Clean up the event in case it is being reused
    29342911                event.result = undefined;
     
    29372914                }
    29382915
    29392916                // Clone any incoming data and prepend the event, creating the handler arg list
    2940                 data = data != null ? jQuery.makeArray( data ) : [];
    2941                 data.unshift( event );
     2917                data = data == null ?
     2918                        [ event ] :
     2919                        jQuery.makeArray( data, [ event ] );
    29422920
    29432921                // Allow special events to draw outside the lines
    29442922                special = jQuery.event.special[ type ] || {};
     
    29482926
    29492927                // Determine event propagation path in advance, per W3C events spec (#9951)
    29502928                // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
    2951                 eventPath = [[ elem, special.bindType || type ]];
    29522929                if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
    29532930
    29542931                        bubbleType = special.delegateType || type;
    2955                         cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
    2956                         for ( old = elem; cur; cur = cur.parentNode ) {
    2957                                 eventPath.push([ cur, bubbleType ]);
    2958                                 old = cur;
     2932                        if ( !rfocusMorph.test( bubbleType + type ) ) {
     2933                                cur = cur.parentNode;
    29592934                        }
     2935                        for ( ; cur; cur = cur.parentNode ) {
     2936                                eventPath.push( cur );
     2937                                tmp = cur;
     2938                        }
    29602939
    29612940                        // Only add window if we got to document (e.g., not plain obj or detached DOM)
    2962                         if ( old === (elem.ownerDocument || document) ) {
    2963                                 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
     2941                        if ( tmp === (elem.ownerDocument || document) ) {
     2942                                eventPath.push( tmp.defaultView || tmp.parentWindow || window );
    29642943                        }
    29652944                }
    29662945
    29672946                // Fire handlers on the event path
    2968                 for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
     2947                i = 0;
     2948                while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
    29692949
    2970                         cur = eventPath[i][0];
    2971                         event.type = eventPath[i][1];
     2950                        event.type = i > 1 ?
     2951                                bubbleType :
     2952                                special.bindType || type;
    29722953
     2954                        // jQuery handler
    29732955                        handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
    29742956                        if ( handle ) {
    29752957                                handle.apply( cur, data );
    29762958                        }
    2977                         // Note that this is a bare JS function and not a jQuery handler
     2959
     2960                        // Native handler
    29782961                        handle = ontype && cur[ ontype ];
    29792962                        if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
    29802963                                event.preventDefault();
     
    29942977                                if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
    29952978
    29962979                                        // Don't re-trigger an onFOO event when we call its FOO() method
    2997                                         old = elem[ ontype ];
     2980                                        tmp = elem[ ontype ];
    29982981
    2999                                         if ( old ) {
     2982                                        if ( tmp ) {
    30002983                                                elem[ ontype ] = null;
    30012984                                        }
    30022985
     
    30102993                                        }
    30112994                                        jQuery.event.triggered = undefined;
    30122995
    3013                                         if ( old ) {
    3014                                                 elem[ ontype ] = old;
     2996                                        if ( tmp ) {
     2997                                                elem[ ontype ] = tmp;
    30152998                                        }
    30162999                                }
    30173000                        }
     
    30253008                // Make a writable jQuery.Event from the native event object
    30263009                event = jQuery.event.fix( event );
    30273010
    3028                 var i, j, cur, ret, selMatch, matched, matches, handleObj, sel,
    3029                         handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
    3030                         delegateCount = handlers.delegateCount,
     3011                var i, j, ret, matched, handleObj,
     3012                        handlerQueue = [],
    30313013                        args = core_slice.call( arguments ),
    3032                         special = jQuery.event.special[ event.type ] || {},
    3033                         handlerQueue = [];
     3014                        handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
     3015                        special = jQuery.event.special[ event.type ] || {};
    30343016
    30353017                // Use the fix-ed jQuery.Event rather than the (read-only) native event
    30363018                args[0] = event;
     
    30413023                        return;
    30423024                }
    30433025
    3044                 // Determine handlers that should run if there are delegated events
     3026                // Determine handlers
     3027                handlerQueue = jQuery.event.handlers.call( this, event, handlers );
     3028
     3029                // Run delegates first; they may want to stop propagation beneath us
     3030                i = 0;
     3031                while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
     3032                        event.currentTarget = matched.elem;
     3033
     3034                        j = 0;
     3035                        while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
     3036
     3037                                // Triggered event must either 1) have no namespace, or
     3038                                // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
     3039                                if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
     3040
     3041                                        event.handleObj = handleObj;
     3042                                        event.data = handleObj.data;
     3043
     3044                                        ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
     3045                                                        .apply( matched.elem, args );
     3046
     3047                                        if ( ret !== undefined ) {
     3048                                                if ( (event.result = ret) === false ) {
     3049                                                        event.preventDefault();
     3050                                                        event.stopPropagation();
     3051                                                }
     3052                                        }
     3053                                }
     3054                        }
     3055                }
     3056
     3057                // Call the postDispatch hook for the mapped type
     3058                if ( special.postDispatch ) {
     3059                        special.postDispatch.call( this, event );
     3060                }
     3061
     3062                return event.result;
     3063        },
     3064
     3065        handlers: function( event, handlers ) {
     3066                var i, matches, sel, handleObj,
     3067                        handlerQueue = [],
     3068                        delegateCount = handlers.delegateCount,
     3069                        cur = event.target;
     3070
     3071                // Find delegate handlers
     3072                // Black-hole SVG <use> instance trees (#13180)
    30453073                // Avoid non-left-click bubbling in Firefox (#3861)
    3046                 if ( delegateCount && !(event.button && event.type === "click") ) {
     3074                if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
    30473075
    3048                         for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
     3076                        for ( ; cur != this; cur = cur.parentNode || this ) {
    30493077
    3050                                 // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
     3078                                // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
    30513079                                if ( cur.disabled !== true || event.type !== "click" ) {
    3052                                         selMatch = {};
    30533080                                        matches = [];
    30543081                                        for ( i = 0; i < delegateCount; i++ ) {
    30553082                                                handleObj = handlers[ i ];
    3056                                                 sel = handleObj.selector;
    30573083
    3058                                                 if ( selMatch[ sel ] === undefined ) {
    3059                                                         selMatch[ sel ] = handleObj.needsContext ?
     3084                                                // Don't conflict with Object.prototype properties (#13203)
     3085                                                sel = handleObj.selector + " ";
     3086
     3087                                                if ( matches[ sel ] === undefined ) {
     3088                                                        matches[ sel ] = handleObj.needsContext ?
    30603089                                                                jQuery( sel, this ).index( cur ) >= 0 :
    30613090                                                                jQuery.find( sel, this, null, [ cur ] ).length;
    30623091                                                }
    3063                                                 if ( selMatch[ sel ] ) {
     3092                                                if ( matches[ sel ] ) {
    30643093                                                        matches.push( handleObj );
    30653094                                                }
    30663095                                        }
    30673096                                        if ( matches.length ) {
    3068                                                 handlerQueue.push({ elem: cur, matches: matches });
     3097                                                handlerQueue.push({ elem: cur, handlers: matches });
    30693098                                        }
    30703099                                }
    30713100                        }
    30723101                }
    30733102
    30743103                // Add the remaining (directly-bound) handlers
    3075                 if ( handlers.length > delegateCount ) {
    3076                         handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
     3104                if ( delegateCount < handlers.length ) {
     3105                        handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
    30773106                }
    30783107
    3079                 // Run delegates first; they may want to stop propagation beneath us
    3080                 for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
    3081                         matched = handlerQueue[ i ];
    3082                         event.currentTarget = matched.elem;
     3108                return handlerQueue;
     3109        },
    30833110
    3084                         for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
    3085                                 handleObj = matched.matches[ j ];
     3111        fix: function( event ) {
     3112                if ( event[ jQuery.expando ] ) {
     3113                        return event;
     3114                }
    30863115
    3087                                 // Triggered event must either 1) have no namespace, or
    3088                                 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
    3089                                 if ( !event.namespace || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
     3116                // Create a writable copy of the event object and normalize some properties
     3117                var i, prop,
     3118                        originalEvent = event,
     3119                        fixHook = jQuery.event.fixHooks[ event.type ] || {},
     3120                        copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
    30903121
    3091                                         event.data = handleObj.data;
    3092                                         event.handleObj = handleObj;
     3122                event = new jQuery.Event( originalEvent );
    30933123
    3094                                         ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
    3095                                                         .apply( matched.elem, args );
     3124                i = copy.length;
     3125                while ( i-- ) {
     3126                        prop = copy[ i ];
     3127                        event[ prop ] = originalEvent[ prop ];
     3128                }
    30963129
    3097                                         if ( ret !== undefined ) {
    3098                                                 event.result = ret;
    3099                                                 if ( ret === false ) {
    3100                                                         event.preventDefault();
    3101                                                         event.stopPropagation();
    3102                                                 }
    3103                                         }
    3104                                 }
    3105                         }
     3130                // Support: IE<9
     3131                // Fix target property (#1925)
     3132                if ( !event.target ) {
     3133                        event.target = originalEvent.srcElement || document;
    31063134                }
    31073135
    3108                 // Call the postDispatch hook for the mapped type
    3109                 if ( special.postDispatch ) {
    3110                         special.postDispatch.call( this, event );
     3136                // Support: Chrome 23+, Safari?
     3137                // Target should not be a text node (#504, #13143)
     3138                if ( event.target.nodeType === 3 ) {
     3139                        event.target = event.target.parentNode;
    31113140                }
    31123141
    3113                 return event.result;
     3142                // Support: IE<9
     3143                // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
     3144                event.metaKey = !!event.metaKey;
     3145
     3146                return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
    31143147        },
    31153148
    31163149        // Includes some event props shared by KeyEvent and MouseEvent
     
    31633196                }
    31643197        },
    31653198
    3166         fix: function( event ) {
    3167                 if ( event[ jQuery.expando ] ) {
    3168                         return event;
    3169                 }
    3170 
    3171                 // Create a writable copy of the event object and normalize some properties
    3172                 var i, prop,
    3173                         originalEvent = event,
    3174                         fixHook = jQuery.event.fixHooks[ event.type ] || {},
    3175                         copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
    3176 
    3177                 event = jQuery.Event( originalEvent );
    3178 
    3179                 for ( i = copy.length; i; ) {
    3180                         prop = copy[ --i ];
    3181                         event[ prop ] = originalEvent[ prop ];
    3182                 }
    3183 
    3184                 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
    3185                 if ( !event.target ) {
    3186                         event.target = originalEvent.srcElement || document;
    3187                 }
    3188 
    3189                 // Target should not be a text node (#504, Safari)
    3190                 if ( event.target.nodeType === 3 ) {
    3191                         event.target = event.target.parentNode;
    3192                 }
    3193 
    3194                 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
    3195                 event.metaKey = !!event.metaKey;
    3196 
    3197                 return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
    3198         },
    3199 
    32003199        special: {
    32013200                load: {
    32023201                        // Prevent triggered image.load events from bubbling to window.load
     
    32193218                                                this.focus();
    32203219                                                return false;
    32213220                                        } catch ( e ) {
    3222                                                 // IE<9 dies on focus to hidden element (#1486,#12518)
    3223                                                 // If this happens, let .trigger() run the handlers
     3221                                                // Support: IE<9
     3222                                                // If we error on focus to hidden element (#1486, #12518),
     3223                                                // let .trigger() run the handlers
    32243224                                        }
    32253225                                }
    32263226                        },
     
    32703270        }
    32713271};
    32723272
    3273 // Some plugins are using, but it's undocumented/deprecated and will be removed.
    3274 // The 1.7 special event interface should provide all the hooks needed now.
    3275 jQuery.event.handle = jQuery.event.dispatch;
    3276 
    32773273jQuery.removeEvent = document.removeEventListener ?
    32783274        function( elem, type, handle ) {
    32793275                if ( elem.removeEventListener ) {
     
    33283324        this[ jQuery.expando ] = true;
    33293325};
    33303326
    3331 function returnFalse() {
    3332         return false;
    3333 }
    3334 function returnTrue() {
    3335         return true;
    3336 }
    3337 
    33383327// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
    33393328// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
    33403329jQuery.Event.prototype = {
     3330        isDefaultPrevented: returnFalse,
     3331        isPropagationStopped: returnFalse,
     3332        isImmediatePropagationStopped: returnFalse,
     3333
    33413334        preventDefault: function() {
     3335                var e = this.originalEvent;
     3336
    33423337                this.isDefaultPrevented = returnTrue;
    3343 
    3344                 var e = this.originalEvent;
    33453338                if ( !e ) {
    33463339                        return;
    33473340                }
    33483341
    3349                 // if preventDefault exists run it on the original event
     3342                // If preventDefault exists, run it on the original event
    33503343                if ( e.preventDefault ) {
    33513344                        e.preventDefault();
    33523345
    3353                 // otherwise set the returnValue property of the original event to false (IE)
     3346                // Support: IE
     3347                // Otherwise set the returnValue property of the original event to false
    33543348                } else {
    33553349                        e.returnValue = false;
    33563350                }
    33573351        },
    33583352        stopPropagation: function() {
     3353                var e = this.originalEvent;
     3354
    33593355                this.isPropagationStopped = returnTrue;
    3360 
    3361                 var e = this.originalEvent;
    33623356                if ( !e ) {
    33633357                        return;
    33643358                }
    3365                 // if stopPropagation exists run it on the original event
     3359                // If stopPropagation exists, run it on the original event
    33663360                if ( e.stopPropagation ) {
    33673361                        e.stopPropagation();
    33683362                }
    3369                 // otherwise set the cancelBubble property of the original event to true (IE)
     3363
     3364                // Support: IE
     3365                // Set the cancelBubble property of the original event to true
    33703366                e.cancelBubble = true;
    33713367        },
    33723368        stopImmediatePropagation: function() {
    33733369                this.isImmediatePropagationStopped = returnTrue;
    33743370                this.stopPropagation();
    3375         },
    3376         isDefaultPrevented: returnFalse,
    3377         isPropagationStopped: returnFalse,
    3378         isImmediatePropagationStopped: returnFalse
     3371        }
    33793372};
    33803373
    33813374// Create mouseenter/leave events using mouseover/out and event-time checks
     
    34203413                                // Node name check avoids a VML-related crash in IE (#9807)
    34213414                                var elem = e.target,
    34223415                                        form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
    3423                                 if ( form && !jQuery._data( form, "_submit_attached" ) ) {
     3416                                if ( form && !jQuery._data( form, "submitBubbles" ) ) {
    34243417                                        jQuery.event.add( form, "submit._submit", function( event ) {
    34253418                                                event._submit_bubble = true;
    34263419                                        });
    3427                                         jQuery._data( form, "_submit_attached", true );
     3420                                        jQuery._data( form, "submitBubbles", true );
    34283421                                }
    34293422                        });
    34303423                        // return undefined since we don't need an event listener
     
    34833476                        jQuery.event.add( this, "beforeactivate._change", function( e ) {
    34843477                                var elem = e.target;
    34853478
    3486                                 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
     3479                                if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
    34873480                                        jQuery.event.add( elem, "change._change", function( event ) {
    34883481                                                if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
    34893482                                                        jQuery.event.simulate( "change", this.parentNode, event, true );
    34903483                                                }
    34913484                                        });
    3492                                         jQuery._data( elem, "_change_attached", true );
     3485                                        jQuery._data( elem, "changeBubbles", true );
    34933486                                }
    34943487                        });
    34953488                },
     
    35443537                // Types can be a map of types/handlers
    35453538                if ( typeof types === "object" ) {
    35463539                        // ( types-Object, selector, data )
    3547                         if ( typeof selector !== "string" ) { // && selector != null
     3540                        if ( typeof selector !== "string" ) {
    35483541                                // ( types-Object, data )
    35493542                                data = data || selector;
    35503543                                selector = undefined;
     
    36333626                return this.off( types, null, fn );
    36343627        },
    36353628
    3636         live: function( types, data, fn ) {
    3637                 jQuery( this.context ).on( types, this.selector, data, fn );
    3638                 return this;
    3639         },
    3640         die: function( types, fn ) {
    3641                 jQuery( this.context ).off( types, this.selector || "**", fn );
    3642                 return this;
    3643         },
    3644 
    36453629        delegate: function( selector, types, data, fn ) {
    36463630                return this.on( types, selector, data, fn );
    36473631        },
     
    36563640                });
    36573641        },
    36583642        triggerHandler: function( type, data ) {
    3659                 if ( this[0] ) {
    3660                         return jQuery.event.trigger( type, data, this[0], true );
     3643                var elem = this[0];
     3644                if ( elem ) {
     3645                        return jQuery.event.trigger( type, data, elem, true );
    36613646                }
    36623647        },
    36633648
     
    37133698        contains,
    37143699        sortOrder,
    37153700
     3701        // Instance-specific data
    37163702        expando = "sizzle" + -(new Date()),
     3703        preferredDoc = window.document,
     3704        support = {},
     3705        dirruns = 0,
     3706        done = 0,
     3707        classCache = createCache(),
     3708        tokenCache = createCache(),
     3709        compilerCache = createCache(),
    37173710
     3711        // General-purpose constants
    37183712        strundefined = typeof undefined,
    3719 
    3720         // Used in sorting
    37213713        MAX_NEGATIVE = 1 << 31,
    3722         preferredDoc = window.document,
    37233714
    3724         Token = String,
    3725         dirruns = 0,
    3726         done = 0,
    3727         support = {},
    3728 
    37293715        // Array methods
    37303716        arr = [],
    37313717        pop = arr.pop,
     
    37433729                return -1;
    37443730        },
    37453731
    3746         // Augment a function for special use by Sizzle
    3747         markFunction = function( fn, value ) {
    3748                 fn[ expando ] = value == null || value;
    3749                 return fn;
    3750         },
    37513732
    3752         createCache = function() {
    3753                 var cache = {},
    3754                         keys = [];
     3733        // Regular expressions
    37553734
    3756                 return markFunction(function( key, value ) {
    3757                         // Only keep the most recent entries
    3758                         if ( keys.push( key ) > Expr.cacheLength ) {
    3759                                 delete cache[ keys.shift() ];
    3760                         }
    3761 
    3762                         // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
    3763                         return (cache[ key + " " ] = value);
    3764                 }, cache );
    3765         },
    3766 
    3767         classCache = createCache(),
    3768         tokenCache = createCache(),
    3769         compilerCache = createCache(),
    3770 
    3771         // Regex
    3772 
    37733735        // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
    37743736        whitespace = "[\\x20\\t\\r\\n\\f]",
    37753737        // http://www.w3.org/TR/css3-syntax/#characters
    37763738        characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
    37773739
    37783740        // Loosely modeled on CSS identifier characters
    3779         // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
     3741        // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
    37803742        // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
    37813743        identifier = characterEncoding.replace( "w", "w#" ),
    37823744
     
    37993761        rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
    38003762        rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
    38013763        rpseudo = new RegExp( pseudos ),
     3764        ridentifier = new RegExp( "^" + identifier + "$" ),
    38023765
    3803         // Easily-parseable/retrievable ID or TAG or CLASS selectors
    3804         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
    3805 
    3806         rsibling = /[\x20\t\r\n\f]*[+~]/,
    3807 
    3808         rheader = /h\d/i,
    3809         rinputs = /input|select|textarea|button/i,
    3810 
    3811         rnative = /\{\s*\[native code\]\s*\}/,
    3812 
    3813         rbackslash = /\\(?!\\)/g,
    3814 
    3815         rescape = /'|\\/g,
    3816         rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
    3817 
    38183766        matchExpr = {
    38193767                "ID": new RegExp( "^#(" + characterEncoding + ")" ),
    38203768                "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
     
    38313779                        whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
    38323780        },
    38333781
    3834         /**
    3835          * For feature detection
    3836          * @param {Function} fn The function to test for native support
    3837          */
    3838         isNative = function( fn ) {
    3839                 return rnative.test( fn + "" );
    3840         },
     3782        rsibling = /[\x20\t\r\n\f]*[+~]/,
    38413783
    3842         /**
    3843          * Support testing using an element
    3844          * @param {Function} fn Passed the created div and expects a boolean result
    3845          */
    3846         assert = function( fn ) {
    3847                 var div = document.createElement("div");
     3784        rnative = /\{\s*\[native code\]\s*\}/,
    38483785
    3849                 try {
    3850                         return fn( div );
    3851                 } catch (e) {
    3852                         return false;
    3853                 } finally {
    3854                         // release memory in IE
    3855                         div = null;
    3856                 }
     3786        // Easily-parseable/retrievable ID or TAG or CLASS selectors
     3787        rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
     3788
     3789        rinputs = /^(?:input|select|textarea|button)$/i,
     3790        rheader = /^h\d$/i,
     3791
     3792        rescape = /'|\\/g,
     3793        rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
     3794
     3795        // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
     3796        runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
     3797        funescape = function( _, escaped ) {
     3798                var high = "0x" + escaped - 0x10000;
     3799                // NaN means non-codepoint
     3800                return high !== high ?
     3801                        escaped :
     3802                        // BMP codepoint
     3803                        high < 0 ?
     3804                                String.fromCharCode( high + 0x10000 ) :
     3805                                // Supplemental Plane codepoint (surrogate pair)
     3806                                String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
    38573807        };
    38583808
    38593809// Use a stripped-down slice if we can't use a native one
     
    38703820        };
    38713821}
    38723822
     3823/**
     3824 * For feature detection
     3825 * @param {Function} fn The function to test for native support
     3826 */
     3827function isNative( fn ) {
     3828        return rnative.test( fn + "" );
     3829}
     3830
     3831/**
     3832 * Create key-value caches of limited size
     3833 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
     3834 *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
     3835 *      deleting the oldest entry
     3836 */
     3837function createCache() {
     3838        var cache,
     3839                keys = [];
     3840
     3841        return (cache = function( key, value ) {
     3842                // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
     3843                if ( keys.push( key += " " ) > Expr.cacheLength ) {
     3844                        // Only keep the most recent entries
     3845                        delete cache[ keys.shift() ];
     3846                }
     3847                return (cache[ key ] = value);
     3848        });
     3849}
     3850
     3851/**
     3852 * Mark a function for special use by Sizzle
     3853 * @param {Function} fn The function to mark
     3854 */
     3855function markFunction( fn ) {
     3856        fn[ expando ] = true;
     3857        return fn;
     3858}
     3859
     3860/**
     3861 * Support testing using an element
     3862 * @param {Function} fn Passed the created div and expects a boolean result
     3863 */
     3864function assert( fn ) {
     3865        var div = document.createElement("div");
     3866
     3867        try {
     3868                return fn( div );
     3869        } catch (e) {
     3870                return false;
     3871        } finally {
     3872                // release memory in IE
     3873                div = null;
     3874        }
     3875}
     3876
    38733877function Sizzle( selector, context, results, seed ) {
    38743878        var match, elem, m, nodeType,
    38753879                // QSA vars
    38763880                i, groups, old, nid, newContext, newSelector;
    38773881
    3878         if ( context && (( context.ownerDocument || context ) !== document) ) {
     3882        if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
    38793883                setDocument( context );
    38803884        }
    38813885
     
    39543958
    39553959                                i = groups.length;
    39563960                                while ( i-- ) {
    3957                                         groups[i] = nid + groups[i].join("");
     3961                                        groups[i] = nid + toSelector( groups[i] );
    39583962                                }
    39593963                                newContext = rsibling.test( selector ) && context.parentNode || context;
    39603964                                newSelector = groups.join(",");
     
    39964000 * @param {Element|Object} [doc] An element or document object to use to set the document
    39974001 * @returns {Object} Returns the current document
    39984002 */
    3999 setDocument = Sizzle.setDocument = function( doc ) {
    4000         doc = doc && doc.ownerDocument || doc || window.document;
     4003setDocument = Sizzle.setDocument = function( node ) {
     4004        var doc = node ? node.ownerDocument || node : preferredDoc;
    40014005
    40024006        // If no document and documentElement is available, return
    4003         if ( !doc || doc.nodeType !== 9 || !doc.documentElement || document === doc ) {
     4007        if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
    40044008                return document;
    40054009        }
    40064010
     
    40874091                        }
    40884092                };
    40894093                Expr.filter["ID"] = function( id ) {
    4090                         var attrId = id.replace( rbackslash, "" );
     4094                        var attrId = id.replace( runescape, funescape );
    40914095                        return function( elem ) {
    40924096                                return elem.getAttribute("id") === attrId;
    40934097                        };
     
    41054109                        }
    41064110                };
    41074111                Expr.filter["ID"] =  function( id ) {
    4108                         var attrId = id.replace( rbackslash, "" );
     4112                        var attrId = id.replace( runescape, funescape );
    41094113                        return function( elem ) {
    41104114                                var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
    41114115                                return node && node.value === attrId;
     
    41894193
    41904194                assert(function( div ) {
    41914195
    4192                         // Opera 10-12/IE9 - ^= $= *= and empty values
     4196                        // Opera 10-12/IE8 - ^= $= *= and empty values
    41934197                        // Should not select anything
    4194                         div.innerHTML = "<p test=''></p>";
    4195                         if ( div.querySelectorAll("[test^='']").length ) {
     4198                        div.innerHTML = "<input type='hidden' i=''/>";
     4199                        if ( div.querySelectorAll("[i^='']").length ) {
    41964200                                rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
    41974201                        }
    41984202
    41994203                        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
    42004204                        // IE8 throws error here and will not see later tests
    4201                         div.innerHTML = "<input type='hidden'/>";
    42024205                        if ( !div.querySelectorAll(":enabled").length ) {
    42034206                                rbuggyQSA.push( ":enabled", ":disabled" );
    42044207                        }
     
    42224225
    42234226                        // This should fail with an exception
    42244227                        // Gecko does not error, returns false instead
    4225                         matches.call( div, "[test!='']:x" );
     4228                        matches.call( div, "[s!='']:x" );
    42264229                        rbuggyMatches.push( "!=", pseudos );
    42274230                });
    42284231        }
     
    43444347};
    43454348
    43464349Sizzle.matches = function( expr, elements ) {
    4347         return Sizzle( expr, window.document, null, elements );
     4350        return Sizzle( expr, null, null, elements );
    43484351};
    43494352
    43504353Sizzle.matchesSelector = function( elem, expr ) {
    43514354        // Set document vars if needed
    4352         if ( elem && (( elem.ownerDocument || elem ) !== document) ) {
     4355        if ( ( elem.ownerDocument || elem ) !== document ) {
    43534356                setDocument( elem );
    43544357        }
    43554358
     
    43764379
    43774380Sizzle.contains = function( context, elem ) {
    43784381        // Set document vars if needed
    4379         if ( context && (( context.ownerDocument || context ) !== document) ) {
     4382        if ( ( context.ownerDocument || context ) !== document ) {
    43804383                setDocument( context );
    43814384        }
    43824385        return contains( context, elem );
     
    43864389        var val;
    43874390
    43884391        // Set document vars if needed
    4389         if ( elem && (( elem.ownerDocument || elem ) !== document) ) {
     4392        if ( ( elem.ownerDocument || elem ) !== document ) {
    43904393                setDocument( elem );
    43914394        }
    43924395
     
    45354538
    45364539        preFilter: {
    45374540                "ATTR": function( match ) {
    4538                         match[1] = match[1].replace( rbackslash, "" );
     4541                        match[1] = match[1].replace( runescape, funescape );
    45394542
    45404543                        // Move the given value to match[3] whether quoted or unquoted
    4541                         match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
     4544                        match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
    45424545
    45434546                        if ( match[2] === "~=" ) {
    45444547                                match[3] = " " + match[3] + " ";
     
    46154618                                return function() { return true; };
    46164619                        }
    46174620
    4618                         nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
     4621                        nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
    46194622                        return function( elem ) {
    46204623                                return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
    46214624                        };
    46224625                },
    46234626
    46244627                "CLASS": function( className ) {
    4625                         var pattern = classCache[ expando ][ className + " " ];
     4628                        var pattern = classCache[ className + " " ];
    46264629
    46274630                        return pattern ||
    46284631                                (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
     
    48244827                        };
    48254828                }),
    48264829
     4830                // "Whether an element is represented by a :lang() selector
     4831                // is based solely on the element's language value
     4832                // being equal to the identifier C,
     4833                // or beginning with the identifier C immediately followed by "-".
     4834                // The matching of C against the element's language value is performed case-insensitively.
     4835                // The identifier C does not have to be a valid language name."
     4836                // http://www.w3.org/TR/selectors/#lang-pseudo
     4837                "lang": markFunction( function( lang ) {
     4838                        // lang value must be a valid identifider
     4839                        if ( !ridentifier.test(lang || "") ) {
     4840                                Sizzle.error( "unsupported lang: " + lang );
     4841                        }
     4842                        lang = lang.replace( runescape, funescape ).toLowerCase();
     4843                        return function( elem ) {
     4844                                var elemLang;
     4845                                do {
     4846                                        if ( (elemLang = documentIsXML ?
     4847                                                elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
     4848                                                elem.lang) ) {
     4849
     4850                                                elemLang = elemLang.toLowerCase();
     4851                                                return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
     4852                                        }
     4853                                } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
     4854                                return false;
     4855                        };
     4856                }),
     4857
    48274858                // Miscellaneous
    48284859                "target": function( elem ) {
    48294860                        var hash = window.location && window.location.hash;
     
    49644995function tokenize( selector, parseOnly ) {
    49654996        var matched, match, tokens, type,
    49664997                soFar, groups, preFilters,
    4967                 cached = tokenCache[ expando ][ selector + " " ];
     4998                cached = tokenCache[ selector + " " ];
    49684999
    49695000        if ( cached ) {
    49705001                return parseOnly ? 0 : cached.slice( 0 );
     
    49895020
    49905021                // Combinators
    49915022                if ( (match = rcombinators.exec( soFar )) ) {
    4992                         tokens.push( matched = new Token( match.shift() ) );
     5023                        matched = match.shift();
     5024                        tokens.push( {
     5025                                value: matched,
     5026                                // Cast descendant combinators to space
     5027                                type: match[0].replace( rtrim, " " )
     5028                        } );
    49935029                        soFar = soFar.slice( matched.length );
    4994 
    4995                         // Cast descendant combinators to space
    4996                         matched.type = match[0].replace( rtrim, " " );
    49975030                }
    49985031
    49995032                // Filters
    50005033                for ( type in Expr.filter ) {
    50015034                        if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
    50025035                                (match = preFilters[ type ]( match ))) ) {
    5003 
    5004                                 tokens.push( matched = new Token( match.shift() ) );
     5036                                matched = match.shift();
     5037                                tokens.push( {
     5038                                        value: matched,
     5039                                        type: type,
     5040                                        matches: match
     5041                                } );
    50055042                                soFar = soFar.slice( matched.length );
    5006                                 matched.type = type;
    5007                                 matched.matches = match;
    50085043                        }
    50095044                }
    50105045
     
    50245059                        tokenCache( selector, groups ).slice( 0 );
    50255060}
    50265061
     5062function toSelector( tokens ) {
     5063        var i = 0,
     5064                len = tokens.length,
     5065                selector = "";
     5066        for ( ; i < len; i++ ) {
     5067                selector += tokens[i].value;
     5068        }
     5069        return selector;
     5070}
     5071
    50275072function addCombinator( matcher, combinator, base ) {
    50285073        var dir = combinator.dir,
    50295074                checkNonElements = base && combinator.dir === "parentNode",
     
    52405285                                }
    52415286                                return setMatcher(
    52425287                                        i > 1 && elementMatcher( matchers ),
    5243                                         i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
     5288                                        i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
    52445289                                        matcher,
    52455290                                        i < j && matcherFromTokens( tokens.slice( i, j ) ),
    52465291                                        j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
    5247                                         j < len && tokens.join("")
     5292                                        j < len && toSelector( tokens )
    52485293                                );
    52495294                        }
    52505295                        matchers.push( matcher );
     
    53575402        var i,
    53585403                setMatchers = [],
    53595404                elementMatchers = [],
    5360                 cached = compilerCache[ expando ][ selector + " " ];
     5405                cached = compilerCache[ selector + " " ];
    53615406
    53625407        if ( !cached ) {
    53635408                // Generate a function of recursive functions that can be used to check each element
     
    54035448                                        context.nodeType === 9 && !documentIsXML &&
    54045449                                        Expr.relative[ tokens[1].type ] ) {
    54055450
    5406                                 context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context )[0];
     5451                                context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
    54075452                                if ( !context ) {
    54085453                                        return results;
    54095454                                }
    54105455
    5411                                 selector = selector.slice( tokens.shift().length );
     5456                                selector = selector.slice( tokens.shift().value.length );
    54125457                        }
    54135458
    54145459                        // Fetch a seed set for right-to-left matching
     
    54225467                                if ( (find = Expr.find[ type ]) ) {
    54235468                                        // Search, expanding context for leading sibling combinators
    54245469                                        if ( (seed = find(
    5425                                                 token.matches[0].replace( rbackslash, "" ),
     5470                                                token.matches[0].replace( runescape, funescape ),
    54265471                                                rsibling.test( tokens[0].type ) && context.parentNode || context
    54275472                                        )) ) {
    54285473
    54295474                                                // If seed is empty or no tokens remain, we can return early
    54305475                                                tokens.splice( i, 1 );
    5431                                                 selector = seed.length && tokens.join("");
     5476                                                selector = seed.length && toSelector( tokens );
    54325477                                                if ( !selector ) {
    54335478                                                        push.apply( results, slice.call( seed, 0 ) );
    54345479                                                        return results;
     
    57805825        rscriptType = /^$|\/(?:java|ecma)script/i,
    57815826        rscriptTypeMasked = /^true\/(.*)/,
    57825827        rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
     5828
     5829        // We have to close these tags to support XHTML (#13200)
    57835830        wrapMap = {
    5784                 option: [ 1, "<select multiple='multiple'>" ],
    5785                 legend: [ 1, "<fieldset>" ],
    5786                 area: [ 1, "<map>" ],
    5787                 param: [ 1, "<object>" ],
    5788                 thead: [ 1, "<table>"  ],
    5789                 tr: [ 2, "<table><tbody>" ],
    5790                 col: [ 2, "<table><tbody></tbody><colgroup>", "</table>" ],
    5791                 td: [ 3, "<table><tbody><tr>" ],
     5831                option: [ 1, "<select multiple='multiple'>", "</select>" ],
     5832                legend: [ 1, "<fieldset>", "</fieldset>" ],
     5833                area: [ 1, "<map>", "</map>" ],
     5834                param: [ 1, "<object>", "</object>" ],
     5835                thead: [ 1, "<table>", "</table>" ],
     5836                tr: [ 2, "<table><tbody>", "</tbody></table>" ],
     5837                col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
     5838                td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
    57925839
    57935840                // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
    57945841                // unless wrapped in a div with non-breaking characters in front of it.
    5795                 _default: jQuery.support.htmlSerialize ? [ 0, "" ] : [ 1, "X<div>"  ]
     5842                _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
    57965843        },
    57975844        safeFragment = createSafeFragment( document ),
    57985845        fragmentDiv = safeFragment.appendChild( document.createElement("div") );
     
    59445991                        while ( elem.firstChild ) {
    59455992                                elem.removeChild( elem.firstChild );
    59465993                        }
     5994
     5995                        // If this is a select, ensure that it displays empty (#12336)
     5996                        // Support: IE<9
     5997                        if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
     5998                                elem.options.length = 0;
     5999                        }
    59476000                }
    59486001
    59496002                return this;
     
    60386091                var fragment, first, scripts, hasScripts, node, doc,
    60396092                        i = 0,
    60406093                        l = this.length,
     6094                        set = this,
    60416095                        iNoClone = l - 1,
    60426096                        value = args[0],
    60436097                        isFunction = jQuery.isFunction( value );
    60446098
    60456099                // We can't cloneNode fragments that contain checked, in WebKit
    60466100                if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
    6047                         return this.each(function() {
    6048                                 var self = jQuery( this );
     6101                        return this.each(function( index ) {
     6102                                var self = set.eq( index );
    60496103                                if ( isFunction ) {
    6050                                         args[0] = value.call( this, i, table ? self.html() : undefined );
     6104                                        args[0] = value.call( this, index, table ? self.html() : undefined );
    60516105                                }
    60526106                                self.domManip( args, table, callback );
    60536107                        });
    60546108                }
    60556109
    6056                 if ( this[0] ) {
    6057                         doc = this[0].ownerDocument;
    6058                         fragment = doc.createDocumentFragment();
    6059                         jQuery.clean( args, doc, fragment, undefined, this );
     6110                if ( l ) {
     6111                        fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
    60606112                        first = fragment.firstChild;
    60616113
    60626114                        if ( fragment.childNodes.length === 1 ) {
     
    63016353                found;
    63026354}
    63036355
    6304 // Used in clean, fixes the defaultChecked property
     6356// Used in buildFragment, fixes the defaultChecked property
    63056357function fixDefaultChecked( elem ) {
    63066358        if ( manipulation_rcheckableType.test( elem.type ) ) {
    63076359                elem.defaultChecked = elem.checked;
     
    63646416                return clone;
    63656417        },
    63666418
    6367         clean: function( elems, context, fragment, scripts, selection ) {
    6368                 var elem, i, j, tmp, tag, wrap, tbody,
    6369                         ret = [],
    6370                         safe = context === document && safeFragment;
     6419        buildFragment: function( elems, context, scripts, selection ) {
     6420                var contains, elem, tag, tmp, wrap, tbody, j,
     6421                        l = elems.length,
    63716422
    6372                 // Ensure that context is a document
    6373                 if ( !context || typeof context.createDocumentFragment === "undefined" ) {
    6374                         context = document;
    6375                 }
     6423                        // Ensure a safe fragment
     6424                        safe = createSafeFragment( context ),
    63766425
    6377                 for ( i = 0; (elem = elems[i]) != null; i++ ) {
     6426                        nodes = [],
     6427                        i = 0;
     6428
     6429                for ( ; i < l; i++ ) {
     6430                        elem = elems[ i ];
     6431
    63786432                        if ( elem || elem === 0 ) {
     6433
    63796434                                // Add nodes directly
    63806435                                if ( jQuery.type( elem ) === "object" ) {
    6381                                         jQuery.merge( ret, elem.nodeType ? [ elem ] : elem );
     6436                                        jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
    63826437
    63836438                                // Convert non-html into a text node
    63846439                                } else if ( !rhtml.test( elem ) ) {
    6385                                         ret.push( context.createTextNode( elem ) );
     6440                                        nodes.push( context.createTextNode( elem ) );
    63866441
    63876442                                // Convert html into DOM nodes
    63886443                                } else {
    6389                                         // Ensure a safe container
    6390                                         safe = safe || createSafeFragment( context );
    63916444                                        tmp = tmp || safe.appendChild( context.createElement("div") );
    63926445
    63936446                                        // Deserialize a standard representation
    63946447                                        tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
    63956448                                        wrap = wrapMap[ tag ] || wrapMap._default;
    6396                                         tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + ( wrap[2] || "" );
    63976449
     6450                                        tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
     6451
    63986452                                        // Descend through wrappers to the right content
    63996453                                        j = wrap[0];
    64006454                                        while ( j-- ) {
     
    64036457
    64046458                                        // Manually add leading whitespace removed by IE
    64056459                                        if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
    6406                                                 ret.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
     6460                                                nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
    64076461                                        }
    64086462
    64096463                                        // Remove IE's autoinserted <tbody> from table fragments
     
    64266480                                                }
    64276481                                        }
    64286482
    6429                                         jQuery.merge( ret, tmp.childNodes );
     6483                                        jQuery.merge( nodes, tmp.childNodes );
    64306484
    64316485                                        // Fix #12392 for WebKit and IE > 9
    64326486                                        tmp.textContent = "";
     
    64426496                        }
    64436497                }
    64446498
    6445                 // Fix #11356: Clear elements from safeFragment
     6499                // Fix #11356: Clear elements from fragment
    64466500                if ( tmp ) {
    64476501                        safe.removeChild( tmp );
    64486502                }
     
    64506504                // Reset defaultChecked for any radios and checkboxes
    64516505                // about to be appended to the DOM in IE 6/7 (#8060)
    64526506                if ( !jQuery.support.appendChecked ) {
    6453                         jQuery.grep( getAll( ret, "input" ), fixDefaultChecked );
     6507                        jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
    64546508                }
    64556509
    6456                 if ( fragment ) {
    6457                         for ( i = 0; (elem = ret[i]) != null; i++ ) {
    6458                                 safe = jQuery.contains( elem.ownerDocument, elem );
     6510                i = 0;
     6511                while ( (elem = nodes[ i++ ]) ) {
    64596512
    6460                                 // Append to fragment
    6461                                 // #4087 - If origin and destination elements are the same, and this is
    6462                                 // that element, do not append to fragment
    6463                                 if ( !selection || jQuery.inArray( elem, selection ) === -1 ) {
    6464                                         fragment.appendChild( elem );
    6465                                 }
    6466                                 tmp = getAll( elem, "script" );
     6513                        // #4087 - If origin and destination elements are the same, and this is
     6514                        // that element, do not do anything
     6515                        if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
     6516                                continue;
     6517                        }
    64676518
    6468                                 // Preserve script evaluation history
    6469                                 if ( safe ) {
    6470                                         setGlobalEval( tmp );
    6471                                 }
     6519                        contains = jQuery.contains( elem.ownerDocument, elem );
    64726520
    6473                                 // Capture executables
    6474                                 if ( scripts ) {
    6475                                         for ( j = 0; (elem = tmp[j]) != null; j++ ) {
    6476                                                 if ( rscriptType.test( elem.type || "" ) ) {
    6477                                                         scripts.push( elem );
    6478                                                 }
     6521                        // Append to fragment
     6522                        tmp = getAll( safe.appendChild( elem ), "script" );
     6523
     6524                        // Preserve script evaluation history
     6525                        if ( contains ) {
     6526                                setGlobalEval( tmp );
     6527                        }
     6528
     6529                        // Capture executables
     6530                        if ( scripts ) {
     6531                                j = 0;
     6532                                while ( (elem = tmp[ j++ ]) ) {
     6533                                        if ( rscriptType.test( elem.type || "" ) ) {
     6534                                                scripts.push( elem );
    64796535                                        }
    64806536                                }
    64816537                        }
    64826538                }
    64836539
    6484                 elem = tmp = safe = null;
     6540                tmp = null;
    64856541
    6486                 return ret;
     6542                return safe;
    64876543        },
    64886544
    64896545        cleanData: function( elems, /* internal */ acceptData ) {
     
    65256581                                                if ( deleteExpando ) {
    65266582                                                        delete elem[ internalKey ];
    65276583
    6528                                                 } else if ( elem.removeAttribute ) {
     6584                                                } else if ( typeof elem.removeAttribute !== "undefined" ) {
    65296585                                                        elem.removeAttribute( internalKey );
    65306586
    65316587                                                } else {
     
    67546810
    67556811                        // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
    67566812                        // but it would mean to define eight (for every problematic property) identical functions
    6757                         if ( value === "" && name.indexOf("background") === 0 ) {
    6758                                 value = " ";
     6813                        if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
     6814                                style[ name ] = "inherit";
    67596815                        }
    67606816
    67616817                        // If a hook was provided, use that value, otherwise just set the specified value
     
    73097365        // Document location
    73107366        ajaxLocParts,
    73117367        ajaxLocation,
    7312 
     7368       
    73137369        ajax_nonce = jQuery.now(),
    73147370
    73157371        ajax_rquery = /\?/,
     
    86098665
    86108666function Animation( elem, properties, options ) {
    86118667        var result,
     8668                stopped,
    86128669                index = 0,
    86138670                length = animationPrefilters.length,
    86148671                deferred = jQuery.Deferred().always( function() {
     
    86168673                        delete tick.elem;
    86178674                }),
    86188675                tick = function() {
     8676                        if ( stopped ) {
     8677                                return false;
     8678                        }
    86198679                        var currentTime = fxNow || createFxNow(),
    86208680                                remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
    86218681                                // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
     
    86578717                                        // if we are going to the end, we want to run all the tweens
    86588718                                        // otherwise we skip this part
    86598719                                        length = gotoEnd ? animation.tweens.length : 0;
    8660 
     8720                                if ( stopped ) {
     8721                                        return this;
     8722                                }
     8723                                stopped = true;
    86618724                                for ( ; index < length ; index++ ) {
    86628725                                        animation.tweens[ index ].run( 1 );
    86638726                                }
     
    86918754
    86928755        jQuery.fx.timer(
    86938756                jQuery.extend( tick, {
     8757                        elem: elem,
    86948758                        anim: animation,
    8695                         queue: animation.opts.queue,
    8696                         elem: elem
     8759                        queue: animation.opts.queue
    86978760                })
    86988761        );
    86998762
     
    90149077                        doAnimation = function() {
    90159078                                // Operate on a copy of prop so per-property easing won't be lost
    90169079                                var anim = Animation( this, jQuery.extend( {}, prop ), optall );
    9017 
    9018                                 // Empty animations resolve immediately
    9019                                 if ( empty ) {
     9080                                doAnimation.finish = function() {
    90209081                                        anim.stop( true );
     9082                                };
     9083                                // Empty animations, or finishing resolves immediately
     9084                                if ( empty || jQuery._data( this, "finish" ) ) {
     9085                                        anim.stop( true );
    90219086                                }
    90229087                        };
     9088                        doAnimation.finish = doAnimation;
    90239089
    90249090                return empty || optall.queue === false ?
    90259091                        this.each( doAnimation ) :
     
    90749140                                jQuery.dequeue( this, type );
    90759141                        }
    90769142                });
     9143        },
     9144        finish: function( type ) {
     9145                if ( type !== false ) {
     9146                        type = type || "fx";
     9147                }
     9148                return this.each(function() {
     9149                        var index,
     9150                                data = jQuery._data( this ),
     9151                                queue = data[ type + "queue" ],
     9152                                hooks = data[ type + "queueHooks" ],
     9153                                timers = jQuery.timers,
     9154                                length = queue ? queue.length : 0;
     9155
     9156                        // enable finishing flag on private data
     9157                        data.finish = true;
     9158
     9159                        // empty the queue first
     9160                        jQuery.queue( this, type, [] );
     9161
     9162                        if ( hooks && hooks.cur && hooks.cur.finish ) {
     9163                                hooks.cur.finish.call( this );
     9164                        }
     9165
     9166                        // look for any active animations, and finish them
     9167                        for ( index = timers.length; index--; ) {
     9168                                if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
     9169                                        timers[ index ].anim.stop( true );
     9170                                        timers.splice( index, 1 );
     9171                                }
     9172                        }
     9173
     9174                        // look for any animations in the old queue and finish them
     9175                        for ( index = 0; index < length; index++ ) {
     9176                                if ( queue[ index ] && queue[ index ].finish ) {
     9177                                        queue[ index ].finish.call( this );
     9178                                }
     9179                        }
     9180
     9181                        // turn off finishing flag
     9182                        delete data.finish;
     9183                });
    90779184        }
    90789185});
    90799186