2980 | | })( window ); |
| 2613 | |
| 2614 | var rneedsContext = jQuery.expr.match.needsContext; |
| 2615 | |
| 2616 | var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | var risSimple = /^.[^:#\[\.,]*$/; |
| 2621 | |
| 2622 | // Implement the identical functionality for filter and not |
| 2623 | function winnow( elements, qualifier, not ) { |
| 2624 | if ( jQuery.isFunction( qualifier ) ) { |
| 2625 | return jQuery.grep( elements, function( elem, i ) { |
| 2626 | /* jshint -W018 */ |
| 2627 | return !!qualifier.call( elem, i, elem ) !== not; |
| 2628 | }); |
| 2629 | |
| 2630 | } |
| 2631 | |
| 2632 | if ( qualifier.nodeType ) { |
| 2633 | return jQuery.grep( elements, function( elem ) { |
| 2634 | return ( elem === qualifier ) !== not; |
| 2635 | }); |
| 2636 | |
| 2637 | } |
| 2638 | |
| 2639 | if ( typeof qualifier === "string" ) { |
| 2640 | if ( risSimple.test( qualifier ) ) { |
| 2641 | return jQuery.filter( qualifier, elements, not ); |
| 2642 | } |
| 2643 | |
| 2644 | qualifier = jQuery.filter( qualifier, elements ); |
| 2645 | } |
| 2646 | |
| 2647 | return jQuery.grep( elements, function( elem ) { |
| 2648 | return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; |
| 2649 | }); |
| 2650 | } |
| 2651 | |
| 2652 | jQuery.filter = function( expr, elems, not ) { |
| 2653 | var elem = elems[ 0 ]; |
| 2654 | |
| 2655 | if ( not ) { |
| 2656 | expr = ":not(" + expr + ")"; |
| 2657 | } |
| 2658 | |
| 2659 | return elems.length === 1 && elem.nodeType === 1 ? |
| 2660 | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : |
| 2661 | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
| 2662 | return elem.nodeType === 1; |
| 2663 | })); |
| 2664 | }; |
| 2665 | |
| 2666 | jQuery.fn.extend({ |
| 2667 | find: function( selector ) { |
| 2668 | var i, |
| 2669 | ret = [], |
| 2670 | self = this, |
| 2671 | len = self.length; |
| 2672 | |
| 2673 | if ( typeof selector !== "string" ) { |
| 2674 | return this.pushStack( jQuery( selector ).filter(function() { |
| 2675 | for ( i = 0; i < len; i++ ) { |
| 2676 | if ( jQuery.contains( self[ i ], this ) ) { |
| 2677 | return true; |
| 2678 | } |
| 2679 | } |
| 2680 | }) ); |
| 2681 | } |
| 2682 | |
| 2683 | for ( i = 0; i < len; i++ ) { |
| 2684 | jQuery.find( selector, self[ i ], ret ); |
| 2685 | } |
| 2686 | |
| 2687 | // Needed because $( selector, context ) becomes $( context ).find( selector ) |
| 2688 | ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); |
| 2689 | ret.selector = this.selector ? this.selector + " " + selector : selector; |
| 2690 | return ret; |
| 2691 | }, |
| 2692 | filter: function( selector ) { |
| 2693 | return this.pushStack( winnow(this, selector || [], false) ); |
| 2694 | }, |
| 2695 | not: function( selector ) { |
| 2696 | return this.pushStack( winnow(this, selector || [], true) ); |
| 2697 | }, |
| 2698 | is: function( selector ) { |
| 2699 | return !!winnow( |
| 2700 | this, |
| 2701 | |
| 2702 | // If this is a positional/relative selector, check membership in the returned set |
| 2703 | // so $("p:first").is("p:last") won't return true for a doc with two "p". |
| 2704 | typeof selector === "string" && rneedsContext.test( selector ) ? |
| 2705 | jQuery( selector ) : |
| 2706 | selector || [], |
| 2707 | false |
| 2708 | ).length; |
| 2709 | } |
| 2710 | }); |
| 2711 | |
| 2712 | |
| 2713 | // Initialize a jQuery object |
| 2714 | |
| 2715 | |
| 2716 | // A central reference to the root jQuery(document) |
| 2717 | var rootjQuery, |
| 2718 | |
| 2719 | // Use the correct document accordingly with window argument (sandbox) |
| 2720 | document = window.document, |
| 2721 | |
| 2722 | // A simple way to check for HTML strings |
| 2723 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
| 2724 | // Strict HTML recognition (#11290: must start with <) |
| 2725 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, |
| 2726 | |
| 2727 | init = jQuery.fn.init = function( selector, context ) { |
| 2728 | var match, elem; |
| 2729 | |
| 2730 | // HANDLE: $(""), $(null), $(undefined), $(false) |
| 2731 | if ( !selector ) { |
| 2732 | return this; |
| 2733 | } |
| 2734 | |
| 2735 | // Handle HTML strings |
| 2736 | if ( typeof selector === "string" ) { |
| 2737 | if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { |
| 2738 | // Assume that strings that start and end with <> are HTML and skip the regex check |
| 2739 | match = [ null, selector, null ]; |
| 2740 | |
| 2741 | } else { |
| 2742 | match = rquickExpr.exec( selector ); |
| 2743 | } |
| 2744 | |
| 2745 | // Match html or make sure no context is specified for #id |
| 2746 | if ( match && (match[1] || !context) ) { |
| 2747 | |
| 2748 | // HANDLE: $(html) -> $(array) |
| 2749 | if ( match[1] ) { |
| 2750 | context = context instanceof jQuery ? context[0] : context; |
| 2751 | |
| 2752 | // scripts is true for back-compat |
| 2753 | // Intentionally let the error be thrown if parseHTML is not present |
| 2754 | jQuery.merge( this, jQuery.parseHTML( |
| 2755 | match[1], |
| 2756 | context && context.nodeType ? context.ownerDocument || context : document, |
| 2757 | true |
| 2758 | ) ); |
| 2759 | |
| 2760 | // HANDLE: $(html, props) |
| 2761 | if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { |
| 2762 | for ( match in context ) { |
| 2763 | // Properties of context are called as methods if possible |
| 2764 | if ( jQuery.isFunction( this[ match ] ) ) { |
| 2765 | this[ match ]( context[ match ] ); |
| 2766 | |
| 2767 | // ...and otherwise set as attributes |
| 2768 | } else { |
| 2769 | this.attr( match, context[ match ] ); |
| 2770 | } |
| 2771 | } |
| 2772 | } |
| 2773 | |
| 2774 | return this; |
| 2775 | |
| 2776 | // HANDLE: $(#id) |
| 2777 | } else { |
| 2778 | elem = document.getElementById( match[2] ); |
| 2779 | |
| 2780 | // Check parentNode to catch when Blackberry 4.6 returns |
| 2781 | // nodes that are no longer in the document #6963 |
| 2782 | if ( elem && elem.parentNode ) { |
| 2783 | // Handle the case where IE and Opera return items |
| 2784 | // by name instead of ID |
| 2785 | if ( elem.id !== match[2] ) { |
| 2786 | return rootjQuery.find( selector ); |
| 2787 | } |
| 2788 | |
| 2789 | // Otherwise, we inject the element directly into the jQuery object |
| 2790 | this.length = 1; |
| 2791 | this[0] = elem; |
| 2792 | } |
| 2793 | |
| 2794 | this.context = document; |
| 2795 | this.selector = selector; |
| 2796 | return this; |
| 2797 | } |
| 2798 | |
| 2799 | // HANDLE: $(expr, $(...)) |
| 2800 | } else if ( !context || context.jquery ) { |
| 2801 | return ( context || rootjQuery ).find( selector ); |
| 2802 | |
| 2803 | // HANDLE: $(expr, context) |
| 2804 | // (which is just equivalent to: $(context).find(expr) |
| 2805 | } else { |
| 2806 | return this.constructor( context ).find( selector ); |
| 2807 | } |
| 2808 | |
| 2809 | // HANDLE: $(DOMElement) |
| 2810 | } else if ( selector.nodeType ) { |
| 2811 | this.context = this[0] = selector; |
| 2812 | this.length = 1; |
| 2813 | return this; |
| 2814 | |
| 2815 | // HANDLE: $(function) |
| 2816 | // Shortcut for document ready |
| 2817 | } else if ( jQuery.isFunction( selector ) ) { |
| 2818 | return typeof rootjQuery.ready !== "undefined" ? |
| 2819 | rootjQuery.ready( selector ) : |
| 2820 | // Execute immediately if ready is not present |
| 2821 | selector( jQuery ); |
| 2822 | } |
| 2823 | |
| 2824 | if ( selector.selector !== undefined ) { |
| 2825 | this.selector = selector.selector; |
| 2826 | this.context = selector.context; |
| 2827 | } |
| 2828 | |
| 2829 | return jQuery.makeArray( selector, this ); |
| 2830 | }; |
| 2831 | |
| 2832 | // Give the init function the jQuery prototype for later instantiation |
| 2833 | init.prototype = jQuery.fn; |
| 2834 | |
| 2835 | // Initialize central reference |
| 2836 | rootjQuery = jQuery( document ); |
| 2837 | |
| 2838 | |
| 2839 | var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
| 2840 | // methods guaranteed to produce a unique set when starting from a unique set |
| 2841 | guaranteedUnique = { |
| 2842 | children: true, |
| 2843 | contents: true, |
| 2844 | next: true, |
| 2845 | prev: true |
| 2846 | }; |
| 2847 | |
| 2848 | jQuery.extend({ |
| 2849 | dir: function( elem, dir, until ) { |
| 2850 | var matched = [], |
| 2851 | cur = elem[ dir ]; |
| 2852 | |
| 2853 | while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { |
| 2854 | if ( cur.nodeType === 1 ) { |
| 2855 | matched.push( cur ); |
| 2856 | } |
| 2857 | cur = cur[dir]; |
| 2858 | } |
| 2859 | return matched; |
| 2860 | }, |
| 2861 | |
| 2862 | sibling: function( n, elem ) { |
| 2863 | var r = []; |
| 2864 | |
| 2865 | for ( ; n; n = n.nextSibling ) { |
| 2866 | if ( n.nodeType === 1 && n !== elem ) { |
| 2867 | r.push( n ); |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | return r; |
| 2872 | } |
| 2873 | }); |
| 2874 | |
| 2875 | jQuery.fn.extend({ |
| 2876 | has: function( target ) { |
| 2877 | var i, |
| 2878 | targets = jQuery( target, this ), |
| 2879 | len = targets.length; |
| 2880 | |
| 2881 | return this.filter(function() { |
| 2882 | for ( i = 0; i < len; i++ ) { |
| 2883 | if ( jQuery.contains( this, targets[i] ) ) { |
| 2884 | return true; |
| 2885 | } |
| 2886 | } |
| 2887 | }); |
| 2888 | }, |
| 2889 | |
| 2890 | closest: function( selectors, context ) { |
| 2891 | var cur, |
| 2892 | i = 0, |
| 2893 | l = this.length, |
| 2894 | matched = [], |
| 2895 | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
| 2896 | jQuery( selectors, context || this.context ) : |
| 2897 | 0; |
| 2898 | |
| 2899 | for ( ; i < l; i++ ) { |
| 2900 | for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { |
| 2901 | // Always skip document fragments |
| 2902 | if ( cur.nodeType < 11 && (pos ? |
| 2903 | pos.index(cur) > -1 : |
| 2904 | |
| 2905 | // Don't pass non-elements to Sizzle |
| 2906 | cur.nodeType === 1 && |
| 2907 | jQuery.find.matchesSelector(cur, selectors)) ) { |
| 2908 | |
| 2909 | matched.push( cur ); |
| 2910 | break; |
| 2911 | } |
| 2912 | } |
| 2913 | } |
| 2914 | |
| 2915 | return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); |
| 2916 | }, |
| 2917 | |
| 2918 | // Determine the position of an element within |
| 2919 | // the matched set of elements |
| 2920 | index: function( elem ) { |
| 2921 | |
| 2922 | // No argument, return index in parent |
| 2923 | if ( !elem ) { |
| 2924 | return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; |
| 2925 | } |
| 2926 | |
| 2927 | // index in selector |
| 2928 | if ( typeof elem === "string" ) { |
| 2929 | return jQuery.inArray( this[0], jQuery( elem ) ); |
| 2930 | } |
| 2931 | |
| 2932 | // Locate the position of the desired element |
| 2933 | return jQuery.inArray( |
| 2934 | // If it receives a jQuery object, the first element is used |
| 2935 | elem.jquery ? elem[0] : elem, this ); |
| 2936 | }, |
| 2937 | |
| 2938 | add: function( selector, context ) { |
| 2939 | return this.pushStack( |
| 2940 | jQuery.unique( |
| 2941 | jQuery.merge( this.get(), jQuery( selector, context ) ) |
| 2942 | ) |
| 2943 | ); |
| 2944 | }, |
| 2945 | |
| 2946 | addBack: function( selector ) { |
| 2947 | return this.add( selector == null ? |
| 2948 | this.prevObject : this.prevObject.filter(selector) |
| 2949 | ); |
| 2950 | } |
| 2951 | }); |
| 2952 | |
| 2953 | function sibling( cur, dir ) { |
| 2954 | do { |
| 2955 | cur = cur[ dir ]; |
| 2956 | } while ( cur && cur.nodeType !== 1 ); |
| 2957 | |
| 2958 | return cur; |
| 2959 | } |
| 2960 | |
| 2961 | jQuery.each({ |
| 2962 | parent: function( elem ) { |
| 2963 | var parent = elem.parentNode; |
| 2964 | return parent && parent.nodeType !== 11 ? parent : null; |
| 2965 | }, |
| 2966 | parents: function( elem ) { |
| 2967 | return jQuery.dir( elem, "parentNode" ); |
| 2968 | }, |
| 2969 | parentsUntil: function( elem, i, until ) { |
| 2970 | return jQuery.dir( elem, "parentNode", until ); |
| 2971 | }, |
| 2972 | next: function( elem ) { |
| 2973 | return sibling( elem, "nextSibling" ); |
| 2974 | }, |
| 2975 | prev: function( elem ) { |
| 2976 | return sibling( elem, "previousSibling" ); |
| 2977 | }, |
| 2978 | nextAll: function( elem ) { |
| 2979 | return jQuery.dir( elem, "nextSibling" ); |
| 2980 | }, |
| 2981 | prevAll: function( elem ) { |
| 2982 | return jQuery.dir( elem, "previousSibling" ); |
| 2983 | }, |
| 2984 | nextUntil: function( elem, i, until ) { |
| 2985 | return jQuery.dir( elem, "nextSibling", until ); |
| 2986 | }, |
| 2987 | prevUntil: function( elem, i, until ) { |
| 2988 | return jQuery.dir( elem, "previousSibling", until ); |
| 2989 | }, |
| 2990 | siblings: function( elem ) { |
| 2991 | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); |
| 2992 | }, |
| 2993 | children: function( elem ) { |
| 2994 | return jQuery.sibling( elem.firstChild ); |
| 2995 | }, |
| 2996 | contents: function( elem ) { |
| 2997 | return jQuery.nodeName( elem, "iframe" ) ? |
| 2998 | elem.contentDocument || elem.contentWindow.document : |
| 2999 | jQuery.merge( [], elem.childNodes ); |
| 3000 | } |
| 3001 | }, function( name, fn ) { |
| 3002 | jQuery.fn[ name ] = function( until, selector ) { |
| 3003 | var ret = jQuery.map( this, fn, until ); |
| 3004 | |
| 3005 | if ( name.slice( -5 ) !== "Until" ) { |
| 3006 | selector = until; |
| 3007 | } |
| 3008 | |
| 3009 | if ( selector && typeof selector === "string" ) { |
| 3010 | ret = jQuery.filter( selector, ret ); |
| 3011 | } |
| 3012 | |
| 3013 | if ( this.length > 1 ) { |
| 3014 | // Remove duplicates |
| 3015 | if ( !guaranteedUnique[ name ] ) { |
| 3016 | ret = jQuery.unique( ret ); |
| 3017 | } |
| 3018 | |
| 3019 | // Reverse order for parents* and prev-derivatives |
| 3020 | if ( rparentsprev.test( name ) ) { |
| 3021 | ret = ret.reverse(); |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | return this.pushStack( ret ); |
| 3026 | }; |
| 3027 | }); |
| 3028 | var rnotwhite = (/\S+/g); |
| 3029 | |
| 3030 | |
| 3031 | |
3319 | | jQuery.support = (function( support ) { |
3320 | | |
3321 | | var all, a, input, select, fragment, opt, eventName, isSupported, i, |
3322 | | div = document.createElement("div"); |
| 3372 | |
| 3373 | |
| 3374 | // The deferred used on DOM ready |
| 3375 | var readyList; |
| 3376 | |
| 3377 | jQuery.fn.ready = function( fn ) { |
| 3378 | // Add the callback |
| 3379 | jQuery.ready.promise().done( fn ); |
| 3380 | |
| 3381 | return this; |
| 3382 | }; |
| 3383 | |
| 3384 | jQuery.extend({ |
| 3385 | // Is the DOM ready to be used? Set to true once it occurs. |
| 3386 | isReady: false, |
| 3387 | |
| 3388 | // A counter to track how many items to wait for before |
| 3389 | // the ready event fires. See #6781 |
| 3390 | readyWait: 1, |
| 3391 | |
| 3392 | // Hold (or release) the ready event |
| 3393 | holdReady: function( hold ) { |
| 3394 | if ( hold ) { |
| 3395 | jQuery.readyWait++; |
| 3396 | } else { |
| 3397 | jQuery.ready( true ); |
| 3398 | } |
| 3399 | }, |
| 3400 | |
| 3401 | // Handle when the DOM is ready |
| 3402 | ready: function( wait ) { |
| 3403 | |
| 3404 | // Abort if there are pending holds or we're already ready |
| 3405 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
| 3406 | return; |
| 3407 | } |
| 3408 | |
| 3409 | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
| 3410 | if ( !document.body ) { |
| 3411 | return setTimeout( jQuery.ready ); |
| 3412 | } |
| 3413 | |
| 3414 | // Remember that the DOM is ready |
| 3415 | jQuery.isReady = true; |
| 3416 | |
| 3417 | // If a normal DOM Ready event fired, decrement, and wait if need be |
| 3418 | if ( wait !== true && --jQuery.readyWait > 0 ) { |
| 3419 | return; |
| 3420 | } |
| 3421 | |
| 3422 | // If there are functions bound, to execute |
| 3423 | readyList.resolveWith( document, [ jQuery ] ); |
| 3424 | |
| 3425 | // Trigger any bound ready events |
| 3426 | if ( jQuery.fn.trigger ) { |
| 3427 | jQuery( document ).trigger("ready").off("ready"); |
| 3428 | } |
| 3429 | } |
| 3430 | }); |
| 3431 | |
| 3432 | /** |
| 3433 | * Clean-up method for dom ready events |
| 3434 | */ |
| 3435 | function detach() { |
| 3436 | if ( document.addEventListener ) { |
| 3437 | document.removeEventListener( "DOMContentLoaded", completed, false ); |
| 3438 | window.removeEventListener( "load", completed, false ); |
| 3439 | |
| 3440 | } else { |
| 3441 | document.detachEvent( "onreadystatechange", completed ); |
| 3442 | window.detachEvent( "onload", completed ); |
| 3443 | } |
| 3444 | } |
| 3445 | |
| 3446 | /** |
| 3447 | * The ready event handler and self cleanup method |
| 3448 | */ |
| 3449 | function completed() { |
| 3450 | // readyState === "complete" is good enough for us to call the dom ready in oldIE |
| 3451 | if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { |
| 3452 | detach(); |
| 3453 | jQuery.ready(); |
| 3454 | } |
| 3455 | } |
| 3456 | |
| 3457 | jQuery.ready.promise = function( obj ) { |
| 3458 | if ( !readyList ) { |
| 3459 | |
| 3460 | readyList = jQuery.Deferred(); |
| 3461 | |
| 3462 | // Catch cases where $(document).ready() is called after the browser event has already occurred. |
| 3463 | // we once tried to use readyState "interactive" here, but it caused issues like the one |
| 3464 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 |
| 3465 | if ( document.readyState === "complete" ) { |
| 3466 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
| 3467 | setTimeout( jQuery.ready ); |
| 3468 | |
| 3469 | // Standards-based browsers support DOMContentLoaded |
| 3470 | } else if ( document.addEventListener ) { |
| 3471 | // Use the handy event callback |
| 3472 | document.addEventListener( "DOMContentLoaded", completed, false ); |
| 3473 | |
| 3474 | // A fallback to window.onload, that will always work |
| 3475 | window.addEventListener( "load", completed, false ); |
| 3476 | |
| 3477 | // If IE event model is used |
| 3478 | } else { |
| 3479 | // Ensure firing before onload, maybe late but safe also for iframes |
| 3480 | document.attachEvent( "onreadystatechange", completed ); |
| 3481 | |
| 3482 | // A fallback to window.onload, that will always work |
| 3483 | window.attachEvent( "onload", completed ); |
| 3484 | |
| 3485 | // If IE and not a frame |
| 3486 | // continually check to see if the document is ready |
| 3487 | var top = false; |
| 3488 | |
| 3489 | try { |
| 3490 | top = window.frameElement == null && document.documentElement; |
| 3491 | } catch(e) {} |
| 3492 | |
| 3493 | if ( top && top.doScroll ) { |
| 3494 | (function doScrollCheck() { |
| 3495 | if ( !jQuery.isReady ) { |
| 3496 | |
| 3497 | try { |
| 3498 | // Use the trick by Diego Perini |
| 3499 | // http://javascript.nwbox.com/IEContentLoaded/ |
| 3500 | top.doScroll("left"); |
| 3501 | } catch(e) { |
| 3502 | return setTimeout( doScrollCheck, 50 ); |
| 3503 | } |
| 3504 | |
| 3505 | // detach all dom ready events |
| 3506 | detach(); |
| 3507 | |
| 3508 | // and execute any waiting functions |
| 3509 | jQuery.ready(); |
| 3510 | } |
| 3511 | })(); |
| 3512 | } |
| 3513 | } |
| 3514 | } |
| 3515 | return readyList.promise( obj ); |
| 3516 | }; |
| 3517 | |
| 3518 | |
| 3519 | var strundefined = typeof undefined; |
| 3520 | |
| 3521 | |
| 3522 | |
| 3523 | // Support: IE<9 |
| 3524 | // Iteration over object's inherited properties before its own |
| 3525 | var i; |
| 3526 | for ( i in jQuery( support ) ) { |
| 3527 | break; |
| 3528 | } |
| 3529 | support.ownLast = i !== "0"; |
| 3530 | |
| 3531 | // Note: most support tests are defined in their respective modules. |
| 3532 | // false until the test is run |
| 3533 | support.inlineBlockNeedsLayout = false; |
| 3534 | |
| 3535 | jQuery(function() { |
| 3536 | // We need to execute this one support test ASAP because we need to know |
| 3537 | // if body.style.zoom needs to be set. |
| 3538 | |
| 3539 | var container, div, |
| 3540 | body = document.getElementsByTagName("body")[0]; |
| 3541 | |
| 3542 | if ( !body ) { |
| 3543 | // Return for frameset docs that don't have a body |
| 3544 | return; |
| 3545 | } |
3325 | | div.setAttribute( "className", "t" ); |
3326 | | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; |
3327 | | |
3328 | | // Finish early in limited (non-browser) environments |
3329 | | all = div.getElementsByTagName("*") || []; |
3330 | | a = div.getElementsByTagName("a")[ 0 ]; |
3331 | | if ( !a || !a.style || !all.length ) { |
3332 | | return support; |
3333 | | } |
3334 | | |
3335 | | // First batch of tests |
3336 | | select = document.createElement("select"); |
3337 | | opt = select.appendChild( document.createElement("option") ); |
3338 | | input = div.getElementsByTagName("input")[ 0 ]; |
3339 | | |
3340 | | a.style.cssText = "top:1px;float:left;opacity:.5"; |
3341 | | |
3342 | | // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
3343 | | support.getSetAttribute = div.className !== "t"; |
3344 | | |
3345 | | // IE strips leading whitespace when .innerHTML is used |
3346 | | support.leadingWhitespace = div.firstChild.nodeType === 3; |
3347 | | |
3348 | | // Make sure that tbody elements aren't automatically inserted |
3349 | | // IE will insert them into empty tables |
3350 | | support.tbody = !div.getElementsByTagName("tbody").length; |
3351 | | |
3352 | | // Make sure that link elements get serialized correctly by innerHTML |
3353 | | // This requires a wrapper element in IE |
3354 | | support.htmlSerialize = !!div.getElementsByTagName("link").length; |
3355 | | |
3356 | | // Get the style information from getAttribute |
3357 | | // (IE uses .cssText instead) |
3358 | | support.style = /top/.test( a.getAttribute("style") ); |
3359 | | |
3360 | | // Make sure that URLs aren't manipulated |
3361 | | // (IE normalizes it by default) |
3362 | | support.hrefNormalized = a.getAttribute("href") === "/a"; |
3363 | | |
3364 | | // Make sure that element opacity exists |
3365 | | // (IE uses filter instead) |
3366 | | // Use a regex to work around a WebKit issue. See #5145 |
3367 | | support.opacity = /^0.5/.test( a.style.opacity ); |
3368 | | |
3369 | | // Verify style float existence |
3370 | | // (IE uses styleFloat instead of cssFloat) |
3371 | | support.cssFloat = !!a.style.cssFloat; |
3372 | | |
3373 | | // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) |
3374 | | support.checkOn = !!input.value; |
3375 | | |
3376 | | // Make sure that a selected-by-default option has a working selected property. |
3377 | | // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
3378 | | support.optSelected = opt.selected; |
3379 | | |
3380 | | // Tests for enctype support on a form (#6743) |
3381 | | support.enctype = !!document.createElement("form").enctype; |
3382 | | |
3383 | | // Makes sure cloning an html5 element does not cause problems |
3384 | | // Where outerHTML is undefined, this still works |
3385 | | support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>"; |
3386 | | |
3387 | | // Will be defined later |
3388 | | support.inlineBlockNeedsLayout = false; |
3389 | | support.shrinkWrapBlocks = false; |
3390 | | support.pixelPosition = false; |
3391 | | support.deleteExpando = true; |
3392 | | support.noCloneEvent = true; |
3393 | | support.reliableMarginRight = true; |
3394 | | support.boxSizingReliable = true; |
3395 | | |
3396 | | // Make sure checked status is properly cloned |
3397 | | input.checked = true; |
3398 | | support.noCloneChecked = input.cloneNode( true ).checked; |
3399 | | |
3400 | | // Make sure that the options inside disabled selects aren't marked as disabled |
3401 | | // (WebKit marks them as disabled) |
3402 | | select.disabled = true; |
3403 | | support.optDisabled = !opt.disabled; |
3404 | | |
3405 | | // Support: IE<9 |
3406 | | try { |
3407 | | delete div.test; |
3408 | | } catch( e ) { |
3409 | | support.deleteExpando = false; |
3410 | | } |
3411 | | |
3412 | | // Check if we can trust getAttribute("value") |
3413 | | input = document.createElement("input"); |
3414 | | input.setAttribute( "value", "" ); |
3415 | | support.input = input.getAttribute( "value" ) === ""; |
3416 | | |
3417 | | // Check if an input maintains its value after becoming a radio |
3418 | | input.value = "t"; |
3419 | | input.setAttribute( "type", "radio" ); |
3420 | | support.radioValue = input.value === "t"; |
3421 | | |
3422 | | // #11217 - WebKit loses check when the name is after the checked attribute |
3423 | | input.setAttribute( "checked", "t" ); |
3424 | | input.setAttribute( "name", "t" ); |
3425 | | |
3426 | | fragment = document.createDocumentFragment(); |
3427 | | fragment.appendChild( input ); |
3428 | | |
3429 | | // Check if a disconnected checkbox will retain its checked |
3430 | | // value of true after appended to the DOM (IE6/7) |
3431 | | support.appendChecked = input.checked; |
3432 | | |
3433 | | // WebKit doesn't clone checked state correctly in fragments |
3434 | | support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; |
3435 | | |
3436 | | // Support: IE<9 |
3437 | | // Opera does not clone events (and typeof div.attachEvent === undefined). |
3438 | | // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() |
3439 | | if ( div.attachEvent ) { |
3440 | | div.attachEvent( "onclick", function() { |
3441 | | support.noCloneEvent = false; |
3442 | | }); |
3443 | | |
3444 | | div.cloneNode( true ).click(); |
3445 | | } |
3446 | | |
3447 | | // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) |
3448 | | // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) |
3449 | | for ( i in { submit: true, change: true, focusin: true }) { |
3450 | | div.setAttribute( eventName = "on" + i, "t" ); |
3451 | | |
3452 | | support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; |
3453 | | } |
3454 | | |
3455 | | div.style.backgroundClip = "content-box"; |
3456 | | div.cloneNode( true ).style.backgroundClip = ""; |
3457 | | support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
3458 | | |
3459 | | // Support: IE<9 |
3460 | | // Iteration over object's inherited properties before its own. |
3461 | | for ( i in jQuery( support ) ) { |
3462 | | break; |
3463 | | } |
3464 | | support.ownLast = i !== "0"; |
3465 | | |
3466 | | // Run tests that need a body at doc ready |
3467 | | jQuery(function() { |
3468 | | var container, marginDiv, tds, |
3469 | | divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", |
3470 | | body = document.getElementsByTagName("body")[0]; |
3471 | | |
3472 | | if ( !body ) { |
3473 | | // Return for frameset docs that don't have a body |
3474 | | return; |
3475 | | } |
3476 | | |
3477 | | container = document.createElement("div"); |
3478 | | container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; |
3479 | | |
3480 | | body.appendChild( container ).appendChild( div ); |
3481 | | |
3482 | | // Support: IE8 |
3483 | | // Check if table cells still have offsetWidth/Height when they are set |
3484 | | // to display:none and there are still other visible table cells in a |
3485 | | // table row; if so, offsetWidth/Height are not reliable for use when |
3486 | | // determining if an element has been hidden directly using |
3487 | | // display:none (it is still safe to use offsets if a parent element is |
3488 | | // hidden; don safety goggles and see bug #4512 for more information). |
3489 | | div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; |
3490 | | tds = div.getElementsByTagName("td"); |
3491 | | tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; |
3492 | | isSupported = ( tds[ 0 ].offsetHeight === 0 ); |
3493 | | |
3494 | | tds[ 0 ].style.display = ""; |
3495 | | tds[ 1 ].style.display = "none"; |
3496 | | |
3497 | | // Support: IE8 |
3498 | | // Check if empty table cells still have offsetWidth/Height |
3499 | | support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); |
3500 | | |
3501 | | // Check box-sizing and margin behavior. |
3502 | | div.innerHTML = ""; |
3503 | | div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; |
3504 | | |
3505 | | // Workaround failing boxSizing test due to offsetWidth returning wrong value |
3506 | | // with some non-1 values of body zoom, ticket #13543 |
3507 | | jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { |
3508 | | support.boxSizing = div.offsetWidth === 4; |
3509 | | }); |
3510 | | |
3511 | | // Use window.getComputedStyle because jsdom on node.js will break without it. |
3512 | | if ( window.getComputedStyle ) { |
3513 | | support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; |
3514 | | support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; |
3515 | | |
3516 | | // Check if div with explicit width and no margin-right incorrectly |
3517 | | // gets computed margin-right based on width of container. (#3333) |
3518 | | // Fails in WebKit before Feb 2011 nightlies |
3519 | | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
3520 | | marginDiv = div.appendChild( document.createElement("div") ); |
3521 | | marginDiv.style.cssText = div.style.cssText = divReset; |
3522 | | marginDiv.style.marginRight = marginDiv.style.width = "0"; |
3523 | | div.style.width = "1px"; |
3524 | | |
3525 | | support.reliableMarginRight = |
3526 | | !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); |
3527 | | } |
3528 | | |
3529 | | if ( typeof div.style.zoom !== core_strundefined ) { |
| 3548 | container = document.createElement( "div" ); |
| 3549 | container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; |
| 3550 | |
| 3551 | div = document.createElement( "div" ); |
| 3552 | body.appendChild( container ).appendChild( div ); |
| 3553 | |
| 3554 | if ( typeof div.style.zoom !== strundefined ) { |
| 3555 | // Support: IE<8 |
| 3556 | // Check if natively block-level elements act like inline-block |
| 3557 | // elements when setting their display to 'inline' and giving |
| 3558 | // them layout |
| 3559 | div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; |
| 3560 | |
| 3561 | if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { |
| 3562 | // Prevent IE 6 from affecting layout for positioned elements #11048 |
| 3563 | // Prevent IE from shrinking the body in IE 7 mode #12869 |
4047 | | var nodeHook, boolHook, |
4048 | | rclass = /[\t\r\n\f]/g, |
4049 | | rreturn = /\r/g, |
4050 | | rfocusable = /^(?:input|select|textarea|button|object)$/i, |
4051 | | rclickable = /^(?:a|area)$/i, |
4052 | | ruseDefault = /^(?:checked|selected)$/i, |
4053 | | getSetAttribute = jQuery.support.getSetAttribute, |
4054 | | getSetInput = jQuery.support.input; |
4055 | | |
4056 | | jQuery.fn.extend({ |
4057 | | attr: function( name, value ) { |
4058 | | return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); |
4059 | | }, |
4060 | | |
4061 | | removeAttr: function( name ) { |
4062 | | return this.each(function() { |
4063 | | jQuery.removeAttr( this, name ); |
| 4070 | var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; |
| 4071 | |
| 4072 | var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
| 4073 | |
| 4074 | var isHidden = function( elem, el ) { |
| 4075 | // isHidden might be called from jQuery#filter function; |
| 4076 | // in that case, element will be second argument |
| 4077 | elem = el || elem; |
| 4078 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); |
| 4079 | }; |
| 4080 | |
| 4081 | |
| 4082 | |
| 4083 | // Multifunctional method to get and set values of a collection |
| 4084 | // The value/s can optionally be executed if it's a function |
| 4085 | var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
| 4086 | var i = 0, |
| 4087 | length = elems.length, |
| 4088 | bulk = key == null; |
| 4089 | |
| 4090 | // Sets many values |
| 4091 | if ( jQuery.type( key ) === "object" ) { |
| 4092 | chainable = true; |
| 4093 | for ( i in key ) { |
| 4094 | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); |
| 4095 | } |
| 4096 | |
| 4097 | // Sets one value |
| 4098 | } else if ( value !== undefined ) { |
| 4099 | chainable = true; |
| 4100 | |
| 4101 | if ( !jQuery.isFunction( value ) ) { |
| 4102 | raw = true; |
| 4103 | } |
| 4104 | |
| 4105 | if ( bulk ) { |
| 4106 | // Bulk operations run against the entire set |
| 4107 | if ( raw ) { |
| 4108 | fn.call( elems, value ); |
| 4109 | fn = null; |
| 4110 | |
| 4111 | // ...except when executing function values |
| 4112 | } else { |
| 4113 | bulk = fn; |
| 4114 | fn = function( elem, key, value ) { |
| 4115 | return bulk.call( jQuery( elem ), value ); |
| 4116 | }; |
| 4117 | } |
| 4118 | } |
| 4119 | |
| 4120 | if ( fn ) { |
| 4121 | for ( ; i < length; i++ ) { |
| 4122 | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); |
| 4123 | } |
| 4124 | } |
| 4125 | } |
| 4126 | |
| 4127 | return chainable ? |
| 4128 | elems : |
| 4129 | |
| 4130 | // Gets |
| 4131 | bulk ? |
| 4132 | fn.call( elems ) : |
| 4133 | length ? fn( elems[0], key ) : emptyGet; |
| 4134 | }; |
| 4135 | var rcheckableType = (/^(?:checkbox|radio)$/i); |
| 4136 | |
| 4137 | |
| 4138 | |
| 4139 | (function() { |
| 4140 | var fragment = document.createDocumentFragment(), |
| 4141 | div = document.createElement("div"), |
| 4142 | input = document.createElement("input"); |
| 4143 | |
| 4144 | // Setup |
| 4145 | div.setAttribute( "className", "t" ); |
| 4146 | div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; |
| 4147 | |
| 4148 | // IE strips leading whitespace when .innerHTML is used |
| 4149 | support.leadingWhitespace = div.firstChild.nodeType === 3; |
| 4150 | |
| 4151 | // Make sure that tbody elements aren't automatically inserted |
| 4152 | // IE will insert them into empty tables |
| 4153 | support.tbody = !div.getElementsByTagName( "tbody" ).length; |
| 4154 | |
| 4155 | // Make sure that link elements get serialized correctly by innerHTML |
| 4156 | // This requires a wrapper element in IE |
| 4157 | support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; |
| 4158 | |
| 4159 | // Makes sure cloning an html5 element does not cause problems |
| 4160 | // Where outerHTML is undefined, this still works |
| 4161 | support.html5Clone = |
| 4162 | document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; |
| 4163 | |
| 4164 | // Check if a disconnected checkbox will retain its checked |
| 4165 | // value of true after appended to the DOM (IE6/7) |
| 4166 | input.type = "checkbox"; |
| 4167 | input.checked = true; |
| 4168 | fragment.appendChild( input ); |
| 4169 | support.appendChecked = input.checked; |
| 4170 | |
| 4171 | // Make sure textarea (and checkbox) defaultValue is properly cloned |
| 4172 | // Support: IE6-IE11+ |
| 4173 | div.innerHTML = "<textarea>x</textarea>"; |
| 4174 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
| 4175 | |
| 4176 | // #11217 - WebKit loses check when the name is after the checked attribute |
| 4177 | fragment.appendChild( div ); |
| 4178 | div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; |
| 4179 | |
| 4180 | // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 |
| 4181 | // old WebKit doesn't clone checked state correctly in fragments |
| 4182 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
| 4183 | |
| 4184 | // Support: IE<9 |
| 4185 | // Opera does not clone events (and typeof div.attachEvent === undefined). |
| 4186 | // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() |
| 4187 | support.noCloneEvent = true; |
| 4188 | if ( div.attachEvent ) { |
| 4189 | div.attachEvent( "onclick", function() { |
| 4190 | support.noCloneEvent = false; |
4065 | | }, |
4066 | | |
4067 | | prop: function( name, value ) { |
4068 | | return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); |
4069 | | }, |
4070 | | |
4071 | | removeProp: function( name ) { |
4072 | | name = jQuery.propFix[ name ] || name; |
4073 | | return this.each(function() { |
4074 | | // try/catch handles cases where IE balks (such as removing a property on window) |
4075 | | try { |
4076 | | this[ name ] = undefined; |
4077 | | delete this[ name ]; |
4078 | | } catch( e ) {} |
4079 | | }); |
4080 | | }, |
4081 | | |
4082 | | addClass: function( value ) { |
4083 | | var classes, elem, cur, clazz, j, |
4084 | | i = 0, |
4085 | | len = this.length, |
4086 | | proceed = typeof value === "string" && value; |
4087 | | |
4088 | | if ( jQuery.isFunction( value ) ) { |
4089 | | return this.each(function( j ) { |
4090 | | jQuery( this ).addClass( value.call( this, j, this.className ) ); |
4091 | | }); |
4092 | | } |
4093 | | |
4094 | | if ( proceed ) { |
4095 | | // The disjunction here is for better compressibility (see removeClass) |
4096 | | classes = ( value || "" ).match( core_rnotwhite ) || []; |
4097 | | |
4098 | | for ( ; i < len; i++ ) { |
4099 | | elem = this[ i ]; |
4100 | | cur = elem.nodeType === 1 && ( elem.className ? |
4101 | | ( " " + elem.className + " " ).replace( rclass, " " ) : |
4102 | | " " |
4103 | | ); |
4104 | | |
4105 | | if ( cur ) { |
4106 | | j = 0; |
4107 | | while ( (clazz = classes[j++]) ) { |
4108 | | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
4109 | | cur += clazz + " "; |
4110 | | } |
4111 | | } |
4112 | | elem.className = jQuery.trim( cur ); |
4113 | | |
4114 | | } |
4115 | | } |
4116 | | } |
4117 | | |
4118 | | return this; |
4119 | | }, |
4120 | | |
4121 | | removeClass: function( value ) { |
4122 | | var classes, elem, cur, clazz, j, |
4123 | | i = 0, |
4124 | | len = this.length, |
4125 | | proceed = arguments.length === 0 || typeof value === "string" && value; |
4126 | | |
4127 | | if ( jQuery.isFunction( value ) ) { |
4128 | | return this.each(function( j ) { |
4129 | | jQuery( this ).removeClass( value.call( this, j, this.className ) ); |
4130 | | }); |
4131 | | } |
4132 | | if ( proceed ) { |
4133 | | classes = ( value || "" ).match( core_rnotwhite ) || []; |
4134 | | |
4135 | | for ( ; i < len; i++ ) { |
4136 | | elem = this[ i ]; |
4137 | | // This expression is here for better compressibility (see addClass) |
4138 | | cur = elem.nodeType === 1 && ( elem.className ? |
4139 | | ( " " + elem.className + " " ).replace( rclass, " " ) : |
4140 | | "" |
4141 | | ); |
4142 | | |
4143 | | if ( cur ) { |
4144 | | j = 0; |
4145 | | while ( (clazz = classes[j++]) ) { |
4146 | | // Remove *all* instances |
4147 | | while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { |
4148 | | cur = cur.replace( " " + clazz + " ", " " ); |
4149 | | } |
4150 | | } |
4151 | | elem.className = value ? jQuery.trim( cur ) : ""; |
4152 | | } |
4153 | | } |
4154 | | } |
4155 | | |
4156 | | return this; |
4157 | | }, |
4158 | | |
4159 | | toggleClass: function( value, stateVal ) { |
4160 | | var type = typeof value; |
4161 | | |
4162 | | if ( typeof stateVal === "boolean" && type === "string" ) { |
4163 | | return stateVal ? this.addClass( value ) : this.removeClass( value ); |
4164 | | } |
4165 | | |
4166 | | if ( jQuery.isFunction( value ) ) { |
4167 | | return this.each(function( i ) { |
4168 | | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); |
4169 | | }); |
4170 | | } |
4171 | | |
4172 | | return this.each(function() { |
4173 | | if ( type === "string" ) { |
4174 | | // toggle individual class names |
4175 | | var className, |
4176 | | i = 0, |
4177 | | self = jQuery( this ), |
4178 | | classNames = value.match( core_rnotwhite ) || []; |
4179 | | |
4180 | | while ( (className = classNames[ i++ ]) ) { |
4181 | | // check each className given, space separated list |
4182 | | if ( self.hasClass( className ) ) { |
4183 | | self.removeClass( className ); |
4184 | | } else { |
4185 | | self.addClass( className ); |
4186 | | } |
4187 | | } |
4188 | | |
4189 | | // Toggle whole class name |
4190 | | } else if ( type === core_strundefined || type === "boolean" ) { |
4191 | | if ( this.className ) { |
4192 | | // store className if set |
4193 | | jQuery._data( this, "__className__", this.className ); |
4194 | | } |
4195 | | |
4196 | | // If the element has a class name or if we're passed "false", |
4197 | | // then remove the whole classname (if there was one, the above saved it). |
4198 | | // Otherwise bring back whatever was previously saved (if anything), |
4199 | | // falling back to the empty string if nothing was stored. |
4200 | | this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; |
4201 | | } |
4202 | | }); |
4203 | | }, |
4204 | | |
4205 | | hasClass: function( selector ) { |
4206 | | var className = " " + selector + " ", |
4207 | | i = 0, |
4208 | | l = this.length; |
4209 | | for ( ; i < l; i++ ) { |
4210 | | if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { |
4211 | | return true; |
4212 | | } |
4213 | | } |
4214 | | |
4215 | | return false; |
4216 | | }, |
4217 | | |
4218 | | val: function( value ) { |
4219 | | var ret, hooks, isFunction, |
4220 | | elem = this[0]; |
4221 | | |
4222 | | if ( !arguments.length ) { |
4223 | | if ( elem ) { |
4224 | | hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
4225 | | |
4226 | | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
4227 | | return ret; |
4228 | | } |
4229 | | |
4230 | | ret = elem.value; |
4231 | | |
4232 | | return typeof ret === "string" ? |
4233 | | // handle most common string cases |
4234 | | ret.replace(rreturn, "") : |
4235 | | // handle cases where value is null/undef or number |
4236 | | ret == null ? "" : ret; |
4237 | | } |
4238 | | |
4239 | | return; |
4240 | | } |
4241 | | |
4242 | | isFunction = jQuery.isFunction( value ); |
4243 | | |
4244 | | return this.each(function( i ) { |
4245 | | var val; |
4246 | | |
4247 | | if ( this.nodeType !== 1 ) { |
4248 | | return; |
4249 | | } |
4250 | | |
4251 | | if ( isFunction ) { |
4252 | | val = value.call( this, i, jQuery( this ).val() ); |
4253 | | } else { |
4254 | | val = value; |
4255 | | } |
4256 | | |
4257 | | // Treat null/undefined as ""; convert numbers to string |
4258 | | if ( val == null ) { |
4259 | | val = ""; |
4260 | | } else if ( typeof val === "number" ) { |
4261 | | val += ""; |
4262 | | } else if ( jQuery.isArray( val ) ) { |
4263 | | val = jQuery.map(val, function ( value ) { |
4264 | | return value == null ? "" : value + ""; |
4265 | | }); |
4266 | | } |
4267 | | |
4268 | | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
4269 | | |
4270 | | // If set returns undefined, fall back to normal setting |
4271 | | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { |
4272 | | this.value = val; |
4273 | | } |
4274 | | }); |
4275 | | } |
4276 | | }); |
4277 | | |
4278 | | jQuery.extend({ |
4279 | | valHooks: { |
4280 | | option: { |
4281 | | get: function( elem ) { |
4282 | | // Use proper attribute retrieval(#6932, #12072) |
4283 | | var val = jQuery.find.attr( elem, "value" ); |
4284 | | return val != null ? |
4285 | | val : |
4286 | | elem.text; |
4287 | | } |
4288 | | }, |
4289 | | select: { |
4290 | | get: function( elem ) { |
4291 | | var value, option, |
4292 | | options = elem.options, |
4293 | | index = elem.selectedIndex, |
4294 | | one = elem.type === "select-one" || index < 0, |
4295 | | values = one ? null : [], |
4296 | | max = one ? index + 1 : options.length, |
4297 | | i = index < 0 ? |
4298 | | max : |
4299 | | one ? index : 0; |
4300 | | |
4301 | | // Loop through all the selected options |
4302 | | for ( ; i < max; i++ ) { |
4303 | | option = options[ i ]; |
4304 | | |
4305 | | // oldIE doesn't update selected after form reset (#2551) |
4306 | | if ( ( option.selected || i === index ) && |
4307 | | // Don't return options that are disabled or in a disabled optgroup |
4308 | | ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && |
4309 | | ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
4310 | | |
4311 | | // Get the specific value for the option |
4312 | | value = jQuery( option ).val(); |
4313 | | |
4314 | | // We don't need an array for one selects |
4315 | | if ( one ) { |
4316 | | return value; |
4317 | | } |
4318 | | |
4319 | | // Multi-Selects return an array |
4320 | | values.push( value ); |
4321 | | } |
4322 | | } |
4323 | | |
4324 | | return values; |
4325 | | }, |
4326 | | |
4327 | | set: function( elem, value ) { |
4328 | | var optionSet, option, |
4329 | | options = elem.options, |
4330 | | values = jQuery.makeArray( value ), |
4331 | | i = options.length; |
4332 | | |
4333 | | while ( i-- ) { |
4334 | | option = options[ i ]; |
4335 | | if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { |
4336 | | optionSet = true; |
4337 | | } |
4338 | | } |
4339 | | |
4340 | | // force browsers to behave consistently when non-matching value is set |
4341 | | if ( !optionSet ) { |
4342 | | elem.selectedIndex = -1; |
4343 | | } |
4344 | | return values; |
4345 | | } |
4346 | | } |
4347 | | }, |
4348 | | |
4349 | | attr: function( elem, name, value ) { |
4350 | | var hooks, ret, |
4351 | | nType = elem.nodeType; |
4352 | | |
4353 | | // don't get/set attributes on text, comment and attribute nodes |
4354 | | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
4355 | | return; |
4356 | | } |
4357 | | |
4358 | | // Fallback to prop when attributes are not supported |
4359 | | if ( typeof elem.getAttribute === core_strundefined ) { |
4360 | | return jQuery.prop( elem, name, value ); |
4361 | | } |
4362 | | |
4363 | | // All attributes are lowercase |
4364 | | // Grab necessary hook if one is defined |
4365 | | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
4366 | | name = name.toLowerCase(); |
4367 | | hooks = jQuery.attrHooks[ name ] || |
4368 | | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); |
4369 | | } |
4370 | | |
4371 | | if ( value !== undefined ) { |
4372 | | |
4373 | | if ( value === null ) { |
4374 | | jQuery.removeAttr( elem, name ); |
4375 | | |
4376 | | } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
4377 | | return ret; |
4378 | | |
4379 | | } else { |
4380 | | elem.setAttribute( name, value + "" ); |
4381 | | return value; |
4382 | | } |
4383 | | |
4384 | | } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
4385 | | return ret; |
4386 | | |
4387 | | } else { |
4388 | | ret = jQuery.find.attr( elem, name ); |
4389 | | |
4390 | | // Non-existent attributes return null, we normalize to undefined |
4391 | | return ret == null ? |
4392 | | undefined : |
4393 | | ret; |
4394 | | } |
4395 | | }, |
4396 | | |
4397 | | removeAttr: function( elem, value ) { |
4398 | | var name, propName, |
4399 | | i = 0, |
4400 | | attrNames = value && value.match( core_rnotwhite ); |
4401 | | |
4402 | | if ( attrNames && elem.nodeType === 1 ) { |
4403 | | while ( (name = attrNames[i++]) ) { |
4404 | | propName = jQuery.propFix[ name ] || name; |
4405 | | |
4406 | | // Boolean attributes get special treatment (#10870) |
4407 | | if ( jQuery.expr.match.bool.test( name ) ) { |
4408 | | // Set corresponding property to false |
4409 | | if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { |
4410 | | elem[ propName ] = false; |
4411 | | // Support: IE<9 |
4412 | | // Also clear defaultChecked/defaultSelected (if appropriate) |
4413 | | } else { |
4414 | | elem[ jQuery.camelCase( "default-" + name ) ] = |
4415 | | elem[ propName ] = false; |
4416 | | } |
4417 | | |
4418 | | // See #9699 for explanation of this approach (setting first, then removal) |
4419 | | } else { |
4420 | | jQuery.attr( elem, name, "" ); |
4421 | | } |
4422 | | |
4423 | | elem.removeAttribute( getSetAttribute ? name : propName ); |
4424 | | } |
4425 | | } |
4426 | | }, |
4427 | | |
4428 | | attrHooks: { |
4429 | | type: { |
4430 | | set: function( elem, value ) { |
4431 | | if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { |
4432 | | // Setting the type on a radio button after the value resets the value in IE6-9 |
4433 | | // Reset value to default in case type is set after value during creation |
4434 | | var val = elem.value; |
4435 | | elem.setAttribute( "type", value ); |
4436 | | if ( val ) { |
4437 | | elem.value = val; |
4438 | | } |
4439 | | return value; |
4440 | | } |
4441 | | } |
4442 | | } |
4443 | | }, |
4444 | | |
4445 | | propFix: { |
4446 | | "for": "htmlFor", |
4447 | | "class": "className" |
4448 | | }, |
4449 | | |
4450 | | prop: function( elem, name, value ) { |
4451 | | var ret, hooks, notxml, |
4452 | | nType = elem.nodeType; |
4453 | | |
4454 | | // don't get/set properties on text, comment and attribute nodes |
4455 | | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
4456 | | return; |
4457 | | } |
4458 | | |
4459 | | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
4460 | | |
4461 | | if ( notxml ) { |
4462 | | // Fix name and attach hooks |
4463 | | name = jQuery.propFix[ name ] || name; |
4464 | | hooks = jQuery.propHooks[ name ]; |
4465 | | } |
4466 | | |
4467 | | if ( value !== undefined ) { |
4468 | | return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? |
4469 | | ret : |
4470 | | ( elem[ name ] = value ); |
4471 | | |
4472 | | } else { |
4473 | | return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? |
4474 | | ret : |
4475 | | elem[ name ]; |
4476 | | } |
4477 | | }, |
4478 | | |
4479 | | propHooks: { |
4480 | | tabIndex: { |
4481 | | get: function( elem ) { |
4482 | | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
4483 | | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
4484 | | // Use proper attribute retrieval(#12072) |
4485 | | var tabindex = jQuery.find.attr( elem, "tabindex" ); |
4486 | | |
4487 | | return tabindex ? |
4488 | | parseInt( tabindex, 10 ) : |
4489 | | rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
4490 | | 0 : |
4491 | | -1; |
4492 | | } |
4493 | | } |
4494 | | } |
4495 | | }); |
4496 | | |
4497 | | // Hooks for boolean attributes |
4498 | | boolHook = { |
4499 | | set: function( elem, value, name ) { |
4500 | | if ( value === false ) { |
4501 | | // Remove boolean attributes when set to false |
4502 | | jQuery.removeAttr( elem, name ); |
4503 | | } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { |
4504 | | // IE<8 needs the *property* name |
4505 | | elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); |
4506 | | |
4507 | | // Use defaultChecked and defaultSelected for oldIE |
4508 | | } else { |
4509 | | elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; |
4510 | | } |
4511 | | |
4512 | | return name; |
4513 | | } |
4514 | | }; |
4515 | | jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { |
4516 | | var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; |
4517 | | |
4518 | | jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? |
4519 | | function( elem, name, isXML ) { |
4520 | | var fn = jQuery.expr.attrHandle[ name ], |
4521 | | ret = isXML ? |
4522 | | undefined : |
4523 | | /* jshint eqeqeq: false */ |
4524 | | (jQuery.expr.attrHandle[ name ] = undefined) != |
4525 | | getter( elem, name, isXML ) ? |
4526 | | |
4527 | | name.toLowerCase() : |
4528 | | null; |
4529 | | jQuery.expr.attrHandle[ name ] = fn; |
4530 | | return ret; |
4531 | | } : |
4532 | | function( elem, name, isXML ) { |
4533 | | return isXML ? |
4534 | | undefined : |
4535 | | elem[ jQuery.camelCase( "default-" + name ) ] ? |
4536 | | name.toLowerCase() : |
4537 | | null; |
4538 | | }; |
4539 | | }); |
4540 | | |
4541 | | // fix oldIE attroperties |
4542 | | if ( !getSetInput || !getSetAttribute ) { |
4543 | | jQuery.attrHooks.value = { |
4544 | | set: function( elem, value, name ) { |
4545 | | if ( jQuery.nodeName( elem, "input" ) ) { |
4546 | | // Does not return so that setAttribute is also used |
4547 | | elem.defaultValue = value; |
4548 | | } else { |
4549 | | // Use nodeHook if defined (#1954); otherwise setAttribute is fine |
4550 | | return nodeHook && nodeHook.set( elem, value, name ); |
4551 | | } |
4552 | | } |
4553 | | }; |
4554 | | } |
4555 | | |
4556 | | // IE6/7 do not support getting/setting some attributes with get/setAttribute |
4557 | | if ( !getSetAttribute ) { |
4558 | | |
4559 | | // Use this for any attribute in IE6/7 |
4560 | | // This fixes almost every IE6/7 issue |
4561 | | nodeHook = { |
4562 | | set: function( elem, value, name ) { |
4563 | | // Set the existing or create a new attribute node |
4564 | | var ret = elem.getAttributeNode( name ); |
4565 | | if ( !ret ) { |
4566 | | elem.setAttributeNode( |
4567 | | (ret = elem.ownerDocument.createAttribute( name )) |
4568 | | ); |
4569 | | } |
4570 | | |
4571 | | ret.value = value += ""; |
4572 | | |
4573 | | // Break association with cloned elements by also using setAttribute (#9646) |
4574 | | return name === "value" || value === elem.getAttribute( name ) ? |
4575 | | value : |
4576 | | undefined; |
4577 | | } |
4578 | | }; |
4579 | | jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = |
4580 | | // Some attributes are constructed with empty-string values when not defined |
4581 | | function( elem, name, isXML ) { |
4582 | | var ret; |
4583 | | return isXML ? |
4584 | | undefined : |
4585 | | (ret = elem.getAttributeNode( name )) && ret.value !== "" ? |
4586 | | ret.value : |
4587 | | null; |
4588 | | }; |
4589 | | jQuery.valHooks.button = { |
4590 | | get: function( elem, name ) { |
4591 | | var ret = elem.getAttributeNode( name ); |
4592 | | return ret && ret.specified ? |
4593 | | ret.value : |
4594 | | undefined; |
4595 | | }, |
4596 | | set: nodeHook.set |
4597 | | }; |
4598 | | |
4599 | | // Set contenteditable to false on removals(#10429) |
4600 | | // Setting to empty string throws an error as an invalid value |
4601 | | jQuery.attrHooks.contenteditable = { |
4602 | | set: function( elem, value, name ) { |
4603 | | nodeHook.set( elem, value === "" ? false : value, name ); |
4604 | | } |
4605 | | }; |
4606 | | |
4607 | | // Set width and height to auto instead of 0 on empty string( Bug #8150 ) |
4608 | | // This is for removals |
4609 | | jQuery.each([ "width", "height" ], function( i, name ) { |
4610 | | jQuery.attrHooks[ name ] = { |
4611 | | set: function( elem, value ) { |
4612 | | if ( value === "" ) { |
4613 | | elem.setAttribute( name, "auto" ); |
4614 | | return value; |
4615 | | } |
4616 | | } |
4617 | | }; |
4618 | | }); |
4619 | | } |
4620 | | |
4621 | | |
4622 | | // Some attributes require a special call on IE |
4623 | | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
4624 | | if ( !jQuery.support.hrefNormalized ) { |
4625 | | // href/src property should get the full normalized URL (#10299/#12915) |
4626 | | jQuery.each([ "href", "src" ], function( i, name ) { |
4627 | | jQuery.propHooks[ name ] = { |
4628 | | get: function( elem ) { |
4629 | | return elem.getAttribute( name, 4 ); |
4630 | | } |
4631 | | }; |
4632 | | }); |
4633 | | } |
4634 | | |
4635 | | if ( !jQuery.support.style ) { |
4636 | | jQuery.attrHooks.style = { |
4637 | | get: function( elem ) { |
4638 | | // Return undefined in the case of empty string |
4639 | | // Note: IE uppercases css property names, but if we were to .toLowerCase() |
4640 | | // .cssText, that would destroy case senstitivity in URL's, like in "background" |
4641 | | return elem.style.cssText || undefined; |
4642 | | }, |
4643 | | set: function( elem, value ) { |
4644 | | return ( elem.style.cssText = value + "" ); |
4645 | | } |
4646 | | }; |
4647 | | } |
4648 | | |
4649 | | // Safari mis-reports the default selected property of an option |
4650 | | // Accessing the parent's selectedIndex property fixes it |
4651 | | if ( !jQuery.support.optSelected ) { |
4652 | | jQuery.propHooks.selected = { |
4653 | | get: function( elem ) { |
4654 | | var parent = elem.parentNode; |
4655 | | |
4656 | | if ( parent ) { |
4657 | | parent.selectedIndex; |
4658 | | |
4659 | | // Make sure that it also works with optgroups, see #5701 |
4660 | | if ( parent.parentNode ) { |
4661 | | parent.parentNode.selectedIndex; |
4662 | | } |
4663 | | } |
4664 | | return null; |
4665 | | } |
4666 | | }; |
4667 | | } |
4668 | | |
4669 | | jQuery.each([ |
4670 | | "tabIndex", |
4671 | | "readOnly", |
4672 | | "maxLength", |
4673 | | "cellSpacing", |
4674 | | "cellPadding", |
4675 | | "rowSpan", |
4676 | | "colSpan", |
4677 | | "useMap", |
4678 | | "frameBorder", |
4679 | | "contentEditable" |
4680 | | ], function() { |
4681 | | jQuery.propFix[ this.toLowerCase() ] = this; |
4682 | | }); |
4683 | | |
4684 | | // IE6/7 call enctype encoding |
4685 | | if ( !jQuery.support.enctype ) { |
4686 | | jQuery.propFix.enctype = "encoding"; |
4687 | | } |
4688 | | |
4689 | | // Radios and checkboxes getter/setter |
4690 | | jQuery.each([ "radio", "checkbox" ], function() { |
4691 | | jQuery.valHooks[ this ] = { |
4692 | | set: function( elem, value ) { |
4693 | | if ( jQuery.isArray( value ) ) { |
4694 | | return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); |
4695 | | } |
4696 | | } |
4697 | | }; |
4698 | | if ( !jQuery.support.checkOn ) { |
4699 | | jQuery.valHooks[ this ].get = function( elem ) { |
4700 | | // Support: Webkit |
4701 | | // "" is returned instead of "on" if a value isn't specified |
4702 | | return elem.getAttribute("value") === null ? "on" : elem.value; |
4703 | | }; |
4704 | | } |
4705 | | }); |
| 4192 | |
| 4193 | div.cloneNode( true ).click(); |
| 4194 | } |
| 4195 | |
| 4196 | // Execute the test only if not already executed in another module. |
| 4197 | if (support.deleteExpando == null) { |
| 4198 | // Support: IE<9 |
| 4199 | support.deleteExpando = true; |
| 4200 | try { |
| 4201 | delete div.test; |
| 4202 | } catch( e ) { |
| 4203 | support.deleteExpando = false; |
| 4204 | } |
| 4205 | } |
| 4206 | |
| 4207 | // Null elements to avoid leaks in IE. |
| 4208 | fragment = div = input = null; |
| 4209 | })(); |
| 4210 | |
| 4211 | |
| 4212 | (function() { |
| 4213 | var i, eventName, |
| 4214 | div = document.createElement( "div" ); |
| 4215 | |
| 4216 | // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) |
| 4217 | for ( i in { submit: true, change: true, focusin: true }) { |
| 4218 | eventName = "on" + i; |
| 4219 | |
| 4220 | if ( !(support[ i + "Bubbles" ] = eventName in window) ) { |
| 4221 | // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) |
| 4222 | div.setAttribute( eventName, "t" ); |
| 4223 | support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; |
| 4224 | } |
| 4225 | } |
| 4226 | |
| 4227 | // Null elements to avoid leaks in IE. |
| 4228 | div = null; |
| 4229 | })(); |
| 4230 | |
| 4231 | |
5701 | | var isSimple = /^.[^:#\[\.,]*$/, |
5702 | | rparentsprev = /^(?:parents|prev(?:Until|All))/, |
5703 | | rneedsContext = jQuery.expr.match.needsContext, |
5704 | | // methods guaranteed to produce a unique set when starting from a unique set |
5705 | | guaranteedUnique = { |
5706 | | children: true, |
5707 | | contents: true, |
5708 | | next: true, |
5709 | | prev: true |
5710 | | }; |
5711 | | |
5712 | | jQuery.fn.extend({ |
5713 | | find: function( selector ) { |
5714 | | var i, |
5715 | | ret = [], |
5716 | | self = this, |
5717 | | len = self.length; |
5718 | | |
5719 | | if ( typeof selector !== "string" ) { |
5720 | | return this.pushStack( jQuery( selector ).filter(function() { |
5721 | | for ( i = 0; i < len; i++ ) { |
5722 | | if ( jQuery.contains( self[ i ], this ) ) { |
5723 | | return true; |
5724 | | } |
5725 | | } |
5726 | | }) ); |
5727 | | } |
5728 | | |
5729 | | for ( i = 0; i < len; i++ ) { |
5730 | | jQuery.find( selector, self[ i ], ret ); |
5731 | | } |
5732 | | |
5733 | | // Needed because $( selector, context ) becomes $( context ).find( selector ) |
5734 | | ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); |
5735 | | ret.selector = this.selector ? this.selector + " " + selector : selector; |
5736 | | return ret; |
5737 | | }, |
5738 | | |
5739 | | has: function( target ) { |
5740 | | var i, |
5741 | | targets = jQuery( target, this ), |
5742 | | len = targets.length; |
5743 | | |
5744 | | return this.filter(function() { |
5745 | | for ( i = 0; i < len; i++ ) { |
5746 | | if ( jQuery.contains( this, targets[i] ) ) { |
5747 | | return true; |
5748 | | } |
5749 | | } |
5750 | | }); |
5751 | | }, |
5752 | | |
5753 | | not: function( selector ) { |
5754 | | return this.pushStack( winnow(this, selector || [], true) ); |
5755 | | }, |
5756 | | |
5757 | | filter: function( selector ) { |
5758 | | return this.pushStack( winnow(this, selector || [], false) ); |
5759 | | }, |
5760 | | |
5761 | | is: function( selector ) { |
5762 | | return !!winnow( |
5763 | | this, |
5764 | | |
5765 | | // If this is a positional/relative selector, check membership in the returned set |
5766 | | // so $("p:first").is("p:last") won't return true for a doc with two "p". |
5767 | | typeof selector === "string" && rneedsContext.test( selector ) ? |
5768 | | jQuery( selector ) : |
5769 | | selector || [], |
5770 | | false |
5771 | | ).length; |
5772 | | }, |
5773 | | |
5774 | | closest: function( selectors, context ) { |
5775 | | var cur, |
5776 | | i = 0, |
5777 | | l = this.length, |
5778 | | ret = [], |
5779 | | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
5780 | | jQuery( selectors, context || this.context ) : |
5781 | | 0; |
5782 | | |
5783 | | for ( ; i < l; i++ ) { |
5784 | | for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { |
5785 | | // Always skip document fragments |
5786 | | if ( cur.nodeType < 11 && (pos ? |
5787 | | pos.index(cur) > -1 : |
5788 | | |
5789 | | // Don't pass non-elements to Sizzle |
5790 | | cur.nodeType === 1 && |
5791 | | jQuery.find.matchesSelector(cur, selectors)) ) { |
5792 | | |
5793 | | cur = ret.push( cur ); |
5794 | | break; |
5795 | | } |
5796 | | } |
5797 | | } |
5798 | | |
5799 | | return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); |
5800 | | }, |
5801 | | |
5802 | | // Determine the position of an element within |
5803 | | // the matched set of elements |
5804 | | index: function( elem ) { |
5805 | | |
5806 | | // No argument, return index in parent |
5807 | | if ( !elem ) { |
5808 | | return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; |
5809 | | } |
5810 | | |
5811 | | // index in selector |
5812 | | if ( typeof elem === "string" ) { |
5813 | | return jQuery.inArray( this[0], jQuery( elem ) ); |
5814 | | } |
5815 | | |
5816 | | // Locate the position of the desired element |
5817 | | return jQuery.inArray( |
5818 | | // If it receives a jQuery object, the first element is used |
5819 | | elem.jquery ? elem[0] : elem, this ); |
5820 | | }, |
5821 | | |
5822 | | add: function( selector, context ) { |
5823 | | var set = typeof selector === "string" ? |
5824 | | jQuery( selector, context ) : |
5825 | | jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), |
5826 | | all = jQuery.merge( this.get(), set ); |
5827 | | |
5828 | | return this.pushStack( jQuery.unique(all) ); |
5829 | | }, |
5830 | | |
5831 | | addBack: function( selector ) { |
5832 | | return this.add( selector == null ? |
5833 | | this.prevObject : this.prevObject.filter(selector) |
5834 | | ); |
5835 | | } |
5836 | | }); |
5837 | | |
5838 | | function sibling( cur, dir ) { |
5839 | | do { |
5840 | | cur = cur[ dir ]; |
5841 | | } while ( cur && cur.nodeType !== 1 ); |
5842 | | |
5843 | | return cur; |
5844 | | } |
5845 | | |
5846 | | jQuery.each({ |
5847 | | parent: function( elem ) { |
5848 | | var parent = elem.parentNode; |
5849 | | return parent && parent.nodeType !== 11 ? parent : null; |
5850 | | }, |
5851 | | parents: function( elem ) { |
5852 | | return jQuery.dir( elem, "parentNode" ); |
5853 | | }, |
5854 | | parentsUntil: function( elem, i, until ) { |
5855 | | return jQuery.dir( elem, "parentNode", until ); |
5856 | | }, |
5857 | | next: function( elem ) { |
5858 | | return sibling( elem, "nextSibling" ); |
5859 | | }, |
5860 | | prev: function( elem ) { |
5861 | | return sibling( elem, "previousSibling" ); |
5862 | | }, |
5863 | | nextAll: function( elem ) { |
5864 | | return jQuery.dir( elem, "nextSibling" ); |
5865 | | }, |
5866 | | prevAll: function( elem ) { |
5867 | | return jQuery.dir( elem, "previousSibling" ); |
5868 | | }, |
5869 | | nextUntil: function( elem, i, until ) { |
5870 | | return jQuery.dir( elem, "nextSibling", until ); |
5871 | | }, |
5872 | | prevUntil: function( elem, i, until ) { |
5873 | | return jQuery.dir( elem, "previousSibling", until ); |
5874 | | }, |
5875 | | siblings: function( elem ) { |
5876 | | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); |
5877 | | }, |
5878 | | children: function( elem ) { |
5879 | | return jQuery.sibling( elem.firstChild ); |
5880 | | }, |
5881 | | contents: function( elem ) { |
5882 | | return jQuery.nodeName( elem, "iframe" ) ? |
5883 | | elem.contentDocument || elem.contentWindow.document : |
5884 | | jQuery.merge( [], elem.childNodes ); |
5885 | | } |
5886 | | }, function( name, fn ) { |
5887 | | jQuery.fn[ name ] = function( until, selector ) { |
5888 | | var ret = jQuery.map( this, fn, until ); |
5889 | | |
5890 | | if ( name.slice( -5 ) !== "Until" ) { |
5891 | | selector = until; |
5892 | | } |
5893 | | |
5894 | | if ( selector && typeof selector === "string" ) { |
5895 | | ret = jQuery.filter( selector, ret ); |
5896 | | } |
5897 | | |
5898 | | if ( this.length > 1 ) { |
5899 | | // Remove duplicates |
5900 | | if ( !guaranteedUnique[ name ] ) { |
5901 | | ret = jQuery.unique( ret ); |
5902 | | } |
5903 | | |
5904 | | // Reverse order for parents* and prev-derivatives |
5905 | | if ( rparentsprev.test( name ) ) { |
5906 | | ret = ret.reverse(); |
5907 | | } |
5908 | | } |
5909 | | |
5910 | | return this.pushStack( ret ); |
5911 | | }; |
5912 | | }); |
5913 | | |
5914 | | jQuery.extend({ |
5915 | | filter: function( expr, elems, not ) { |
5916 | | var elem = elems[ 0 ]; |
5917 | | |
5918 | | if ( not ) { |
5919 | | expr = ":not(" + expr + ")"; |
5920 | | } |
5921 | | |
5922 | | return elems.length === 1 && elem.nodeType === 1 ? |
5923 | | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : |
5924 | | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
5925 | | return elem.nodeType === 1; |
5926 | | })); |
5927 | | }, |
5928 | | |
5929 | | dir: function( elem, dir, until ) { |
5930 | | var matched = [], |
5931 | | cur = elem[ dir ]; |
5932 | | |
5933 | | while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { |
5934 | | if ( cur.nodeType === 1 ) { |
5935 | | matched.push( cur ); |
5936 | | } |
5937 | | cur = cur[dir]; |
5938 | | } |
5939 | | return matched; |
5940 | | }, |
5941 | | |
5942 | | sibling: function( n, elem ) { |
5943 | | var r = []; |
5944 | | |
5945 | | for ( ; n; n = n.nextSibling ) { |
5946 | | if ( n.nodeType === 1 && n !== elem ) { |
5947 | | r.push( n ); |
5948 | | } |
5949 | | } |
5950 | | |
5951 | | return r; |
5952 | | } |
5953 | | }); |
5954 | | |
5955 | | // Implement the identical functionality for filter and not |
5956 | | function winnow( elements, qualifier, not ) { |
5957 | | if ( jQuery.isFunction( qualifier ) ) { |
5958 | | return jQuery.grep( elements, function( elem, i ) { |
5959 | | /* jshint -W018 */ |
5960 | | return !!qualifier.call( elem, i, elem ) !== not; |
5961 | | }); |
5962 | | |
5963 | | } |
5964 | | |
5965 | | if ( qualifier.nodeType ) { |
5966 | | return jQuery.grep( elements, function( elem ) { |
5967 | | return ( elem === qualifier ) !== not; |
5968 | | }); |
5969 | | |
5970 | | } |
5971 | | |
5972 | | if ( typeof qualifier === "string" ) { |
5973 | | if ( isSimple.test( qualifier ) ) { |
5974 | | return jQuery.filter( qualifier, elements, not ); |
5975 | | } |
5976 | | |
5977 | | qualifier = jQuery.filter( qualifier, elements ); |
5978 | | } |
5979 | | |
5980 | | return jQuery.grep( elements, function( elem ) { |
5981 | | return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; |
5982 | | }); |
5983 | | } |
| 5245 | |
| 5246 | |
6037 | | jQuery.fn.extend({ |
6038 | | text: function( value ) { |
6039 | | return jQuery.access( this, function( value ) { |
6040 | | return value === undefined ? |
6041 | | jQuery.text( this ) : |
6042 | | this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); |
6043 | | }, null, value, arguments.length ); |
6044 | | }, |
6045 | | |
6046 | | append: function() { |
6047 | | return this.domManip( arguments, function( elem ) { |
6048 | | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
6049 | | var target = manipulationTarget( this, elem ); |
6050 | | target.appendChild( elem ); |
6051 | | } |
6052 | | }); |
6053 | | }, |
6054 | | |
6055 | | prepend: function() { |
6056 | | return this.domManip( arguments, function( elem ) { |
6057 | | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
6058 | | var target = manipulationTarget( this, elem ); |
6059 | | target.insertBefore( elem, target.firstChild ); |
6060 | | } |
6061 | | }); |
6062 | | }, |
6063 | | |
6064 | | before: function() { |
6065 | | return this.domManip( arguments, function( elem ) { |
6066 | | if ( this.parentNode ) { |
6067 | | this.parentNode.insertBefore( elem, this ); |
6068 | | } |
6069 | | }); |
6070 | | }, |
6071 | | |
6072 | | after: function() { |
6073 | | return this.domManip( arguments, function( elem ) { |
6074 | | if ( this.parentNode ) { |
6075 | | this.parentNode.insertBefore( elem, this.nextSibling ); |
6076 | | } |
6077 | | }); |
6078 | | }, |
6079 | | |
6080 | | // keepData is for internal use only--do not document |
6081 | | remove: function( selector, keepData ) { |
6082 | | var elem, |
6083 | | elems = selector ? jQuery.filter( selector, this ) : this, |
6084 | | i = 0; |
6085 | | |
6086 | | for ( ; (elem = elems[i]) != null; i++ ) { |
6087 | | |
6088 | | if ( !keepData && elem.nodeType === 1 ) { |
6089 | | jQuery.cleanData( getAll( elem ) ); |
6090 | | } |
6091 | | |
6092 | | if ( elem.parentNode ) { |
6093 | | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { |
6094 | | setGlobalEval( getAll( elem, "script" ) ); |
6095 | | } |
6096 | | elem.parentNode.removeChild( elem ); |
6097 | | } |
6098 | | } |
6099 | | |
6100 | | return this; |
6101 | | }, |
6102 | | |
6103 | | empty: function() { |
6104 | | var elem, |
6105 | | i = 0; |
6106 | | |
6107 | | for ( ; (elem = this[i]) != null; i++ ) { |
6108 | | // Remove element nodes and prevent memory leaks |
6109 | | if ( elem.nodeType === 1 ) { |
6110 | | jQuery.cleanData( getAll( elem, false ) ); |
6111 | | } |
6112 | | |
6113 | | // Remove any remaining nodes |
6114 | | while ( elem.firstChild ) { |
6115 | | elem.removeChild( elem.firstChild ); |
6116 | | } |
6117 | | |
6118 | | // If this is a select, ensure that it displays empty (#12336) |
6119 | | // Support: IE<9 |
6120 | | if ( elem.options && jQuery.nodeName( elem, "select" ) ) { |
6121 | | elem.options.length = 0; |
6122 | | } |
6123 | | } |
6124 | | |
6125 | | return this; |
6126 | | }, |
6127 | | |
6128 | | clone: function( dataAndEvents, deepDataAndEvents ) { |
6129 | | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
6130 | | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
6131 | | |
6132 | | return this.map( function () { |
6133 | | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
6134 | | }); |
6135 | | }, |
6136 | | |
6137 | | html: function( value ) { |
6138 | | return jQuery.access( this, function( value ) { |
6139 | | var elem = this[0] || {}, |
6140 | | i = 0, |
6141 | | l = this.length; |
6142 | | |
6143 | | if ( value === undefined ) { |
6144 | | return elem.nodeType === 1 ? |
6145 | | elem.innerHTML.replace( rinlinejQuery, "" ) : |
6146 | | undefined; |
6147 | | } |
6148 | | |
6149 | | // See if we can take a shortcut and just use innerHTML |
6150 | | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
6151 | | ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && |
6152 | | ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && |
6153 | | !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { |
6154 | | |
6155 | | value = value.replace( rxhtmlTag, "<$1></$2>" ); |
6156 | | |
6157 | | try { |
6158 | | for (; i < l; i++ ) { |
6159 | | // Remove element nodes and prevent memory leaks |
6160 | | elem = this[i] || {}; |
6161 | | if ( elem.nodeType === 1 ) { |
6162 | | jQuery.cleanData( getAll( elem, false ) ); |
6163 | | elem.innerHTML = value; |
6164 | | } |
6165 | | } |
6166 | | |
6167 | | elem = 0; |
6168 | | |
6169 | | // If using innerHTML throws an exception, use the fallback method |
6170 | | } catch(e) {} |
6171 | | } |
6172 | | |
6173 | | if ( elem ) { |
6174 | | this.empty().append( value ); |
6175 | | } |
6176 | | }, null, value, arguments.length ); |
6177 | | }, |
6178 | | |
6179 | | replaceWith: function() { |
6180 | | var |
6181 | | // Snapshot the DOM in case .domManip sweeps something relevant into its fragment |
6182 | | args = jQuery.map( this, function( elem ) { |
6183 | | return [ elem.nextSibling, elem.parentNode ]; |
6184 | | }), |
6185 | | i = 0; |
6186 | | |
6187 | | // Make the changes, replacing each context element with the new content |
6188 | | this.domManip( arguments, function( elem ) { |
6189 | | var next = args[ i++ ], |
6190 | | parent = args[ i++ ]; |
6191 | | |
6192 | | if ( parent ) { |
6193 | | // Don't use the snapshot next if it has moved (#13810) |
6194 | | if ( next && next.parentNode !== parent ) { |
6195 | | next = this.nextSibling; |
6196 | | } |
6197 | | jQuery( this ).remove(); |
6198 | | parent.insertBefore( elem, next ); |
6199 | | } |
6200 | | // Allow new content to include elements from the context set |
6201 | | }, true ); |
6202 | | |
6203 | | // Force removal if there was no new content (e.g., from empty arguments) |
6204 | | return i ? this : this.remove(); |
6205 | | }, |
6206 | | |
6207 | | detach: function( selector ) { |
6208 | | return this.remove( selector, true ); |
6209 | | }, |
6210 | | |
6211 | | domManip: function( args, callback, allowIntersection ) { |
6212 | | |
6213 | | // Flatten any nested arrays |
6214 | | args = core_concat.apply( [], args ); |
6215 | | |
6216 | | var first, node, hasScripts, |
6217 | | scripts, doc, fragment, |
6218 | | i = 0, |
6219 | | l = this.length, |
6220 | | set = this, |
6221 | | iNoClone = l - 1, |
6222 | | value = args[0], |
6223 | | isFunction = jQuery.isFunction( value ); |
6224 | | |
6225 | | // We can't cloneNode fragments that contain checked, in WebKit |
6226 | | if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { |
6227 | | return this.each(function( index ) { |
6228 | | var self = set.eq( index ); |
6229 | | if ( isFunction ) { |
6230 | | args[0] = value.call( this, index, self.html() ); |
6231 | | } |
6232 | | self.domManip( args, callback, allowIntersection ); |
6233 | | }); |
6234 | | } |
6235 | | |
6236 | | if ( l ) { |
6237 | | fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); |
6238 | | first = fragment.firstChild; |
6239 | | |
6240 | | if ( fragment.childNodes.length === 1 ) { |
6241 | | fragment = first; |
6242 | | } |
6243 | | |
6244 | | if ( first ) { |
6245 | | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
6246 | | hasScripts = scripts.length; |
6247 | | |
6248 | | // Use the original fragment for the last item instead of the first because it can end up |
6249 | | // being emptied incorrectly in certain situations (#8070). |
6250 | | for ( ; i < l; i++ ) { |
6251 | | node = fragment; |
6252 | | |
6253 | | if ( i !== iNoClone ) { |
6254 | | node = jQuery.clone( node, true, true ); |
6255 | | |
6256 | | // Keep references to cloned scripts for later restoration |
6257 | | if ( hasScripts ) { |
6258 | | jQuery.merge( scripts, getAll( node, "script" ) ); |
6259 | | } |
6260 | | } |
6261 | | |
6262 | | callback.call( this[i], node, i ); |
6263 | | } |
6264 | | |
6265 | | if ( hasScripts ) { |
6266 | | doc = scripts[ scripts.length - 1 ].ownerDocument; |
6267 | | |
6268 | | // Reenable scripts |
6269 | | jQuery.map( scripts, restoreScript ); |
6270 | | |
6271 | | // Evaluate executable scripts on first document insertion |
6272 | | for ( i = 0; i < hasScripts; i++ ) { |
6273 | | node = scripts[ i ]; |
6274 | | if ( rscriptType.test( node.type || "" ) && |
6275 | | !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { |
6276 | | |
6277 | | if ( node.src ) { |
6278 | | // Hope ajax is available... |
6279 | | jQuery._evalUrl( node.src ); |
6280 | | } else { |
6281 | | jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); |
6282 | | } |
6283 | | } |
6284 | | } |
6285 | | } |
6286 | | |
6287 | | // Fix #11809: Avoid leaking memory |
6288 | | fragment = first = null; |
6289 | | } |
6290 | | } |
6291 | | |
6292 | | return this; |
6293 | | } |
6294 | | }); |
| 5299 | function getAll( context, tag ) { |
| 5300 | var elems, elem, |
| 5301 | i = 0, |
| 5302 | found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : |
| 5303 | typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : |
| 5304 | undefined; |
| 5305 | |
| 5306 | if ( !found ) { |
| 5307 | for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { |
| 5308 | if ( !tag || jQuery.nodeName( elem, tag ) ) { |
| 5309 | found.push( elem ); |
| 5310 | } else { |
| 5311 | jQuery.merge( found, getAll( elem, tag ) ); |
| 5312 | } |
| 5313 | } |
| 5314 | } |
| 5315 | |
| 5316 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? |
| 5317 | jQuery.merge( [ context ], found ) : |
| 5318 | found; |
| 5319 | } |
| 5320 | |
| 5321 | // Used in buildFragment, fixes the defaultChecked property |
| 5322 | function fixDefaultChecked( elem ) { |
| 5323 | if ( rcheckableType.test( elem.type ) ) { |
| 5324 | elem.defaultChecked = elem.checked; |
| 5325 | } |
| 5326 | } |
| 5457 | |
| 5458 | jQuery.extend({ |
| 5459 | clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
| 5460 | var destElements, node, clone, i, srcElements, |
| 5461 | inPage = jQuery.contains( elem.ownerDocument, elem ); |
| 5462 | |
| 5463 | if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { |
| 5464 | clone = elem.cloneNode( true ); |
| 5465 | |
| 5466 | // IE<=8 does not properly clone detached, unknown element nodes |
| 5467 | } else { |
| 5468 | fragmentDiv.innerHTML = elem.outerHTML; |
| 5469 | fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); |
| 5470 | } |
| 5471 | |
| 5472 | if ( (!support.noCloneEvent || !support.noCloneChecked) && |
| 5473 | (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { |
| 5474 | |
| 5475 | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 |
| 5476 | destElements = getAll( clone ); |
| 5477 | srcElements = getAll( elem ); |
| 5478 | |
| 5479 | // Fix all IE cloning issues |
| 5480 | for ( i = 0; (node = srcElements[i]) != null; ++i ) { |
| 5481 | // Ensure that the destination node is not null; Fixes #9587 |
| 5482 | if ( destElements[i] ) { |
| 5483 | fixCloneNodeIssues( node, destElements[i] ); |
| 5484 | } |
| 5485 | } |
| 5486 | } |
| 5487 | |
| 5488 | // Copy the events from the original to the clone |
| 5489 | if ( dataAndEvents ) { |
| 5490 | if ( deepDataAndEvents ) { |
| 5491 | srcElements = srcElements || getAll( elem ); |
| 5492 | destElements = destElements || getAll( clone ); |
| 5493 | |
| 5494 | for ( i = 0; (node = srcElements[i]) != null; i++ ) { |
| 5495 | cloneCopyEvent( node, destElements[i] ); |
| 5496 | } |
| 5497 | } else { |
| 5498 | cloneCopyEvent( elem, clone ); |
| 5499 | } |
| 5500 | } |
| 5501 | |
| 5502 | // Preserve script evaluation history |
| 5503 | destElements = getAll( clone, "script" ); |
| 5504 | if ( destElements.length > 0 ) { |
| 5505 | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
| 5506 | } |
| 5507 | |
| 5508 | destElements = srcElements = node = null; |
| 5509 | |
| 5510 | // Return the cloned set |
| 5511 | return clone; |
| 5512 | }, |
| 5513 | |
| 5514 | buildFragment: function( elems, context, scripts, selection ) { |
| 5515 | var j, elem, contains, |
| 5516 | tmp, tag, tbody, wrap, |
| 5517 | l = elems.length, |
| 5518 | |
| 5519 | // Ensure a safe fragment |
| 5520 | safe = createSafeFragment( context ), |
| 5521 | |
| 5522 | nodes = [], |
| 5523 | i = 0; |
| 5524 | |
| 5525 | for ( ; i < l; i++ ) { |
| 5526 | elem = elems[ i ]; |
| 5527 | |
| 5528 | if ( elem || elem === 0 ) { |
| 5529 | |
| 5530 | // Add nodes directly |
| 5531 | if ( jQuery.type( elem ) === "object" ) { |
| 5532 | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
| 5533 | |
| 5534 | // Convert non-html into a text node |
| 5535 | } else if ( !rhtml.test( elem ) ) { |
| 5536 | nodes.push( context.createTextNode( elem ) ); |
| 5537 | |
| 5538 | // Convert html into DOM nodes |
| 5539 | } else { |
| 5540 | tmp = tmp || safe.appendChild( context.createElement("div") ); |
| 5541 | |
| 5542 | // Deserialize a standard representation |
| 5543 | tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); |
| 5544 | wrap = wrapMap[ tag ] || wrapMap._default; |
| 5545 | |
| 5546 | tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; |
| 5547 | |
| 5548 | // Descend through wrappers to the right content |
| 5549 | j = wrap[0]; |
| 5550 | while ( j-- ) { |
| 5551 | tmp = tmp.lastChild; |
| 5552 | } |
| 5553 | |
| 5554 | // Manually add leading whitespace removed by IE |
| 5555 | if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
| 5556 | nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); |
| 5557 | } |
| 5558 | |
| 5559 | // Remove IE's autoinserted <tbody> from table fragments |
| 5560 | if ( !support.tbody ) { |
| 5561 | |
| 5562 | // String was a <table>, *may* have spurious <tbody> |
| 5563 | elem = tag === "table" && !rtbody.test( elem ) ? |
| 5564 | tmp.firstChild : |
| 5565 | |
| 5566 | // String was a bare <thead> or <tfoot> |
| 5567 | wrap[1] === "<table>" && !rtbody.test( elem ) ? |
| 5568 | tmp : |
| 5569 | 0; |
| 5570 | |
| 5571 | j = elem && elem.childNodes.length; |
| 5572 | while ( j-- ) { |
| 5573 | if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { |
| 5574 | elem.removeChild( tbody ); |
| 5575 | } |
| 5576 | } |
| 5577 | } |
| 5578 | |
| 5579 | jQuery.merge( nodes, tmp.childNodes ); |
| 5580 | |
| 5581 | // Fix #12392 for WebKit and IE > 9 |
| 5582 | tmp.textContent = ""; |
| 5583 | |
| 5584 | // Fix #12392 for oldIE |
| 5585 | while ( tmp.firstChild ) { |
| 5586 | tmp.removeChild( tmp.firstChild ); |
| 5587 | } |
| 5588 | |
| 5589 | // Remember the top-level container for proper cleanup |
| 5590 | tmp = safe.lastChild; |
| 5591 | } |
| 5592 | } |
| 5593 | } |
| 5594 | |
| 5595 | // Fix #11356: Clear elements from fragment |
| 5596 | if ( tmp ) { |
| 5597 | safe.removeChild( tmp ); |
| 5598 | } |
| 5599 | |
| 5600 | // Reset defaultChecked for any radios and checkboxes |
| 5601 | // about to be appended to the DOM in IE 6/7 (#8060) |
| 5602 | if ( !support.appendChecked ) { |
| 5603 | jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); |
| 5604 | } |
| 5605 | |
| 5606 | i = 0; |
| 5607 | while ( (elem = nodes[ i++ ]) ) { |
| 5608 | |
| 5609 | // #4087 - If origin and destination elements are the same, and this is |
| 5610 | // that element, do not do anything |
| 5611 | if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { |
| 5612 | continue; |
| 5613 | } |
| 5614 | |
| 5615 | contains = jQuery.contains( elem.ownerDocument, elem ); |
| 5616 | |
| 5617 | // Append to fragment |
| 5618 | tmp = getAll( safe.appendChild( elem ), "script" ); |
| 5619 | |
| 5620 | // Preserve script evaluation history |
| 5621 | if ( contains ) { |
| 5622 | setGlobalEval( tmp ); |
| 5623 | } |
| 5624 | |
| 5625 | // Capture executables |
| 5626 | if ( scripts ) { |
| 5627 | j = 0; |
| 5628 | while ( (elem = tmp[ j++ ]) ) { |
| 5629 | if ( rscriptType.test( elem.type || "" ) ) { |
| 5630 | scripts.push( elem ); |
| 5631 | } |
| 5632 | } |
| 5633 | } |
| 5634 | } |
| 5635 | |
| 5636 | tmp = null; |
| 5637 | |
| 5638 | return safe; |
| 5639 | }, |
| 5640 | |
| 5641 | cleanData: function( elems, /* internal */ acceptData ) { |
| 5642 | var elem, type, id, data, |
| 5643 | i = 0, |
| 5644 | internalKey = jQuery.expando, |
| 5645 | cache = jQuery.cache, |
| 5646 | deleteExpando = support.deleteExpando, |
| 5647 | special = jQuery.event.special; |
| 5648 | |
| 5649 | for ( ; (elem = elems[i]) != null; i++ ) { |
| 5650 | if ( acceptData || jQuery.acceptData( elem ) ) { |
| 5651 | |
| 5652 | id = elem[ internalKey ]; |
| 5653 | data = id && cache[ id ]; |
| 5654 | |
| 5655 | if ( data ) { |
| 5656 | if ( data.events ) { |
| 5657 | for ( type in data.events ) { |
| 5658 | if ( special[ type ] ) { |
| 5659 | jQuery.event.remove( elem, type ); |
| 5660 | |
| 5661 | // This is a shortcut to avoid jQuery.event.remove's overhead |
| 5662 | } else { |
| 5663 | jQuery.removeEvent( elem, type, data.handle ); |
| 5664 | } |
| 5665 | } |
| 5666 | } |
| 5667 | |
| 5668 | // Remove cache only if it was not already removed by jQuery.event.remove |
| 5669 | if ( cache[ id ] ) { |
| 5670 | |
| 5671 | delete cache[ id ]; |
| 5672 | |
| 5673 | // IE does not allow us to delete expando properties from nodes, |
| 5674 | // nor does it have a removeAttribute function on Document nodes; |
| 5675 | // we must handle all of these cases |
| 5676 | if ( deleteExpando ) { |
| 5677 | delete elem[ internalKey ]; |
| 5678 | |
| 5679 | } else if ( typeof elem.removeAttribute !== strundefined ) { |
| 5680 | elem.removeAttribute( internalKey ); |
| 5681 | |
| 5682 | } else { |
| 5683 | elem[ internalKey ] = null; |
| 5684 | } |
| 5685 | |
| 5686 | deletedIds.push( id ); |
| 5687 | } |
| 5688 | } |
| 5689 | } |
| 5690 | } |
| 5691 | } |
| 5692 | }); |
| 5693 | |
| 5694 | jQuery.fn.extend({ |
| 5695 | text: function( value ) { |
| 5696 | return access( this, function( value ) { |
| 5697 | return value === undefined ? |
| 5698 | jQuery.text( this ) : |
| 5699 | this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); |
| 5700 | }, null, value, arguments.length ); |
| 5701 | }, |
| 5702 | |
| 5703 | append: function() { |
| 5704 | return this.domManip( arguments, function( elem ) { |
| 5705 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
| 5706 | var target = manipulationTarget( this, elem ); |
| 5707 | target.appendChild( elem ); |
| 5708 | } |
| 5709 | }); |
| 5710 | }, |
| 5711 | |
| 5712 | prepend: function() { |
| 5713 | return this.domManip( arguments, function( elem ) { |
| 5714 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
| 5715 | var target = manipulationTarget( this, elem ); |
| 5716 | target.insertBefore( elem, target.firstChild ); |
| 5717 | } |
| 5718 | }); |
| 5719 | }, |
| 5720 | |
| 5721 | before: function() { |
| 5722 | return this.domManip( arguments, function( elem ) { |
| 5723 | if ( this.parentNode ) { |
| 5724 | this.parentNode.insertBefore( elem, this ); |
| 5725 | } |
| 5726 | }); |
| 5727 | }, |
| 5728 | |
| 5729 | after: function() { |
| 5730 | return this.domManip( arguments, function( elem ) { |
| 5731 | if ( this.parentNode ) { |
| 5732 | this.parentNode.insertBefore( elem, this.nextSibling ); |
| 5733 | } |
| 5734 | }); |
| 5735 | }, |
| 5736 | |
| 5737 | remove: function( selector, keepData /* Internal Use Only */ ) { |
| 5738 | var elem, |
| 5739 | elems = selector ? jQuery.filter( selector, this ) : this, |
| 5740 | i = 0; |
| 5741 | |
| 5742 | for ( ; (elem = elems[i]) != null; i++ ) { |
| 5743 | |
| 5744 | if ( !keepData && elem.nodeType === 1 ) { |
| 5745 | jQuery.cleanData( getAll( elem ) ); |
| 5746 | } |
| 5747 | |
| 5748 | if ( elem.parentNode ) { |
| 5749 | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { |
| 5750 | setGlobalEval( getAll( elem, "script" ) ); |
| 5751 | } |
| 5752 | elem.parentNode.removeChild( elem ); |
| 5753 | } |
| 5754 | } |
| 5755 | |
| 5756 | return this; |
| 5757 | }, |
| 5758 | |
| 5759 | empty: function() { |
| 5760 | var elem, |
| 5761 | i = 0; |
| 5762 | |
| 5763 | for ( ; (elem = this[i]) != null; i++ ) { |
| 5764 | // Remove element nodes and prevent memory leaks |
| 5765 | if ( elem.nodeType === 1 ) { |
| 5766 | jQuery.cleanData( getAll( elem, false ) ); |
| 5767 | } |
| 5768 | |
| 5769 | // Remove any remaining nodes |
| 5770 | while ( elem.firstChild ) { |
| 5771 | elem.removeChild( elem.firstChild ); |
| 5772 | } |
| 5773 | |
| 5774 | // If this is a select, ensure that it displays empty (#12336) |
| 5775 | // Support: IE<9 |
| 5776 | if ( elem.options && jQuery.nodeName( elem, "select" ) ) { |
| 5777 | elem.options.length = 0; |
| 5778 | } |
| 5779 | } |
| 5780 | |
| 5781 | return this; |
| 5782 | }, |
| 5783 | |
| 5784 | clone: function( dataAndEvents, deepDataAndEvents ) { |
| 5785 | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
| 5786 | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
| 5787 | |
| 5788 | return this.map(function() { |
| 5789 | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
| 5790 | }); |
| 5791 | }, |
| 5792 | |
| 5793 | html: function( value ) { |
| 5794 | return access( this, function( value ) { |
| 5795 | var elem = this[ 0 ] || {}, |
| 5796 | i = 0, |
| 5797 | l = this.length; |
| 5798 | |
| 5799 | if ( value === undefined ) { |
| 5800 | return elem.nodeType === 1 ? |
| 5801 | elem.innerHTML.replace( rinlinejQuery, "" ) : |
| 5802 | undefined; |
| 5803 | } |
| 5804 | |
| 5805 | // See if we can take a shortcut and just use innerHTML |
| 5806 | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
| 5807 | ( support.htmlSerialize || !rnoshimcache.test( value ) ) && |
| 5808 | ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && |
| 5809 | !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { |
| 5810 | |
| 5811 | value = value.replace( rxhtmlTag, "<$1></$2>" ); |
| 5812 | |
| 5813 | try { |
| 5814 | for (; i < l; i++ ) { |
| 5815 | // Remove element nodes and prevent memory leaks |
| 5816 | elem = this[i] || {}; |
| 5817 | if ( elem.nodeType === 1 ) { |
| 5818 | jQuery.cleanData( getAll( elem, false ) ); |
| 5819 | elem.innerHTML = value; |
| 5820 | } |
| 5821 | } |
| 5822 | |
| 5823 | elem = 0; |
| 5824 | |
| 5825 | // If using innerHTML throws an exception, use the fallback method |
| 5826 | } catch(e) {} |
| 5827 | } |
| 5828 | |
| 5829 | if ( elem ) { |
| 5830 | this.empty().append( value ); |
| 5831 | } |
| 5832 | }, null, value, arguments.length ); |
| 5833 | }, |
| 5834 | |
| 5835 | replaceWith: function() { |
| 5836 | var arg = arguments[ 0 ]; |
| 5837 | |
| 5838 | // Make the changes, replacing each context element with the new content |
| 5839 | this.domManip( arguments, function( elem ) { |
| 5840 | arg = this.parentNode; |
| 5841 | |
| 5842 | jQuery.cleanData( getAll( this ) ); |
| 5843 | |
| 5844 | if ( arg ) { |
| 5845 | arg.replaceChild( elem, this ); |
| 5846 | } |
| 5847 | }); |
| 5848 | |
| 5849 | // Force removal if there was no new content (e.g., from empty arguments) |
| 5850 | return arg && (arg.length || arg.nodeType) ? this : this.remove(); |
| 5851 | }, |
| 5852 | |
| 5853 | detach: function( selector ) { |
| 5854 | return this.remove( selector, true ); |
| 5855 | }, |
| 5856 | |
| 5857 | domManip: function( args, callback ) { |
| 5858 | |
| 5859 | // Flatten any nested arrays |
| 5860 | args = concat.apply( [], args ); |
| 5861 | |
| 5862 | var first, node, hasScripts, |
| 5863 | scripts, doc, fragment, |
| 5864 | i = 0, |
| 5865 | l = this.length, |
| 5866 | set = this, |
| 5867 | iNoClone = l - 1, |
| 5868 | value = args[0], |
| 5869 | isFunction = jQuery.isFunction( value ); |
| 5870 | |
| 5871 | // We can't cloneNode fragments that contain checked, in WebKit |
| 5872 | if ( isFunction || |
| 5873 | ( l > 1 && typeof value === "string" && |
| 5874 | !support.checkClone && rchecked.test( value ) ) ) { |
| 5875 | return this.each(function( index ) { |
| 5876 | var self = set.eq( index ); |
| 5877 | if ( isFunction ) { |
| 5878 | args[0] = value.call( this, index, self.html() ); |
| 5879 | } |
| 5880 | self.domManip( args, callback ); |
| 5881 | }); |
| 5882 | } |
| 5883 | |
| 5884 | if ( l ) { |
| 5885 | fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); |
| 5886 | first = fragment.firstChild; |
| 5887 | |
| 5888 | if ( fragment.childNodes.length === 1 ) { |
| 5889 | fragment = first; |
| 5890 | } |
| 5891 | |
| 5892 | if ( first ) { |
| 5893 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
| 5894 | hasScripts = scripts.length; |
| 5895 | |
| 5896 | // Use the original fragment for the last item instead of the first because it can end up |
| 5897 | // being emptied incorrectly in certain situations (#8070). |
| 5898 | for ( ; i < l; i++ ) { |
| 5899 | node = fragment; |
| 5900 | |
| 5901 | if ( i !== iNoClone ) { |
| 5902 | node = jQuery.clone( node, true, true ); |
| 5903 | |
| 5904 | // Keep references to cloned scripts for later restoration |
| 5905 | if ( hasScripts ) { |
| 5906 | jQuery.merge( scripts, getAll( node, "script" ) ); |
| 5907 | } |
| 5908 | } |
| 5909 | |
| 5910 | callback.call( this[i], node, i ); |
| 5911 | } |
| 5912 | |
| 5913 | if ( hasScripts ) { |
| 5914 | doc = scripts[ scripts.length - 1 ].ownerDocument; |
| 5915 | |
| 5916 | // Reenable scripts |
| 5917 | jQuery.map( scripts, restoreScript ); |
| 5918 | |
| 5919 | // Evaluate executable scripts on first document insertion |
| 5920 | for ( i = 0; i < hasScripts; i++ ) { |
| 5921 | node = scripts[ i ]; |
| 5922 | if ( rscriptType.test( node.type || "" ) && |
| 5923 | !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { |
| 5924 | |
| 5925 | if ( node.src ) { |
| 5926 | // Optional AJAX dependency, but won't run scripts if not present |
| 5927 | if ( jQuery._evalUrl ) { |
| 5928 | jQuery._evalUrl( node.src ); |
| 5929 | } |
| 5930 | } else { |
| 5931 | jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); |
| 5932 | } |
| 5933 | } |
| 5934 | } |
| 5935 | } |
| 5936 | |
| 5937 | // Fix #11809: Avoid leaking memory |
| 5938 | fragment = first = null; |
| 5939 | } |
| 5940 | } |
| 5941 | |
| 5942 | return this; |
| 5943 | } |
| 5944 | }); |
6481 | | jQuery.extend({ |
6482 | | clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
6483 | | var destElements, node, clone, i, srcElements, |
6484 | | inPage = jQuery.contains( elem.ownerDocument, elem ); |
6485 | | |
6486 | | if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { |
6487 | | clone = elem.cloneNode( true ); |
6488 | | |
6489 | | // IE<=8 does not properly clone detached, unknown element nodes |
6490 | | } else { |
6491 | | fragmentDiv.innerHTML = elem.outerHTML; |
6492 | | fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); |
6493 | | } |
6494 | | |
6495 | | if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && |
6496 | | (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { |
6497 | | |
6498 | | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 |
6499 | | destElements = getAll( clone ); |
6500 | | srcElements = getAll( elem ); |
6501 | | |
6502 | | // Fix all IE cloning issues |
6503 | | for ( i = 0; (node = srcElements[i]) != null; ++i ) { |
6504 | | // Ensure that the destination node is not null; Fixes #9587 |
6505 | | if ( destElements[i] ) { |
6506 | | fixCloneNodeIssues( node, destElements[i] ); |
6507 | | } |
6508 | | } |
6509 | | } |
6510 | | |
6511 | | // Copy the events from the original to the clone |
6512 | | if ( dataAndEvents ) { |
6513 | | if ( deepDataAndEvents ) { |
6514 | | srcElements = srcElements || getAll( elem ); |
6515 | | destElements = destElements || getAll( clone ); |
6516 | | |
6517 | | for ( i = 0; (node = srcElements[i]) != null; i++ ) { |
6518 | | cloneCopyEvent( node, destElements[i] ); |
6519 | | } |
6520 | | } else { |
6521 | | cloneCopyEvent( elem, clone ); |
6522 | | } |
6523 | | } |
6524 | | |
6525 | | // Preserve script evaluation history |
6526 | | destElements = getAll( clone, "script" ); |
6527 | | if ( destElements.length > 0 ) { |
6528 | | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
6529 | | } |
6530 | | |
6531 | | destElements = srcElements = node = null; |
6532 | | |
6533 | | // Return the cloned set |
6534 | | return clone; |
6535 | | }, |
6536 | | |
6537 | | buildFragment: function( elems, context, scripts, selection ) { |
6538 | | var j, elem, contains, |
6539 | | tmp, tag, tbody, wrap, |
6540 | | l = elems.length, |
6541 | | |
6542 | | // Ensure a safe fragment |
6543 | | safe = createSafeFragment( context ), |
6544 | | |
6545 | | nodes = [], |
6546 | | i = 0; |
6547 | | |
6548 | | for ( ; i < l; i++ ) { |
6549 | | elem = elems[ i ]; |
6550 | | |
6551 | | if ( elem || elem === 0 ) { |
6552 | | |
6553 | | // Add nodes directly |
6554 | | if ( jQuery.type( elem ) === "object" ) { |
6555 | | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
6556 | | |
6557 | | // Convert non-html into a text node |
6558 | | } else if ( !rhtml.test( elem ) ) { |
6559 | | nodes.push( context.createTextNode( elem ) ); |
6560 | | |
6561 | | // Convert html into DOM nodes |
6562 | | } else { |
6563 | | tmp = tmp || safe.appendChild( context.createElement("div") ); |
6564 | | |
6565 | | // Deserialize a standard representation |
6566 | | tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); |
6567 | | wrap = wrapMap[ tag ] || wrapMap._default; |
6568 | | |
6569 | | tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; |
6570 | | |
6571 | | // Descend through wrappers to the right content |
6572 | | j = wrap[0]; |
6573 | | while ( j-- ) { |
6574 | | tmp = tmp.lastChild; |
6575 | | } |
6576 | | |
6577 | | // Manually add leading whitespace removed by IE |
6578 | | if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
6579 | | nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); |
6580 | | } |
6581 | | |
6582 | | // Remove IE's autoinserted <tbody> from table fragments |
6583 | | if ( !jQuery.support.tbody ) { |
6584 | | |
6585 | | // String was a <table>, *may* have spurious <tbody> |
6586 | | elem = tag === "table" && !rtbody.test( elem ) ? |
6587 | | tmp.firstChild : |
6588 | | |
6589 | | // String was a bare <thead> or <tfoot> |
6590 | | wrap[1] === "<table>" && !rtbody.test( elem ) ? |
6591 | | tmp : |
6592 | | 0; |
6593 | | |
6594 | | j = elem && elem.childNodes.length; |
6595 | | while ( j-- ) { |
6596 | | if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { |
6597 | | elem.removeChild( tbody ); |
6598 | | } |
6599 | | } |
6600 | | } |
6601 | | |
6602 | | jQuery.merge( nodes, tmp.childNodes ); |
6603 | | |
6604 | | // Fix #12392 for WebKit and IE > 9 |
6605 | | tmp.textContent = ""; |
6606 | | |
6607 | | // Fix #12392 for oldIE |
6608 | | while ( tmp.firstChild ) { |
6609 | | tmp.removeChild( tmp.firstChild ); |
6610 | | } |
6611 | | |
6612 | | // Remember the top-level container for proper cleanup |
6613 | | tmp = safe.lastChild; |
6614 | | } |
6615 | | } |
6616 | | } |
6617 | | |
6618 | | // Fix #11356: Clear elements from fragment |
6619 | | if ( tmp ) { |
6620 | | safe.removeChild( tmp ); |
6621 | | } |
6622 | | |
6623 | | // Reset defaultChecked for any radios and checkboxes |
6624 | | // about to be appended to the DOM in IE 6/7 (#8060) |
6625 | | if ( !jQuery.support.appendChecked ) { |
6626 | | jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); |
6627 | | } |
6628 | | |
6629 | | i = 0; |
6630 | | while ( (elem = nodes[ i++ ]) ) { |
6631 | | |
6632 | | // #4087 - If origin and destination elements are the same, and this is |
6633 | | // that element, do not do anything |
6634 | | if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { |
6635 | | continue; |
6636 | | } |
6637 | | |
6638 | | contains = jQuery.contains( elem.ownerDocument, elem ); |
6639 | | |
6640 | | // Append to fragment |
6641 | | tmp = getAll( safe.appendChild( elem ), "script" ); |
6642 | | |
6643 | | // Preserve script evaluation history |
6644 | | if ( contains ) { |
6645 | | setGlobalEval( tmp ); |
6646 | | } |
6647 | | |
6648 | | // Capture executables |
6649 | | if ( scripts ) { |
6650 | | j = 0; |
6651 | | while ( (elem = tmp[ j++ ]) ) { |
6652 | | if ( rscriptType.test( elem.type || "" ) ) { |
6653 | | scripts.push( elem ); |
6654 | | } |
6655 | | } |
6656 | | } |
6657 | | } |
6658 | | |
6659 | | tmp = null; |
6660 | | |
6661 | | return safe; |
6662 | | }, |
6663 | | |
6664 | | cleanData: function( elems, /* internal */ acceptData ) { |
6665 | | var elem, type, id, data, |
6666 | | i = 0, |
6667 | | internalKey = jQuery.expando, |
6668 | | cache = jQuery.cache, |
6669 | | deleteExpando = jQuery.support.deleteExpando, |
6670 | | special = jQuery.event.special; |
6671 | | |
6672 | | for ( ; (elem = elems[i]) != null; i++ ) { |
6673 | | |
6674 | | if ( acceptData || jQuery.acceptData( elem ) ) { |
6675 | | |
6676 | | id = elem[ internalKey ]; |
6677 | | data = id && cache[ id ]; |
6678 | | |
6679 | | if ( data ) { |
6680 | | if ( data.events ) { |
6681 | | for ( type in data.events ) { |
6682 | | if ( special[ type ] ) { |
6683 | | jQuery.event.remove( elem, type ); |
6684 | | |
6685 | | // This is a shortcut to avoid jQuery.event.remove's overhead |
6686 | | } else { |
6687 | | jQuery.removeEvent( elem, type, data.handle ); |
6688 | | } |
6689 | | } |
6690 | | } |
6691 | | |
6692 | | // Remove cache only if it was not already removed by jQuery.event.remove |
6693 | | if ( cache[ id ] ) { |
6694 | | |
6695 | | delete cache[ id ]; |
6696 | | |
6697 | | // IE does not allow us to delete expando properties from nodes, |
6698 | | // nor does it have a removeAttribute function on Document nodes; |
6699 | | // we must handle all of these cases |
6700 | | if ( deleteExpando ) { |
6701 | | delete elem[ internalKey ]; |
6702 | | |
6703 | | } else if ( typeof elem.removeAttribute !== core_strundefined ) { |
6704 | | elem.removeAttribute( internalKey ); |
6705 | | |
6706 | | } else { |
6707 | | elem[ internalKey ] = null; |
6708 | | } |
6709 | | |
6710 | | core_deletedIds.push( id ); |
6711 | | } |
6712 | | } |
6713 | | } |
6714 | | } |
6715 | | }, |
6716 | | |
6717 | | _evalUrl: function( url ) { |
6718 | | return jQuery.ajax({ |
6719 | | url: url, |
6720 | | type: "GET", |
6721 | | dataType: "script", |
6722 | | async: false, |
6723 | | global: false, |
6724 | | "throws": true |
| 6034 | |
| 6035 | (function() { |
| 6036 | var a, shrinkWrapBlocksVal, |
| 6037 | div = document.createElement( "div" ), |
| 6038 | divReset = |
| 6039 | "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + |
| 6040 | "display:block;padding:0;margin:0;border:0"; |
| 6041 | |
| 6042 | // Setup |
| 6043 | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; |
| 6044 | a = div.getElementsByTagName( "a" )[ 0 ]; |
| 6045 | |
| 6046 | a.style.cssText = "float:left;opacity:.5"; |
| 6047 | |
| 6048 | // Make sure that element opacity exists |
| 6049 | // (IE uses filter instead) |
| 6050 | // Use a regex to work around a WebKit issue. See #5145 |
| 6051 | support.opacity = /^0.5/.test( a.style.opacity ); |
| 6052 | |
| 6053 | // Verify style float existence |
| 6054 | // (IE uses styleFloat instead of cssFloat) |
| 6055 | support.cssF |