Ignore:
Timestamp:
Mar 6, 2011, 10:46:00 AM (13 years ago)
Author:
patdenice
Message:

bug:2214
Update jQuery to 1.5.1 and cluetip to 1.0.7.
Now cluetip work on IE9.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/default/js/jquery.js

    r9172 r9553  
    11/*!
    2  * jQuery JavaScript Library v1.5
     2 * jQuery JavaScript Library v1.5.1
    33 * http://jquery.com/
    44 *
     
    1212 * Released under the MIT, BSD, and GPL Licenses.
    1313 *
    14  * Date: Mon Jan 31 08:31:29 2011 -0500
     14 * Date: Wed Feb 23 13:55:29 2011 -0500
    1515 */
    1616(function( window, undefined ) {
     
    203203
    204204        // The current version of jQuery being used
    205         jquery: "1.5",
     205        jquery: "1.5.1",
    206206
    207207        // The default length of a jQuery object is 0
     
    314314
    315315jQuery.extend = jQuery.fn.extend = function() {
    316          var options, name, src, copy, copyIsArray, clone,
     316        var options, name, src, copy, copyIsArray, clone,
    317317                target = arguments[0] || {},
    318318                i = 1,
     
    586586                        // Inspired by code by Andrea Giammarchi
    587587                        // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
    588                         var head = document.getElementsByTagName("head")[0] || document.documentElement,
    589                                 script = document.createElement("script");
    590 
    591                         script.type = "text/javascript";
     588                        var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
     589                                script = document.createElement( "script" );
    592590
    593591                        if ( jQuery.support.scriptEval() ) {
     
    865863                                                        }
    866864                                                }
     865                                                // We have to add a catch block for
     866                                                // IE prior to 8 or else the finally
     867                                                // block will never get executed
     868                                                catch (e) {
     869                                                        throw e;
     870                                                }
    867871                                                finally {
    868872                                                        fired = [ context, args ];
     
    912916                        // Get a promise for this deferred
    913917                        // If obj is provided, the promise aspect is added to the object
    914                         promise: function( obj , i /* internal */ ) {
     918                        promise: function( obj ) {
    915919                                if ( obj == null ) {
    916920                                        if ( promise ) {
     
    919923                                        promise = obj = {};
    920924                                }
    921                                 i = promiseMethods.length;
     925                                var i = promiseMethods.length;
    922926                                while( i-- ) {
    923                                         obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];
     927                                        obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
    924928                                }
    925929                                return obj;
     
    927931                } );
    928932                // Make sure only one callback list will be used
    929                 deferred.then( failDeferred.cancel, deferred.cancel );
     933                deferred.done( failDeferred.cancel ).fail( deferred.cancel );
    930934                // Unexpose cancel
    931935                delete deferred.cancel;
     
    939943        // Deferred helper
    940944        when: function( object ) {
    941                 var args = arguments,
    942                         length = args.length,
    943                         deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ?
     945                var lastIndex = arguments.length,
     946                        deferred = lastIndex <= 1 && object && jQuery.isFunction( object.promise ) ?
    944947                                object :
    945948                                jQuery.Deferred(),
    946                         promise = deferred.promise(),
    947                         resolveArray;
    948 
    949                 if ( length > 1 ) {
    950                         resolveArray = new Array( length );
    951                         jQuery.each( args, function( index, element ) {
    952                                 jQuery.when( element ).then( function( value ) {
    953                                         resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
    954                                         if( ! --length ) {
    955                                                 deferred.resolveWith( promise, resolveArray );
    956                                         }
    957                                 }, deferred.reject );
    958                         } );
     949                        promise = deferred.promise();
     950
     951                if ( lastIndex > 1 ) {
     952                        var array = slice.call( arguments, 0 ),
     953                                count = lastIndex,
     954                                iCallback = function( index ) {
     955                                        return function( value ) {
     956                                                array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
     957                                                if ( !( --count ) ) {
     958                                                        deferred.resolveWith( promise, array );
     959                                                }
     960                                        };
     961                                };
     962                        while( ( lastIndex-- ) ) {
     963                                object = array[ lastIndex ];
     964                                if ( object && jQuery.isFunction( object.promise ) ) {
     965                                        object.promise().then( iCallback(lastIndex), deferred.reject );
     966                                } else {
     967                                        --count;
     968                                }
     969                        }
     970                        if ( !count ) {
     971                                deferred.resolveWith( promise, array );
     972                        }
    959973                } else if ( deferred !== object ) {
    960974                        deferred.resolve( object );
     
    10721086
    10731087// Expose jQuery to the global object
    1074 return (window.jQuery = window.$ = jQuery);
     1088return jQuery;
    10751089
    10761090})();
     
    10891103                a = div.getElementsByTagName("a")[0],
    10901104                select = document.createElement("select"),
    1091                 opt = select.appendChild( document.createElement("option") );
     1105                opt = select.appendChild( document.createElement("option") ),
     1106                input = div.getElementsByTagName("input")[0];
    10921107
    10931108        // Can't get basic test support
     
    11281143                // that it defaults to "on".
    11291144                // (WebKit defaults to "" instead)
    1130                 checkOn: div.getElementsByTagName("input")[0].value === "on",
     1145                checkOn: input.value === "on",
    11311146
    11321147                // Make sure that a selected-by-default option has a working selected property.
     
    11381153                optDisabled: false,
    11391154                checkClone: false,
    1140                 _scriptEval: null,
    11411155                noCloneEvent: true,
     1156                noCloneChecked: true,
    11421157                boxModel: null,
    11431158                inlineBlockNeedsLayout: false,
     
    11461161        };
    11471162
     1163        input.checked = true;
     1164        jQuery.support.noCloneChecked = input.cloneNode( true ).checked;
     1165
    11481166        // Make sure that the options inside disabled selects aren't marked as disabled
    11491167        // (WebKit marks them as diabled)
     
    11511169        jQuery.support.optDisabled = !opt.disabled;
    11521170
     1171        var _scriptEval = null;
    11531172        jQuery.support.scriptEval = function() {
    1154                 if ( jQuery.support._scriptEval === null ) {
     1173                if ( _scriptEval === null ) {
    11551174                        var root = document.documentElement,
    11561175                                script = document.createElement("script"),
    11571176                                id = "script" + jQuery.now();
    11581177
    1159                         script.type = "text/javascript";
    11601178                        try {
    11611179                                script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
     
    11681186                        // (IE doesn't support this, fails, and uses .text instead)
    11691187                        if ( window[ id ] ) {
    1170                                 jQuery.support._scriptEval = true;
     1188                                _scriptEval = true;
    11711189                                delete window[ id ];
    11721190                        } else {
    1173                                 jQuery.support._scriptEval = false;
     1191                                _scriptEval = false;
    11741192                        }
    11751193
     
    11791197                }
    11801198
    1181                 return jQuery.support._scriptEval;
     1199                return _scriptEval;
    11821200        };
    11831201
     
    11911209        }
    11921210
    1193         if ( div.attachEvent && div.fireEvent ) {
     1211        if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
    11941212                div.attachEvent("onclick", function click() {
    11951213                        // Cloning a node shouldn't copy over any
     
    13221340                elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
    13231341
    1324                 return !!elem && !jQuery.isEmptyObject(elem);
     1342                return !!elem && !isEmptyDataObject( elem );
    13251343        },
    13261344
     
    13621380                if ( !cache[ id ] ) {
    13631381                        cache[ id ] = {};
     1382
     1383                        // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
     1384                        // metadata on plain JS objects when the object is serialized using
     1385                        // JSON.stringify
     1386                        if ( !isNode ) {
     1387                                cache[ id ].toJSON = jQuery.noop;
     1388                        }
    13641389                }
    13651390
    13661391                // An object can be passed to jQuery.data instead of a key/value pair; this gets
    13671392                // shallow copied over onto the existing cache
    1368                 if ( typeof name === "object" ) {
     1393                if ( typeof name === "object" || typeof name === "function" ) {
    13691394                        if ( pvt ) {
    13701395                                cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
     
    14281453                                // If there is no data left in the cache, we want to continue
    14291454                                // and let the cache object itself get destroyed
    1430                                 if ( !jQuery.isEmptyObject(thisCache) ) {
     1455                                if ( !isEmptyDataObject(thisCache) ) {
    14311456                                        return;
    14321457                                }
     
    14401465                        // Don't destroy the parent cache unless the internal data object
    14411466                        // had been the only thing left in it
    1442                         if ( !jQuery.isEmptyObject(cache[ id ]) ) {
     1467                        if ( !isEmptyDataObject(cache[ id ]) ) {
    14431468                                return;
    14441469                        }
     
    14611486                if ( internalCache ) {
    14621487                        cache[ id ] = {};
     1488                        // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
     1489                        // metadata on plain JS objects when the object is serialized using
     1490                        // JSON.stringify
     1491                        if ( !isNode ) {
     1492                                cache[ id ].toJSON = jQuery.noop;
     1493                        }
     1494
    14631495                        cache[ id ][ internalKey ] = internalCache;
    14641496
     
    15891621}
    15901622
     1623// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
     1624// property to be considered empty objects; this property always exists in
     1625// order to make sure JSON.stringify does not expose internal metadata
     1626function isEmptyDataObject( obj ) {
     1627        for ( var name in obj ) {
     1628                if ( name !== "toJSON" ) {
     1629                        return false;
     1630                }
     1631        }
     1632
     1633        return true;
     1634}
     1635
    15911636
    15921637
     
    18891934                                        }
    18901935
     1936                                        // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
     1937                                        if ( one && !values.length && options.length ) {
     1938                                                return jQuery( options[ index ] ).val();
     1939                                        }
     1940
    18911941                                        return values;
    18921942                                }
     
    20822132        fcleanup = function( nm ) {
    20832133                return nm.replace(rescape, "\\$&");
    2084         },
    2085         eventKey = "events";
     2134        };
    20862135
    20872136/*
     
    20992148                }
    21002149
    2101                 // For whatever reason, IE has trouble passing the window object
    2102                 // around, causing it to be cloned in the process
    2103                 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
    2104                         elem = window;
    2105                 }
     2150                // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6)
     2151                // Minor release fix for bug #8018
     2152                try {
     2153                        // For whatever reason, IE has trouble passing the window object
     2154                        // around, causing it to be cloned in the process
     2155                        if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
     2156                                elem = window;
     2157                        }
     2158                }
     2159                catch ( e ) {}
    21062160
    21072161                if ( handler === false ) {
     
    21092163                } else if ( !handler ) {
    21102164                        // Fixes bug #7229. Fix recommended by jdalton
    2111                   return;
     2165                        return;
    21122166                }
    21132167
     
    21332187                }
    21342188
    2135                 var events = elemData[ eventKey ],
     2189                var events = elemData.events,
    21362190                        eventHandle = elemData.handle;
    21372191
    2138                 if ( typeof events === "function" ) {
    2139                         // On plain objects events is a fn that holds the the data
    2140                         // which prevents this data from being JSON serialized
    2141                         // the function does not need to be called, it just contains the data
    2142                         eventHandle = events.handle;
    2143                         events = events.events;
    2144 
    2145                 } else if ( !events ) {
    2146                         if ( !elem.nodeType ) {
    2147                                 // On plain objects, create a fn that acts as the holder
    2148                                 // of the values to avoid JSON serialization of event data
    2149                                 elemData[ eventKey ] = elemData = function(){};
    2150                         }
    2151 
     2192                if ( !events ) {
    21522193                        elemData.events = events = {};
    21532194                }
     
    22502291                var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
    22512292                        elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
    2252                         events = elemData && elemData[ eventKey ];
     2293                        events = elemData && elemData.events;
    22532294
    22542295                if ( !elemData || !events ) {
    22552296                        return;
    2256                 }
    2257 
    2258                 if ( typeof events === "function" ) {
    2259                         elemData = events;
    2260                         events = events.events;
    22612297                }
    22622298
     
    23602396                        delete elemData.handle;
    23612397
    2362                         if ( typeof elemData === "function" ) {
    2363                                 jQuery.removeData( elem, eventKey, true );
    2364 
    2365                         } else if ( jQuery.isEmptyObject( elemData ) ) {
     2398                        if ( jQuery.isEmptyObject( elemData ) ) {
    23662399                                jQuery.removeData( elem, undefined, true );
    23672400                        }
     
    24042437                                                var internalKey = jQuery.expando,
    24052438                                                        internalCache = this[ internalKey ];
    2406                                                 if ( internalCache && internalCache.events && internalCache.events[type] ) {
     2439                                                if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
    24072440                                                        jQuery.event.trigger( event, data, internalCache.handle.elem );
    24082441                                                }
     
    24302463
    24312464                // Trigger the event, it is assumed that "handle" is a function
    2432                 var handle = elem.nodeType ?
    2433                         jQuery._data( elem, "handle" ) :
    2434                         (jQuery._data( elem, eventKey ) || {}).handle;
     2465                var handle = jQuery._data( elem, "handle" );
    24352466
    24362467                if ( handle ) {
     
    25102541                event.namespace = event.namespace || namespace_sort.join(".");
    25112542
    2512                 events = jQuery._data(this, eventKey);
    2513 
    2514                 if ( typeof events === "function" ) {
    2515                         events = events.events;
    2516                 }
     2543                events = jQuery._data(this, "events");
    25172544
    25182545                handlers = (events || {})[ event.type ];
     
    26812708                // Events bubbling up the document may have been marked as prevented
    26822709                // by a handler lower down the tree; reflect the correct value.
    2683                 this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || 
     2710                this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
    26842711                        src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
    26852712
     
    27562783        // which we cannot access the parentNode property of
    27572784        try {
     2785
     2786                // Chrome does something similar, the parentNode property
     2787                // can be accessed but is null.
     2788                if ( parent !== document && !parent.parentNode ) {
     2789                        return;
     2790                }
    27582791                // Traverse up the tree
    27592792                while ( parent && parent !== this ) {
     
    28062839
    28072840                                        if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
    2808                                                 e.liveFired = undefined;
    2809                                                 return trigger( "submit", this, arguments );
     2841                                                trigger( "submit", this, arguments );
    28102842                                        }
    28112843                                });
     
    28162848
    28172849                                        if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
    2818                                                 e.liveFired = undefined;
    2819                                                 return trigger( "submit", this, arguments );
     2850                                                trigger( "submit", this, arguments );
    28202851                                        }
    28212852                                });
     
    28802911                        e.type = "change";
    28812912                        e.liveFired = undefined;
    2882                         return jQuery.event.trigger( e, arguments[1], elem );
     2913                        jQuery.event.trigger( e, arguments[1], elem );
    28832914                }
    28842915        };
     
    28942925
    28952926                                if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
    2896                                         return testChange.call( this, e );
     2927                                        testChange.call( this, e );
    28972928                                }
    28982929                        },
     
    29062937                                        (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
    29072938                                        type === "select-multiple" ) {
    2908                                         return testChange.call( this, e );
     2939                                        testChange.call( this, e );
    29092940                                }
    29102941                        },
     
    29452976
    29462977function trigger( type, elem, args ) {
    2947         args[0].type = type;
    2948         return jQuery.event.handle.apply( elem, args );
     2978        // Piggyback on a donor event to simulate a different one.
     2979        // Fake originalEvent to avoid donor's stopPropagation, but if the
     2980        // simulated event prevents default then we do the same on the donor.
     2981        // Don't pass args or remember liveFired; they apply to the donor event.
     2982        var event = jQuery.extend( {}, args[ 0 ] );
     2983        event.type = type;
     2984        event.originalEvent = {};
     2985        event.liveFired = undefined;
     2986        jQuery.event.handle.call( elem, event );
     2987        if ( event.isDefaultPrevented() ) {
     2988                args[ 0 ].preventDefault();
     2989        }
    29492990}
    29502991
     
    29552996                        setup: function() {
    29562997                                this.addEventListener( orig, handler, true );
    2957                         }, 
    2958                         teardown: function() { 
     2998                        },
     2999                        teardown: function() {
    29593000                                this.removeEventListener( orig, handler, true );
    29603001                        }
     
    31493190                elems = [],
    31503191                selectors = [],
    3151                 events = jQuery._data( this, eventKey );
    3152 
    3153         if ( typeof events === "function" ) {
    3154                 events = events.events;
    3155         }
     3192                events = jQuery._data( this, "events" );
    31563193
    31573194        // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
     
    31873224                        handleObj = live[j];
    31883225
    3189                         if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
     3226                        if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
    31903227                                elem = close.elem;
    31913228                                related = null;
     
    32703307        toString = Object.prototype.toString,
    32713308        hasDuplicate = false,
    3272         baseHasDuplicate = true;
     3309        baseHasDuplicate = true,
     3310        rBackslash = /\\/g,
     3311        rNonWord = /\W/;
    32733312
    32743313// Here we check if the JavaScript engine is using some sort of
     
    34693508
    34703509                        if ( left.substr( left.length - 1 ) !== "\\" ) {
    3471                                 match[1] = (match[1] || "").replace(/\\/g, "");
     3510                                match[1] = (match[1] || "").replace( rBackslash, "" );
    34723511                                set = Expr.find[ type ]( match, context, isXML );
    34733512
     
    36083647                href: function( elem ) {
    36093648                        return elem.getAttribute( "href" );
     3649                },
     3650                type: function( elem ) {
     3651                        return elem.getAttribute( "type" );
    36103652                }
    36113653        },
     
    36143656                "+": function(checkSet, part){
    36153657                        var isPartStr = typeof part === "string",
    3616                                 isTag = isPartStr && !/\W/.test( part ),
     3658                                isTag = isPartStr && !rNonWord.test( part ),
    36173659                                isPartStrNotTag = isPartStr && !isTag;
    36183660
     
    36423684                                l = checkSet.length;
    36433685
    3644                         if ( isPartStr && !/\W/.test( part ) ) {
     3686                        if ( isPartStr && !rNonWord.test( part ) ) {
    36453687                                part = part.toLowerCase();
    36463688
     
    36763718                                checkFn = dirCheck;
    36773719
    3678                         if ( typeof part === "string" && !/\W/.test(part) ) {
     3720                        if ( typeof part === "string" && !rNonWord.test( part ) ) {
    36793721                                part = part.toLowerCase();
    36803722                                nodeCheck = part;
     
    36903732                                checkFn = dirCheck;
    36913733
    3692                         if ( typeof part === "string" && !/\W/.test( part ) ) {
     3734                        if ( typeof part === "string" && !rNonWord.test( part ) ) {
    36933735                                part = part.toLowerCase();
    36943736                                nodeCheck = part;
     
    37333775        preFilter: {
    37343776                CLASS: function( match, curLoop, inplace, result, not, isXML ) {
    3735                         match = " " + match[1].replace(/\\/g, "") + " ";
     3777                        match = " " + match[1].replace( rBackslash, "" ) + " ";
    37363778
    37373779                        if ( isXML ) {
     
    37563798
    37573799                ID: function( match ) {
    3758                         return match[1].replace(/\\/g, "");
     3800                        return match[1].replace( rBackslash, "" );
    37593801                },
    37603802
    37613803                TAG: function( match, curLoop ) {
    3762                         return match[1].toLowerCase();
     3804                        return match[1].replace( rBackslash, "" ).toLowerCase();
    37633805                },
    37643806
     
    37913833
    37923834                ATTR: function( match, curLoop, inplace, result, not, isXML ) {
    3793                         var name = match[1] = match[1].replace(/\\/g, "");
     3835                        var name = match[1] = match[1].replace( rBackslash, "" );
    37943836                       
    37953837                        if ( !isXML && Expr.attrMap[name] ) {
     
    37983840
    37993841                        // Handle if an un-quoted value was used
    3800                         match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");
     3842                        match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
    38013843
    38023844                        if ( match[2] === "~=" ) {
     
    38533895                        // Accessing this property makes selected-by-default
    38543896                        // options in Safari work properly
    3855                         elem.parentNode.selectedIndex;
     3897                        if ( elem.parentNode ) {
     3898                                elem.parentNode.selectedIndex;
     3899                        }
    38563900                       
    38573901                        return elem.selected === true;
     
    38753919
    38763920                text: function( elem ) {
    3877                         return "text" === elem.type;
     3921                        // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
     3922                        // use getAttribute instead to test this case
     3923                        return "text" === elem.getAttribute( 'type' );
    38783924                },
    38793925                radio: function( elem ) {
     
    44084454                                // IE 8 doesn't work on object elements
    44094455                                } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
    4410                                         var old = context.getAttribute( "id" ),
     4456                                        var oldContext = context,
     4457                                                old = context.getAttribute( "id" ),
    44114458                                                nid = old || id,
    44124459                                                hasParent = context.parentNode,
     
    44304477                                        } finally {
    44314478                                                if ( !old ) {
    4432                                                         context.removeAttribute( "id" );
     4479                                                        oldContext.removeAttribute( "id" );
    44334480                                                }
    44344481                                        }
     
    48464893        jQuery.fn[ name ] = function( until, selector ) {
    48474894                var ret = jQuery.map( this, fn, until ),
    4848                 // The variable 'args' was introduced in
    4849                 // https://github.com/jquery/jquery/commit/52a0238
    4850                 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
    4851                 // http://code.google.com/p/v8/issues/detail?id=1050
    4852                     args = slice.call(arguments);
     4895                        // The variable 'args' was introduced in
     4896                        // https://github.com/jquery/jquery/commit/52a0238
     4897                        // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
     4898                        // http://code.google.com/p/v8/issues/detail?id=1050
     4899                        args = slice.call(arguments);
    48534900
    48544901                if ( !runtil.test( name ) ) {
     
    49605007        rhtml = /<|&#?\w+;/,
    49615008        rnocache = /<(?:script|object|embed|option|style)/i,
    4962         // checked="checked" or checked (html5)
     5009        // checked="checked" or checked
    49635010        rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
    49645011        wrapMap = {
     
    51125159
    51135160                                if ( elem.parentNode ) {
    5114                                          elem.parentNode.removeChild( elem );
     5161                                        elem.parentNode.removeChild( elem );
    51155162                                }
    51165163                        }
     
    51375184
    51385185        clone: function( dataAndEvents, deepDataAndEvents ) {
    5139                 dataAndEvents = dataAndEvents == null ? true : dataAndEvents;
     5186                dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
    51405187                deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
    51415188
     
    53065353
    53075354        var internalKey = jQuery.expando,
    5308                         oldData = jQuery.data( src ),
    5309                         curData = jQuery.data( dest, oldData );
     5355                oldData = jQuery.data( src ),
     5356                curData = jQuery.data( dest, oldData );
    53105357
    53115358        // Switch to use the internal data object, if it exists, for the next
     
    53215368                        for ( var type in events ) {
    53225369                                for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
    5323                                         jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data );
     5370                                        jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
    53245371                                }
    53255372                        }
     
    54425489});
    54435490
     5491function getAll( elem ) {
     5492        if ( "getElementsByTagName" in elem ) {
     5493                return elem.getElementsByTagName( "*" );
     5494       
     5495        } else if ( "querySelectorAll" in elem ) {
     5496                return elem.querySelectorAll( "*" );
     5497
     5498        } else {
     5499                return [];
     5500        }
     5501}
     5502
    54445503jQuery.extend({
    54455504        clone: function( elem, dataAndEvents, deepDataAndEvents ) {
     
    54495508                                i;
    54505509
    5451                 if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
     5510                if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
     5511                                (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
    54525512                        // IE copies events bound via attachEvent when using cloneNode.
    54535513                        // Calling detachEvent on the clone will also remove the events
     
    54565516                        // guys for this hotness.
    54575517
     5518                        cloneFixAttributes( elem, clone );
     5519
    54585520                        // Using Sizzle here is crazy slow, so we use getElementsByTagName
    54595521                        // instead
    5460                         srcElements = elem.getElementsByTagName("*");
    5461                         destElements = clone.getElementsByTagName("*");
     5522                        srcElements = getAll( elem );
     5523                        destElements = getAll( clone );
    54625524
    54635525                        // Weird iteration because IE will replace the length property
     
    54675529                                cloneFixAttributes( srcElements[i], destElements[i] );
    54685530                        }
    5469 
    5470                         cloneFixAttributes( elem, clone );
    54715531                }
    54725532
    54735533                // Copy the events from the original to the clone
    54745534                if ( dataAndEvents ) {
    5475 
    54765535                        cloneCopyEvent( elem, clone );
    54775536
    5478                         if ( deepDataAndEvents && "getElementsByTagName" in elem ) {
    5479 
    5480                                 srcElements = elem.getElementsByTagName("*");
    5481                                 destElements = clone.getElementsByTagName("*");
    5482 
    5483                                 if ( srcElements.length ) {
    5484                                         for ( i = 0; srcElements[i]; ++i ) {
    5485                                                 cloneCopyEvent( srcElements[i], destElements[i] );
    5486                                         }
    5487                                 }
    5488                         }
    5489                 }
     5537                        if ( deepDataAndEvents ) {
     5538                                srcElements = getAll( elem );
     5539                                destElements = getAll( clone );
     5540
     5541                                for ( i = 0; srcElements[i]; ++i ) {
     5542                                        cloneCopyEvent( srcElements[i], destElements[i] );
     5543                                }
     5544                        }
     5545                }
     5546
    54905547                // Return the cloned set
    54915548                return clone;
    5492   },
     5549},
    54935550        clean: function( elems, context, fragment, scripts ) {
    54945551                context = context || document;
     
    59115968if ( document.documentElement.currentStyle ) {
    59125969        currentStyle = function( elem, name ) {
    5913                 var left, 
     5970                var left,
    59145971                        ret = elem.currentStyle && elem.currentStyle[ name ],
    59155972                        rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
     
    59896046        rCRLF = /\r?\n/g,
    59906047        rhash = /#.*$/,
    5991         rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
     6048        rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
    59926049        rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
     6050        // #7653, #8125, #8152: local protocol detection
     6051        rlocalProtocol = /(?:^file|^widget|\-extension):$/,
    59936052        rnoContent = /^(?:GET|HEAD)$/,
    59946053        rprotocol = /^\/\//,
     
    59986057        rspacesAjax = /\s+/,
    59996058        rts = /([?&])_=[^&]*/,
    6000         rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,
     6059        rucHeaders = /(^|\-)([a-z])/g,
     6060        rucHeadersFunc = function( _, $1, $2 ) {
     6061                return $1 + $2.toUpperCase();
     6062        },
     6063        rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
    60016064
    60026065        // Keep a copy of the old load method
     
    60196082         * 3) selection will start with transport dataType and THEN go to "*" if needed
    60206083         */
    6021         transports = {};
     6084        transports = {},
     6085
     6086        // Document location
     6087        ajaxLocation,
     6088
     6089        // Document location segments
     6090        ajaxLocParts;
     6091
     6092// #8138, IE may throw an exception when accessing
     6093// a field from document.location if document.domain has been set
     6094try {
     6095        ajaxLocation = document.location.href;
     6096} catch( e ) {
     6097        // Use the href attribute of an A element
     6098        // since IE will modify it given document.location
     6099        ajaxLocation = document.createElement( "a" );
     6100        ajaxLocation.href = "";
     6101        ajaxLocation = ajaxLocation.href;
     6102}
     6103
     6104// Segment location into parts
     6105ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
    60226106
    60236107// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
     
    60586142
    60596143//Base inspection function for prefilters and transports
    6060 function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR,
     6144function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
    60616145                dataType /* internal */, inspected /* internal */ ) {
    60626146
     
    60736157
    60746158        for(; i < length && ( executeOnly || !selection ); i++ ) {
    6075                 selection = list[ i ]( options, originalOptions, jXHR );
     6159                selection = list[ i ]( options, originalOptions, jqXHR );
    60766160                // If we got redirected to another dataType
    6077                 // we try there if not done already
     6161                // we try there if executing only and not done already
    60786162                if ( typeof selection === "string" ) {
    6079                         if ( inspected[ selection ] ) {
     6163                        if ( !executeOnly || inspected[ selection ] ) {
    60806164                                selection = undefined;
    60816165                        } else {
    60826166                                options.dataTypes.unshift( selection );
    60836167                                selection = inspectPrefiltersOrTransports(
    6084                                                 structure, options, originalOptions, jXHR, selection, inspected );
     6168                                                structure, options, originalOptions, jqXHR, selection, inspected );
    60856169                        }
    60866170                }
     
    60906174        if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
    60916175                selection = inspectPrefiltersOrTransports(
    6092                                 structure, options, originalOptions, jXHR, "*", inspected );
     6176                                structure, options, originalOptions, jqXHR, "*", inspected );
    60936177        }
    60946178        // unnecessary when only executing (prefilters)
     
    61226206                                // We assume that it's the callback
    61236207                                callback = params;
    6124                                 params = null;
     6208                                params = undefined;
    61256209
    61266210                        // Otherwise, build a param string
     
    61406224                        data: params,
    61416225                        // Complete callback (responseText is used internally)
    6142                         complete: function( jXHR, status, responseText ) {
    6143                                 // Store the response as specified by the jXHR object
    6144                                 responseText = jXHR.responseText;
     6226                        complete: function( jqXHR, status, responseText ) {
     6227                                // Store the response as specified by the jqXHR object
     6228                                responseText = jqXHR.responseText;
    61456229                                // If successful, inject the HTML into all the matched elements
    6146                                 if ( jXHR.isResolved() ) {
     6230                                if ( jqXHR.isResolved() ) {
    61476231                                        // #4825: Get the actual response in case
    61486232                                        // a dataFilter is present in ajaxSettings
    6149                                         jXHR.done(function( r ) {
     6233                                        jqXHR.done(function( r ) {
    61506234                                                responseText = r;
    61516235                                        });
     
    61666250
    61676251                                if ( callback ) {
    6168                                         self.each( callback, [ responseText, status, jXHR ] );
     6252                                        self.each( callback, [ responseText, status, jqXHR ] );
    61696253                                }
    61706254                        }
     
    62146298                        type = type || callback;
    62156299                        callback = data;
    6216                         data = null;
     6300                        data = undefined;
    62176301                }
    62186302
     
    62306314
    62316315        getScript: function( url, callback ) {
    6232                 return jQuery.get( url, null, callback, "script" );
     6316                return jQuery.get( url, undefined, callback, "script" );
    62336317        },
    62346318
     
    62376321        },
    62386322
    6239         ajaxSetup: function( settings ) {
    6240                 jQuery.extend( true, jQuery.ajaxSettings, settings );
    6241                 if ( settings.context ) {
    6242                         jQuery.ajaxSettings.context = settings.context;
    6243                 }
     6323        // Creates a full fledged settings object into target
     6324        // with both ajaxSettings and settings fields.
     6325        // If target is omitted, writes into ajaxSettings.
     6326        ajaxSetup: function ( target, settings ) {
     6327                if ( !settings ) {
     6328                        // Only one parameter, we extend ajaxSettings
     6329                        settings = target;
     6330                        target = jQuery.extend( true, jQuery.ajaxSettings, settings );
     6331                } else {
     6332                        // target was provided, we extend into it
     6333                        jQuery.extend( true, target, jQuery.ajaxSettings, settings );
     6334                }
     6335                // Flatten fields we don't want deep extended
     6336                for( var field in { context: 1, url: 1 } ) {
     6337                        if ( field in settings ) {
     6338                                target[ field ] = settings[ field ];
     6339                        } else if( field in jQuery.ajaxSettings ) {
     6340                                target[ field ] = jQuery.ajaxSettings[ field ];
     6341                        }
     6342                }
     6343                return target;
    62446344        },
    62456345
    62466346        ajaxSettings: {
    6247                 url: location.href,
     6347                url: ajaxLocation,
     6348                isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
    62486349                global: true,
    62496350                type: "GET",
     
    63076408        ajax: function( url, options ) {
    63086409
    6309                 // If options is not an object,
    6310                 // we simulate pre-1.5 signature
    6311                 if ( typeof options !== "object" ) {
     6410                // If url is an object, simulate pre-1.5 signature
     6411                if ( typeof url === "object" ) {
    63126412                        options = url;
    63136413                        url = undefined;
     
    63186418
    63196419                var // Create the final options object
    6320                         s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
    6321                         // Callbacks contexts
    6322                         // We force the original context if it exists
    6323                         // or take it from jQuery.ajaxSettings otherwise
    6324                         // (plain objects used as context get extended)
    6325                         callbackContext =
    6326                                 ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
    6327                         globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ),
     6420                        s = jQuery.ajaxSetup( {}, options ),
     6421                        // Callbacks context
     6422                        callbackContext = s.context || s,
     6423                        // Context for global events
     6424                        // It's the callbackContext if one was provided in the options
     6425                        // and if it's a DOM node or a jQuery collection
     6426                        globalEventContext = callbackContext !== s &&
     6427                                ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
     6428                                                jQuery( callbackContext ) : jQuery.event,
    63286429                        // Deferreds
    63296430                        deferred = jQuery.Deferred(),
     
    63316432                        // Status-dependent callbacks
    63326433                        statusCode = s.statusCode || {},
     6434                        // ifModified key
     6435                        ifModifiedKey,
    63336436                        // Headers (they are sent all at once)
    63346437                        requestHeaders = {},
     
    63416444                        timeoutTimer,
    63426445                        // Cross-domain detection vars
    6343                         loc = document.location,
    6344                         protocol = loc.protocol || "http:",
    63456446                        parts,
    6346                         // The jXHR state
     6447                        // The jqXHR state
    63476448                        state = 0,
     6449                        // To know if global events are to be dispatched
     6450                        fireGlobals,
    63486451                        // Loop variable
    63496452                        i,
    63506453                        // Fake xhr
    6351                         jXHR = {
     6454                        jqXHR = {
    63526455
    63536456                                readyState: 0,
     
    63556458                                // Caches the header
    63566459                                setRequestHeader: function( name, value ) {
    6357                                         if ( state === 0 ) {
    6358                                                 requestHeaders[ name.toLowerCase() ] = value;
     6460                                        if ( !state ) {
     6461                                                requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value;
    63596462                                        }
    63606463                                        return this;
     
    63786481                                                match = responseHeaders[ key.toLowerCase() ];
    63796482                                        }
    6380                                         return match || null;
     6483                                        return match === undefined ? null : match;
     6484                                },
     6485
     6486                                // Overrides response content-type header
     6487                                overrideMimeType: function( type ) {
     6488                                        if ( !state ) {
     6489                                                s.mimeType = type;
     6490                                        }
     6491                                        return this;
    63816492                                },
    63826493
     
    63956506                // It is defined here because jslint complains if it is declared
    63966507                // at the end of the function (which would be more logical and readable)
    6397                 function done( status, statusText, responses, headers) {
     6508                function done( status, statusText, responses, headers ) {
    63986509
    63996510                        // Called once
     
    64116522
    64126523                        // Dereference transport for early garbage collection
    6413                         // (no matter how long the jXHR object will be used)
     6524                        // (no matter how long the jqXHR object will be used)
    64146525                        transport = undefined;
    64156526
     
    64186529
    64196530                        // Set readyState
    6420                         jXHR.readyState = status ? 4 : 0;
     6531                        jqXHR.readyState = status ? 4 : 0;
    64216532
    64226533                        var isSuccess,
    64236534                                success,
    64246535                                error,
    6425                                 response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined,
     6536                                response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
    64266537                                lastModified,
    64276538                                etag;
     
    64336544                                if ( s.ifModified ) {
    64346545
    6435                                         if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) {
    6436                                                 jQuery.lastModified[ s.url ] = lastModified;
     6546                                        if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
     6547                                                jQuery.lastModified[ ifModifiedKey ] = lastModified;
    64376548                                        }
    6438                                         if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) {
    6439                                                 jQuery.etag[ s.url ] = etag;
     6549                                        if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
     6550                                                jQuery.etag[ ifModifiedKey ] = etag;
    64406551                                        }
    64416552                                }
     
    64646575                                // then normalize statusText and status for non-aborts
    64656576                                error = statusText;
    6466                                 if( status ) {
     6577                                if( !statusText || status ) {
    64676578                                        statusText = "error";
    64686579                                        if ( status < 0 ) {
     
    64736584
    64746585                        // Set data for the fake xhr object
    6475                         jXHR.status = status;
    6476                         jXHR.statusText = statusText;
     6586                        jqXHR.status = status;
     6587                        jqXHR.statusText = statusText;
    64776588
    64786589                        // Success/Error
    64796590                        if ( isSuccess ) {
    6480                                 deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] );
     6591                                deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
    64816592                        } else {
    6482                                 deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] );
     6593                                deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
    64836594                        }
    64846595
    64856596                        // Status-dependent callbacks
    6486                         jXHR.statusCode( statusCode );
     6597                        jqXHR.statusCode( statusCode );
    64876598                        statusCode = undefined;
    64886599
    6489                         if ( s.global ) {
     6600                        if ( fireGlobals ) {
    64906601                                globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
    6491                                                 [ jXHR, s, isSuccess ? success : error ] );
     6602                                                [ jqXHR, s, isSuccess ? success : error ] );
    64926603                        }
    64936604
    64946605                        // Complete
    6495                         completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] );
    6496 
    6497                         if ( s.global ) {
    6498                                 globalEventContext.trigger( "ajaxComplete", [ jXHR, s] );
     6606                        completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
     6607
     6608                        if ( fireGlobals ) {
     6609                                globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
    64996610                                // Handle the global AJAX counter
    65006611                                if ( !( --jQuery.active ) ) {
     
    65056616
    65066617                // Attach deferreds
    6507                 deferred.promise( jXHR );
    6508                 jXHR.success = jXHR.done;
    6509                 jXHR.error = jXHR.fail;
    6510                 jXHR.complete = completeDeferred.done;
     6618                deferred.promise( jqXHR );
     6619                jqXHR.success = jqXHR.done;
     6620                jqXHR.error = jqXHR.fail;
     6621                jqXHR.complete = completeDeferred.done;
    65116622
    65126623                // Status-dependent callbacks
    6513                 jXHR.statusCode = function( map ) {
     6624                jqXHR.statusCode = function( map ) {
    65146625                        if ( map ) {
    65156626                                var tmp;
     
    65196630                                        }
    65206631                                } else {
    6521                                         tmp = map[ jXHR.status ];
    6522                                         jXHR.then( tmp, tmp );
     6632                                        tmp = map[ jqXHR.status ];
     6633                                        jqXHR.then( tmp, tmp );
    65236634                                }
    65246635                        }
     
    65296640                // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
    65306641                // We also use the url parameter if available
    6531                 s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" );
     6642                s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
    65326643
    65336644                // Extract dataTypes list
     
    65386649                        parts = rurl.exec( s.url.toLowerCase() );
    65396650                        s.crossDomain = !!( parts &&
    6540                                 ( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname ||
     6651                                ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
    65416652                                        ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
    6542                                                 ( loc.port || ( protocol === "http:" ? 80 : 443 ) ) )
     6653                                                ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
    65436654                        );
    65446655                }
     
    65506661
    65516662                // Apply prefilters
    6552                 inspectPrefiltersOrTransports( prefilters, s, options, jXHR );
     6663                inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
     6664
     6665                // If request was aborted inside a prefiler, stop there
     6666                if ( state === 2 ) {
     6667                        return false;
     6668                }
     6669
     6670                // We can fire global events as of now if asked to
     6671                fireGlobals = s.global;
    65536672
    65546673                // Uppercase the type
     
    65596678
    65606679                // Watch for a new set of requests
    6561                 if ( s.global && jQuery.active++ === 0 ) {
     6680                if ( fireGlobals && jQuery.active++ === 0 ) {
    65626681                        jQuery.event.trigger( "ajaxStart" );
    65636682                }
     
    65716690                        }
    65726691
     6692                        // Get ifModifiedKey before adding the anti-cache parameter
     6693                        ifModifiedKey = s.url;
     6694
    65736695                        // Add anti-cache in url if needed
    65746696                        if ( s.cache === false ) {
     
    65856707                // Set the correct header, if data is being sent
    65866708                if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
    6587                         requestHeaders[ "content-type" ] = s.contentType;
     6709                        requestHeaders[ "Content-Type" ] = s.contentType;
    65886710                }
    65896711
    65906712                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
    65916713                if ( s.ifModified ) {
    6592                         if ( jQuery.lastModified[ s.url ] ) {
    6593                                 requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ];
    6594                         }
    6595                         if ( jQuery.etag[ s.url ] ) {
    6596                                 requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ];
     6714                        ifModifiedKey = ifModifiedKey || s.url;
     6715                        if ( jQuery.lastModified[ ifModifiedKey ] ) {
     6716                                requestHeaders[ "If-Modified-Since" ] = jQuery.lastModified[ ifModifiedKey ];
     6717                        }
     6718                        if ( jQuery.etag[ ifModifiedKey ] ) {
     6719                                requestHeaders[ "If-None-Match" ] = jQuery.etag[ ifModifiedKey ];
    65976720                        }
    65986721                }
    65996722
    66006723                // Set the Accepts header for the server, depending on the dataType
    6601                 requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
     6724                requestHeaders.Accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
    66026725                        s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
    66036726                        s.accepts[ "*" ];
     
    66056728                // Check for headers option
    66066729                for ( i in s.headers ) {
    6607                         requestHeaders[ i.toLowerCase() ] = s.headers[ i ];
     6730                        jqXHR.setRequestHeader( i, s.headers[ i ] );
    66086731                }
    66096732
    66106733                // Allow custom headers/mimetypes and early abort
    6611                 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) {
     6734                if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
    66126735                                // Abort if not done already
    6613                                 done( 0, "abort" );
    6614                                 // Return false
    6615                                 jXHR = false;
    6616 
     6736                                jqXHR.abort();
     6737                                return false;
     6738
     6739                }
     6740
     6741                // Install callbacks on deferreds
     6742                for ( i in { success: 1, error: 1, complete: 1 } ) {
     6743                        jqXHR[ i ]( s[ i ] );
     6744                }
     6745
     6746                // Get transport
     6747                transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
     6748
     6749                // If no transport, we auto-abort
     6750                if ( !transport ) {
     6751                        done( -1, "No Transport" );
    66176752                } else {
    6618 
    6619                         // Install callbacks on deferreds
    6620                         for ( i in { success: 1, error: 1, complete: 1 } ) {
    6621                                 jXHR[ i ]( s[ i ] );
    6622                         }
    6623 
    6624                         // Get transport
    6625                         transport = inspectPrefiltersOrTransports( transports, s, options, jXHR );
    6626 
    6627                         // If no transport, we auto-abort
    6628                         if ( !transport ) {
    6629                                 done( -1, "No Transport" );
    6630                         } else {
    6631                                 // Set state as sending
    6632                                 state = jXHR.readyState = 1;
    6633                                 // Send global event
    6634                                 if ( s.global ) {
    6635                                         globalEventContext.trigger( "ajaxSend", [ jXHR, s ] );
    6636                                 }
    6637                                 // Timeout
    6638                                 if ( s.async && s.timeout > 0 ) {
    6639                                         timeoutTimer = setTimeout( function(){
    6640                                                 jXHR.abort( "timeout" );
    6641                                         }, s.timeout );
    6642                                 }
    6643 
    6644                                 try {
    6645                                         transport.send( requestHeaders, done );
    6646                                 } catch (e) {
    6647                                         // Propagate exception as error if not done
    6648                                         if ( status < 2 ) {
    6649                                                 done( -1, e );
    6650                                         // Simply rethrow otherwise
    6651                                         } else {
    6652                                                 jQuery.error( e );
    6653                                         }
    6654                                 }
    6655                         }
    6656                 }
    6657                 return jXHR;
     6753                        jqXHR.readyState = 1;
     6754                        // Send global event
     6755                        if ( fireGlobals ) {
     6756                                globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
     6757                        }
     6758                        // Timeout
     6759                        if ( s.async && s.timeout > 0 ) {
     6760                                timeoutTimer = setTimeout( function(){
     6761                                        jqXHR.abort( "timeout" );
     6762                                }, s.timeout );
     6763                        }
     6764
     6765                        try {
     6766                                state = 1;
     6767                                transport.send( requestHeaders, done );
     6768                        } catch (e) {
     6769                                // Propagate exception as error if not done
     6770                                if ( status < 2 ) {
     6771                                        done( -1, e );
     6772                                // Simply rethrow otherwise
     6773                                } else {
     6774                                        jQuery.error( e );
     6775                                }
     6776                        }
     6777                }
     6778
     6779                return jqXHR;
    66586780        },
    66596781
     
    66746796
    66756797                // If an array was passed in, assume that it is an array of form elements.
    6676                 if ( jQuery.isArray( a ) || a.jquery ) {
     6798                if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
    66776799                        // Serialize the form elements
    66786800                        jQuery.each( a, function() {
     
    67216843                // Serialize object item.
    67226844                } else {
    6723                         jQuery.each( obj, function( k, v ) {
    6724                                 buildParams( prefix + "[" + k + "]", v, traditional, add );
    6725                         });
     6845                        for ( var name in obj ) {
     6846                                buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
     6847                        }
    67266848                }
    67276849
     
    67506872 * - returns the corresponding response
    67516873 */
    6752 function ajaxHandleResponses( s, jXHR, responses ) {
     6874function ajaxHandleResponses( s, jqXHR, responses ) {
    67536875
    67546876        var contents = s.contents,
     
    67636885        for( type in responseFields ) {
    67646886                if ( type in responses ) {
    6765                         jXHR[ responseFields[type] ] = responses[ type ];
     6887                        jqXHR[ responseFields[type] ] = responses[ type ];
    67666888                }
    67676889        }
     
    67716893                dataTypes.shift();
    67726894                if ( ct === undefined ) {
    6773                         ct = jXHR.getResponseHeader( "content-type" );
     6895                        ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
    67746896                }
    67756897        }
     
    68236945
    68246946        var dataTypes = s.dataTypes,
    6825                 converters = s.converters,
     6947                converters = {},
    68266948                i,
     6949                key,
    68276950                length = dataTypes.length,
    68286951                tmp,
     
    68406963        // For each dataType in the chain
    68416964        for( i = 1; i < length; i++ ) {
     6965
     6966                // Create converters map
     6967                // with lowercased keys
     6968                if ( i === 1 ) {
     6969                        for( key in s.converters ) {
     6970                                if( typeof key === "string" ) {
     6971                                        converters[ key.toLowerCase() ] = s.converters[ key ];
     6972                                }
     6973                        }
     6974                }
    68426975
    68436976                // Get the dataTypes
     
    69037036
    69047037// Detect, normalize options and install callbacks for jsonp requests
    6905 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {
    6906 
    6907         dataIsString = ( typeof s.data === "string" );
     7038jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
     7039
     7040        var dataIsString = ( typeof s.data === "string" );
    69087041
    69097042        if ( s.dataTypes[ 0 ] === "jsonp" ||
     
    69197052                        url = s.url,
    69207053                        data = s.data,
    6921                         replace = "$1" + jsonpCallback + "$2";
     7054                        replace = "$1" + jsonpCallback + "$2",
     7055                        cleanUp = function() {
     7056                                // Set callback back to previous value
     7057                                window[ jsonpCallback ] = previous;
     7058                                // Call if it was a function and we have a response
     7059                                if ( responseContainer && jQuery.isFunction( previous ) ) {
     7060                                        window[ jsonpCallback ]( responseContainer[ 0 ] );
     7061                                }
     7062                        };
    69227063
    69237064                if ( s.jsonp !== false ) {
     
    69377078                s.data = data;
    69387079
     7080                // Install callback
    69397081                window[ jsonpCallback ] = function( response ) {
    69407082                        responseContainer = [ response ];
    69417083                };
    69427084
    6943                 s.complete = [ function() {
    6944 
    6945                         // Set callback back to previous value
    6946                         window[ jsonpCallback ] = previous;
    6947 
    6948                         // Call if it was a function and we have a response
    6949                         if ( previous) {
    6950                                 if ( responseContainer && jQuery.isFunction( previous ) ) {
    6951                                         window[ jsonpCallback ] ( responseContainer[ 0 ] );
    6952                                 }
    6953                         } else {
    6954                                 // else, more memory leak avoidance
    6955                                 try{
    6956                                         delete window[ jsonpCallback ];
    6957                                 } catch( e ) {}
    6958                         }
    6959 
    6960                 }, s.complete ];
     7085                // Install cleanUp function
     7086                jqXHR.then( cleanUp, cleanUp );
    69617087
    69627088                // Use data converter to retrieve json after script execution
    69637089                s.converters["script json"] = function() {
    6964                         if ( ! responseContainer ) {
     7090                        if ( !responseContainer ) {
    69657091                                jQuery.error( jsonpCallback + " was not called" );
    69667092                        }
     
    69827108jQuery.ajaxSetup({
    69837109        accepts: {
    6984                 script: "text/javascript, application/javascript"
     7110                script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
    69857111        },
    69867112        contents: {
    6987                 script: /javascript/
     7113                script: /javascript|ecmascript/
    69887114        },
    69897115        converters: {
     
    70137139
    70147140                var script,
    7015                         head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
     7141                        head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
    70167142
    70177143                return {
     
    70687194
    70697195
    7070 var // Next active xhr id
     7196var // #5280: next active xhr id and list of active xhrs' callbacks
    70717197        xhrId = jQuery.now(),
    7072 
    7073         // active xhrs
    7074         xhrs = {},
    7075 
    7076         // #5280: see below
    7077         xhrUnloadAbortInstalled,
     7198        xhrCallbacks,
    70787199
    70797200        // XHR used to determine supports properties
    70807201        testXHR;
     7202
     7203// #5280: Internet Explorer will keep connections alive if we don't abort on unload
     7204function xhrOnUnloadAbort() {
     7205        jQuery( window ).unload(function() {
     7206                // Abort all pending requests
     7207                for ( var key in xhrCallbacks ) {
     7208                        xhrCallbacks[ key ]( 0, 1 );
     7209                }
     7210        });
     7211}
     7212
     7213// Functions to create xhrs
     7214function createStandardXHR() {
     7215        try {
     7216                return new window.XMLHttpRequest();
     7217        } catch( e ) {}
     7218}
     7219
     7220function createActiveXHR() {
     7221        try {
     7222                return new window.ActiveXObject( "Microsoft.XMLHTTP" );
     7223        } catch( e ) {}
     7224}
    70817225
    70827226// Create the request object
     
    70907234         */
    70917235        function() {
    7092                 if ( window.location.protocol !== "file:" ) {
    7093                         try {
    7094                                 return new window.XMLHttpRequest();
    7095                         } catch( xhrError ) {}
    7096                 }
    7097 
    7098                 try {
    7099                         return new window.ActiveXObject("Microsoft.XMLHTTP");
    7100                 } catch( activeError ) {}
     7236                return !this.isLocal && createStandardXHR() || createActiveXHR();
    71017237        } :
    71027238        // For all other browsers, use the standard XMLHttpRequest object
    7103         function() {
    7104                 return new window.XMLHttpRequest();
    7105         };
     7239        createStandardXHR;
    71067240
    71077241// Test if we can create an xhr object
    7108 try {
    7109         testXHR = jQuery.ajaxSettings.xhr();
    7110 } catch( xhrCreationException ) {}
    7111 
    7112 //Does this browser support XHR requests?
     7242testXHR = jQuery.ajaxSettings.xhr();
    71137243jQuery.support.ajax = !!testXHR;
    71147244
     
    71317261                                send: function( headers, complete ) {
    71327262
    7133                                         // #5280: we need to abort on unload or IE will keep connections alive
    7134                                         if ( !xhrUnloadAbortInstalled ) {
    7135 
    7136                                                 xhrUnloadAbortInstalled = 1;
    7137 
    7138                                                 jQuery(window).bind( "unload", function() {
    7139 
    7140                                                         // Abort all pending requests
    7141                                                         jQuery.each( xhrs, function( _, xhr ) {
    7142                                                                 if ( xhr.onreadystatechange ) {
    7143                                                                         xhr.onreadystatechange( 1 );
    7144                                                                 }
    7145                                                         } );
    7146 
    7147                                                 } );
    7148                                         }
    7149 
    71507263                                        // Get a new xhr
    71517264                                        var xhr = s.xhr(),
    7152                                                 handle;
     7265                                                handle,
     7266                                                i;
    71537267
    71547268                                        // Open the socket
     
    71607274                                        }
    71617275
     7276                                        // Apply custom fields if provided
     7277                                        if ( s.xhrFields ) {
     7278                                                for ( i in s.xhrFields ) {
     7279                                                        xhr[ i ] = s.xhrFields[ i ];
     7280                                                }
     7281                                        }
     7282
     7283                                        // Override mime type if needed
     7284                                        if ( s.mimeType && xhr.overrideMimeType ) {
     7285                                                xhr.overrideMimeType( s.mimeType );
     7286                                        }
     7287
    71627288                                        // Requested-With header
    71637289                                        // Not set for crossDomain requests with no content
    71647290                                        // (see why at http://trac.dojotoolkit.org/ticket/9486)
    71657291                                        // Won't change header if already provided
    7166                                         if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) {
    7167                                                 headers[ "x-requested-with" ] = "XMLHttpRequest";
     7292                                        if ( !( s.crossDomain && !s.hasContent ) && !headers["X-Requested-With"] ) {
     7293                                                headers[ "X-Requested-With" ] = "XMLHttpRequest";
    71687294                                        }
    71697295
    71707296                                        // Need an extra try/catch for cross domain requests in Firefox 3
    71717297                                        try {
    7172                                                 jQuery.each( headers, function( key, value ) {
    7173                                                         xhr.setRequestHeader( key, value );
    7174                                                 } );
     7298                                                for ( i in headers ) {
     7299                                                        xhr.setRequestHeader( i, headers[ i ] );
     7300                                                }
    71757301                                        } catch( _ ) {}
    71767302
     
    71837309                                        callback = function( _, isAbort ) {
    71847310
    7185                                                 // Was never called and is aborted or complete
    7186                                                 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
    7187 
    7188                                                         // Only called once
    7189                                                         callback = 0;
    7190 
    7191                                                         // Do not keep as active anymore
    7192                                                         if ( handle ) {
    7193                                                                 xhr.onreadystatechange = jQuery.noop;
    7194                                                                 delete xhrs[ handle ];
     7311                                                var status,
     7312                                                        statusText,
     7313                                                        responseHeaders,
     7314                                                        responses,
     7315                                                        xml;
     7316
     7317                                                // Firefox throws exceptions when accessing properties
     7318                                                // of an xhr when a network error occured
     7319                                                // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
     7320                                                try {
     7321
     7322                                                        // Was never called and is aborted or complete
     7323                                                        if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
     7324
     7325                                                                // Only called once
     7326                                                                callback = undefined;
     7327
     7328                                                                // Do not keep as active anymore
     7329                                                                if ( handle ) {
     7330                                                                        xhr.onreadystatechange = jQuery.noop;
     7331                                                                        delete xhrCallbacks[ handle ];
     7332                                                                }
     7333
     7334                                                                // If it's an abort
     7335                                                                if ( isAbort ) {
     7336                                                                        // Abort it manually if needed
     7337                                                                        if ( xhr.readyState !== 4 ) {
     7338                                                                                xhr.abort();
     7339                                                                        }
     7340                                                                } else {
     7341                                                                        status = xhr.status;
     7342                                                                        responseHeaders = xhr.getAllResponseHeaders();
     7343                                                                        responses = {};
     7344                                                                        xml = xhr.responseXML;
     7345
     7346                                                                        // Construct response list
     7347                                                                        if ( xml && xml.documentElement /* #4958 */ ) {
     7348                                                                                responses.xml = xml;
     7349                                                                        }
     7350                                                                        responses.text = xhr.responseText;
     7351
     7352                                                                        // Firefox throws an exception when accessing
     7353                                                                        // statusText for faulty cross-domain requests
     7354                                                                        try {
     7355                                                                                statusText = xhr.statusText;
     7356                                                                        } catch( e ) {
     7357                                                                                // We normalize with Webkit giving an empty statusText
     7358                                                                                statusText = "";
     7359                                                                        }
     7360
     7361                                                                        // Filter status for non standard behaviors
     7362
     7363                                                                        // If the request is local and we have data: assume a success
     7364                                                                        // (success with no data won't get notified, that's the best we
     7365                                                                        // can do given current implementations)
     7366                                                                        if ( !status && s.isLocal && !s.crossDomain ) {
     7367                                                                                status = responses.text ? 200 : 404;
     7368                                                                        // IE - #1450: sometimes returns 1223 when it should be 204
     7369                                                                        } else if ( status === 1223 ) {
     7370                                                                                status = 204;
     7371                                                                        }
     7372                                                                }
    71957373                                                        }
    7196 
    7197                                                         // If it's an abort
    7198                                                         if ( isAbort ) {
    7199                                                                 // Abort it manually if needed
    7200                                                                 if ( xhr.readyState !== 4 ) {
    7201                                                                         xhr.abort();
    7202                                                                 }
    7203                                                         } else {
    7204                                                                 // Get info
    7205                                                                 var status = xhr.status,
    7206                                                                         statusText,
    7207                                                                         responseHeaders = xhr.getAllResponseHeaders(),
    7208                                                                         responses = {},
    7209                                                                         xml = xhr.responseXML;
    7210 
    7211                                                                 // Construct response list
    7212                                                                 if ( xml && xml.documentElement /* #4958 */ ) {
    7213                                                                         responses.xml = xml;
    7214                                                                 }
    7215                                                                 responses.text = xhr.responseText;
    7216 
    7217                                                                 // Firefox throws an exception when accessing
    7218                                                                 // statusText for faulty cross-domain requests
    7219                                                                 try {
    7220                                                                         statusText = xhr.statusText;
    7221                                                                 } catch( e ) {
    7222                                                                         // We normalize with Webkit giving an empty statusText
    7223                                                                         statusText = "";
    7224                                                                 }
    7225 
    7226                                                                 // Filter status for non standard behaviours
    7227                                                                 status =
    7228                                                                         // Opera returns 0 when it should be 304
    7229                                                                         // Webkit returns 0 for failing cross-domain no matter the real status
    7230                                                                         status === 0 ?
    7231                                                                                 (
    7232                                                                                         // Webkit, Firefox: filter out faulty cross-domain requests
    7233                                                                                         !s.crossDomain || statusText ?
    7234                                                                                         (
    7235                                                                                                 // Opera: filter out real aborts #6060
    7236                                                                                                 responseHeaders ?
    7237                                                                                                 304 :
    7238                                                                                                 0
    7239                                                                                         ) :
    7240                                                                                         // We assume 302 but could be anything cross-domain related
    7241                                                                                         302
    7242                                                                                 ) :
    7243                                                                                 (
    7244                                                                                         // IE sometimes returns 1223 when it should be 204 (see #1450)
    7245                                                                                         status == 1223 ?
    7246                                                                                                 204 :
    7247                                                                                                 status
    7248                                                                                 );
    7249 
    7250                                                                 // Call complete
    7251                                                                 complete( status, statusText, responses, responseHeaders );
     7374                                                } catch( firefoxAccessException ) {
     7375                                                        if ( !isAbort ) {
     7376                                                                complete( -1, firefoxAccessException );
    72527377                                                        }
     7378                                                }
     7379
     7380                                                // Call complete if needed
     7381                                                if ( responses ) {
     7382                                                        complete( status, statusText, responses, responseHeaders );
    72537383                                                }
    72547384                                        };
     
    72607390                                                callback();
    72617391                                        } else {
    7262                                                 // Add to list of active xhrs
     7392                                                // Create the active xhrs callbacks list if needed
     7393                                                // and attach the unload handler
     7394                                                if ( !xhrCallbacks ) {
     7395                                                        xhrCallbacks = {};
     7396                                                        xhrOnUnloadAbort();
     7397                                                }
     7398                                                // Add to list of active xhrs callbacks
    72637399                                                handle = xhrId++;
    7264                                                 xhrs[ handle ] = xhr;
    7265                                                 xhr.onreadystatechange = callback;
     7400                                                xhr.onreadystatechange = xhrCallbacks[ handle ] = callback;
    72667401                                        }
    72677402                                },
     
    74657600                                } else {
    74667601                                        var parts = rfxnum.exec(val),
    7467                                                 start = e.cur() || 0;
     7602                                                start = e.cur();
    74687603
    74697604                                        if ( parts ) {
    74707605                                                var end = parseFloat( parts[2] ),
    7471                                                         unit = parts[3] || "px";
     7606                                                        unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
    74727607
    74737608                                                // We need to compute starting value
     
    76167751                }
    76177752
    7618                 var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    7619                 return r || 0;
     7753                var parsed,
     7754                        r = jQuery.css( this.elem, this.prop );
     7755                // Empty strings, null, undefined and "auto" are converted to 0,
     7756                // complex values such as "rotate(1rad)" are returned as is,
     7757                // simple values such as "10px" are parsed to Float.
     7758                return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
    76207759        },
    76217760
     
    76287767                this.start = from;
    76297768                this.end = to;
    7630                 this.unit = unit || this.unit || "px";
     7769                this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
    76317770                this.now = this.start;
    76327771                this.pos = this.state = 0;
     
    80798218                                        win.scrollTo(
    80808219                                                !i ? val : jQuery(win).scrollLeft(),
    8081                                                  i ? val : jQuery(win).scrollTop()
     8220                                                i ? val : jQuery(win).scrollTop()
    80828221                                        );
    80838222
     
    81748313
    81758314
     8315window.jQuery = window.$ = jQuery;
    81768316})(window);
Note: See TracChangeset for help on using the changeset viewer.