Редакция 290 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 290 | Редакция 293 | ||
---|---|---|---|
Строка 1... | Строка 1... | ||
1 | /*!
|
1 | /*!
|
2 | * jQuery JavaScript Library v1.3.3pre
|
2 | * jQuery JavaScript Library v1.4pre
|
3 | * http://jquery.com/
|
3 | * http://jquery.com/
|
4 | *
|
4 | *
|
5 | * Copyright (c) 2009 John Resig
|
5 | * Copyright (c) 2009 John Resig
|
6 | * Dual licensed under the MIT and GPL licenses.
|
6 | * Dual licensed under the MIT and GPL licenses.
|
7 | * http://docs.jquery.com/License
|
7 | * http://docs.jquery.com/License
|
8 | *
|
8 | *
|
9 | * Date: 2009-07-28 03:48:42 +0700 (Втр, 28 Июл 2009)
|
9 | * Date: 2009-10-12 23:26:01 +0700 (Пнд, 12 Окт 2009)
|
10 | * Revision: 6514
|
10 | * Revision: 6617
|
11 | */
|
11 | */
|
12 | (function(window, undefined){ |
12 | (function(window, undefined){ |
13 | 13 | ||
14 | // Define a local copy of jQuery
|
14 | // Define a local copy of jQuery
|
15 | var jQuery = function( selector, context ) { |
15 | var jQuery = function( selector, context ) { |
Строка 42... | Строка 42... | ||
42 | rnotwhite = /\S/, |
42 | rnotwhite = /\S/, |
43 | 43 | ||
44 | // Used for trimming whitespace
|
44 | // Used for trimming whitespace
|
45 | rtrim = /^\s+|\s+$/g, |
45 | rtrim = /^\s+|\s+$/g, |
46 | 46 | ||
- | 47 | // Match a standalone tag
|
|
- | 48 | rsingleTag = /^<(\w+)\s*\/?>$/, |
|
- | 49 | ||
47 | // Keep a UserAgent string for use with jQuery.browser
|
50 | // Keep a UserAgent string for use with jQuery.browser
|
48 | userAgent = navigator.userAgent.toLowerCase(), |
51 | userAgent = navigator.userAgent.toLowerCase(), |
49 | 52 | ||
50 | // Save a reference to some core methods
|
53 | // Save a reference to some core methods
|
51 | toString = Object.prototype.toString, |
54 | toString = Object.prototype.toString, |
52 | push = Array.prototype.push, |
55 | push = Array.prototype.push, |
53 | slice = Array.prototype.slice; |
56 | slice = Array.prototype.slice, |
54 | - | ||
55 | // Expose jQuery to the global object
|
- | |
56 | window.jQuery = window.$ = jQuery; |
57 | indexOf = Array.prototype.indexOf; |
57 | 58 | ||
58 | jQuery.fn = jQuery.prototype = { |
59 | jQuery.fn = jQuery.prototype = { |
59 | init: function( selector, context ) { |
60 | init: function( selector, context ) { |
60 | var match, elem, ret; |
61 | var match, elem, ret, doc; |
61 | 62 | ||
62 | // Handle $(""), $(null), or $(undefined)
|
63 | // Handle $(""), $(null), or $(undefined)
|
63 | if ( !selector ) { |
64 | if ( !selector ) { |
64 | return this; |
65 | return this; |
65 | }
|
66 | }
|
Строка 79... | Строка 80... | ||
79 | // Verify a match, and that no context was specified for #id
|
80 | // Verify a match, and that no context was specified for #id
|
80 | if ( match && (match[1] || !context) ) { |
81 | if ( match && (match[1] || !context) ) { |
81 | 82 | ||
82 | // HANDLE: $(html) -> $(array)
|
83 | // HANDLE: $(html) -> $(array)
|
83 | if ( match[1] ) { |
84 | if ( match[1] ) { |
- | 85 | doc = (context ? context.ownerDocument || context : document); |
|
- | 86 | ||
- | 87 | // If a single string is passed in and it's a single tag
|
|
- | 88 | // just do a createElement and skip the rest
|
|
- | 89 | ret = rsingleTag.exec( selector ); |
|
- | 90 | ||
- | 91 | if ( ret ) { |
|
- | 92 | selector = [ doc.createElement( ret[1] ) ]; |
|
- | 93 | ||
- | 94 | } else { |
|
84 | selector = jQuery.clean( [ match[1] ], context ); |
95 | ret = buildFragment( [ match[1] ], [ doc ] ); |
- | 96 | selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; |
|
- | 97 | }
|
|
85 | 98 | ||
86 | // HANDLE: $("#id")
|
99 | // HANDLE: $("#id")
|
87 | } else { |
100 | } else { |
88 | elem = document.getElementById( match[2] ); |
101 | elem = document.getElementById( match[2] ); |
89 | 102 | ||
Строка 102... | Строка 115... | ||
102 | this.context = document; |
115 | this.context = document; |
103 | this.selector = selector; |
116 | this.selector = selector; |
104 | return this; |
117 | return this; |
105 | }
|
118 | }
|
106 | 119 | ||
- | 120 | // HANDLE: $("TAG")
|
|
- | 121 | } else if ( !context && /^\w+$/.test( selector ) ) { |
|
- | 122 | this.selector = selector; |
|
- | 123 | this.context = document; |
|
- | 124 | selector = document.getElementsByTagName( selector ); |
|
- | 125 | ||
107 | // HANDLE: $(expr, $(...))
|
126 | // HANDLE: $(expr, $(...))
|
108 | } else if ( !context || context.jquery ) { |
127 | } else if ( !context || context.jquery ) { |
109 | return (context || rootjQuery).find( selector ); |
128 | return (context || rootjQuery).find( selector ); |
110 | 129 | ||
111 | // HANDLE: $(expr, context)
|
130 | // HANDLE: $(expr, context)
|
Строка 118... | Строка 137... | ||
118 | // Shortcut for document ready
|
137 | // Shortcut for document ready
|
119 | } else if ( jQuery.isFunction( selector ) ) { |
138 | } else if ( jQuery.isFunction( selector ) ) { |
120 | return rootjQuery.ready( selector ); |
139 | return rootjQuery.ready( selector ); |
121 | }
|
140 | }
|
122 | 141 | ||
123 | // Make sure that old selector state is passed along
|
- | |
124 | if ( selector.selector && selector.context ) { |
142 | if (selector.selector !== undefined) { |
125 | this.selector = selector.selector; |
143 | this.selector = selector.selector; |
126 | this.context = selector.context; |
144 | this.context = selector.context; |
127 | }
|
145 | }
|
128 | 146 | ||
129 | return this.setArray(jQuery.isArray( selector ) ? |
147 | return this.setArray(jQuery.isArray( selector ) ? |
Строка 133... | Строка 151... | ||
133 | 151 | ||
134 | // Start with an empty selector
|
152 | // Start with an empty selector
|
135 | selector: "", |
153 | selector: "", |
136 | 154 | ||
137 | // The current version of jQuery being used
|
155 | // The current version of jQuery being used
|
138 | jquery: "1.3.3pre", |
156 | jquery: "1.4pre", |
139 | 157 | ||
140 | // The default length of a jQuery object is 0
|
158 | // The default length of a jQuery object is 0
|
141 | length: 0, |
159 | length: 0, |
142 | 160 | ||
143 | // The number of elements contained in the matched element set
|
161 | // The number of elements contained in the matched element set
|
Строка 330... | Строка 348... | ||
330 | 348 | ||
331 | // check if an element is in a (or is an) XML document
|
349 | // check if an element is in a (or is an) XML document
|
332 | isXMLDoc: function( elem ) { |
350 | isXMLDoc: function( elem ) { |
333 | // documentElement is verified for cases where it doesn't yet exist
|
351 | // documentElement is verified for cases where it doesn't yet exist
|
334 | // (such as loading iframes in IE - #4833)
|
352 | // (such as loading iframes in IE - #4833)
|
- | 353 | var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; |
|
335 | return ((elem.ownerDocument || elem).documentElement || 0).nodeName !== "HTML"; |
354 | return documentElement ? documentElement.nodeName !== "HTML" : false; |
336 | }, |
355 | }, |
337 | 356 | ||
338 | // Evalulates a script in a global context
|
357 | // Evalulates a script in a global context
|
339 | globalEval: function( data ) { |
358 | globalEval: function( data ) { |
340 | if ( data && rnotwhite.test(data) ) { |
359 | if ( data && rnotwhite.test(data) ) { |
Строка 454... | Строка 473... | ||
454 | }
|
473 | }
|
455 | 474 | ||
456 | return first; |
475 | return first; |
457 | }, |
476 | }, |
458 | 477 | ||
459 | unique: function( array ) { |
- | |
460 | var ret = [], done = {}, id; |
- | |
461 | - | ||
462 | try { |
- | |
463 | for ( var i = 0, length = array.length; i < length; i++ ) { |
- | |
464 | id = jQuery.data( array[ i ] ); |
- | |
465 | - | ||
466 | if ( !done[ id ] ) { |
- | |
467 | done[ id ] = true; |
- | |
468 | ret.push( array[ i ] ); |
- | |
469 | }
|
- | |
470 | }
|
- | |
471 | } catch( e ) { |
- | |
472 | ret = array; |
- | |
473 | }
|
- | |
474 | - | ||
475 | return ret; |
- | |
476 | }, |
- | |
477 | - | ||
478 | grep: function( elems, callback, inv ) { |
478 | grep: function( elems, callback, inv ) { |
479 | var ret = []; |
479 | var ret = []; |
480 | 480 | ||
481 | // Go through the array, only saving the items
|
481 | // Go through the array, only saving the items
|
482 | // that pass the validator function
|
482 | // that pass the validator function
|
Строка 515... | Строка 515... | ||
515 | msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
515 | msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
516 | mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
516 | mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
517 | }
|
517 | }
|
518 | }); |
518 | }); |
519 | 519 | ||
- | 520 | if ( indexOf ) { |
|
- | 521 | jQuery.inArray = function( elem, array ) { |
|
- | 522 | return indexOf.call( array, elem ); |
|
- | 523 | }; |
|
- | 524 | }
|
|
- | 525 | ||
520 | // All jQuery objects should point back to these
|
526 | // All jQuery objects should point back to these
|
521 | rootjQuery = jQuery(document); |
527 | rootjQuery = jQuery(document); |
522 | 528 | ||
523 | function evalScript( i, elem ) { |
529 | function evalScript( i, elem ) { |
524 | if ( elem.src ) { |
530 | if ( elem.src ) { |
Строка 534... | Строка 540... | ||
534 | if ( elem.parentNode ) { |
540 | if ( elem.parentNode ) { |
535 | elem.parentNode.removeChild( elem ); |
541 | elem.parentNode.removeChild( elem ); |
536 | }
|
542 | }
|
537 | }
|
543 | }
|
538 | 544 | ||
- | 545 | // Mutifunctional method to get and set values to a collection
|
|
- | 546 | // The value/s can be optionally by executed if its a function
|
|
- | 547 | function access( elems, key, value, exec, fn ) { |
|
- | 548 | var l = elems.length; |
|
- | 549 | ||
- | 550 | // Setting many attributes
|
|
- | 551 | if ( typeof key === "object" ) { |
|
- | 552 | for (var k in key) { |
|
- | 553 | access(elems, k, key[k], exec, fn); |
|
- | 554 | }
|
|
- | 555 | return elems; |
|
- | 556 | }
|
|
- | 557 | ||
- | 558 | // Setting one attribute
|
|
- | 559 | if (value !== undefined) { |
|
- | 560 | // Optionally, function values get executed if exec is true
|
|
- | 561 | exec = exec && jQuery.isFunction(value); |
|
- | 562 | ||
- | 563 | for (var i = 0; i < l; i++) { |
|
- | 564 | var elem = elems[i], |
|
- | 565 | val = exec ? value.call(elem, i) : value; |
|
- | 566 | fn(elem, key, val); |
|
- | 567 | }
|
|
- | 568 | return elems; |
|
- | 569 | }
|
|
- | 570 | ||
- | 571 | // Getting an attribute
|
|
- | 572 | return l ? fn(elems[0], key) : null; |
|
- | 573 | }
|
|
- | 574 | ||
539 | function now() { |
575 | function now() { |
540 | return (new Date).getTime(); |
576 | return (new Date).getTime(); |
541 | }
|
577 | }
|
542 | var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
578 | var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
- | 579 | var emptyObject = {}; |
|
543 | 580 | ||
544 | jQuery.extend({ |
581 | jQuery.extend({ |
545 | cache: {}, |
582 | cache: {}, |
546 | 583 | ||
- | 584 | expando:expando, |
|
- | 585 | ||
547 | data: function( elem, name, data ) { |
586 | data: function( elem, name, data ) { |
548 | elem = elem == window ? |
587 | elem = elem == window ? |
549 | windowData :
|
588 | windowData :
|
550 | elem;
|
589 | elem;
|
551 | 590 | ||
552 | var id = elem[ expando ], cache = jQuery.cache; |
591 | var id = elem[ expando ], cache = jQuery.cache, thisCache; |
553 | 592 | ||
554 | // Compute a unique ID for the element
|
593 | // Handle the case where there's no name immediately
|
555 | if(!id) id = elem[ expando ] = ++uuid; |
594 | if ( !name && !id ) { |
- | 595 | return null; |
|
- | 596 | }
|
|
556 | 597 | ||
557 | // Only generate the data cache if we're
|
- | |
558 | // trying to access or manipulate it
|
598 | // Compute a unique ID for the element
|
559 | if ( name && !cache[ id ] ) |
599 | if ( !id ) { |
560 | cache[ id ] = {}; |
600 | id = ++uuid; |
- | 601 | }
|
|
561 | 602 | ||
- | 603 | // Avoid generating a new cache unless none exists and we
|
|
- | 604 | // want to manipulate it.
|
|
- | 605 | if ( cache[ id ] ) { |
|
562 | var thisCache = cache[ id ]; |
606 | thisCache = cache[ id ]; |
- | 607 | } else if ( typeof data === "undefined" ) { |
|
- | 608 | thisCache = emptyObject; |
|
- | 609 | } else { |
|
- | 610 | thisCache = cache[ id ] = {}; |
|
- | 611 | }
|
|
563 | 612 | ||
564 | // Prevent overriding the named cache with undefined values
|
613 | // Prevent overriding the named cache with undefined values
|
565 | if ( data !== undefined ) thisCache[ name ] = data; |
614 | if ( data !== undefined ) { |
- | 615 | elem[ expando ] = id; |
|
- | 616 | thisCache[ name ] = data; |
|
- | 617 | }
|
|
566 | 618 | ||
567 | if(name === true) return thisCache |
619 | return name ? thisCache[ name ] : thisCache; |
568 | else if(name) return thisCache[name] |
- | |
569 | else return id |
- | |
570 | }, |
620 | }, |
571 | 621 | ||
572 | removeData: function( elem, name ) { |
622 | removeData: function( elem, name ) { |
573 | elem = elem == window ? |
623 | elem = elem == window ? |
574 | windowData :
|
624 | windowData :
|
Строка 581... | Строка 631... | ||
581 | if ( thisCache ) { |
631 | if ( thisCache ) { |
582 | // Remove the section of cache data
|
632 | // Remove the section of cache data
|
583 | delete thisCache[ name ]; |
633 | delete thisCache[ name ]; |
584 | 634 | ||
585 | // If we've removed all the data, remove the element's cache
|
635 | // If we've removed all the data, remove the element's cache
|
586 | if( jQuery.isEmptyObject(thisCache) ) |
636 | if ( jQuery.isEmptyObject(thisCache) ) { |
587 | jQuery.removeData( elem ); |
637 | jQuery.removeData( elem ); |
588 | }
|
638 | }
|
- | 639 | }
|
|
589 | 640 | ||
590 | // Otherwise, we want to remove all of the element's data
|
641 | // Otherwise, we want to remove all of the element's data
|
591 | } else { |
642 | } else { |
592 | // Clean up the element expando
|
643 | // Clean up the element expando
|
593 | try { |
644 | try { |
594 | delete elem[ expando ]; |
645 | delete elem[ expando ]; |
595 | } catch(e){ |
646 | } catch( e ) { |
596 | // IE has trouble directly removing the expando
|
647 | // IE has trouble directly removing the expando
|
597 | // but it's ok with using removeAttribute
|
648 | // but it's ok with using removeAttribute
|
598 | if ( elem.removeAttribute ) |
649 | if ( elem.removeAttribute ) { |
599 | elem.removeAttribute( expando ); |
650 | elem.removeAttribute( expando ); |
600 | }
|
651 | }
|
- | 652 | }
|
|
601 | 653 | ||
602 | // Completely remove the data cache
|
654 | // Completely remove the data cache
|
603 | delete cache[ id ]; |
655 | delete cache[ id ]; |
604 | }
|
656 | }
|
605 | }, |
657 | }, |
- | 658 | ||
606 | queue: function( elem, type, data ) { |
659 | queue: function( elem, type, data ) { |
607 | if( !elem ) return; |
660 | if( !elem ) return; |
608 | 661 | ||
609 | type = (type || "fx") + "queue"; |
662 | type = (type || "fx") + "queue"; |
610 | var q = jQuery.data( elem, type ); |
663 | var q = jQuery.data( elem, type ); |
Строка 638... | Строка 691... | ||
638 | }
|
691 | }
|
639 | }); |
692 | }); |
640 | 693 | ||
641 | jQuery.fn.extend({ |
694 | jQuery.fn.extend({ |
642 | data: function( key, value ){ |
695 | data: function( key, value ){ |
643 | if(typeof key === "undefined" && this.length) return jQuery.data(this[0], true); |
696 | if ( typeof key === "undefined" && this.length ) { |
- | 697 | return jQuery.data( this[0] ); |
|
- | 698 | }
|
|
644 | 699 | ||
645 | var parts = key.split("."); |
700 | var parts = key.split("."); |
646 | parts[1] = parts[1] ? "." + parts[1] : ""; |
701 | parts[1] = parts[1] ? "." + parts[1] : ""; |
647 | 702 | ||
648 | if ( value === undefined ) { |
703 | if ( value === undefined ) { |
Строка 687... | Строка 742... | ||
687 | }); |
742 | }); |
688 | }, |
743 | }, |
689 | clearQueue: function(type){ |
744 | clearQueue: function(type){ |
690 | return this.queue( type || "fx", [] ); |
745 | return this.queue( type || "fx", [] ); |
691 | }
|
746 | }
|
692 | });/*! |
747 | }); |
- | 748 | /*
|
|
693 | * Sizzle CSS Selector Engine - v1.0
|
749 | * A number of helper functions used for managing events.
|
694 | * Copyright 2009, The Dojo Foundation
|
- | |
695 | * Released under the MIT, BSD, and GPL Licenses.
|
750 | * Many of the ideas behind this code originated from
|
696 | * More information: http://sizzlejs.com/
|
751 | * Dean Edwards' addEvent library.
|
697 | */
|
752 | */
|
698 | (function(){ |
753 | jQuery.event = { |
699 | 754 | ||
700 | var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
755 | // Bind an event to an element
|
701 | done = 0, |
756 | // Original by Dean Edwards
|
702 | toString = Object.prototype.toString, |
757 | add: function( elem, types, handler, data ) { |
- | 758 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
703 | hasDuplicate = false; |
759 | return; |
- | 760 | }
|
|
704 | 761 | ||
705 | var Sizzle = function(selector, context, results, seed) { |
762 | // For whatever reason, IE has trouble passing the window object
|
706 | results = results || []; |
763 | // around, causing it to be cloned in the process
|
707 | var origContext = context = context || document; |
764 | if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { |
- | 765 | elem = window; |
|
- | 766 | }
|
|
708 | 767 | ||
709 | if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
768 | // Make sure that the function being executed has a unique ID
|
710 | return []; |
769 | if ( !handler.guid ) { |
- | 770 | handler.guid = this.guid++; |
|
711 | }
|
771 | }
|
712 | 772 | ||
- | 773 | // if data is passed, bind to handler
|
|
- | 774 | if ( data !== undefined ) { |
|
713 | if ( !selector || typeof selector !== "string" ) { |
775 | // Create temporary function pointer to original handler
|
714 | return results; |
776 | var fn = handler; |
- | 777 | ||
- | 778 | // Create unique handler function, wrapped around original handler
|
|
- | 779 | handler = this.proxy( fn ); |
|
- | 780 | ||
- | 781 | // Store data in unique handler
|
|
- | 782 | handler.data = data; |
|
715 | }
|
783 | }
|
716 | 784 | ||
- | 785 | // Init the element's event structure
|
|
717 | var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context); |
786 | var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), |
- | 787 | handle = jQuery.data( elem, "handle" ) || jQuery.data( elem, "handle", function() { |
|
- | 788 | // Handle the second event of a trigger and when
|
|
- | 789 | // an event is called after a page has unloaded
|
|
- | 790 | return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
|
- | 791 | jQuery.event.handle.apply( arguments.callee.elem, arguments ) : |
|
- | 792 | undefined; |
|
- | 793 | }); |
|
- | 794 | // Add elem as a property of the handle function
|
|
- | 795 | // This is to prevent a memory leak with non-native
|
|
- | 796 | // event in IE.
|
|
- | 797 | handle.elem = elem; |
|
718 | 798 | ||
719 | // Reset the position of the chunker regexp (start from head)
|
799 | // Handle multiple events separated by a space
|
- | 800 | // jQuery(...).bind("mouseover mouseout", fn);
|
|
- | 801 | types = types.split( /\s+/ ); |
|
720 | chunker.lastIndex = 0; |
802 | var type, i=0; |
- | 803 | while ( (type = types[ i++ ]) ) { |
|
- | 804 | // Namespaced event handlers
|
|
- | 805 | var namespaces = type.split("."); |
|
- | 806 | type = namespaces.shift(); |
|
- | 807 | handler.type = namespaces.slice(0).sort().join("."); |
|
721 | 808 | ||
722 | while ( (m = chunker.exec(selector)) !== null ) { |
809 | // Get the current list of functions bound to this event
|
723 | parts.push( m[1] ); |
810 | var handlers = events[ type ], |
- | 811 | special = this.special[ type ] || {}; |
|
724 | 812 | ||
725 | if ( m[2] ) { |
813 | if ( special.add ) { |
- | 814 | var modifiedHandler = special.add.call( elem, handler, data, namespaces ); |
|
- | 815 | if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { |
|
726 | extra = RegExp.rightContext; |
816 | modifiedHandler.guid = modifiedHandler.guid || handler.guid; |
727 | break; |
817 | handler = modifiedHandler; |
728 | }
|
818 | }
|
729 | }
|
819 | }
|
730 | 820 | ||
731 | if ( parts.length > 1 && origPOS.exec( selector ) ) { |
- | |
732 | if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
- | |
733 | set = posProcess( parts[0] + parts[1], context ); |
- | |
734 | } else { |
- | |
735 | set = Expr.relative[ parts[0] ] ? |
821 | // Init the event handler queue
|
736 | [ context ] : |
- | |
737 | Sizzle( parts.shift(), context ); |
- | |
738 | - | ||
739 | while ( parts.length ) { |
822 | if ( !handlers ) { |
740 | selector = parts.shift(); |
- | |
741 | - | ||
742 | if ( Expr.relative[ selector ] ) |
823 | handlers = events[ type ] = {}; |
743 | selector += parts.shift(); |
- | |
744 | 824 | ||
- | 825 | // Check for a special event handler
|
|
- | 826 | // Only use addEventListener/attachEvent if the special
|
|
- | 827 | // events handler returns false
|
|
- | 828 | if ( !special.setup || special.setup.call( elem, data, namespaces ) === false ) { |
|
- | 829 | // Bind the global event handler to the element
|
|
- | 830 | if ( elem.addEventListener ) { |
|
- | 831 | elem.addEventListener( type, handle, false ); |
|
745 | set = posProcess( selector, set ); |
832 | } else if ( elem.attachEvent ) { |
- | 833 | elem.attachEvent( "on" + type, handle ); |
|
746 | }
|
834 | }
|
747 | }
|
835 | }
|
748 | } else { |
- | |
749 | // Take a shortcut and set the context if the root selector is an ID
|
- | |
750 | // (but not if it'll be faster if the inner selector is an ID)
|
- | |
751 | if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
- | |
752 | Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
- | |
753 | var ret = Sizzle.find( parts.shift(), context, contextXML ); |
- | |
754 | context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; |
- | |
755 | }
|
836 | }
|
756 | 837 | ||
757 | if ( context ) { |
- | |
758 | var ret = seed ? |
- | |
759 | { expr: parts.pop(), set: makeArray(seed) } : |
838 | // Add the function to the element's handler list
|
760 | Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
- | |
761 | set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; |
839 | handlers[ handler.guid ] = handler; |
762 | 840 | ||
763 | if ( parts.length > 0 ) { |
841 | // Keep track of which events have been used, for global triggering
|
764 | checkSet = makeArray(set); |
842 | this.global[ type ] = true; |
765 | } else { |
- | |
766 | prune = false; |
- | |
767 | }
|
843 | }
|
768 | 844 | ||
769 | while ( parts.length ) { |
845 | // Nullify elem to prevent memory leaks in IE
|
770 | var cur = parts.pop(), pop = cur; |
846 | elem = null; |
- | 847 | }, |
|
771 | 848 | ||
772 | if ( !Expr.relative[ cur ] ) { |
- | |
773 | cur = ""; |
849 | guid: 1, |
774 | } else { |
850 | global: {}, |
775 | pop = parts.pop(); |
- | |
776 | }
|
- | |
777 | 851 | ||
- | 852 | // Detach an event or set of events from an element
|
|
778 | if ( pop == null ) { |
853 | remove: function( elem, types, handler ) { |
- | 854 | // don't do events on text and comment nodes
|
|
- | 855 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
779 | pop = context; |
856 | return; |
780 | }
|
857 | }
|
781 | 858 | ||
- | 859 | var events = jQuery.data( elem, "events" ), ret, type; |
|
- | 860 | ||
- | 861 | if ( events ) { |
|
- | 862 | // Unbind all events for the element
|
|
- | 863 | if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) { |
|
- | 864 | for ( type in events ) { |
|
782 | Expr.relative[ cur ]( checkSet, pop, contextXML ); |
865 | this.remove( elem, type + (types || "") ); |
783 | }
|
866 | }
|
784 | } else { |
867 | } else { |
- | 868 | // types is actually an event object here
|
|
- | 869 | if ( types.type ) { |
|
785 | checkSet = parts = []; |
870 | handler = types.handler; |
786 | }
|
871 | types = types.type; |
787 | }
|
872 | }
|
788 | 873 | ||
- | 874 | // Handle multiple events seperated by a space
|
|
- | 875 | // jQuery(...).unbind("mouseover mouseout", fn);
|
|
789 | if ( !checkSet ) { |
876 | types = types.split(/\s+/); |
790 | checkSet = set; |
877 | var i = 0; |
791 | }
|
- | |
- | 878 | while ( (type = types[ i++ ]) ) { |
|
- | 879 | // Namespaced event handlers
|
|
- | 880 | var namespaces = type.split("."); |
|
- | 881 | type = namespaces.shift(); |
|
- | 882 | var all = !namespaces.length, |
|
- | 883 | namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"), |
|
- | 884 | special = this.special[ type ] || {}; |
|
792 | 885 | ||
793 | if ( !checkSet ) { |
886 | if ( events[ type ] ) { |
794 | throw "Syntax error, unrecognized expression: " + (cur || selector); |
887 | // remove the given handler for the given type
|
795 | }
|
888 | if ( handler ) { |
- | 889 | delete events[ type ][ handler.guid ]; |
|
796 | 890 | ||
797 | if ( toString.call(checkSet) === "[object Array]" ) { |
- | |
798 | if ( !prune ) { |
- | |
799 | results.push.apply( results, checkSet ); |
891 | // remove all handlers for the given type
|
800 | } else if ( context && context.nodeType === 1 ) { |
- | |
801 | for ( var i = 0; checkSet[i] != null; i++ ) { |
- | |
802 | if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
- | |
803 | results.push( set[i] ); |
- | |
804 | }
|
- | |
805 | }
|
- | |
806 | } else { |
892 | } else { |
807 | for ( var i = 0; checkSet[i] != null; i++ ) { |
893 | for ( var handle in events[ type ] ) { |
- | 894 | // Handle the removal of namespaced events
|
|
808 | if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
895 | if ( all || namespace.test( events[ type ][ handle ].type ) ) { |
809 | results.push( set[i] ); |
896 | delete events[ type ][ handle ]; |
810 | }
|
897 | }
|
811 | }
|
898 | }
|
812 | }
|
899 | }
|
813 | } else { |
- | |
814 | makeArray( checkSet, results ); |
- | |
815 | }
|
- | |
816 | 900 | ||
817 | if ( extra ) { |
901 | if ( special.remove ) { |
818 | Sizzle( extra, origContext, results, seed ); |
902 | special.remove.call( elem, namespaces ); |
819 | Sizzle.uniqueSort( results ); |
- | |
820 | }
|
903 | }
|
821 | 904 | ||
- | 905 | // remove generic event handler if no more handlers exist
|
|
- | 906 | for ( ret in events[ type ] ) { |
|
822 | return results; |
907 | break; |
823 | }; |
908 | }
|
824 | - | ||
- | 909 | if ( !ret ) { |
|
- | 910 | if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { |
|
825 | Sizzle.uniqueSort = function(results){ |
911 | if ( elem.removeEventListener ) { |
- | 912 | elem.removeEventListener( type, jQuery.data( elem, "handle" ), false ); |
|
826 | if ( sortOrder ) { |
913 | } else if ( elem.detachEvent ) { |
- | 914 | elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) ); |
|
- | 915 | }
|
|
- | 916 | }
|
|
827 | hasDuplicate = false; |
917 | ret = null; |
828 | results.sort(sortOrder); |
918 | delete events[ type ]; |
- | 919 | }
|
|
- | 920 | }
|
|
- | 921 | }
|
|
- | 922 | }
|
|
829 | 923 | ||
830 | if ( hasDuplicate ) { |
- | |
831 | for ( var i = 1; i < results.length; i++ ) { |
924 | // Remove the expando if it's no longer used
|
832 | if ( results[i] === results[i-1] ) { |
925 | for ( ret in events ) { |
833 | results.splice(i--, 1); |
926 | break; |
834 | }
|
927 | }
|
- | 928 | if ( !ret ) { |
|
- | 929 | var handle = jQuery.data( elem, "handle" ); |
|
- | 930 | if ( handle ) { |
|
- | 931 | handle.elem = null; |
|
835 | }
|
932 | }
|
- | 933 | jQuery.removeData( elem, "events" ); |
|
- | 934 | jQuery.removeData( elem, "handle" ); |
|
836 | }
|
935 | }
|
837 | }
|
936 | }
|
838 | }; |
937 | }, |
839 | 938 | ||
- | 939 | // bubbling is internal
|
|
- | 940 | trigger: function( event, data, elem /*, bubbling */ ) { |
|
- | 941 | // Event object or event type
|
|
840 | Sizzle.matches = function(expr, set){ |
942 | var type = event.type || event, |
841 | return Sizzle(expr, null, null, set); |
943 | bubbling = arguments[3]; |
842 | }; |
- | |
843 | 944 | ||
- | 945 | if ( !bubbling ) { |
|
844 | Sizzle.find = function(expr, context, isXML){ |
946 | event = typeof event === "object" ? |
- | 947 | // jQuery.Event object
|
|
- | 948 | event[expando] ? event : |
|
845 | var set, match; |
949 | // Object literal
|
- | 950 | jQuery.extend( jQuery.Event(type), event ) : |
|
- | 951 | // Just the event type (string)
|
|
- | 952 | jQuery.Event(type); |
|
846 | 953 | ||
847 | if ( !expr ) { |
954 | if ( type.indexOf("!") >= 0 ) { |
- | 955 | event.type = type = type.slice(0, -1); |
|
848 | return []; |
956 | event.exclusive = true; |
849 | }
|
957 | }
|
850 | 958 | ||
851 | for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
959 | // Handle a global trigger
|
852 | var type = Expr.order[i], match; |
960 | if ( !elem ) { |
853 | - | ||
854 | if ( (match = Expr.match[ type ].exec( expr )) ) { |
961 | // Don't bubble custom events when global (to avoid too much overhead)
|
855 | var left = RegExp.leftContext; |
962 | event.stopPropagation(); |
856 | - | ||
857 | if ( left.substr( left.length - 1 ) !== "\\" ) { |
963 | // Only trigger if we've ever bound an event for it
|
858 | match[1] = (match[1] || "").replace(/\\/g, ""); |
964 | if ( this.global[ type ] ) { |
859 | set = Expr.find[ type ]( match, context, isXML ); |
965 | jQuery.each( jQuery.cache, function() { |
860 | if ( set != null ) { |
966 | if ( this.events && this.events[type] ) { |
861 | expr = expr.replace( Expr.match[ type ], "" ); |
967 | jQuery.event.trigger( event, data, this.handle.elem ); |
862 | break; |
- | |
863 | }
|
968 | }
|
- | 969 | }); |
|
864 | }
|
970 | }
|
865 | }
|
971 | }
|
- | 972 | ||
- | 973 | // Handle triggering a single element
|
|
- | 974 | ||
- | 975 | // don't do events on text and comment nodes
|
|
- | 976 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
- | 977 | return undefined; |
|
866 | }
|
978 | }
|
867 | 979 | ||
- | 980 | // Clean up in case it is reused
|
|
- | 981 | event.result = undefined; |
|
868 | if ( !set ) { |
982 | event.target = elem; |
- | 983 | ||
869 | set = context.getElementsByTagName("*"); |
984 | // Clone the incoming data, if any
|
- | 985 | data = jQuery.makeArray( data ); |
|
- | 986 | data.unshift( event ); |
|
870 | }
|
987 | }
|
871 | 988 | ||
872 | return {set: set, expr: expr}; |
989 | event.currentTarget = elem; |
873 | }; |
- | |
874 | 990 | ||
875 | Sizzle.filter = function(expr, set, inplace, not){ |
991 | // Trigger the event, it is assumed that "handle" is a function
|
876 | var old = expr, result = [], curLoop = set, match, anyFound, |
992 | var handle = jQuery.data( elem, "handle" ); |
- | 993 | if ( handle ) { |
|
877 | isXMLFilter = set && set[0] && isXML(set[0]); |
994 | handle.apply( elem, data ); |
- | 995 | }
|
|
878 | 996 | ||
879 | while ( expr && set.length ) { |
997 | var nativeFn, nativeHandler; |
- | 998 | try { |
|
880 | for ( var type in Expr.filter ) { |
999 | nativeFn = elem[ type ]; |
881 | if ( (match = Expr.match[ type ].exec( expr )) != null ) { |
1000 | nativeHandler = elem[ "on" + type ]; |
882 | var filter = Expr.filter[ type ], found, item; |
1001 | // prevent IE from throwing an error for some elements with some event types, see #3533
|
- | 1002 | } catch (e) {} |
|
- | 1003 | // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
|
|
- | 1004 | if ( (!nativeFn || (jQuery.nodeName(elem, 'a') && type === "click")) && nativeHandler && nativeHandler.apply( elem, data ) === false ) { |
|
883 | anyFound = false; |
1005 | event.result = false; |
- | 1006 | }
|
|
884 | 1007 | ||
- | 1008 | // Trigger the native events (except for clicks on links)
|
|
- | 1009 | if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) { |
|
885 | if ( curLoop == result ) { |
1010 | this.triggered = true; |
- | 1011 | try { |
|
886 | result = []; |
1012 | nativeFn(); |
- | 1013 | // prevent IE from throwing an error for some hidden elements
|
|
- | 1014 | } catch (e) {} |
|
887 | }
|
1015 | }
|
888 | 1016 | ||
889 | if ( Expr.preFilter[ type ] ) { |
1017 | this.triggered = false; |
890 | match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
- | |
891 | 1018 | ||
892 | if ( !match ) { |
1019 | if ( !event.isPropagationStopped() ) { |
893 | anyFound = found = true; |
1020 | var parent = elem.parentNode || elem.ownerDocument; |
894 | } else if ( match === true ) { |
1021 | if ( parent ) { |
895 | continue; |
1022 | jQuery.event.trigger( event, data, parent, true ); |
896 | }
|
1023 | }
|
897 | }
|
1024 | }
|
- | 1025 | }, |
|
898 | 1026 | ||
899 | if ( match ) { |
- | |
900 | for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
- | |
901 | if ( item ) { |
1027 | handle: function( event ) { |
902 | found = filter( item, match, i, curLoop ); |
1028 | // returned undefined or false
|
903 | var pass = not ^ !!found; |
1029 | var all, handlers; |
904 | 1030 | ||
- | 1031 | event = arguments[0] = jQuery.event.fix( event || window.event ); |
|
- | 1032 | event.currentTarget = this; |
|
- | 1033 | ||
- | 1034 | // Namespaced event handlers
|
|
- | 1035 | var namespaces = event.type.split("."); |
|
- | 1036 | event.type = namespaces.shift(); |
|
- | 1037 | ||
- | 1038 | // Cache this now, all = true means, any handler
|
|
- | 1039 | all = !namespaces.length && !event.exclusive; |
|
- | 1040 | ||
- | 1041 | var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"); |
|
- | 1042 | ||
- | 1043 | handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; |
|
- | 1044 | ||
905 | if ( inplace && found != null ) { |
1045 | for ( var j in handlers ) { |
- | 1046 | var handler = handlers[ j ]; |
|
- | 1047 | ||
- | 1048 | // Filter the functions by class
|
|
- | 1049 | if ( all || namespace.test(handler.type) ) { |
|
- | 1050 | // Pass in a reference to the handler function itself
|
|
- | 1051 | // So that we can later remove it
|
|
- | 1052 | event.handler = handler; |
|
- | 1053 | event.data = handler.data; |
|
- | 1054 | ||
- | 1055 | var ret = handler.apply( this, arguments ); |
|
- | 1056 | ||
906 | if ( pass ) { |
1057 | if ( ret !== undefined ) { |
907 | anyFound = true; |
1058 | event.result = ret; |
908 | } else { |
1059 | if ( ret === false ) { |
909 | curLoop[i] = false; |
1060 | event.preventDefault(); |
- | 1061 | event.stopPropagation(); |
|
910 | }
|
1062 | }
|
911 | } else if ( pass ) { |
- | |
912 | result.push( item ); |
- | |
913 | anyFound = true; |
- | |
914 | }
|
1063 | }
|
- | 1064 | ||
- | 1065 | if ( event.isImmediatePropagationStopped() ) { |
|
- | 1066 | break; |
|
915 | }
|
1067 | }
|
- | 1068 | ||
916 | }
|
1069 | }
|
917 | }
|
1070 | }
|
- | 1071 | }, |
|
918 | 1072 | ||
919 | if ( found !== undefined ) { |
1073 | props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
- | 1074 | ||
920 | if ( !inplace ) { |
1075 | fix: function( event ) { |
- | 1076 | if ( event[ expando ] ) { |
|
921 | curLoop = result; |
1077 | return event; |
922 | }
|
1078 | }
|
923 | 1079 | ||
- | 1080 | // store a copy of the original event object
|
|
- | 1081 | // and "clone" to set read-only properties
|
|
- | 1082 | var originalEvent = event; |
|
924 | expr = expr.replace( Expr.match[ type ], "" ); |
1083 | event = jQuery.Event( originalEvent ); |
925 | 1084 | ||
- | 1085 | for ( var i = this.props.length, prop; i; ) { |
|
926 | if ( !anyFound ) { |
1086 | prop = this.props[ --i ]; |
927 | return []; |
1087 | event[ prop ] = originalEvent[ prop ]; |
928 | }
|
1088 | }
|
929 | 1089 | ||
- | 1090 | // Fix target property, if necessary
|
|
930 | break; |
1091 | if ( !event.target ) { |
- | 1092 | event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
|
931 | }
|
1093 | }
|
- | 1094 | ||
- | 1095 | // check if target is a textnode (safari)
|
|
- | 1096 | if ( event.target.nodeType === 3 ) { |
|
- | 1097 | event.target = event.target.parentNode; |
|
932 | }
|
1098 | }
|
- | 1099 | ||
- | 1100 | // Add relatedTarget, if necessary
|
|
- | 1101 | if ( !event.relatedTarget && event.fromElement ) { |
|
- | 1102 | event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
|
933 | }
|
1103 | }
|
934 | 1104 | ||
935 | // Improper expression
|
1105 | // Calculate pageX/Y if missing and clientX/Y available
|
936 | if ( expr == old ) { |
1106 | if ( event.pageX == null && event.clientX != null ) { |
937 | if ( anyFound == null ) { |
1107 | var doc = document.documentElement, body = document.body; |
938 | throw "Syntax error, unrecognized expression: " + expr; |
1108 | event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
939 | } else { |
- | |
940 | break; |
- | |
- | 1109 | event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
|
941 | }
|
1110 | }
|
- | 1111 | ||
- | 1112 | // Add which for key events
|
|
- | 1113 | if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { |
|
- | 1114 | event.which = event.charCode || event.keyCode; |
|
942 | }
|
1115 | }
|
943 | 1116 | ||
- | 1117 | // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
|
- | 1118 | if ( !event.metaKey && event.ctrlKey ) { |
|
944 | old = expr; |
1119 | event.metaKey = event.ctrlKey; |
945 | }
|
1120 | }
|
946 | 1121 | ||
- | 1122 | // Add which for click: 1 == left; 2 == middle; 3 == right
|
|
947 | return curLoop; |
1123 | // Note: button is not normalized, so don't use it
|
- | 1124 | if ( !event.which && event.button !== undefined ) { |
|
- | 1125 | event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
|
948 | }; |
1126 | }
|
949 | 1127 | ||
950 | var Expr = Sizzle.selectors = { |
- | |
951 | order: [ "ID", "NAME", "TAG" ], |
- | |
952 | match: { |
- | |
953 | ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
- | |
954 | CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
- | |
955 | NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, |
- | |
956 | ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
- | |
957 | TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, |
- | |
958 | CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
- | |
959 | POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
- | |
960 | PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ |
- | |
961 | }, |
- | |
962 | attrMap: { |
1128 | return event; |
963 | "class": "className", |
- | |
964 | "for": "htmlFor" |
- | |
965 | }, |
1129 | }, |
- | 1130 | ||
966 | attrHandle: { |
1131 | proxy: function( fn, proxy, thisObject ) { |
- | 1132 | if ( proxy !== undefined && !jQuery.isFunction( proxy ) ) { |
|
967 | href: function(elem){ |
1133 | thisObject = proxy; |
968 | return elem.getAttribute("href"); |
1134 | proxy = undefined; |
969 | }
|
1135 | }
|
- | 1136 | // FIXME: Should proxy be redefined to be applied with thisObject if defined?
|
|
- | 1137 | proxy = proxy || function() { return fn.apply( thisObject !== undefined ? thisObject : this, arguments ); }; |
|
- | 1138 | // Set the guid of unique handler to the same of original handler, so it can be removed
|
|
- | 1139 | proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; |
|
- | 1140 | // So proxy can be declared as an argument
|
|
- | 1141 | return proxy; |
|
970 | }, |
1142 | }, |
971 | relative: { |
- | |
972 | "+": function(checkSet, part, isXML){ |
- | |
973 | var isPartStr = typeof part === "string", |
- | |
974 | isTag = isPartStr && !/\W/.test(part), |
- | |
975 | isPartStrNotTag = isPartStr && !isTag; |
- | |
976 | 1143 | ||
- | 1144 | special: { |
|
- | 1145 | ready: { |
|
- | 1146 | // Make sure the ready event is setup
|
|
977 | if ( isTag && !isXML ) { |
1147 | setup: bindReady, |
978 | part = part.toUpperCase(); |
1148 | teardown: function() {} |
979 | }
|
1149 | }, |
980 | 1150 | ||
- | 1151 | live: { |
|
981 | for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
1152 | add: function( proxy, data, namespaces ) { |
982 | if ( (elem = checkSet[i]) ) { |
1153 | jQuery.extend( proxy, data || {} ); |
- | 1154 | proxy.guid += data.selector + data.live; |
|
983 | while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
1155 | jQuery.event.add( this, data.live, liveHandler, data ); |
- | 1156 | }, |
|
984 | 1157 | ||
985 | checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? |
1158 | remove: function( namespaces ) { |
986 | elem || false : |
1159 | if ( namespaces.length ) { |
987 | elem === part; |
1160 | var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); |
988 | }
|
- | |
989 | }
|
- | |
990 | 1161 | ||
- | 1162 | jQuery.each( (jQuery.data(this, "events").live || {}), function() { |
|
991 | if ( isPartStrNotTag ) { |
1163 | if ( name.test(this.type) ) { |
992 | Sizzle.filter( part, checkSet, true ); |
1164 | remove++;
|
993 | }
|
1165 | }
|
994 | }, |
1166 | }); |
995 | ">": function(checkSet, part, isXML){ |
- | |
996 | var isPartStr = typeof part === "string"; |
- | |
997 | - | ||
998 | if ( isPartStr && !/\W/.test(part) ) { |
- | |
999 | part = isXML ? part : part.toUpperCase(); |
- | |
1000 | 1167 | ||
1001 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
- | |
1002 | var elem = checkSet[i]; |
- | |
1003 | if ( elem ) { |
1168 | if ( remove < 1 ) { |
1004 | var parent = elem.parentNode; |
- | |
1005 | checkSet[i] = parent.nodeName === part ? parent : false; |
1169 | jQuery.event.remove( this, namespaces[0], liveHandler ); |
1006 | }
|
1170 | }
|
1007 | }
|
1171 | }
|
1008 | } else { |
- | |
1009 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
- | |
1010 | var elem = checkSet[i]; |
- | |
1011 | if ( elem ) { |
- | |
1012 | checkSet[i] = isPartStr ? |
- | |
1013 | elem.parentNode : |
- | |
1014 | elem.parentNode === part; |
- | |
1015 | }
|
1172 | }
|
1016 | }
|
1173 | }
|
1017 | - | ||
1018 | if ( isPartStr ) { |
- | |
1019 | Sizzle.filter( part, checkSet, true ); |
- | |
1020 | }
|
1174 | }
|
- | 1175 | }; |
|
- | 1176 | ||
- | 1177 | jQuery.Event = function( src ){ |
|
- | 1178 | // Allow instantiation without the 'new' keyword
|
|
- | 1179 | if ( !this.preventDefault ) { |
|
- | 1180 | return new jQuery.Event( src ); |
|
1021 | }
|
1181 | }
|
1022 | }, |
- | |
1023 | "": function(checkSet, part, isXML){ |
- | |
1024 | var doneName = done++, checkFn = dirCheck; |
- | |
1025 | 1182 | ||
- | 1183 | // Event object
|
|
1026 | if ( !/\W/.test(part) ) { |
1184 | if ( src && src.type ) { |
1027 | var nodeCheck = part = isXML ? part : part.toUpperCase(); |
1185 | this.originalEvent = src; |
1028 | checkFn = dirNodeCheck; |
1186 | this.type = src.type; |
- | 1187 | // Event type
|
|
- | 1188 | } else { |
|
- | 1189 | this.type = src; |
|
1029 | }
|
1190 | }
|
1030 | 1191 | ||
1031 | checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
1192 | // timeStamp is buggy for some events on Firefox(#3843)
|
1032 | }, |
- | |
1033 | "~": function(checkSet, part, isXML){ |
1193 | // So we won't rely on the native value
|
1034 | var doneName = done++, checkFn = dirCheck; |
1194 | this.timeStamp = now(); |
1035 | 1195 | ||
1036 | if ( typeof part === "string" && !/\W/.test(part) ) { |
1196 | // Mark it as fixed
|
1037 | var nodeCheck = part = isXML ? part : part.toUpperCase(); |
- | |
1038 | checkFn = dirNodeCheck; |
1197 | this[ expando ] = true; |
1039 | }
|
1198 | }; |
1040 | 1199 | ||
1041 | checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
1200 | function returnFalse() { |
- | 1201 | return false; |
|
1042 | }
|
1202 | }
|
1043 | }, |
- | |
1044 | find: { |
- | |
1045 | ID: function(match, context, isXML){ |
1203 | function returnTrue() { |
1046 | if ( typeof context.getElementById !== "undefined" && !isXML ) { |
- | |
1047 | var m = context.getElementById(match[1]); |
- | |
1048 | return m ? [m] : []; |
1204 | return true; |
1049 | }
|
1205 | }
|
1050 | }, |
- | |
1051 | NAME: function(match, context, isXML){ |
- | |
1052 | if ( typeof context.getElementsByName !== "undefined" ) { |
- | |
1053 | var ret = [], results = context.getElementsByName(match[1]); |
- | |
1054 | 1206 | ||
1055 | for ( var i = 0, l = results.length; i < l; i++ ) { |
1207 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
- | 1208 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
|
- | 1209 | jQuery.Event.prototype = { |
|
- | 1210 | preventDefault: function() { |
|
1056 | if ( results[i].getAttribute("name") === match[1] ) { |
1211 | this.isDefaultPrevented = returnTrue; |
- | 1212 | ||
1057 | ret.push( results[i] ); |
1213 | var e = this.originalEvent; |
- | 1214 | if ( !e ) { |
|
1058 | }
|
1215 | return; |
1059 | }
|
1216 | }
|
1060 | 1217 | ||
- | 1218 | // if preventDefault exists run it on the original event
|
|
1061 | return ret.length === 0 ? null : ret; |
1219 | if ( e.preventDefault ) { |
- | 1220 | e.preventDefault(); |
|
1062 | }
|
1221 | }
|
- | 1222 | // otherwise set the returnValue property of the original event to false (IE)
|
|
- | 1223 | e.returnValue = false; |
|
1063 | }, |
1224 | }, |
1064 | TAG: function(match, context){ |
1225 | stopPropagation: function() { |
1065 | return context.getElementsByTagName(match[1]); |
1226 | this.isPropagationStopped = returnTrue; |
- | 1227 | ||
- | 1228 | var e = this.originalEvent; |
|
- | 1229 | if ( !e ) { |
|
- | 1230 | return; |
|
- | 1231 | }
|
|
- | 1232 | // if stopPropagation exists run it on the original event
|
|
- | 1233 | if ( e.stopPropagation ) { |
|
- | 1234 | e.stopPropagation(); |
|
1066 | }
|
1235 | }
|
- | 1236 | // otherwise set the cancelBubble property of the original event to true (IE)
|
|
- | 1237 | e.cancelBubble = true; |
|
1067 | }, |
1238 | }, |
1068 | preFilter: { |
1239 | stopImmediatePropagation: function(){ |
1069 | CLASS: function(match, curLoop, inplace, result, not, isXML){ |
1240 | this.isImmediatePropagationStopped = returnTrue; |
- | 1241 | this.stopPropagation(); |
|
- | 1242 | }, |
|
- | 1243 | isDefaultPrevented: returnFalse, |
|
- | 1244 | isPropagationStopped: returnFalse, |
|
1070 | match = " " + match[1].replace(/\\/g, "") + " "; |
1245 | isImmediatePropagationStopped: returnFalse
|
1071 | 1246 | }; |
|
- | 1247 | // Checks if an event happened on an element within another element
|
|
- | 1248 | // Used in jQuery.event.special.mouseenter and mouseleave handlers
|
|
- | 1249 | var withinElement = function( event ) { |
|
- | 1250 | // Check if mouse(over|out) are still within the same parent element
|
|
- | 1251 | var parent = event.relatedTarget; |
|
1072 | if ( isXML ) { |
1252 | // Traverse up the tree
|
- | 1253 | while ( parent && parent != this ) { |
|
- | 1254 | // Firefox sometimes assigns relatedTarget a XUL element
|
|
- | 1255 | // which we cannot access the parentNode property of
|
|
- | 1256 | try { parent = parent.parentNode; } |
|
- | 1257 | // assuming we've left the element since we most likely mousedover a xul element
|
|
1073 | return match; |
1258 | catch(e) { break; } |
1074 | }
|
1259 | }
|
1075 | 1260 | ||
1076 | for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
- | |
1077 | if ( elem ) { |
1261 | if ( parent != this ) { |
1078 | if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { |
- | |
1079 | if ( !inplace ) |
1262 | // set the correct event type
|
1080 | result.push( elem ); |
1263 | event.type = event.data; |
1081 | } else if ( inplace ) { |
1264 | // handle event if we actually just moused on to a non sub-element
|
1082 | curLoop[i] = false; |
1265 | jQuery.event.handle.apply( this, arguments ); |
1083 | }
|
1266 | }
|
- | 1267 | }; |
|
- | 1268 | ||
- | 1269 | // Create mouseenter and mouseleave events
|
|
- | 1270 | jQuery.each({ |
|
- | 1271 | mouseover: "mouseenter", |
|
- | 1272 | mouseout: "mouseleave" |
|
- | 1273 | }, function( orig, fix ) { |
|
- | 1274 | jQuery.event.special[ fix ] = { |
|
- | 1275 | setup: function(){ |
|
- | 1276 | jQuery.event.add( this, orig, withinElement, fix ); |
|
- | 1277 | }, |
|
- | 1278 | teardown: function(){ |
|
- | 1279 | jQuery.event.remove( this, orig, withinElement ); |
|
1084 | }
|
1280 | }
|
- | 1281 | }; |
|
- | 1282 | }); |
|
- | 1283 | ||
- | 1284 | (function() { |
|
- | 1285 | ||
- | 1286 | var event = jQuery.event, |
|
- | 1287 | special = event.special, |
|
- | 1288 | handle = event.handle; |
|
- | 1289 | ||
- | 1290 | special.submit = { |
|
- | 1291 | setup: function(data, namespaces) { |
|
- | 1292 | if(data.selector) { |
|
- | 1293 | event.add(this, 'click.specialSubmit', function(e, eventData) { |
|
- | 1294 | if(jQuery(e.target).filter(":submit, :image").closest(data.selector).length) { |
|
- | 1295 | e.type = "submit"; |
|
- | 1296 | return handle.call( this, e, eventData ); |
|
1085 | }
|
1297 | }
|
- | 1298 | }); |
|
1086 | 1299 | ||
- | 1300 | event.add(this, 'keypress.specialSubmit', function( e, eventData ) { |
|
- | 1301 | if(jQuery(e.target).filter(":text, :password").closest(data.selector).length) { |
|
- | 1302 | e.type = "submit"; |
|
- | 1303 | return handle.call( this, e, eventData ); |
|
- | 1304 | }
|
|
- | 1305 | }); |
|
- | 1306 | } else { |
|
1087 | return false; |
1307 | return false; |
- | 1308 | }
|
|
1088 | }, |
1309 | }, |
1089 | ID: function(match){ |
- | |
1090 | return match[1].replace(/\\/g, ""); |
- | |
1091 | }, |
- | |
1092 | TAG: function(match, curLoop){ |
- | |
1093 | for ( var i = 0; curLoop[i] === false; i++ ){} |
- | |
1094 | return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); |
- | |
1095 | }, |
- | |
1096 | CHILD: function(match){ |
- | |
1097 | if ( match[1] == "nth" ) { |
- | |
1098 | // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
|
- | |
1099 | var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
- | |
1100 | match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || |
- | |
1101 | !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
- | |
1102 | 1310 | ||
1103 | // calculate the numbers (first)n+(last) including if they are negative
|
1311 | remove: function(namespaces) { |
1104 | match[2] = (test[1] + (test[2] || 1)) - 0; |
1312 | event.remove(this, 'click.specialSubmit'); |
1105 | match[3] = test[3] - 0; |
1313 | event.remove(this, 'keypress.specialSubmit'); |
1106 | }
|
1314 | }
|
- | 1315 | }; |
|
1107 | 1316 | ||
1108 | // TODO: Move to normal caching system
|
- | |
1109 | match[0] = done++; |
1317 | })(); |
1110 | 1318 | ||
- | 1319 | // Create "bubbling" focus and blur events
|
|
1111 | return match; |
1320 | jQuery.each({ |
1112 | }, |
1321 | focus: "focusin", |
- | 1322 | blur: "focusout" |
|
1113 | ATTR: function(match, curLoop, inplace, result, not, isXML){ |
1323 | }, function( orig, fix ){ |
1114 | var name = match[1].replace(/\\/g, ""); |
1324 | var event = jQuery.event, |
1115 | - | ||
1116 | if ( !isXML && Expr.attrMap[name] ) { |
1325 | special = event.special, |
1117 | match[1] = Expr.attrMap[name]; |
1326 | handle = event.handle; |
1118 | }
|
- | |
1119 | 1327 | ||
- | 1328 | function ieHandler() { |
|
1120 | if ( match[2] === "~=" ) { |
1329 | arguments[0].type = orig; |
1121 | match[4] = " " + match[4] + " "; |
1330 | return handle.apply(this, arguments); |
1122 | }
|
1331 | }
|
1123 | 1332 | ||
- | 1333 | special[orig] = { |
|
1124 | return match; |
1334 | setup:function() { |
- | 1335 | if ( this.addEventListener ) |
|
- | 1336 | this.addEventListener( orig, handle, true ); |
|
- | 1337 | else
|
|
- | 1338 | jQuery.event.add( this, fix, ieHandler ); |
|
1125 | }, |
1339 | }, |
1126 | PSEUDO: function(match, curLoop, inplace, result, not){ |
1340 | teardown:function() { |
1127 | if ( match[1] === "not" ) { |
1341 | if ( this.removeEventListener ) |
1128 | // If we're dealing with a complex expression, or a simple one
|
- | |
1129 | if ( chunker.exec(match[3]).length > 1 || /^\w/.test(match[3]) ) { |
- | |
1130 | match[3] = Sizzle(match[3], null, null, curLoop); |
1342 | this.removeEventListener( orig, handle, true ); |
1131 | } else { |
1343 | else
|
1132 | var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
- | |
1133 | if ( !inplace ) { |
- | |
1134 | result.push.apply( result, ret ); |
1344 | jQuery.event.remove( this, fix, ieHandler ); |
1135 | }
|
1345 | }
|
- | 1346 | }; |
|
- | 1347 | }); |
|
- | 1348 | ||
- | 1349 | jQuery.fn.extend({ |
|
- | 1350 | // TODO: make bind(), unbind() and one() DRY!
|
|
- | 1351 | bind: function( type, data, fn, thisObject ) { |
|
- | 1352 | // Handle object literals
|
|
- | 1353 | if ( typeof type === "object" ) { |
|
1136 | return false; |
1354 | for ( var key in type ) { |
- | 1355 | this.bind(key, data, type[key], fn); |
|
1137 | }
|
1356 | }
|
1138 | } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
- | |
1139 | return true; |
1357 | return this; |
1140 | }
|
1358 | }
|
1141 | 1359 | ||
1142 | return match; |
1360 | if ( jQuery.isFunction( data ) ) { |
1143 | }, |
- | |
1144 | POS: function(match){ |
1361 | thisObject = fn; |
1145 | match.unshift( true ); |
1362 | fn = data; |
1146 | return match; |
1363 | data = undefined; |
1147 | }
|
1364 | }
|
- | 1365 | fn = thisObject === undefined ? fn : jQuery.event.proxy( fn, thisObject ); |
|
- | 1366 | return type === "unload" ? this.one(type, data, fn, thisObject) : this.each(function() { |
|
- | 1367 | jQuery.event.add( this, type, fn, data ); |
|
- | 1368 | }); |
|
1148 | }, |
1369 | }, |
1149 | filters: { |
- | |
1150 | enabled: function(elem){ |
- | |
1151 | return elem.disabled === false && elem.type !== "hidden"; |
- | |
1152 | }, |
- | |
1153 | disabled: function(elem){ |
- | |
1154 | return elem.disabled === true; |
- | |
1155 | }, |
1370 | |
1156 | checked: function(elem){ |
- | |
1157 | return elem.checked === true; |
- | |
1158 | }, |
- | |
1159 | selected: function(elem){ |
- | |
1160 | // Accessing this property makes selected-by-default
|
- | |
1161 | // options in Safari work properly
|
- | |
1162 | elem.parentNode.selectedIndex; |
- | |
1163 | return elem.selected === true; |
- | |
1164 | }, |
- | |
1165 | parent: function(elem){ |
- | |
1166 | return !!elem.firstChild; |
- | |
1167 | }, |
- | |
1168 | empty: function(elem){ |
- | |
1169 | return !elem.firstChild; |
- | |
1170 | }, |
- | |
1171 | has: function(elem, i, match){ |
1371 | one: function( type, data, fn, thisObject ) { |
1172 | return !!Sizzle( match[3], elem ).length; |
- | |
1173 | }, |
- | |
1174 | header: function(elem){ |
1372 | // Handle object literals
|
1175 | return /h\d/i.test( elem.nodeName ); |
- | |
1176 | }, |
- | |
1177 | text: function(elem){ |
- | |
1178 | return "text" === elem.type; |
- | |
1179 | }, |
- | |
1180 | radio: function(elem){ |
- | |
1181 | return "radio" === elem.type; |
- | |
1182 | }, |
- | |
1183 | checkbox: function(elem){ |
- | |
1184 | return "checkbox" === elem.type; |
- | |
1185 | }, |
- | |
1186 | file: function(elem){ |
- | |
1187 | return "file" === elem.type; |
1373 | if ( typeof type === "object" ) { |
1188 | }, |
- | |
1189 | password: function(elem){ |
- | |
1190 | return "password" === elem.type; |
- | |
1191 | }, |
- | |
1192 | submit: function(elem){ |
- | |
1193 | return "submit" === elem.type; |
- | |
1194 | }, |
- | |
1195 | image: function(elem){ |
- | |
1196 | return "image" === elem.type; |
1374 | for ( var key in type ) { |
1197 | }, |
- | |
1198 | reset: function(elem){ |
- | |
1199 | return "reset" === elem.type; |
1375 | this.one(key, data, type[key], fn); |
1200 | }, |
- | |
1201 | button: function(elem){ |
- | |
1202 | return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; |
- | |
1203 | }, |
- | |
1204 | input: function(elem){ |
- | |
1205 | return /input|select|textarea|button/i.test(elem.nodeName); |
- | |
1206 | }
|
1376 | }
|
- | 1377 | return this; |
|
- | 1378 | }
|
|
- | 1379 | ||
- | 1380 | if ( jQuery.isFunction( data ) ) { |
|
- | 1381 | thisObject = fn; |
|
- | 1382 | fn = data; |
|
- | 1383 | data = undefined; |
|
- | 1384 | }
|
|
- | 1385 | fn = thisObject === undefined ? fn : jQuery.event.proxy( fn, thisObject ); |
|
- | 1386 | var one = jQuery.event.proxy( fn, function( event ) { |
|
- | 1387 | jQuery( this ).unbind( event, one ); |
|
- | 1388 | return fn.apply( this, arguments ); |
|
- | 1389 | }); |
|
- | 1390 | return this.each(function() { |
|
- | 1391 | jQuery.event.add( this, type, one, data ); |
|
- | 1392 | }); |
|
1207 | }, |
1393 | }, |
1208 | setFilters: { |
1394 | |
1209 | first: function(elem, i){ |
1395 | unbind: function( type, fn ) { |
1210 | return i === 0; |
1396 | // Handle object literals
|
1211 | }, |
- | |
1212 | last: function(elem, i, match, array){ |
1397 | if ( typeof type === "object" && !type.preventDefault ) { |
1213 | return i === array.length - 1; |
1398 | for ( var key in type ) { |
1214 | }, |
- | |
1215 | even: function(elem, i){ |
1399 | this.unbind(key, type[key]); |
1216 | return i % 2 === 0; |
- | |
1217 | }, |
1400 | }
|
1218 | odd: function(elem, i){ |
- | |
1219 | return i % 2 === 1; |
1401 | return this; |
1220 | }, |
1402 | }
|
- | 1403 | ||
1221 | lt: function(elem, i, match){ |
1404 | return this.each(function() { |
1222 | return i < match[3] - 0; |
1405 | jQuery.event.remove( this, type, fn ); |
1223 | }, |
1406 | }); |
1224 | gt: function(elem, i, match){ |
- | |
1225 | return i > match[3] - 0; |
- | |
1226 | }, |
1407 | }, |
- | 1408 | ||
1227 | nth: function(elem, i, match){ |
1409 | trigger: function( type, data ) { |
1228 | return match[3] - 0 == i; |
1410 | return this.each(function() { |
- | 1411 | jQuery.event.trigger( type, data, this ); |
|
- | 1412 | }); |
|
1229 | }, |
1413 | }, |
- | 1414 | ||
1230 | eq: function(elem, i, match){ |
1415 | triggerHandler: function( type, data ) { |
- | 1416 | if ( this[0] ) { |
|
- | 1417 | var event = jQuery.Event( type ); |
|
- | 1418 | event.preventDefault(); |
|
- | 1419 | event.stopPropagation(); |
|
- | 1420 | jQuery.event.trigger( event, data, this[0] ); |
|
1231 | return match[3] - 0 == i; |
1421 | return event.result; |
1232 | }
|
1422 | }
|
1233 | }, |
1423 | }, |
1234 | filter: { |
- | |
1235 | PSEUDO: function(elem, match, i, array){ |
- | |
1236 | var name = match[1], filter = Expr.filters[ name ]; |
- | |
1237 | 1424 | ||
1238 | if ( filter ) { |
1425 | toggle: function( fn ) { |
1239 | return filter( elem, i, match, array ); |
- | |
1240 | } else if ( name === "contains" ) { |
1426 | // Save reference to arguments for access in closure
|
1241 | return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; |
- | |
1242 | } else if ( name === "not" ) { |
- | |
1243 | var not = match[3]; |
1427 | var args = arguments, i = 1; |
1244 | 1428 | ||
1245 | for ( i = 0, l = not.length; i < l; i++ ) { |
1429 | // link all the functions, so any of them can unbind this click handler
|
1246 | if ( not[i] === elem ) { |
1430 | while( i < args.length ) { |
1247 | return false; |
1431 | jQuery.event.proxy( fn, args[ i++ ] ); |
1248 | }
|
- | |
1249 | }
|
1432 | }
|
1250 | 1433 | ||
- | 1434 | return this.click( jQuery.event.proxy( fn, function( event ) { |
|
- | 1435 | // Figure out which function to execute
|
|
- | 1436 | this.lastToggle = ( this.lastToggle || 0 ) % i; |
|
- | 1437 | ||
- | 1438 | // Make sure that clicks stop
|
|
1251 | return true; |
1439 | event.preventDefault(); |
- | 1440 | ||
- | 1441 | // and execute the function
|
|
- | 1442 | return args[ this.lastToggle++ ].apply( this, arguments ) || false; |
|
1252 | }
|
1443 | })); |
1253 | }, |
1444 | }, |
1254 | CHILD: function(elem, match){ |
- | |
1255 | var type = match[1], node = elem; |
- | |
1256 | switch (type) { |
- | |
1257 | case 'only': |
- | |
1258 | case 'first': |
- | |
1259 | while ( (node = node.previousSibling) ) { |
- | |
1260 | if ( node.nodeType === 1 ) return false; |
- | |
1261 | }
|
- | |
1262 | if ( type == 'first') return true; |
- | |
1263 | node = elem; |
- | |
1264 | case 'last': |
- | |
1265 | while ( (node = node.nextSibling) ) { |
- | |
1266 | if ( node.nodeType === 1 ) return false; |
- | |
1267 | }
|
- | |
1268 | return true; |
- | |
1269 | case 'nth': |
- | |
1270 | var first = match[2], last = match[3]; |
- | |
1271 | 1445 | ||
1272 | if ( first == 1 && last == 0 ) { |
1446 | hover: function( fnOver, fnOut ) { |
1273 | return true; |
1447 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
1274 | }
|
1448 | }, |
1275 | 1449 | ||
1276 | var doneName = match[0], |
1450 | ready: function( fn ) { |
1277 | parent = elem.parentNode; |
1451 | // Attach the listeners
|
- | 1452 | bindReady(); |
|
1278 | 1453 | ||
1279 | if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
- | |
1280 | var count = 0; |
1454 | // If the DOM is already ready
|
1281 | for ( node = parent.firstChild; node; node = node.nextSibling ) { |
- | |
1282 | if ( node.nodeType === 1 ) { |
1455 | if ( jQuery.isReady ) { |
1283 | node.nodeIndex = ++count; |
1456 | // Execute the function immediately
|
1284 | }
|
- | |
1285 | }
|
- | |
1286 | parent.sizcache = doneName; |
1457 | fn.call( document, jQuery ); |
1287 | }
|
- | |
1288 | 1458 | ||
1289 | var diff = elem.nodeIndex - last; |
1459 | // Otherwise, remember the function for later
|
1290 | if ( first == 0 ) { |
- | |
1291 | return diff == 0; |
- | |
1292 | } else { |
1460 | } else { |
1293 | return ( diff % first == 0 && diff / first >= 0 ); |
1461 | // Add the function to the wait list
|
1294 | }
|
1462 | jQuery.readyList.push( fn ); |
1295 | }
|
1463 | }
|
- | 1464 | ||
- | 1465 | return this; |
|
1296 | }, |
1466 | }, |
1297 | ID: function(elem, match){ |
- | |
1298 | return elem.nodeType === 1 && elem.getAttribute("id") === match; |
- | |
1299 | }, |
- | |
1300 | TAG: function(elem, match){ |
- | |
1301 | return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; |
- | |
1302 | }, |
- | |
1303 | CLASS: function(elem, match){ |
- | |
1304 | return (" " + (elem.className || elem.getAttribute("class")) + " ") |
- | |
1305 | .indexOf( match ) > -1; |
- | |
1306 | }, |
- | |
1307 | ATTR: function(elem, match){ |
- | |
1308 | var name = match[1], |
- | |
1309 | result = Expr.attrHandle[ name ] ? |
- | |
1310 | Expr.attrHandle[ name ]( elem ) : |
- | |
1311 | elem[ name ] != null ? |
- | |
1312 | elem[ name ] : |
- | |
1313 | elem.getAttribute( name ), |
- | |
1314 | value = result + "", |
- | |
1315 | type = match[2], |
- | |
1316 | check = match[4]; |
- | |
1317 | - | ||
1318 | return result == null ? |
- | |
1319 | type === "!=" : |
- | |
1320 | type === "=" ? |
- | |
1321 | value === check : |
- | |
1322 | type === "*=" ? |
- | |
1323 | value.indexOf(check) >= 0 : |
- | |
1324 | type === "~=" ? |
- | |
1325 | (" " + value + " ").indexOf(check) >= 0 : |
- | |
1326 | !check ? |
- | |
1327 | value && result !== false : |
- | |
1328 | type === "!=" ? |
- | |
1329 | value != check : |
- | |
1330 | type === "^=" ? |
- | |
1331 | value.indexOf(check) === 0 : |
- | |
1332 | type === "$=" ? |
- | |
1333 | value.substr(value.length - check.length) === check : |
- | |
1334 | type === "|=" ? |
- | |
1335 | value === check || value.substr(0, check.length + 1) === check + "-" : |
- | |
1336 | false; |
- | |
1337 | }, |
- | |
1338 | POS: function(elem, match, i, array){ |
- | |
1339 | var name = match[2], filter = Expr.setFilters[ name ]; |
- | |
1340 | 1467 | ||
- | 1468 | live: function( type, data, fn, thisObject ) { |
|
- | 1469 | if ( jQuery.isFunction( data ) ) { |
|
1341 | if ( filter ) { |
1470 | if ( fn !== undefined ) { |
1342 | return filter( elem, i, match, array ); |
1471 | thisObject = fn; |
1343 | }
|
1472 | }
|
- | 1473 | fn = data; |
|
- | 1474 | data = undefined; |
|
1344 | }
|
1475 | }
|
- | 1476 | jQuery( this.context ).bind( liveConvert( type, this.selector ), { |
|
- | 1477 | data: data, selector: this.selector, live: type |
|
- | 1478 | }, fn, thisObject ); |
|
- | 1479 | return this; |
|
- | 1480 | }, |
|
- | 1481 | ||
- | 1482 | die: function( type, fn ) { |
|
- | 1483 | jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null ); |
|
- | 1484 | return this; |
|
1345 | }
|
1485 | }
|
1346 | }; |
1486 | }); |
1347 | 1487 | ||
- | 1488 | function liveHandler( event ) { |
|
1348 | var origPOS = Expr.match.POS; |
1489 | var stop = true, elems = [], args = arguments; |
1349 | 1490 | ||
- | 1491 | jQuery.each( jQuery.data( this, "events" ).live || [], function( i, fn ) { |
|
1350 | for ( var type in Expr.match ) { |
1492 | if ( fn.live === event.type ) { |
1351 | Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
1493 | var elem = jQuery( event.target ).closest( fn.selector )[0]; |
- | 1494 | if ( elem ) { |
|
- | 1495 | elems.push({ elem: elem, fn: fn }); |
|
1352 | }
|
1496 | }
|
- | 1497 | }
|
|
- | 1498 | }); |
|
1353 | 1499 | ||
1354 | var makeArray = function(array, results) { |
1500 | elems.sort(function( a, b ) { |
1355 | array = Array.prototype.slice.call( array, 0 ); |
1501 | return jQuery.data( a.elem, "closest" ) - jQuery.data( b.elem, "closest" ); |
- | 1502 | }); |
|
1356 | 1503 | ||
1357 | if ( results ) { |
1504 | jQuery.each(elems, function() { |
- | 1505 | event.currentTarget = this.elem; |
|
- | 1506 | event.data = this.fn.data; |
|
1358 | results.push.apply( results, array ); |
1507 | if ( this.fn.apply( this.elem, args ) === false ) { |
1359 | return results; |
1508 | return (stop = false); |
1360 | }
|
1509 | }
|
- | 1510 | }); |
|
1361 | 1511 | ||
1362 | return array; |
1512 | return stop; |
1363 | }; |
1513 | }
|
1364 | 1514 | ||
1365 | // Perform a simple check to determine if the browser is capable of
|
1515 | function liveConvert( type, selector ) { |
1366 | // converting a NodeList to an array using builtin methods.
|
1516 | return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); |
1367 | try { |
1517 | }
|
1368 | Array.prototype.slice.call( document.documentElement.childNodes, 0 ); |
- | |
1369 | 1518 | ||
- | 1519 | jQuery.extend({ |
|
- | 1520 | isReady: false, |
|
- | 1521 | readyList: [], |
|
1370 | // Provide a fallback method if it does not work
|
1522 | // Handle when the DOM is ready
|
1371 | } catch(e){ |
1523 | ready: function() { |
1372 | makeArray = function(array, results) { |
1524 | // Make sure that the DOM is not already loaded
|
- | 1525 | if ( !jQuery.isReady ) { |
|
- | 1526 | // Remember that the DOM is ready
|
|
1373 | var ret = results || []; |
1527 | jQuery.isReady = true; |
1374 | 1528 | ||
1375 | if ( toString.call(array) === "[object Array]" ) { |
1529 | // If there are functions bound, to execute
|
1376 | Array.prototype.push.apply( ret, array ); |
1530 | if ( jQuery.readyList ) { |
1377 | } else { |
1531 | // Execute all of them
|
1378 | if ( typeof array.length === "number" ) { |
1532 | var fn, i = 0; |
1379 | for ( var i = 0, l = array.length; i < l; i++ ) { |
1533 | while ( (fn = jQuery.readyList[ i++ ]) ) { |
1380 | ret.push( array[i] ); |
1534 | fn.call( document, jQuery ); |
1381 | }
|
1535 | }
|
1382 | } else { |
1536 | |
1383 | for ( var i = 0; array[i]; i++ ) { |
1537 | // Reset the list of functions
|
1384 | ret.push( array[i] ); |
1538 | jQuery.readyList = null; |
1385 | }
|
1539 | }
|
- | 1540 | ||
- | 1541 | // Trigger any bound ready events
|
|
- | 1542 | jQuery( document ).triggerHandler( "ready" ); |
|
1386 | }
|
1543 | }
|
1387 | }
|
1544 | }
|
- | 1545 | }); |
|
1388 | 1546 | ||
1389 | return ret; |
1547 | var readyBound = false; |
1390 | }; |
- | |
1391 | }
|
- | |
1392 | 1548 | ||
- | 1549 | function bindReady() { |
|
- | 1550 | if ( readyBound ) return; |
|
1393 | var sortOrder; |
1551 | readyBound = true; |
1394 | 1552 | ||
1395 | if ( document.documentElement.compareDocumentPosition ) { |
- | |
1396 | sortOrder = function( a, b ) { |
- | |
1397 | var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
1553 | // Catch cases where $(document).ready() is called after the
|
1398 | if ( ret === 0 ) { |
- | |
1399 | hasDuplicate = true; |
- | |
1400 | }
|
- | |
1401 | return ret; |
- | |
1402 | }; |
- | |
1403 | } else if ( "sourceIndex" in document.documentElement ) { |
- | |
1404 | sortOrder = function( a, b ) { |
- | |
1405 | var ret = a.sourceIndex - b.sourceIndex; |
1554 | // browser event has already occurred.
|
1406 | if ( ret === 0 ) { |
- | |
1407 | hasDuplicate = true; |
- | |
1408 | }
|
- | |
1409 | return ret; |
- | |
1410 | }; |
- | |
1411 | } else if ( document.createRange ) { |
1555 | if ( document.readyState === "complete" ) { |
1412 | sortOrder = function( a, b ) { |
- | |
1413 | var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
- | |
1414 | aRange.selectNode(a); |
- | |
1415 | aRange.collapse(true); |
- | |
1416 | bRange.selectNode(b); |
- | |
1417 | bRange.collapse(true); |
- | |
1418 | var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
- | |
1419 | if ( ret === 0 ) { |
- | |
1420 | hasDuplicate = true; |
- | |
1421 | }
|
- | |
1422 | return ret; |
1556 | return jQuery.ready(); |
1423 | }; |
- | |
1424 | }
|
1557 | }
|
1425 | 1558 | ||
1426 | // Check to see if the browser returns elements by name when
|
1559 | // Mozilla, Opera and webkit nightlies currently support this event
|
1427 | // querying by getElementById (and provide a workaround)
|
1560 | if ( document.addEventListener ) { |
1428 | (function(){ |
1561 | // Use the handy event callback
|
1429 | // We're going to inject a fake input element with a specified name
|
1562 | document.addEventListener( "DOMContentLoaded", function() { |
1430 | var form = document.createElement("div"), |
1563 | document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); |
1431 | id = "script" + (new Date).getTime(); |
1564 | jQuery.ready(); |
1432 | form.innerHTML = "<a name='" + id + "'/>"; |
1565 | }, false ); |
1433 | 1566 | ||
1434 | // Inject it into the root element, check its status, and remove it quickly
|
1567 | // If IE event model is used
|
1435 | var root = document.documentElement; |
1568 | } else if ( document.attachEvent ) { |
1436 | root.insertBefore( form, root.firstChild ); |
1569 | // ensure firing before onload,
|
- | 1570 | // maybe late but safe also for iframes
|
|
- | 1571 | document.attachEvent("onreadystatechange", function() { |
|
- | 1572 | if ( document.readyState === "complete" ) { |
|
- | 1573 | document.detachEvent( "onreadystatechange", arguments.callee ); |
|
- | 1574 | jQuery.ready(); |
|
- | 1575 | }
|
|
- | 1576 | }); |
|
1437 | 1577 | ||
1438 | // The workaround has to do additional checks after a getElementById
|
1578 | // If IE and not an iframe
|
1439 | // Which slows things down for other browsers (hence the branching)
|
1579 | // continually check to see if the document is ready
|
1440 | if ( !!document.getElementById( id ) ) { |
1580 | // NOTE: DO NOT CHANGE TO ===, FAILS IN IE.
|
1441 | Expr.find.ID = function(match, context, isXML){ |
1581 | if ( document.documentElement.doScroll && window == window.top ) (function() { |
1442 | if ( typeof context.getElementById !== "undefined" && !isXML ) { |
1582 | if ( jQuery.isReady ) { |
1443 | var m = context.getElementById(match[1]); |
1583 | return; |
1444 | return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
- | |
1445 | }
|
1584 | }
|
1446 | }; |
- | |
1447 | 1585 | ||
- | 1586 | try { |
|
1448 | Expr.filter.ID = function(elem, match){ |
1587 | // If IE is used, use the trick by Diego Perini
|
1449 | var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
1588 | // http://javascript.nwbox.com/IEContentLoaded/
|
1450 | return elem.nodeType === 1 && node && node.nodeValue === match; |
1589 | document.documentElement.doScroll("left"); |
- | 1590 | } catch( error ) { |
|
- | 1591 | setTimeout( arguments.callee, 0 ); |
|
1451 | }; |
1592 | return; |
1452 | }
|
1593 | }
|
1453 | 1594 | ||
1454 | root.removeChild( form ); |
1595 | // and execute any waiting functions
|
1455 | root = form = null; // release memory in IE |
1596 | jQuery.ready(); |
1456 | })(); |
1597 | })(); |
1457 | - | ||
1458 | (function(){ |
- | |
1459 | // Check to see if the browser returns only elements
|
- | |
1460 | // when doing getElementsByTagName("*")
|
- | |
1461 | - | ||
1462 | // Create a fake element
|
- | |
1463 | var div = document.createElement("div"); |
- | |
1464 | div.appendChild( document.createComment("") ); |
- | |
1465 | - | ||
1466 | // Make sure no comments are found
|
- | |
1467 | if ( div.getElementsByTagName("*").length > 0 ) { |
- | |
1468 | Expr.find.TAG = function(match, context){ |
- | |
1469 | var results = context.getElementsByTagName(match[1]); |
- | |
1470 | - | ||
1471 | // Filter out possible comments
|
- | |
1472 | if ( match[1] === "*" ) { |
- | |
1473 | var tmp = []; |
- | |
1474 | - | ||
1475 | for ( var i = 0; results[i]; i++ ) { |
- | |
1476 | if ( results[i].nodeType === 1 ) { |
- | |
1477 | tmp.push( results[i] ); |
- | |
1478 | }
|
- | |
1479 | }
|
1598 | }
|
1480 | 1599 | ||
- | 1600 | // A fallback to window.onload, that will always work
|
|
1481 | results = tmp; |
1601 | jQuery.event.add( window, "load", jQuery.ready ); |
1482 | }
|
1602 | }
|
1483 | 1603 | ||
- | 1604 | jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
|
- | 1605 | "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + |
|
- | 1606 | "change,select,submit,keydown,keypress,keyup,error").split(","), function( i, name ) { |
|
- | 1607 | ||
1484 | return results; |
1608 | // Handle event binding
|
- | 1609 | jQuery.fn[ name ] = function( fn ) { |
|
- | 1610 | return fn ? this.bind( name, fn ) : this.trigger( name ); |
|
1485 | }; |
1611 | }; |
1486 | }
|
1612 | }); |
1487 | 1613 | ||
- | 1614 | // Prevent memory leaks in IE
|
|
1488 | // Check to see if an attribute returns normalized href attributes
|
1615 | // Window isn't included so as not to unbind existing unload events
|
- | 1616 | // More info:
|
|
1489 | div.innerHTML = "<a href='#'></a>"; |
1617 | // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
|
- | 1618 | /*@cc_on
|
|
1490 | if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
1619 | jQuery( window ).bind( 'unload', function() {
|
1491 | div.firstChild.getAttribute("href") !== "#" ) { |
1620 | for ( var id in jQuery.cache ) {
|
- | 1621 | // Skip the window
|
|
1492 | Expr.attrHandle.href = function(elem){ |
1622 | if ( id != 1 && jQuery.cache[ id ].handle ) {
|
1493 | return elem.getAttribute("href", 2); |
1623 | jQuery.event.remove( jQuery.cache[ id ].handle.elem );
|
1494 | }; |
- | |
1495 | }
|
1624 | }
|
- | 1625 | }
|
|
- | 1626 | });
|
|
- | 1627 | @*/
|
|
- | 1628 | (function(){ |
|
1496 | 1629 | ||
1497 | div = null; // release memory in IE |
1630 | jQuery.support = {}; |
1498 | })(); |
- | |
1499 | 1631 | ||
- | 1632 | var root = document.documentElement, |
|
1500 | if ( document.querySelectorAll ) (function(){ |
1633 | script = document.createElement("script"), |
1501 | var oldSizzle = Sizzle, div = document.createElement("div"); |
1634 | div = document.createElement("div"), |
1502 | div.innerHTML = "<p class='TEST'></p>"; |
1635 | id = "script" + (new Date).getTime(); |
1503 | 1636 | ||
1504 | // Safari can't handle uppercase or unicode characters when
|
- | |
1505 | // in quirks mode.
|
1637 | div.style.display = "none"; |
1506 | if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
1638 | div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>'; |
1507 | return; |
- | |
1508 | }
|
- | |
1509 | 1639 | ||
1510 | Sizzle = function(query, context, extra, seed){ |
1640 | var all = div.getElementsByTagName("*"), |
1511 | context = context || document; |
1641 | a = div.getElementsByTagName("a")[0]; |
1512 | 1642 | ||
1513 | // Only use querySelectorAll on non-XML documents
|
- | |
1514 | // (ID selectors don't work in non-HTML documents)
|
1643 | // Can't get basic test support
|
1515 | if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
1644 | if ( !all || !all.length || !a ) { |
1516 | try { |
1645 | return; |
1517 | return makeArray( context.querySelectorAll(query), extra ); |
- | |
1518 | } catch(e){} |
- | |
1519 | }
|
1646 | }
|
1520 | 1647 | ||
- | 1648 | jQuery.support = { |
|
1521 | return oldSizzle(query, context, extra, seed); |
1649 | // IE strips leading whitespace when .innerHTML is used
|
1522 | }; |
- | |
- | 1650 | leadingWhitespace: div.firstChild.nodeType == 3, |
|
1523 | 1651 | ||
- | 1652 | // Make sure that tbody elements aren't automatically inserted
|
|
1524 | for ( var prop in oldSizzle ) { |
1653 | // IE will insert them into empty tables
|
1525 | Sizzle[ prop ] = oldSizzle[ prop ]; |
1654 | tbody: !div.getElementsByTagName("tbody").length, |
1526 | }
|
- | |
1527 | 1655 | ||
- | 1656 | // Make sure that link elements get serialized correctly by innerHTML
|
|
1528 | div = null; // release memory in IE |
1657 | // This requires a wrapper element in IE
|
1529 | })(); |
- | |
- | 1658 | htmlSerialize: !!div.getElementsByTagName("link").length, |
|
1530 | 1659 | ||
1531 | if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ |
1660 | // Get the style information from getAttribute
|
1532 | var div = document.createElement("div"); |
1661 | // (IE uses .cssText insted)
|
1533 | div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
1662 | style: /red/.test( a.getAttribute("style") ), |
1534 | 1663 | ||
1535 | // Opera can't find a second classname (in 9.6)
|
1664 | // Make sure that URLs aren't manipulated
|
1536 | if ( div.getElementsByClassName("e").length === 0 ) |
1665 | // (IE normalizes it by default)
|
1537 | return; |
1666 | hrefNormalized: a.getAttribute("href") === "/a", |
1538 | 1667 | ||
1539 | // Safari caches class attributes, doesn't catch changes (in 3.2)
|
1668 | // Make sure that element opacity exists
|
- | 1669 | // (IE uses filter instead)
|
|
1540 | div.lastChild.className = "e"; |
1670 | opacity: a.style.opacity === "0.5", |
1541 | 1671 | ||
- | 1672 | // Verify style float existence
|
|
1542 | if ( div.getElementsByClassName("e").length === 1 ) |
1673 | // (IE uses styleFloat instead of cssFloat)
|
1543 | return; |
1674 | cssFloat: !!a.style.cssFloat, |
1544 | 1675 | ||
1545 | Expr.order.splice(1, 0, "CLASS"); |
1676 | // Will be defined later
|
1546 | Expr.find.CLASS = function(match, context, isXML) { |
1677 | scriptEval: false, |
1547 | if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
- | |
1548 | return context.getElementsByClassName(match[1]); |
1678 | noCloneEvent: true, |
1549 | }
|
1679 | boxModel: null |
1550 | }; |
1680 | }; |
1551 | 1681 | ||
1552 | div = null; // release memory in IE |
1682 | script.type = "text/javascript"; |
1553 | })(); |
1683 | try { |
- | 1684 | script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
|
- | 1685 | } catch(e){} |
|
1554 | 1686 | ||
1555 | function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
- | |
1556 | var sibDir = dir == "previousSibling" && !isXML; |
1687 | root.insertBefore( script, root.firstChild ); |
1557 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
- | |
1558 | var elem = checkSet[i]; |
- | |
1559 | if ( elem ) { |
- | |
1560 | if ( sibDir && elem.nodeType === 1 ){ |
- | |
1561 | elem.sizcache = doneName; |
- | |
1562 | elem.sizset = i; |
- | |
1563 | }
|
- | |
1564 | elem = elem[dir]; |
- | |
1565 | var match = false; |
- | |
1566 | 1688 | ||
- | 1689 | // Make sure that the execution of code works by injecting a script
|
|
1567 | while ( elem ) { |
1690 | // tag with appendChild/createTextNode
|
- | 1691 | // (IE doesn't support this, fails, and uses .text instead)
|
|
1568 | if ( elem.sizcache === doneName ) { |
1692 | if ( window[ id ] ) { |
1569 | match = checkSet[elem.sizset]; |
1693 | jQuery.support.scriptEval = true; |
1570 | break; |
1694 | delete window[ id ]; |
1571 | }
|
1695 | }
|
1572 | 1696 | ||
1573 | if ( elem.nodeType === 1 && !isXML ){ |
- | |
1574 | elem.sizcache = doneName; |
- | |
1575 | elem.sizset = i; |
1697 | root.removeChild( script ); |
1576 | }
|
- | |
1577 | 1698 | ||
- | 1699 | if ( div.attachEvent && div.fireEvent ) { |
|
- | 1700 | div.attachEvent("onclick", function click(){ |
|
1578 | if ( elem.nodeName === cur ) { |
1701 | // Cloning a node shouldn't copy over any
|
- | 1702 | // bound event handlers (IE does this)
|
|
- | 1703 | jQuery.support.noCloneEvent = false; |
|
1579 | match = elem; |
1704 | div.detachEvent("onclick", click); |
1580 | break; |
1705 | }); |
- | 1706 | div.cloneNode(true).fireEvent("onclick"); |
|
1581 | }
|
1707 | }
|
1582 | 1708 | ||
- | 1709 | // Figure out if the W3C box model works as expected
|
|
1583 | elem = elem[dir]; |
1710 | // document.body must exist before we can do this
|
1584 | }
|
1711 | jQuery(function(){ |
- | 1712 | var div = document.createElement("div"); |
|
- | 1713 | div.style.width = div.style.paddingLeft = "1px"; |
|
1585 | 1714 | ||
1586 | checkSet[i] = match; |
1715 | document.body.appendChild( div ); |
- | 1716 | jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
|
- | 1717 | document.body.removeChild( div ).style.display = 'none'; |
|
1587 | }
|
1718 | div = null; |
1588 | }
|
1719 | }); |
1589 | }
|
- | |
1590 | 1720 | ||
1591 | function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
- | |
1592 | var sibDir = dir == "previousSibling" && !isXML; |
- | |
1593 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
- | |
1594 | var elem = checkSet[i]; |
1721 | // release memory in IE
|
1595 | if ( elem ) { |
- | |
1596 | if ( sibDir && elem.nodeType === 1 ) { |
1722 | root = script = div = all = a = null; |
1597 | elem.sizcache = doneName; |
- | |
1598 | elem.sizset = i; |
- | |
1599 | }
|
1723 | })(); |
1600 | elem = elem[dir]; |
- | |
1601 | var match = false; |
- | |
1602 | 1724 | ||
1603 | while ( elem ) { |
1725 | jQuery.props = { |
- | 1726 | "for": "htmlFor", |
|
1604 | if ( elem.sizcache === doneName ) { |
1727 | "class": "className", |
- | 1728 | readonly: "readOnly", |
|
- | 1729 | maxlength: "maxLength", |
|
1605 | match = checkSet[elem.sizset]; |
1730 | cellspacing: "cellSpacing", |
1606 | break; |
1731 | rowspan: "rowSpan", |
- | 1732 | colspan: "colSpan", |
|
- | 1733 | tabindex: "tabIndex" |
|
- | 1734 | }; |
|
- | 1735 | /*!
|
|
- | 1736 | * Sizzle CSS Selector Engine - v1.0
|
|
- | 1737 | * Copyright 2009, The Dojo Foundation
|
|
- | 1738 | * Released under the MIT, BSD, and GPL Licenses.
|
|
- | 1739 | * More information: http://sizzlejs.com/
|
|
1607 | }
|
1740 | */
|
- | 1741 | (function(){ |
|
1608 | 1742 | ||
1609 | if ( elem.nodeType === 1 ) { |
1743 | var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
1610 | if ( !isXML ) { |
- | |
1611 | elem.sizcache = doneName; |
- | |
1612 | elem.sizset = i; |
- | |
1613 | }
|
1744 | done = 0, |
1614 | if ( typeof cur !== "string" ) { |
1745 | toString = Object.prototype.toString, |
1615 | if ( elem === cur ) { |
- | |
1616 | match = true; |
1746 | hasDuplicate = false; |
1617 | break; |
- | |
1618 | }
|
- | |
1619 | 1747 | ||
1620 | } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
1748 | var Sizzle = function(selector, context, results, seed) { |
1621 | match = elem; |
1749 | results = results || []; |
1622 | break; |
1750 | var origContext = context = context || document; |
1623 | }
|
- | |
1624 | }
|
- | |
1625 | 1751 | ||
- | 1752 | if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
|
1626 | elem = elem[dir]; |
1753 | return []; |
1627 | }
|
1754 | }
|
1628 | 1755 | ||
1629 | checkSet[i] = match; |
1756 | if ( !selector || typeof selector !== "string" ) { |
1630 | }
|
1757 | return results; |
1631 | }
|
- | |
1632 | }
|
1758 | }
|
1633 | 1759 | ||
1634 | var contains = document.compareDocumentPosition ? function(a, b){ |
1760 | var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context); |
1635 | return a.compareDocumentPosition(b) & 16; |
- | |
1636 | } : function(a, b){ |
- | |
1637 | return a !== b && (a.contains ? a.contains(b) : true); |
- | |
1638 | }; |
- | |
1639 | 1761 | ||
1640 | var isXML = function(elem){ |
- | |
1641 | return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
1762 | // Reset the position of the chunker regexp (start from head)
|
1642 | !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; |
1763 | chunker.lastIndex = 0; |
1643 | }; |
- | |
1644 | 1764 | ||
1645 | var posProcess = function(selector, context){ |
1765 | while ( (m = chunker.exec(selector)) !== null ) { |
1646 | var tmpSet = [], later = "", match, |
1766 | parts.push( m[1] ); |
1647 | root = context.nodeType ? [context] : context; |
- | |
1648 | 1767 | ||
1649 | // Position selectors must be done after the filter
|
1768 | if ( m[2] ) { |
1650 | // And so must :not(positional) so we move all PSEUDOs to the end
|
- | |
1651 | while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
1769 | extra = RegExp.rightContext; |
1652 | later += match[0]; |
1770 | break; |
1653 | selector = selector.replace( Expr.match.PSEUDO, "" ); |
- | |
1654 | }
|
1771 | }
|
1655 | - | ||
1656 | selector = Expr.relative[selector] ? selector + "*" : selector; |
- | |
1657 | - | ||
1658 | for ( var i = 0, l = root.length; i < l; i++ ) { |
- | |
1659 | Sizzle( selector, root[i], tmpSet ); |
- | |
1660 | }
|
1772 | }
|
1661 | 1773 | ||
1662 | return Sizzle.filter( later, tmpSet ); |
- | |
1663 | }; |
- | |
1664 | - | ||
1665 | // EXPOSE
|
- | |
1666 | jQuery.find = Sizzle; |
- | |
1667 | jQuery.expr = Sizzle.selectors; |
- | |
1668 | jQuery.expr[":"] = jQuery.expr.filters; |
- | |
1669 | - | ||
1670 | Sizzle.selectors.filters.hidden = function(elem){ |
1774 | if ( parts.length > 1 && origPOS.exec( selector ) ) { |
1671 | var width = elem.offsetWidth, height = elem.offsetHeight, |
- | |
1672 | force = /^tr$/i.test( elem.nodeName ); // ticket #4512 |
1775 | if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
1673 | return ( width === 0 && height === 0 && !force ) ? |
1776 | set = posProcess( parts[0] + parts[1], context ); |
1674 | true : |
1777 | } else { |
1675 | ( width !== 0 && height !== 0 && !force ) ? |
1778 | set = Expr.relative[ parts[0] ] ? |
1676 | false : |
1779 | [ context ] : |
1677 | !!( jQuery.curCSS(elem, "display") === "none" ); |
1780 | Sizzle( parts.shift(), context ); |
1678 | }; |
- | |
1679 | 1781 | ||
1680 | Sizzle.selectors.filters.visible = function(elem){ |
1782 | while ( parts.length ) { |
1681 | return !Sizzle.selectors.filters.hidden(elem); |
1783 | selector = parts.shift(); |
1682 | }; |
- | |
1683 | 1784 | ||
1684 | Sizzle.selectors.filters.animated = function(elem){ |
- | |
1685 | return jQuery.grep(jQuery.timers, function(fn){ |
1785 | if ( Expr.relative[ selector ] ) |
1686 | return elem === fn.elem; |
1786 | selector += parts.shift(); |
1687 | }).length; |
- | |
1688 | }; |
- | |
1689 | 1787 | ||
1690 | jQuery.filter = jQuery.multiFilter = function( expr, elems, not ) { |
- | |
1691 | if ( not ) { |
- | |
1692 | expr = ":not(" + expr + ")"; |
1788 | set = posProcess( selector, set ); |
1693 | }
|
1789 | }
|
1694 | - | ||
1695 | return Sizzle.matches(expr, elems); |
- | |
1696 | }; |
- | |
1697 | - | ||
1698 | jQuery.dir = function( elem, dir ){ |
- | |
1699 | var matched = [], cur = elem[dir]; |
- | |
1700 | while ( cur && cur != document ) { |
- | |
1701 | if ( cur.nodeType == 1 ) |
- | |
1702 | matched.push( cur ); |
- | |
1703 | cur = cur[dir]; |
- | |
1704 | }
|
1790 | }
|
1705 | return matched; |
1791 | } else { |
1706 | }; |
- | |
1707 | - | ||
1708 | jQuery.nth = function(cur, result, dir, elem){ |
1792 | // Take a shortcut and set the context if the root selector is an ID
|
1709 | result = result || 1; |
- | |
1710 | var num = 0; |
- | |
1711 | - | ||
1712 | for ( ; cur; cur = cur[dir] ) |
1793 | // (but not if it'll be faster if the inner selector is an ID)
|
1713 | if ( cur.nodeType == 1 && ++num == result ) |
1794 | if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
1714 | break; |
- | |
1715 | - | ||
1716 | return cur; |
- | |
1717 | }; |
- | |
1718 | - | ||
1719 | jQuery.sibling = function(n, elem){ |
1795 | Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
1720 | var r = []; |
- | |
1721 | - | ||
1722 | for ( ; n; n = n.nextSibling ) { |
1796 | var ret = Sizzle.find( parts.shift(), context, contextXML ); |
1723 | if ( n.nodeType == 1 && n != elem ) |
1797 | context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; |
1724 | r.push( n ); |
- | |
1725 | }
|
1798 | }
|
1726 | 1799 | ||
1727 | return r; |
1800 | if ( context ) { |
1728 | }; |
1801 | var ret = seed ? |
- | 1802 | { expr: parts.pop(), set: makeArray(seed) } : |
|
- | 1803 | Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
|
- | 1804 | set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; |
|
1729 | 1805 | ||
- | 1806 | if ( parts.length > 0 ) { |
|
- | 1807 | checkSet = makeArray(set); |
|
1730 | return; |
1808 | } else { |
- | 1809 | prune = false; |
|
- | 1810 | }
|
|
1731 | 1811 | ||
1732 | window.Sizzle = Sizzle; |
1812 | while ( parts.length ) { |
- | 1813 | var cur = parts.pop(), pop = cur; |
|
1733 | 1814 | ||
1734 | })(); |
- | |
1735 | jQuery.winnow = function( elements, qualifier, keep ) { |
- | |
1736 | if(jQuery.isFunction( qualifier )) { |
1815 | if ( !Expr.relative[ cur ] ) { |
1737 | return jQuery.grep(elements, function(elem, i) { |
- | |
1738 | return !!qualifier.call( elem, i ) === keep; |
1816 | cur = ""; |
1739 | }); |
1817 | } else { |
1740 | } else if( qualifier.nodeType ) { |
1818 | pop = parts.pop(); |
1741 | return jQuery.grep(elements, function(elem, i) { |
- | |
1742 | return (elem === qualifier) === keep; |
- | |
1743 | }) |
1819 | }
|
1744 | } else if( typeof qualifier === "string" ) { |
- | |
1745 | var filtered = jQuery.grep(elements, function(elem) { return elem.nodeType === 1 }); |
- | |
1746 | 1820 | ||
1747 | if(isSimple.test( qualifier )) return jQuery.multiFilter(qualifier, filtered, !keep); |
1821 | if ( pop == null ) { |
1748 | else qualifier = jQuery.multiFilter( qualifier, elements ); |
1822 | pop = context; |
1749 | }
|
1823 | }
|
1750 | 1824 | ||
1751 | return jQuery.grep(elements, function(elem, i) { |
1825 | Expr.relative[ cur ]( checkSet, pop, contextXML ); |
- | 1826 | }
|
|
- | 1827 | } else { |
|
1752 | return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
1828 | checkSet = parts = []; |
1753 | }); |
1829 | }
|
1754 | }
|
1830 | }
|
1755 | 1831 | ||
1756 | jQuery.fn.extend({ |
1832 | if ( !checkSet ) { |
1757 | find: function( selector ) { |
1833 | checkSet = set; |
1758 | var ret = this.pushStack( "", "find", selector ), length = 0; |
- | |
- | 1834 | }
|
|
1759 | 1835 | ||
1760 | for ( var i = 0, l = this.length; i < l; i++ ) { |
- | |
1761 | length = ret.length; |
1836 | if ( !checkSet ) { |
1762 | jQuery.find( selector, this[i], ret ); |
1837 | throw "Syntax error, unrecognized expression: " + (cur || selector); |
- | 1838 | }
|
|
1763 | 1839 | ||
- | 1840 | if ( toString.call(checkSet) === "[object Array]" ) { |
|
1764 | if ( i > 0 ) { |
1841 | if ( !prune ) { |
1765 | // Make sure that the results are unique
|
1842 | results.push.apply( results, checkSet ); |
1766 | for ( var n = length; n < ret.length; n++ ) { |
1843 | } else if ( context && context.nodeType === 1 ) { |
1767 | for ( var r = 0; r < length; r++ ) { |
1844 | for ( var i = 0; checkSet[i] != null; i++ ) { |
1768 | if ( ret[r] === ret[n] ) { |
1845 | if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
1769 | ret.splice(n--, 1); |
1846 | results.push( set[i] ); |
1770 | break; |
1847 | }
|
1771 | }
|
1848 | }
|
- | 1849 | } else { |
|
- | 1850 | for ( var i = 0; checkSet[i] != null; i++ ) { |
|
- | 1851 | if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
|
- | 1852 | results.push( set[i] ); |
|
1772 | }
|
1853 | }
|
1773 | }
|
1854 | }
|
1774 | }
|
1855 | }
|
- | 1856 | } else { |
|
- | 1857 | makeArray( checkSet, results ); |
|
1775 | }
|
1858 | }
|
1776 | 1859 | ||
1777 | return ret; |
1860 | if ( extra ) { |
1778 | }, |
- | |
1779 | - | ||
1780 | not: function( selector ) { |
1861 | Sizzle( extra, origContext, results, seed ); |
1781 | return this.pushStack( jQuery.winnow(this, selector, false), "not", selector); |
1862 | Sizzle.uniqueSort( results ); |
1782 | }, |
1863 | }
|
1783 | 1864 | ||
1784 | filter: function( selector ) { |
1865 | return results; |
1785 | return this.pushStack( jQuery.winnow(this, selector, true), "filter", selector ); |
- | |
1786 | }, |
1866 | }; |
1787 | 1867 | ||
1788 | closest: function( selector ) { |
1868 | Sizzle.uniqueSort = function(results){ |
1789 | var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
1869 | if ( sortOrder ) { |
1790 | closer = 0, |
1870 | hasDuplicate = false; |
1791 | context = this.context; |
1871 | results.sort(sortOrder); |
1792 | 1872 | ||
1793 | return this.map(function(){ |
1873 | if ( hasDuplicate ) { |
1794 | var cur = this; |
- | |
1795 | while ( cur && cur.ownerDocument && cur !== context ) { |
1874 | for ( var i = 1; i < results.length; i++ ) { |
1796 | if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
1875 | if ( results[i] === results[i-1] ) { |
1797 | jQuery.data(cur, "closest", closer); |
1876 | results.splice(i--, 1); |
1798 | return cur; |
1877 | }
|
- | 1878 | }
|
|
1799 | }
|
1879 | }
|
1800 | cur = cur.parentNode; |
- | |
1801 | closer++;
|
- | |
1802 | }
|
1880 | }
|
1803 | }); |
- | |
1804 | }, |
- | |
1805 | - | ||
1806 | add: function( selector ) { |
- | |
1807 | return this.pushStack( jQuery.unique( jQuery.merge( |
- | |
1808 | this.get(), |
- | |
1809 | typeof selector === "string" ? |
- | |
1810 | jQuery( selector ) : |
- | |
1811 | jQuery.makeArray( selector ) |
- | |
1812 | ))); |
- | |
1813 | }, |
- | |
1814 | - | ||
1815 | eq: function( i ) { |
- | |
1816 | return this.slice( i, +i + 1 ); |
- | |
1817 | }, |
- | |
1818 | 1881 | ||
1819 | slice: function() { |
1882 | return results; |
1820 | return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
- | |
1821 | "slice", Array.prototype.slice.call(arguments).join(",") ); |
- | |
1822 | }, |
1883 | }; |
1823 | 1884 | ||
1824 | map: function( callback ) { |
1885 | Sizzle.matches = function(expr, set){ |
1825 | return this.pushStack( jQuery.map(this, function(elem, i){ |
- | |
1826 | return callback.call( elem, i, elem ); |
1886 | return Sizzle(expr, null, null, set); |
1827 | })); |
- | |
1828 | }, |
1887 | }; |
1829 | 1888 | ||
1830 | andSelf: function() { |
1889 | Sizzle.find = function(expr, context, isXML){ |
1831 | return this.add( this.prevObject ); |
1890 | var set, match; |
1832 | }, |
- | |
1833 | 1891 | ||
1834 | end: function() { |
1892 | if ( !expr ) { |
1835 | return this.prevObject || jQuery(null); |
1893 | return []; |
1836 | }
|
1894 | }
|
1837 | }); |
- | |
1838 | - | ||
1839 | jQuery.each({ |
- | |
1840 | parent: function(elem){return elem.parentNode;}, |
- | |
1841 | parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
- | |
1842 | next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
- | |
1843 | prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
- | |
1844 | nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
- | |
1845 | prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
- | |
1846 | siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
- | |
1847 | children: function(elem){return jQuery.sibling(elem.firstChild);}, |
- | |
1848 | contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
- | |
1849 | }, function(name, fn){ |
- | |
1850 | jQuery.fn[ name ] = function( selector ) { |
- | |
1851 | var ret = jQuery.map( this, fn ); |
- | |
1852 | 1895 | ||
1853 | if ( selector && typeof selector == "string" ) |
1896 | for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
1854 | ret = jQuery.multiFilter( selector, ret ); |
1897 | var type = Expr.order[i], match; |
1855 | 1898 | ||
1856 | return this.pushStack( jQuery.unique( ret ), name, selector ); |
1899 | if ( (match = Expr.match[ type ].exec( expr )) ) { |
1857 | }; |
- | |
1858 | }); |
- | |
1859 | jQuery.fn.extend({ |
- | |
1860 | attr: function( name, value ) { |
1900 | var left = RegExp.leftContext; |
1861 | var elem, options, isFunction = jQuery.isFunction(value); |
- | |
1862 | 1901 | ||
1863 | if ( typeof name === "string" ) { // A single attribute |
1902 | if ( left.substr( left.length - 1 ) !== "\\" ) { |
1864 | if ( value === undefined ) { // Query it on first element |
1903 | match[1] = (match[1] || "").replace(/\\/g, ""); |
1865 | return this.length ? |
- | |
1866 | jQuery.attr( this[0], name ) : |
1904 | set = Expr.find[ type ]( match, context, isXML ); |
1867 | null; |
1905 | if ( set != null ) { |
1868 | } else { // Set it on all elements |
- | |
1869 | for ( var i = 0, l = this.length; i < l; i++ ) { |
1906 | expr = expr.replace( Expr.match[ type ], "" ); |
1870 | elem = this[i]; |
1907 | break; |
1871 | if ( isFunction ) |
- | |
1872 | value = value.call(elem,i); |
- | |
1873 | jQuery.attr( elem, name, value ); |
- | |
1874 | }
|
1908 | }
|
1875 | }
|
1909 | }
|
1876 | } else { // Multiple attributes to set on all |
- | |
1877 | options = name; |
- | |
1878 | for ( var i = 0, l = this.length; i < l; i++ ) { |
- | |
1879 | elem = this[i]; |
- | |
1880 | for ( name in options ) { |
- | |
1881 | value = options[name]; |
- | |
1882 | if ( jQuery.isFunction(value) ) |
- | |
1883 | value = value.call(elem,i); |
- | |
1884 | jQuery.attr( elem, name, value ); |
- | |
1885 | }
|
1910 | }
|
1886 | }
|
1911 | }
|
- | 1912 | ||
- | 1913 | if ( !set ) { |
|
- | 1914 | set = context.getElementsByTagName("*"); |
|
1887 | }
|
1915 | }
|
1888 | 1916 | ||
1889 | return this; |
1917 | return {set: set, expr: expr}; |
1890 | }, |
1918 | }; |
1891 | 1919 | ||
1892 | hasClass: function( selector ) { |
1920 | Sizzle.filter = function(expr, set, inplace, not){ |
1893 | return !!selector && this.is( "." + selector ); |
1921 | var old = expr, result = [], curLoop = set, match, anyFound, |
1894 | }, |
- | |
1895 | - | ||
1896 | val: function( value ) { |
- | |
1897 | if ( value === undefined ) { |
- | |
1898 | var elem = this[0]; |
- | |
1899 | - | ||
1900 | if ( elem ) { |
- | |
1901 | if( jQuery.nodeName( elem, 'option' ) ) |
1922 | isXMLFilter = set && set[0] && isXML(set[0]); |
1902 | return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
- | |
1903 | 1923 | ||
1904 | // We need to handle select boxes special
|
1924 | while ( expr && set.length ) { |
1905 | if ( jQuery.nodeName( elem, "select" ) ) { |
1925 | for ( var type in Expr.filter ) { |
1906 | var index = elem.selectedIndex, |
1926 | if ( (match = Expr.match[ type ].exec( expr )) != null ) { |
1907 | values = [], |
- | |
1908 | options = elem.options, |
1927 | var filter = Expr.filter[ type ], found, item; |
1909 | one = elem.type == "select-one"; |
1928 | anyFound = false; |
1910 | 1929 | ||
1911 | // Nothing was selected
|
1930 | if ( curLoop == result ) { |
1912 | if ( index < 0 ) |
1931 | result = []; |
1913 | return null; |
1932 | }
|
1914 | 1933 | ||
1915 | // Loop through all the selected options
|
1934 | if ( Expr.preFilter[ type ] ) { |
1916 | for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
1935 | match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
1917 | var option = options[ i ]; |
- | |
1918 | 1936 | ||
1919 | if ( option.selected ) { |
1937 | if ( !match ) { |
- | 1938 | anyFound = found = true; |
|
1920 | // Get the specifc value for the option
|
1939 | } else if ( match === true ) { |
1921 | value = jQuery(option).val(); |
1940 | continue; |
- | 1941 | }
|
|
- | 1942 | }
|
|
1922 | 1943 | ||
- | 1944 | if ( match ) { |
|
1923 | // We don't need an array for one selects
|
1945 | for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
1924 | if ( one ) |
1946 | if ( item ) { |
- | 1947 | found = filter( item, match, i, curLoop ); |
|
1925 | return value; |
1948 | var pass = not ^ !!found; |
1926 | 1949 | ||
1927 | // Multi-Selects return an array
|
1950 | if ( inplace && found != null ) { |
- | 1951 | if ( pass ) { |
|
- | 1952 | anyFound = true; |
|
- | 1953 | } else { |
|
- | 1954 | curLoop[i] = false; |
|
- | 1955 | }
|
|
- | 1956 | } else if ( pass ) { |
|
1928 | values.push( value ); |
1957 | result.push( item ); |
- | 1958 | anyFound = true; |
|
- | 1959 | }
|
|
- | 1960 | }
|
|
1929 | }
|
1961 | }
|
1930 | }
|
1962 | }
|
1931 | 1963 | ||
- | 1964 | if ( found !== undefined ) { |
|
- | 1965 | if ( !inplace ) { |
|
1932 | return values; |
1966 | curLoop = result; |
1933 | }
|
1967 | }
|
1934 | 1968 | ||
1935 | // Everything else, we just grab the value
|
- | |
1936 | return (elem.value || "").replace(/\r/g, ""); |
1969 | expr = expr.replace( Expr.match[ type ], "" ); |
1937 | 1970 | ||
- | 1971 | if ( !anyFound ) { |
|
- | 1972 | return []; |
|
1938 | }
|
1973 | }
|
1939 | 1974 | ||
1940 | return undefined; |
1975 | break; |
- | 1976 | }
|
|
- | 1977 | }
|
|
1941 | }
|
1978 | }
|
1942 | 1979 | ||
1943 | // Typecast once if the value is a number
|
1980 | // Improper expression
|
1944 | if ( typeof value === "number" ) |
1981 | if ( expr == old ) { |
1945 | value += ''; |
- | |
1946 | - | ||
1947 | var val = value; |
1982 | if ( anyFound == null ) { |
1948 | - | ||
1949 | return this.each(function(){ |
1983 | throw "Syntax error, unrecognized expression: " + expr; |
1950 | if(jQuery.isFunction(value)) { |
1984 | } else { |
1951 | val = value.call(this); |
1985 | break; |
1952 | // Typecast each time if the value is a Function and the appended
|
- | |
1953 | // value is therefore different each time.
|
- | |
1954 | if( typeof val === "number" ) val += ''; |
1986 | }
|
1955 | }
|
1987 | }
|
1956 | 1988 | ||
1957 | if ( this.nodeType != 1 ) |
1989 | old = expr; |
1958 | return; |
1990 | }
|
1959 | 1991 | ||
1960 | if ( jQuery.isArray(val) && /radio|checkbox/.test( this.type ) ) |
1992 | return curLoop; |
1961 | this.checked = jQuery.inArray(this.value || this.name, val) >= 0; |
- | |
- | 1993 | }; |
|
1962 | 1994 | ||
- | 1995 | var Expr = Sizzle.selectors = { |
|
- | 1996 | order: [ "ID", "NAME", "TAG" ], |
|
- | 1997 | match: { |
|
- | 1998 | ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
|
- | 1999 | CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
|
- | 2000 | NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, |
|
- | 2001 | ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
|
- | 2002 | TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, |
|
- | 2003 | CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
|
- | 2004 | POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
|
- | 2005 | PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ |
|
- | 2006 | }, |
|
- | 2007 | attrMap: { |
|
- | 2008 | "class": "className", |
|
- | 2009 | "for": "htmlFor" |
|
- | 2010 | }, |
|
- | 2011 | attrHandle: { |
|
- | 2012 | href: function(elem){ |
|
- | 2013 | return elem.getAttribute("href"); |
|
- | 2014 | }
|
|
- | 2015 | }, |
|
- | 2016 | relative: { |
|
- | 2017 | "+": function(checkSet, part, isXML){ |
|
1963 | else if ( jQuery.nodeName( this, "select" ) ) { |
2018 | var isPartStr = typeof part === "string", |
- | 2019 | isTag = isPartStr && !/\W/.test(part), |
|
1964 | var values = jQuery.makeArray(val); |
2020 | isPartStrNotTag = isPartStr && !isTag; |
1965 | 2021 | ||
1966 | jQuery( "option", this ).each(function(){ |
2022 | if ( isTag && !isXML ) { |
1967 | this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; |
2023 | part = part.toUpperCase(); |
1968 | }); |
2024 | }
|
1969 | 2025 | ||
- | 2026 | for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
|
1970 | if ( !values.length ) |
2027 | if ( (elem = checkSet[i]) ) { |
1971 | this.selectedIndex = -1; |
2028 | while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
1972 | 2029 | ||
- | 2030 | checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? |
|
1973 | } else |
2031 | elem || false : |
1974 | this.value = val; |
2032 | elem === part; |
1975 | }); |
2033 | }
|
1976 | }
|
2034 | }
|
1977 | }); |
- | |
1978 | - | ||
1979 | jQuery.each({ |
- | |
1980 | removeAttr: function( name ) { |
- | |
1981 | jQuery.attr( this, name, "" ); |
- | |
1982 | if (this.nodeType == 1) |
- | |
1983 | this.removeAttribute( name ); |
- | |
1984 | }, |
- | |
1985 | 2035 | ||
1986 | addClass: function( classNames ) { |
2036 | if ( isPartStrNotTag ) { |
1987 | jQuery.className.add( this, classNames ); |
2037 | Sizzle.filter( part, checkSet, true ); |
- | 2038 | }
|
|
1988 | }, |
2039 | }, |
- | 2040 | ">": function(checkSet, part, isXML){ |
|
- | 2041 | var isPartStr = typeof part === "string"; |
|
1989 | 2042 | ||
1990 | removeClass: function( classNames ) { |
2043 | if ( isPartStr && !/\W/.test(part) ) { |
1991 | jQuery.className.remove( this, classNames ); |
2044 | part = isXML ? part : part.toUpperCase(); |
1992 | }, |
- | |
1993 | 2045 | ||
1994 | toggleClass: function( classNames, state ) { |
2046 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
1995 | var type = typeof classNames; |
2047 | var elem = checkSet[i]; |
1996 | if ( type === "string" ) { |
2048 | if ( elem ) { |
1997 | // toggle individual class names
|
- | |
1998 | var isBool = typeof state === "boolean", className, i = 0, |
- | |
1999 | classNames = classNames.split( /\s+/ ); |
2049 | var parent = elem.parentNode; |
2000 | while ( (className = classNames[ i++ ]) ) { |
- | |
2001 | // check each className given, space seperated list
|
2050 | checkSet[i] = parent.nodeName === part ? parent : false; |
2002 | state = isBool ? state : !jQuery.className.has( this, className ); |
- | |
2003 | jQuery.className[ state ? "add" : "remove" ]( this, className ); |
- | |
2004 | }
|
2051 | }
|
2005 | } else if ( type === "undefined" || type === "boolean" ) { |
- | |
2006 | if ( this.className ) { |
- | |
2007 | // store className if set
|
- | |
2008 | jQuery.data( this, "__className__", this.className ); |
- | |
2009 | }
|
2052 | }
|
- | 2053 | } else { |
|
- | 2054 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
2010 | // toggle whole className
|
2055 | var elem = checkSet[i]; |
- | 2056 | if ( elem ) { |
|
- | 2057 | checkSet[i] = isPartStr ? |
|
- | 2058 | elem.parentNode : |
|
2011 | this.className = this.className || classNames === false ? "" : jQuery.data( this, "__className__" ) || ""; |
2059 | elem.parentNode === part; |
2012 | }
|
2060 | }
|
2013 | }
|
2061 | }
|
2014 | }, function(name, fn){ |
- | |
2015 | jQuery.fn[ name ] = function(){ |
- | |
2016 | return this.each( fn, arguments ); |
- | |
2017 | }; |
- | |
2018 | }); |
- | |
2019 | 2062 | ||
2020 | jQuery.extend({ |
- | |
2021 | className: { |
2063 | if ( isPartStr ) { |
2022 | // internal only, use addClass("class")
|
2064 | Sizzle.filter( part, checkSet, true ); |
2023 | add: function( elem, classNames ) { |
2065 | }
|
2024 | jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
- | |
2025 | if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
- | |
2026 | elem.className += (elem.className ? " " : "") + className; |
- | |
2027 | }); |
2066 | }
|
2028 | }, |
2067 | }, |
- | 2068 | "": function(checkSet, part, isXML){ |
|
- | 2069 | var doneName = done++, checkFn = dirCheck; |
|
2029 | 2070 | ||
2030 | // internal only, use removeClass("class")
|
- | |
2031 | remove: function( elem, classNames ) { |
- | |
2032 | if (elem.nodeType == 1) |
2071 | if ( !/\W/.test(part) ) { |
2033 | elem.className = classNames !== undefined ? |
- | |
2034 | jQuery.grep(elem.className.split(/\s+/), function(className){ |
- | |
2035 | return !jQuery.className.has( classNames, className ); |
2072 | var nodeCheck = part = isXML ? part : part.toUpperCase(); |
2036 | }).join(" ") : |
2073 | checkFn = dirNodeCheck; |
2037 | ""; |
2074 | }
|
- | 2075 | ||
- | 2076 | checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
|
2038 | }, |
2077 | }, |
- | 2078 | "~": function(checkSet, part, isXML){ |
|
- | 2079 | var doneName = done++, checkFn = dirCheck; |
|
2039 | 2080 | ||
2040 | // internal only, use hasClass("class")
|
2081 | if ( typeof part === "string" && !/\W/.test(part) ) { |
2041 | has: function( elem, className ) { |
2082 | var nodeCheck = part = isXML ? part : part.toUpperCase(); |
2042 | return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
2083 | checkFn = dirNodeCheck; |
2043 | }
|
2084 | }
|
2044 | }, |
- | |
2045 | 2085 | ||
- | 2086 | checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
|
- | 2087 | }
|
|
- | 2088 | }, |
|
- | 2089 | find: { |
|
2046 | attr: function( elem, name, value ) { |
2090 | ID: function(match, context, isXML){ |
2047 | // don't set attributes on text and comment nodes
|
2091 | if ( typeof context.getElementById !== "undefined" && !isXML ) { |
2048 | if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
2092 | var m = context.getElementById(match[1]); |
2049 | return undefined; |
2093 | return m ? [m] : []; |
- | 2094 | }
|
|
- | 2095 | }, |
|
- | 2096 | NAME: function(match, context, isXML){ |
|
- | 2097 | if ( typeof context.getElementsByName !== "undefined" ) { |
|
- | 2098 | var ret = [], results = context.getElementsByName(match[1]); |
|
2050 | 2099 | ||
2051 | var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
2100 | for ( var i = 0, l = results.length; i < l; i++ ) { |
2052 | // Whether we are setting (or getting)
|
2101 | if ( results[i].getAttribute("name") === match[1] ) { |
2053 | set = value !== undefined; |
2102 | ret.push( results[i] ); |
- | 2103 | }
|
|
- | 2104 | }
|
|
2054 | 2105 | ||
- | 2106 | return ret.length === 0 ? null : ret; |
|
- | 2107 | }
|
|
- | 2108 | }, |
|
2055 | // Try to normalize/fix the name
|
2109 | TAG: function(match, context){ |
2056 | name = notxml && jQuery.props[ name ] || name; |
2110 | return context.getElementsByTagName(match[1]); |
- | 2111 | }
|
|
- | 2112 | }, |
|
- | 2113 | preFilter: { |
|
- | 2114 | CLASS: function(match, curLoop, inplace, result, not, isXML){ |
|
- | 2115 | match = " " + match[1].replace(/\\/g, "") + " "; |
|
2057 | 2116 | ||
2058 | // Only do all the following if this is a node (faster for style)
|
2117 | if ( isXML ) { |
2059 | if ( elem.nodeType === 1 ) { |
2118 | return match; |
2060 | 2119 | }
|
|
2061 | // These attributes require special treatment
|
- | |
2062 | var special = /href|src|style/.test( name ); |
- | |
2063 | 2120 | ||
2064 | // Safari mis-reports the default selected property of a hidden option
|
2121 | for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
- | 2122 | if ( elem ) { |
|
2065 | // Accessing the parent's selectedIndex property fixes it
|
2123 | if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { |
- | 2124 | if ( !inplace ) |
|
2066 | if ( name == "selected" && elem.parentNode ) |
2125 | result.push( elem ); |
2067 | elem.parentNode.selectedIndex; |
2126 | } else if ( inplace ) { |
- | 2127 | curLoop[i] = false; |
|
- | 2128 | }
|
|
- | 2129 | }
|
|
- | 2130 | }
|
|
2068 | 2131 | ||
- | 2132 | return false; |
|
- | 2133 | }, |
|
- | 2134 | ID: function(match){ |
|
2069 | // If applicable, access the attribute via the DOM 0 way
|
2135 | return match[1].replace(/\\/g, ""); |
- | 2136 | }, |
|
- | 2137 | TAG: function(match, curLoop){ |
|
2070 | if ( name in elem && notxml && !special ) { |
2138 | for ( var i = 0; curLoop[i] === false; i++ ){} |
- | 2139 | return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); |
|
- | 2140 | }, |
|
- | 2141 | CHILD: function(match){ |
|
2071 | if ( set ){ |
2142 | if ( match[1] == "nth" ) { |
2072 | // We can't allow the type property to be changed (since it causes problems in IE)
|
2143 | // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
|
- | 2144 | var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
|
2073 | if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode ) |
2145 | match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || |
2074 | throw "type property can't be changed"; |
2146 | !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
2075 | 2147 | ||
- | 2148 | // calculate the numbers (first)n+(last) including if they are negative
|
|
- | 2149 | match[2] = (test[1] + (test[2] || 1)) - 0; |
|
2076 | elem[ name ] = value; |
2150 | match[3] = test[3] - 0; |
2077 | }
|
2151 | }
|
2078 | 2152 | ||
2079 | // browsers index elements by id/name on forms, give priority to attributes.
|
- | |
2080 | if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
2153 | // TODO: Move to normal caching system
|
2081 | return elem.getAttributeNode( name ).nodeValue; |
2154 | match[0] = done++; |
2082 | 2155 | ||
2083 | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
- | |
2084 | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
- | |
2085 | if ( name == "tabIndex" ) { |
2156 | return match; |
2086 | var attributeNode = elem.getAttributeNode( "tabIndex" ); |
- | |
- | 2157 | }, |
|
2087 | return attributeNode && attributeNode.specified |
2158 | ATTR: function(match, curLoop, inplace, result, not, isXML){ |
2088 | ? attributeNode.value |
2159 | var name = match[1].replace(/\\/g, ""); |
2089 | : /(button|input|object|select|textarea)/i.test(elem.nodeName) |
- | |
2090 | ? 0 |
2160 | |
2091 | : /^(a|area)$/i.test(elem.nodeName) && elem.href |
2161 | if ( !isXML && Expr.attrMap[name] ) { |
2092 | ? 0 |
- | |
2093 | : undefined; |
2162 | match[1] = Expr.attrMap[name]; |
2094 | }
|
2163 | }
|
2095 | 2164 | ||
2096 | return elem[ name ]; |
2165 | if ( match[2] === "~=" ) { |
- | 2166 | match[4] = " " + match[4] + " "; |
|
2097 | }
|
2167 | }
|
2098 | 2168 | ||
- | 2169 | return match; |
|
- | 2170 | }, |
|
- | 2171 | PSEUDO: function(match, curLoop, inplace, result, not){ |
|
- | 2172 | if ( match[1] === "not" ) { |
|
- | 2173 | // If we're dealing with a complex expression, or a simple one
|
|
2099 | if ( !jQuery.support.style && notxml && name == "style" ) { |
2174 | if ( chunker.exec(match[3]).length > 1 || /^\w/.test(match[3]) ) { |
- | 2175 | match[3] = Sizzle(match[3], null, null, curLoop); |
|
2100 | if ( set ) |
2176 | } else { |
- | 2177 | var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
|
- | 2178 | if ( !inplace ) { |
|
2101 | elem.style.cssText = "" + value; |
2179 | result.push.apply( result, ret ); |
- | 2180 | }
|
|
- | 2181 | return false; |
|
- | 2182 | }
|
|
- | 2183 | } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
|
- | 2184 | return true; |
|
- | 2185 | }
|
|
2102 | 2186 | ||
- | 2187 | return match; |
|
- | 2188 | }, |
|
- | 2189 | POS: function(match){ |
|
- | 2190 | match.unshift( true ); |
|
- | 2191 | return match; |
|
- | 2192 | }
|
|
- | 2193 | }, |
|
- | 2194 | filters: { |
|
- | 2195 | enabled: function(elem){ |
|
- | 2196 | return elem.disabled === false && elem.type !== "hidden"; |
|
- | 2197 | }, |
|
- | 2198 | disabled: function(elem){ |
|
2103 | return elem.style.cssText; |
2199 | return elem.disabled === true; |
- | 2200 | }, |
|
- | 2201 | checked: function(elem){ |
|
- | 2202 | return elem.checked === true; |
|
- | 2203 | }, |
|
- | 2204 | selected: function(elem){ |
|
- | 2205 | // Accessing this property makes selected-by-default
|
|
- | 2206 | // options in Safari work properly
|
|
- | 2207 | elem.parentNode.selectedIndex; |
|
- | 2208 | return elem.selected === true; |
|
- | 2209 | }, |
|
- | 2210 | parent: function(elem){ |
|
- | 2211 | return !!elem.firstChild; |
|
- | 2212 | }, |
|
- | 2213 | empty: function(elem){ |
|
- | 2214 | return !elem.firstChild; |
|
- | 2215 | }, |
|
- | 2216 | has: function(elem, i, match){ |
|
- | 2217 | return !!Sizzle( match[3], elem ).length; |
|
- | 2218 | }, |
|
- | 2219 | header: function(elem){ |
|
- | 2220 | return /h\d/i.test( elem.nodeName ); |
|
- | 2221 | }, |
|
- | 2222 | text: function(elem){ |
|
- | 2223 | return "text" === elem.type; |
|
- | 2224 | }, |
|
- | 2225 | radio: function(elem){ |
|
- | 2226 | return "radio" === elem.type; |
|
- | 2227 | }, |
|
- | 2228 | checkbox: function(elem){ |
|
- | 2229 | return "checkbox" === elem.type; |
|
- | 2230 | }, |
|
- | 2231 | file: function(elem){ |
|
- | 2232 | return "file" === elem.type; |
|
- | 2233 | }, |
|
- | 2234 | password: function(elem){ |
|
- | 2235 | return "password" === elem.type; |
|
- | 2236 | }, |
|
- | 2237 | submit: function(elem){ |
|
- | 2238 | return "submit" === elem.type; |
|
- | 2239 | }, |
|
- | 2240 | image: function(elem){ |
|
- | 2241 | return "image" === elem.type; |
|
- | 2242 | }, |
|
- | 2243 | reset: function(elem){ |
|
- | 2244 | return "reset" === elem.type; |
|
- | 2245 | }, |
|
- | 2246 | button: function(elem){ |
|
- | 2247 | return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; |
|
- | 2248 | }, |
|
- | 2249 | input: function(elem){ |
|
- | 2250 | return /input|select|textarea|button/i.test(elem.nodeName); |
|
2104 | }
|
2251 | }
|
- | 2252 | }, |
|
- | 2253 | setFilters: { |
|
- | 2254 | first: function(elem, i){ |
|
- | 2255 | return i === 0; |
|
- | 2256 | }, |
|
- | 2257 | last: function(elem, i, match, array){ |
|
- | 2258 | return i === array.length - 1; |
|
- | 2259 | }, |
|
- | 2260 | even: function(elem, i){ |
|
- | 2261 | return i % 2 === 0; |
|
- | 2262 | }, |
|
- | 2263 | odd: function(elem, i){ |
|
- | 2264 | return i % 2 === 1; |
|
- | 2265 | }, |
|
- | 2266 | lt: function(elem, i, match){ |
|
- | 2267 | return i < match[3] - 0; |
|
- | 2268 | }, |
|
- | 2269 | gt: function(elem, i, match){ |
|
- | 2270 | return i > match[3] - 0; |
|
- | 2271 | }, |
|
- | 2272 | nth: function(elem, i, match){ |
|
- | 2273 | return match[3] - 0 == i; |
|
- | 2274 | }, |
|
- | 2275 | eq: function(elem, i, match){ |
|
- | 2276 | return match[3] - 0 == i; |
|
- | 2277 | }
|
|
- | 2278 | }, |
|
- | 2279 | filter: { |
|
- | 2280 | PSEUDO: function(elem, match, i, array){ |
|
- | 2281 | var name = match[1], filter = Expr.filters[ name ]; |
|
2105 | 2282 | ||
2106 | if ( set ) |
2283 | if ( filter ) { |
- | 2284 | return filter( elem, i, match, array ); |
|
- | 2285 | } else if ( name === "contains" ) { |
|
2107 | // convert the value to a string (all browsers do this but IE) see #1070
|
2286 | return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; |
2108 | elem.setAttribute( name, "" + value ); |
2287 | } else if ( name === "not" ) { |
- | 2288 | var not = match[3]; |
|
2109 | 2289 | ||
2110 | var attr = !jQuery.support.hrefNormalized && notxml && special |
2290 | for ( var i = 0, l = not.length; i < l; i++ ) { |
2111 | // Some attributes require a special call on IE
|
2291 | if ( not[i] === elem ) { |
2112 | ? elem.getAttribute( name, 2 ) |
2292 | return false; |
2113 | : elem.getAttribute( name ); |
2293 | }
|
- | 2294 | }
|
|
2114 | 2295 | ||
- | 2296 | return true; |
|
- | 2297 | }
|
|
- | 2298 | }, |
|
- | 2299 | CHILD: function(elem, match){ |
|
- | 2300 | var type = match[1], node = elem; |
|
- | 2301 | switch (type) { |
|
- | 2302 | case 'only': |
|
- | 2303 | case 'first': |
|
2115 | // Non-existent attributes return null, we normalize to undefined
|
2304 | while ( (node = node.previousSibling) ) { |
2116 | return attr === null ? undefined : attr; |
2305 | if ( node.nodeType === 1 ) return false; |
2117 | }
|
2306 | }
|
- | 2307 | if ( type == 'first') return true; |
|
- | 2308 | node = elem; |
|
- | 2309 | case 'last': |
|
- | 2310 | while ( (node = node.nextSibling) ) { |
|
- | 2311 | if ( node.nodeType === 1 ) return false; |
|
- | 2312 | }
|
|
- | 2313 | return true; |
|
- | 2314 | case 'nth': |
|
- | 2315 | var first = match[2], last = match[3]; |
|
2118 | 2316 | ||
2119 | // elem is actually elem.style ... set the style
|
2317 | if ( first == 1 && last == 0 ) { |
2120 | // Using attr for specific style information is now deprecated. Use style insead.
|
- | |
2121 | return jQuery.style(elem, name, value); |
2318 | return true; |
2122 | }
|
2319 | }
|
2123 | }); |
- | |
2124 | var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, |
- | |
2125 | rleadingWhitespace = /^\s+/, |
- | |
2126 | rsingleTag = /^<(\w+)\s*\/?>$/, |
- | |
2127 | rxhtmlTag = /(<(\w+)[^>]*?)\/>/g, |
- | |
2128 | rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i, |
- | |
2129 | rinsideTable = /^<(thead|tbody|tfoot|colg|cap)/, |
- | |
2130 | rtbody = /<tbody/i, |
- | |
2131 | fcloseTag = function(all, front, tag){ |
- | |
2132 | return rselfClosing.test(tag) ? |
- | |
2133 | all :
|
- | |
2134 | front + "></" + tag + ">"; |
- | |
2135 | }; |
- | |
2136 | 2320 | ||
2137 | jQuery.fn.extend({ |
- | |
2138 | text: function( text ) { |
2321 | var doneName = match[0], |
2139 | if ( typeof text !== "object" && text !== undefined ) |
2322 | parent = elem.parentNode; |
2140 | return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
- | |
2141 | 2323 | ||
- | 2324 | if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
|
2142 | var ret = ""; |
2325 | var count = 0; |
- | 2326 | for ( node = parent.firstChild; node; node = node.nextSibling ) { |
|
- | 2327 | if ( node.nodeType === 1 ) { |
|
- | 2328 | node.nodeIndex = ++count; |
|
- | 2329 | }
|
|
- | 2330 | }
|
|
- | 2331 | parent.sizcache = doneName; |
|
- | 2332 | }
|
|
2143 | 2333 | ||
2144 | jQuery.each( text || this, function(){ |
- | |
2145 | jQuery.each( this.childNodes, function(){ |
2334 | var diff = elem.nodeIndex - last; |
2146 | if ( this.nodeType !== 8 ) { |
2335 | if ( first == 0 ) { |
2147 | ret += this.nodeType !== 1 ? |
2336 | return diff == 0; |
2148 | this.nodeValue : |
2337 | } else { |
2149 | jQuery.fn.text( [ this ] ); |
2338 | return ( diff % first == 0 && diff / first >= 0 ); |
2150 | }
|
2339 | }
|
2151 | }); |
2340 | }
|
2152 | }); |
2341 | }, |
- | 2342 | ID: function(elem, match){ |
|
- | 2343 | return elem.nodeType === 1 && elem.getAttribute("id") === match; |
|
- | 2344 | }, |
|
- | 2345 | TAG: function(elem, match){ |
|
- | 2346 | return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; |
|
- | 2347 | }, |
|
- | 2348 | CLASS: function(elem, match){ |
|
- | 2349 | return (" " + (elem.className || elem.getAttribute("class")) + " ") |
|
- | 2350 | .indexOf( match ) > -1; |
|
- | 2351 | }, |
|
- | 2352 | ATTR: function(elem, match){ |
|
- | 2353 | var name = match[1], |
|
- | 2354 | result = Expr.attrHandle[ name ] ? |
|
- | 2355 | Expr.attrHandle[ name ]( elem ) : |
|
- | 2356 | elem[ name ] != null ? |
|
- | 2357 | elem[ name ] : |
|
- | 2358 | elem.getAttribute( name ), |
|
- | 2359 | value = result + "", |
|
- | 2360 | type = match[2], |
|
- | 2361 | check = match[4]; |
|
2153 | 2362 | ||
2154 | return ret; |
2363 | return result == null ? |
- | 2364 | type === "!=" : |
|
- | 2365 | type === "=" ? |
|
- | 2366 | value === check : |
|
- | 2367 | type === "*=" ? |
|
- | 2368 | value.indexOf(check) >= 0 : |
|
- | 2369 | type === "~=" ? |
|
- | 2370 | (" " + value + " ").indexOf(check) >= 0 : |
|
- | 2371 | !check ? |
|
- | 2372 | value && result !== false : |
|
- | 2373 | type === "!=" ? |
|
- | 2374 | value != check : |
|
- | 2375 | type === "^=" ? |
|
- | 2376 | value.indexOf(check) === 0 : |
|
- | 2377 | type === "$=" ? |
|
- | 2378 | value.substr(value.length - check.length) === check : |
|
- | 2379 | type === "|=" ? |
|
- | 2380 | value === check || value.substr(0, check.length + 1) === check + "-" : |
|
- | 2381 | false; |
|
2155 | }, |
2382 | }, |
- | 2383 | POS: function(elem, match, i, array){ |
|
- | 2384 | var name = match[2], filter = Expr.setFilters[ name ]; |
|
2156 | 2385 | ||
2157 | wrapAll: function( html ) { |
2386 | if ( filter ) { |
2158 | if ( jQuery.isFunction( html ) ) { |
- | |
2159 | return this.each(function() { |
2387 | return filter( elem, i, match, array ); |
2160 | jQuery(this).wrapAll( html.apply(this, arguments) ); |
- | |
2161 | }); |
2388 | }
|
- | 2389 | }
|
|
- | 2390 | }
|
|
- | 2391 | }; |
|
- | 2392 | ||
- | 2393 | var origPOS = Expr.match.POS; |
|
- | 2394 | ||
- | 2395 | for ( var type in Expr.match ) { |
|
- | 2396 | Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
|
2162 | }
|
2397 | }
|
2163 | 2398 | ||
2164 | if ( this[0] ) { |
- | |
2165 | // The elements to wrap the target around
|
2399 | var makeArray = function(array, results) { |
2166 | var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(); |
2400 | array = Array.prototype.slice.call( array, 0 ); |
2167 | 2401 | ||
2168 | if ( this[0].parentNode ) { |
2402 | if ( results ) { |
2169 | wrap.insertBefore( this[0] ); |
2403 | results.push.apply( results, array ); |
- | 2404 | return results; |
|
2170 | }
|
2405 | }
|
2171 | 2406 | ||
2172 | wrap.map(function(){ |
2407 | return array; |
2173 | var elem = this; |
2408 | }; |
2174 | 2409 | ||
- | 2410 | // Perform a simple check to determine if the browser is capable of
|
|
- | 2411 | // converting a NodeList to an array using builtin methods.
|
|
- | 2412 | try { |
|
- | 2413 | Array.prototype.slice.call( document.documentElement.childNodes, 0 ); |
|
- | 2414 | ||
- | 2415 | // Provide a fallback method if it does not work
|
|
- | 2416 | } catch(e){ |
|
- | 2417 | makeArray = function(array, results) { |
|
- | 2418 | var ret = results || []; |
|
- | 2419 | ||
- | 2420 | if ( toString.call(array) === "[object Array]" ) { |
|
- | 2421 | Array.prototype.push.apply( ret, array ); |
|
- | 2422 | } else { |
|
- | 2423 | if ( typeof array.length === "number" ) { |
|
2175 | while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
2424 | for ( var i = 0, l = array.length; i < l; i++ ) { |
- | 2425 | ret.push( array[i] ); |
|
- | 2426 | }
|
|
- | 2427 | } else { |
|
- | 2428 | for ( var i = 0; array[i]; i++ ) { |
|
2176 | elem = elem.firstChild; |
2429 | ret.push( array[i] ); |
- | 2430 | }
|
|
- | 2431 | }
|
|
2177 | }
|
2432 | }
|
2178 | 2433 | ||
2179 | return elem; |
2434 | return ret; |
2180 | }).append(this); |
2435 | }; |
2181 | }
|
2436 | }
|
2182 | 2437 | ||
2183 | return this; |
2438 | var sortOrder; |
2184 | }, |
- | |
2185 | 2439 | ||
- | 2440 | if ( document.documentElement.compareDocumentPosition ) { |
|
2186 | wrapInner: function( html ) { |
2441 | sortOrder = function( a, b ) { |
- | 2442 | if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { |
|
2187 | return this.each(function(){ |
2443 | if ( a == b ) { |
2188 | jQuery( this ).contents().wrapAll( html ); |
2444 | hasDuplicate = true; |
2189 | }); |
2445 | }
|
- | 2446 | return 0; |
|
2190 | }, |
2447 | }
|
2191 | 2448 | ||
- | 2449 | var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
|
- | 2450 | if ( ret === 0 ) { |
|
- | 2451 | hasDuplicate = true; |
|
- | 2452 | }
|
|
- | 2453 | return ret; |
|
- | 2454 | }; |
|
- | 2455 | } else if ( "sourceIndex" in document.documentElement ) { |
|
2192 | wrap: function( html ) { |
2456 | sortOrder = function( a, b ) { |
2193 | return this.each(function(){ |
2457 | if ( !a.sourceIndex || !b.sourceIndex ) { |
- | 2458 | if ( a == b ) { |
|
2194 | jQuery( this ).wrapAll( html ); |
2459 | hasDuplicate = true; |
2195 | }); |
2460 | }
|
- | 2461 | return 0; |
|
2196 | }, |
2462 | }
|
2197 | 2463 | ||
- | 2464 | var ret = a.sourceIndex - b.sourceIndex; |
|
- | 2465 | if ( ret === 0 ) { |
|
- | 2466 | hasDuplicate = true; |
|
- | 2467 | }
|
|
- | 2468 | return ret; |
|
- | 2469 | }; |
|
- | 2470 | } else if ( document.createRange ) { |
|
2198 | append: function() { |
2471 | sortOrder = function( a, b ) { |
2199 | return this.domManip(arguments, true, function(elem){ |
2472 | if ( !a.ownerDocument || !b.ownerDocument ) { |
2200 | if ( this.nodeType === 1 ) { |
2473 | if ( a == b ) { |
2201 | this.appendChild( elem ); |
2474 | hasDuplicate = true; |
- | 2475 | }
|
|
- | 2476 | return 0; |
|
2202 | }
|
2477 | }
|
2203 | }); |
- | |
2204 | }, |
- | |
2205 | 2478 | ||
- | 2479 | var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
|
- | 2480 | aRange.selectNode(a); |
|
- | 2481 | aRange.collapse(true); |
|
2206 | prepend: function() { |
2482 | bRange.selectNode(b); |
- | 2483 | bRange.collapse(true); |
|
2207 | return this.domManip(arguments, true, function(elem){ |
2484 | var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
2208 | if ( this.nodeType === 1 ) { |
2485 | if ( ret === 0 ) { |
2209 | this.insertBefore( elem, this.firstChild ); |
2486 | hasDuplicate = true; |
- | 2487 | }
|
|
- | 2488 | return ret; |
|
- | 2489 | }; |
|
2210 | }
|
2490 | }
|
2211 | }); |
- | |
2212 | }, |
- | |
2213 | 2491 | ||
- | 2492 | // Check to see if the browser returns elements by name when
|
|
- | 2493 | // querying by getElementById (and provide a workaround)
|
|
2214 | before: function() { |
2494 | (function(){ |
2215 | return this.domManip(arguments, false, function(elem){ |
2495 | // We're going to inject a fake input element with a specified name
|
2216 | this.parentNode.insertBefore( elem, this ); |
2496 | var form = document.createElement("div"), |
2217 | }); |
2497 | id = "script" + (new Date).getTime(); |
2218 | }, |
- | |
- | 2498 | form.innerHTML = "<a name='" + id + "'/>"; |
|
2219 | 2499 | ||
2220 | after: function() { |
2500 | // Inject it into the root element, check its status, and remove it quickly
|
2221 | return this.domManip(arguments, false, function(elem){ |
2501 | var root = document.documentElement; |
2222 | this.parentNode.insertBefore( elem, this.nextSibling ); |
2502 | root.insertBefore( form, root.firstChild ); |
2223 | }); |
- | |
2224 | }, |
- | |
2225 | 2503 | ||
2226 | clone: function( events ) { |
- | |
2227 | // Do the clone
|
- | |
2228 | var ret = this.map(function(){ |
- | |
2229 | if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
- | |
2230 | // IE copies events bound via attachEvent when
|
2504 | // The workaround has to do additional checks after a getElementById
|
2231 | // using cloneNode. Calling detachEvent on the
|
- | |
2232 | // clone will also remove the events from the orignal
|
2505 | // Which slows things down for other browsers (hence the branching)
|
2233 | // In order to get around this, we use innerHTML.
|
- | |
2234 | // Unfortunately, this means some modifications to
|
- | |
2235 | // attributes in IE that are actually only stored
|
- | |
2236 | // as properties will not be copied (such as the
|
2506 | if ( !!document.getElementById( id ) ) { |
2237 | // the name attribute on an input).
|
2507 | Expr.find.ID = function(match, context, isXML){ |
2238 | var html = this.outerHTML, ownerDocument = this.ownerDocument; |
2508 | if ( typeof context.getElementById !== "undefined" && !isXML ) { |
2239 | if ( !html ) { |
- | |
2240 | var div = ownerDocument.createElement("div"); |
2509 | var m = context.getElementById(match[1]); |
2241 | div.appendChild( this.cloneNode(true) ); |
2510 | return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
2242 | html = div.innerHTML; |
- | |
2243 | }
|
2511 | }
|
- | 2512 | }; |
|
2244 | 2513 | ||
2245 | return jQuery.clean([html.replace(rinlinejQuery, "") |
2514 | Expr.filter.ID = function(elem, match){ |
- | 2515 | var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
|
2246 | .replace(rleadingWhitespace, "")], ownerDocument)[0]; |
2516 | return elem.nodeType === 1 && node && node.nodeValue === match; |
2247 | } else { |
2517 | }; |
2248 | return this.cloneNode(true); |
- | |
2249 | }
|
2518 | }
|
2250 | }); |
- | |
2251 | 2519 | ||
2252 | // Copy the events from the original to the clone
|
- | |
2253 | if ( events === true ) { |
2520 | root.removeChild( form ); |
2254 | var orig = this.find("*").andSelf(), i = 0; |
2521 | root = form = null; // release memory in IE |
- | 2522 | })(); |
|
2255 | 2523 | ||
- | 2524 | (function(){ |
|
2256 | ret.find("*").andSelf().each(function(){ |
2525 | // Check to see if the browser returns only elements
|
2257 | if ( this.nodeName !== orig[i].nodeName ) { return; } |
2526 | // when doing getElementsByTagName("*")
|
2258 | 2527 | ||
- | 2528 | // Create a fake element
|
|
2259 | var events = jQuery.data( orig[i], "events" ); |
2529 | var div = document.createElement("div"); |
- | 2530 | div.appendChild( document.createComment("") ); |
|
2260 | 2531 | ||
- | 2532 | // Make sure no comments are found
|
|
- | 2533 | if ( div.getElementsByTagName("*").length > 0 ) { |
|
- | 2534 | Expr.find.TAG = function(match, context){ |
|
- | 2535 | var results = context.getElementsByTagName(match[1]); |
|
- | 2536 | ||
- | 2537 | // Filter out possible comments
|
|
2261 | for ( var type in events ) { |
2538 | if ( match[1] === "*" ) { |
- | 2539 | var tmp = []; |
|
- | 2540 | ||
2262 | for ( var handler in events[ type ] ) { |
2541 | for ( var i = 0; results[i]; i++ ) { |
2263 | jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
2542 | if ( results[i].nodeType === 1 ) { |
- | 2543 | tmp.push( results[i] ); |
|
2264 | }
|
2544 | }
|
2265 | }
|
2545 | }
|
2266 | 2546 | ||
2267 | i++;
|
2547 | results = tmp; |
2268 | }); |
- | |
2269 | }
|
2548 | }
|
2270 | 2549 | ||
2271 | // Return the cloned set
|
- | |
2272 | return ret; |
2550 | return results; |
2273 | }, |
2551 | }; |
2274 | - | ||
2275 | html: function( value ) { |
- | |
2276 | return value === undefined ? |
- | |
2277 | (this[0] ? |
- | |
2278 | this[0].innerHTML.replace(rinlinejQuery, "") : |
- | |
2279 | null) : |
- | |
2280 | this.empty().append( value ); |
- | |
2281 | }, |
2552 | }
|
2282 | 2553 | ||
- | 2554 | // Check to see if an attribute returns normalized href attributes
|
|
- | 2555 | div.innerHTML = "<a href='#'></a>"; |
|
- | 2556 | if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
|
- | 2557 | div.firstChild.getAttribute("href") !== "#" ) { |
|
2283 | replaceWith: function( value ) { |
2558 | Expr.attrHandle.href = function(elem){ |
2284 | return this.after( value ).remove(); |
2559 | return elem.getAttribute("href", 2); |
- | 2560 | }; |
|
2285 | }, |
2561 | }
|
2286 | 2562 | ||
2287 | detach: function( selector ) { |
- | |
2288 | return this.remove( selector, true ); |
2563 | div = null; // release memory in IE |
2289 | }, |
2564 | })(); |
2290 | 2565 | ||
2291 | domManip: function( args, table, callback ) { |
2566 | if ( document.querySelectorAll ) (function(){ |
2292 | var fragment, scripts, cacheable, cached, cacheresults, first, |
2567 | var oldSizzle = Sizzle, div = document.createElement("div"); |
2293 | value = args[0]; |
2568 | div.innerHTML = "<p class='TEST'></p>"; |
2294 | 2569 | ||
2295 | if ( jQuery.isFunction(value) ) { |
2570 | // Safari can't handle uppercase or unicode characters when
|
2296 | return this.each(function() { |
2571 | // in quirks mode.
|
2297 | args[0] = value.call(this); |
- | |
2298 | return jQuery(this).domManip( args, table, callback ); |
2572 | if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
2299 | }); |
2573 | return; |
2300 | }
|
2574 | }
|
2301 | 2575 | ||
2302 | if ( this[0] ) { |
2576 | Sizzle = function(query, context, extra, seed){ |
2303 | if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) { |
- | |
2304 | cacheable = true; |
2577 | context = context || document; |
- | 2578 | ||
2305 | cacheresults = jQuery.fragments[ args[0] ]; |
2579 | // Only use querySelectorAll on non-XML documents
|
2306 | if ( cacheresults ) { |
2580 | // (ID selectors don't work in non-HTML documents)
|
2307 | if ( cacheresults !== 1 ) { |
2581 | if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
2308 | fragment = cacheresults; |
- | |
2309 | }
|
2582 | try { |
2310 | cached = true; |
2583 | return makeArray( context.querySelectorAll(query), extra ); |
2311 | }
|
2584 | } catch(e){} |
2312 | }
|
2585 | }
|
2313 | 2586 | ||
2314 | if ( !fragment ) { |
2587 | return oldSizzle(query, context, extra, seed); |
- | 2588 | }; |
|
- | 2589 | ||
2315 | fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(); |
2590 | for ( var prop in oldSizzle ) { |
2316 | scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ); |
2591 | Sizzle[ prop ] = oldSizzle[ prop ]; |
2317 | }
|
2592 | }
|
2318 | 2593 | ||
2319 | first = fragment.firstChild; |
2594 | div = null; // release memory in IE |
- | 2595 | })(); |
|
2320 | 2596 | ||
- | 2597 | if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ |
|
2321 | if ( first ) { |
2598 | var div = document.createElement("div"); |
2322 | table = table && jQuery.nodeName( first, "tr" ); |
2599 | div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
2323 | 2600 | ||
2324 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2601 | // Opera can't find a second classname (in 9.6)
|
2325 | callback.call( |
2602 | if ( div.getElementsByClassName("e").length === 0 ) |
2326 | table ?
|
2603 | return; |
- | 2604 | ||
- | 2605 | // Safari caches class attributes, doesn't catch changes (in 3.2)
|
|
2327 | root(this[i], first) : |
2606 | div.lastChild.className = "e"; |
- | 2607 | ||
- | 2608 | if ( div.getElementsByClassName("e").length === 1 ) |
|
2328 | this[i], |
2609 | return; |
- | 2610 | ||
2329 | cacheable || this.length > 1 || i > 0 ? |
2611 | Expr.order.splice(1, 0, "CLASS"); |
2330 | fragment.cloneNode(true) : |
2612 | Expr.find.CLASS = function(match, context, isXML) { |
- | 2613 | if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
|
2331 | fragment |
2614 | return context.getElementsByClassName(match[1]); |
2332 | ); |
- | |
2333 | }
|
2615 | }
|
- | 2616 | }; |
|
- | 2617 | ||
- | 2618 | div = null; // release memory in IE |
|
- | 2619 | })(); |
|
- | 2620 | ||
- | 2621 | function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
|
- | 2622 | var sibDir = dir == "previousSibling" && !isXML; |
|
- | 2623 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
- | 2624 | var elem = checkSet[i]; |
|
- | 2625 | if ( elem ) { |
|
- | 2626 | if ( sibDir && elem.nodeType === 1 ){ |
|
- | 2627 | elem.sizcache = doneName; |
|
- | 2628 | elem.sizset = i; |
|
2334 | }
|
2629 | }
|
- | 2630 | elem = elem[dir]; |
|
- | 2631 | var match = false; |
|
2335 | 2632 | ||
2336 | if ( scripts ) { |
2633 | while ( elem ) { |
- | 2634 | if ( elem.sizcache === doneName ) { |
|
2337 | jQuery.each( scripts, evalScript ); |
2635 | match = checkSet[elem.sizset]; |
- | 2636 | break; |
|
2338 | }
|
2637 | }
|
2339 | 2638 | ||
2340 | if ( cacheable ) { |
2639 | if ( elem.nodeType === 1 && !isXML ){ |
2341 | jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; |
2640 | elem.sizcache = doneName; |
- | 2641 | elem.sizset = i; |
|
2342 | }
|
2642 | }
|
- | 2643 | ||
- | 2644 | if ( elem.nodeName === cur ) { |
|
- | 2645 | match = elem; |
|
- | 2646 | break; |
|
2343 | }
|
2647 | }
|
2344 | 2648 | ||
2345 | return this; |
2649 | elem = elem[dir]; |
- | 2650 | }
|
|
2346 | 2651 | ||
2347 | function root( elem, cur ) { |
2652 | checkSet[i] = match; |
2348 | return jQuery.nodeName(elem, "table") ? |
- | |
2349 | (elem.getElementsByTagName("tbody")[0] || |
- | |
2350 | elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
- | |
2351 | elem;
|
2653 | }
|
2352 | }
|
2654 | }
|
2353 | }
|
2655 | }
|
2354 | }); |
- | |
2355 | - | ||
2356 | jQuery.fragments = {}; |
- | |
2357 | - | ||
2358 | jQuery.each({ |
- | |
2359 | appendTo: "append", |
- | |
2360 | prependTo: "prepend", |
- | |
2361 | insertBefore: "before", |
- | |
2362 | insertAfter: "after", |
- | |
2363 | replaceAll: "replaceWith" |
- | |
2364 | }, function(name, original){ |
- | |
2365 | jQuery.fn[ name ] = function( selector ) { |
- | |
2366 | var ret = [], insert = jQuery( selector ); |
- | |
2367 | 2656 | ||
- | 2657 | function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
|
- | 2658 | var sibDir = dir == "previousSibling" && !isXML; |
|
2368 | for ( var i = 0, l = insert.length; i < l; i++ ) { |
2659 | for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
2369 | var elems = (i > 0 ? this.clone(true) : this).get(); |
2660 | var elem = checkSet[i]; |
- | 2661 | if ( elem ) { |
|
2370 | jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
2662 | if ( sibDir && elem.nodeType === 1 ) { |
2371 | ret = ret.concat( elems ); |
2663 | elem.sizcache = doneName; |
- | 2664 | elem.sizset = i; |
|
2372 | }
|
2665 | }
|
- | 2666 | elem = elem[dir]; |
|
- | 2667 | var match = false; |
|
2373 | 2668 | ||
- | 2669 | while ( elem ) { |
|
2374 | return this.pushStack( ret, name, selector ); |
2670 | if ( elem.sizcache === doneName ) { |
- | 2671 | match = checkSet[elem.sizset]; |
|
2375 | }; |
2672 | break; |
2376 | }); |
2673 | }
|
2377 | 2674 | ||
- | 2675 | if ( elem.nodeType === 1 ) { |
|
2378 | jQuery.each({ |
2676 | if ( !isXML ) { |
2379 | // keepData is for internal use only--do not document
|
2677 | elem.sizcache = doneName; |
2380 | remove: function( selector, keepData ) { |
2678 | elem.sizset = i; |
- | 2679 | }
|
|
2381 | if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { |
2680 | if ( typeof cur !== "string" ) { |
2382 | if ( !keepData && this.nodeType === 1 ) { |
2681 | if ( elem === cur ) { |
2383 | cleanData( jQuery("*", this).add(this) ); |
2682 | match = true; |
- | 2683 | break; |
|
2384 | }
|
2684 | }
|
2385 | 2685 | ||
2386 | if ( this.parentNode ) { |
2686 | } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
2387 | this.parentNode.removeChild( this ); |
2687 | match = elem; |
- | 2688 | break; |
|
2388 | }
|
2689 | }
|
2389 | }
|
2690 | }
|
2390 | }, |
- | |
2391 | 2691 | ||
2392 | empty: function() { |
2692 | elem = elem[dir]; |
2393 | // Remove element nodes and prevent memory leaks
|
- | |
2394 | if ( this.nodeType === 1 ) { |
- | |
2395 | cleanData( jQuery("*", this) ); |
- | |
2396 | }
|
2693 | }
|
2397 | 2694 | ||
2398 | // Remove any remaining nodes
|
- | |
2399 | while ( this.firstChild ) { |
2695 | checkSet[i] = match; |
2400 | this.removeChild( this.firstChild ); |
- | |
2401 | }
|
2696 | }
|
2402 | }
|
2697 | }
|
- | 2698 | }
|
|
- | 2699 | ||
- | 2700 | var contains = document.compareDocumentPosition ? function(a, b){ |
|
2403 | }, function(name, fn){ |
2701 | return a.compareDocumentPosition(b) & 16; |
2404 | jQuery.fn[ name ] = function(){ |
2702 | } : function(a, b){ |
2405 | return this.each( fn, arguments ); |
2703 | return a !== b && (a.contains ? a.contains(b) : true); |
2406 | }; |
2704 | }; |
2407 | }); |
- | |
2408 | 2705 | ||
2409 | jQuery.extend({ |
2706 | var isXML = function(elem){ |
2410 | clean: function( elems, context, fragment ) { |
2707 | return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
2411 | context = context || document; |
2708 | !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; |
- | 2709 | }; |
|
2412 | 2710 | ||
2413 | // !context.createElement fails in IE with an error but returns typeof 'object'
|
2711 | var posProcess = function(selector, context){ |
2414 | if ( typeof context.createElement === "undefined" ) { |
2712 | var tmpSet = [], later = "", match, |
2415 | context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
2713 | root = context.nodeType ? [context] : context; |
2416 | }
|
- | |
2417 | 2714 | ||
2418 | // If a single string is passed in and it's a single tag
|
- | |
2419 | // just do a createElement and skip the rest
|
2715 | // Position selectors must be done after the filter
|
2420 | if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { |
2716 | // And so must :not(positional) so we move all PSEUDOs to the end
|
2421 | var match = rsingleTag.exec(elems[0]); |
2717 | while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
2422 | if ( match ) { |
2718 | later += match[0]; |
2423 | return [ context.createElement( match[1] ) ]; |
2719 | selector = selector.replace( Expr.match.PSEUDO, "" ); |
2424 | }
|
- | |
2425 | }
|
2720 | }
|
2426 | 2721 | ||
2427 | var ret = [], scripts = [], div = context.createElement("div"); |
2722 | selector = Expr.relative[selector] ? selector + "*" : selector; |
2428 | 2723 | ||
2429 | jQuery.each(elems, function(i, elem){ |
2724 | for ( var i = 0, l = root.length; i < l; i++ ) { |
2430 | if ( typeof elem === "number" ) { |
2725 | Sizzle( selector, root[i], tmpSet ); |
2431 | elem += ''; |
- | |
2432 | }
|
2726 | }
|
2433 | 2727 | ||
2434 | if ( !elem ) { return; } |
2728 | return Sizzle.filter( later, tmpSet ); |
- | 2729 | }; |
|
2435 | 2730 | ||
2436 | // Convert html string into DOM nodes
|
2731 | // EXPOSE
|
2437 | if ( typeof elem === "string" ) { |
2732 | jQuery.find = Sizzle; |
2438 | // Fix "XHTML"-style tags in all browsers
|
2733 | jQuery.expr = Sizzle.selectors; |
2439 | elem = elem.replace(rxhtmlTag, fcloseTag); |
2734 | jQuery.expr[":"] = jQuery.expr.filters; |
2440 | 2735 | ||
2441 | // Trim whitespace, otherwise indexOf won't work as expected
|
2736 | Sizzle.selectors.filters.hidden = function(elem){ |
2442 | var tags = elem.replace(rleadingWhitespace, "") |
2737 | var width = elem.offsetWidth, height = elem.offsetHeight, |
- | 2738 | force = /^tr$/i.test( elem.nodeName ); // ticket #4512 |
|
- | 2739 | return ( width === 0 && height === 0 && !force ) ? |
|
- | 2740 | true : |
|
- | 2741 | ( width !== 0 && height !== 0 && !force ) ? |
|
- | 2742 | false : |
|
2443 | .substring(0, 10).toLowerCase(); |
2743 | !!( jQuery.curCSS(elem, "display") === "none" ); |
- | 2744 | }; |
|
2444 | 2745 | ||
2445 | var wrap = |
- | |
2446 | // option or optgroup
|
- | |
2447 | !tags.indexOf("<opt") && |
2746 | Sizzle.selectors.filters.visible = function(elem){ |
2448 | [ 1, "<select multiple='multiple'>", "</select>" ] || |
2747 | return !Sizzle.selectors.filters.hidden(elem); |
- | 2748 | }; |
|
2449 | 2749 | ||
2450 | !tags.indexOf("<leg") && |
2750 | Sizzle.selectors.filters.animated = function(elem){ |
2451 | [ 1, "<fieldset>", "</fieldset>" ] || |
2751 | return jQuery.grep(jQuery.timers, function(fn){ |
- | 2752 | return elem === fn.elem; |
|
- | 2753 | }).length; |
|
- | 2754 | }; |
|
2452 | 2755 | ||
- | 2756 | jQuery.filter = jQuery.multiFilter = function( expr, elems, not ) { |
|
2453 | rinsideTable.test(tags) && |
2757 | if ( not ) { |
2454 | [ 1, "<table>", "</table>" ] || |
2758 | expr = ":not(" + expr + ")"; |
- | 2759 | }
|
|
2455 | 2760 | ||
2456 | !tags.indexOf("<tr") && |
2761 | return Sizzle.matches(expr, elems); |
2457 | [ 2, "<table><tbody>", "</tbody></table>" ] || |
- | |
- | 2762 | }; |
|
2458 | 2763 | ||
- | 2764 | jQuery.dir = function( elem, dir ){ |
|
2459 | // <thead> matched above
|
2765 | var matched = [], cur = elem[dir]; |
2460 | (!tags.indexOf("<td") || !tags.indexOf("<th")) && |
2766 | while ( cur && cur != document ) { |
2461 | [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
2767 | if ( cur.nodeType == 1 ) |
- | 2768 | matched.push( cur ); |
|
- | 2769 | cur = cur[dir]; |
|
- | 2770 | }
|
|
- | 2771 | return matched; |
|
- | 2772 | }; |
|
2462 | 2773 | ||
2463 | !tags.indexOf("<col") && |
2774 | jQuery.nth = function(cur, result, dir, elem){ |
2464 | [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
2775 | result = result || 1; |
- | 2776 | var num = 0; |
|
2465 | 2777 | ||
2466 | // IE can't serialize <link> and <script> tags normally
|
2778 | for ( ; cur; cur = cur[dir] ) |
2467 | !jQuery.support.htmlSerialize && |
2779 | if ( cur.nodeType == 1 && ++num == result ) |
2468 | [ 1, "div<div>", "</div>" ] || |
2780 | break; |
2469 | 2781 | ||
2470 | [ 0, "", "" ]; |
2782 | return cur; |
- | 2783 | }; |
|
2471 | 2784 | ||
2472 | // Go to html and back, then peel off extra wrappers
|
2785 | jQuery.sibling = function(n, elem){ |
2473 | div.innerHTML = wrap[1] + elem + wrap[2]; |
2786 | var r = []; |
2474 | 2787 | ||
2475 | // Move to the right depth
|
2788 | for ( ; n; n = n.nextSibling ) { |
2476 | while ( wrap[0]-- ) { |
2789 | if ( n.nodeType == 1 && n != elem ) |
2477 | div = div.lastChild; |
2790 | r.push( n ); |
2478 | }
|
2791 | }
|
2479 | 2792 | ||
2480 | // Remove IE's autoinserted <tbody> from table fragments
|
- | |
2481 | if ( !jQuery.support.tbody ) { |
2793 | return r; |
- | 2794 | }; |
|
2482 | 2795 | ||
2483 | // String was a <table>, *may* have spurious <tbody>
|
- | |
2484 | var hasBody = rtbody.test(elem), |
2796 | jQuery.unique = Sizzle.uniqueSort; |
2485 | tbody = !tags.indexOf("<table") && !hasBody ? |
- | |
2486 | div.firstChild && div.firstChild.childNodes : |
- | |
2487 | 2797 | ||
- | 2798 | return; |
|
- | 2799 | ||
- | 2800 | window.Sizzle = Sizzle; |
|
- | 2801 | ||
- | 2802 | })(); |
|
2488 | // String was a bare <thead> or <tfoot>
|
2803 | var winnow = function( elements, qualifier, keep ) { |
2489 | wrap[1] == "<table>" && !hasBody ? |
2804 | if(jQuery.isFunction( qualifier )) { |
- | 2805 | return jQuery.grep(elements, function(elem, i) { |
|
2490 | div.childNodes : |
2806 | return !!qualifier.call( elem, i ) === keep; |
2491 | []; |
2807 | }); |
- | 2808 | } else if( qualifier.nodeType ) { |
|
- | 2809 | return jQuery.grep(elements, function(elem, i) { |
|
- | 2810 | return (elem === qualifier) === keep; |
|
- | 2811 | }) |
|
- | 2812 | } else if( typeof qualifier === "string" ) { |
|
- | 2813 | var filtered = jQuery.grep(elements, function(elem) { return elem.nodeType === 1 }); |
|
2492 | 2814 | ||
2493 | for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
- | |
2494 | if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
2815 | if(isSimple.test( qualifier )) return jQuery.multiFilter(qualifier, filtered, !keep); |
2495 | tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
2816 | else qualifier = jQuery.multiFilter( qualifier, elements ); |
2496 | }
|
- | |
2497 | }
|
2817 | }
|
2498 | 2818 | ||
- | 2819 | return jQuery.grep(elements, function(elem, i) { |
|
- | 2820 | return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
|
- | 2821 | }); |
|
2499 | }
|
2822 | }
|
2500 | 2823 | ||
2501 | // IE completely kills leading whitespace when innerHTML is used
|
2824 | jQuery.fn.extend({ |
2502 | if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
2825 | find: function( selector ) { |
2503 | div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
2826 | var ret = this.pushStack( "", "find", selector ), length = 0; |
2504 | }
|
- | |
2505 | 2827 | ||
2506 | elem = jQuery.makeArray( div.childNodes ); |
2828 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2507 | }
|
2829 | length = ret.length; |
- | 2830 | jQuery.find( selector, this[i], ret ); |
|
2508 | 2831 | ||
2509 | if ( elem.nodeType ) { |
2832 | if ( i > 0 ) { |
2510 | ret.push( elem ); |
2833 | // Make sure that the results are unique
|
- | 2834 | for ( var n = length; n < ret.length; n++ ) { |
|
- | 2835 | for ( var r = 0; r < length; r++ ) { |
|
2511 | } else { |
2836 | if ( ret[r] === ret[n] ) { |
2512 | ret = jQuery.merge( ret, elem ); |
2837 | ret.splice(n--, 1); |
- | 2838 | break; |
|
2513 | }
|
2839 | }
|
2514 | - | ||
2515 | }); |
- | |
2516 | - | ||
2517 | if ( fragment ) { |
- | |
2518 | for ( var i = 0; ret[i]; i++ ) { |
- | |
2519 | if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
- | |
2520 | scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
- | |
2521 | } else { |
- | |
2522 | if ( ret[i].nodeType === 1 ) { |
- | |
2523 | ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
- | |
2524 | }
|
2840 | }
|
2525 | fragment.appendChild( ret[i] ); |
- | |
2526 | }
|
2841 | }
|
2527 | }
|
2842 | }
|
2528 | - | ||
2529 | return scripts; |
- | |
2530 | }
|
2843 | }
|
2531 | 2844 | ||
2532 | return ret; |
2845 | return ret; |
2533 | }
|
2846 | }, |
2534 | }); |
- | |
2535 | 2847 | ||
2536 | function cleanData( elems ) { |
2848 | not: function( selector ) { |
2537 | for ( var i = 0, l = elems.length; i < l; i++ ) { |
2849 | return this.pushStack( winnow(this, selector, false), "not", selector); |
2538 | var id = elems[i][expando]; |
- | |
2539 | if ( id ) { |
- | |
2540 | delete jQuery.cache[ id ]; |
- | |
2541 | }
|
- | |
2542 | }
|
2850 | }, |
2543 | }
|
- | |
2544 | /*
|
- | |
2545 | * A number of helper functions used for managing events.
|
- | |
2546 | * Many of the ideas behind this code originated from
|
- | |
2547 | * Dean Edwards' addEvent library.
|
- | |
2548 | */
|
- | |
2549 | jQuery.event = { |
- | |
2550 | 2851 | ||
2551 | // Bind an event to an element
|
- | |
2552 | // Original by Dean Edwards
|
- | |
2553 | add: function( elem, types, handler, data ) { |
2852 | filter: function( selector ) { |
2554 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
2853 | return this.pushStack( winnow(this, selector, true), "filter", selector ); |
2555 | return; |
- | |
2556 | }
|
2854 | }, |
2557 | 2855 | ||
2558 | // For whatever reason, IE has trouble passing the window object
|
- | |
2559 | // around, causing it to be cloned in the process
|
2856 | closest: function( selector, context ) { |
2560 | if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { |
2857 | var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
2561 | elem = window; |
2858 | closer = 0; |
2562 | }
|
- | |
2563 | 2859 | ||
- | 2860 | return this.map(function(){ |
|
- | 2861 | var cur = this; |
|
2564 | // Make sure that the function being executed has a unique ID
|
2862 | while ( cur && cur.ownerDocument && cur !== context ) { |
2565 | if ( !handler.guid ) { |
2863 | if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
2566 | handler.guid = this.guid++; |
2864 | jQuery.data(cur, "closest", closer); |
- | 2865 | return cur; |
|
2567 | }
|
2866 | }
|
2568 | - | ||
2569 | // if data is passed, bind to handler
|
- | |
2570 | if ( data !== undefined ) { |
- | |
2571 | // Create temporary function pointer to original handler
|
- | |
2572 | var fn = handler; |
- | |
2573 | - | ||
2574 | // Create unique handler function, wrapped around original handler
|
- | |
2575 | handler = this.proxy( fn ); |
2867 | cur = cur.parentNode; |
2576 | - | ||
2577 | // Store data in unique handler
|
- | |
2578 | handler.data = data; |
2868 | closer++;
|
2579 | }
|
2869 | }
|
2580 | - | ||
2581 | // Init the element's event structure
|
- | |
2582 | var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), |
- | |
2583 | handle = jQuery.data( elem, "handle" ) || jQuery.data( elem, "handle", function() { |
- | |
2584 | // Handle the second event of a trigger and when
|
- | |
2585 | // an event is called after a page has unloaded
|
- | |
2586 | return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
- | |
2587 | jQuery.event.handle.apply( arguments.callee.elem, arguments ) : |
- | |
2588 | undefined; |
- | |
2589 | }); |
2870 | }); |
2590 | // Add elem as a property of the handle function
|
- | |
2591 | // This is to prevent a memory leak with non-native
|
- | |
2592 | // event in IE.
|
- | |
2593 | handle.elem = elem; |
- | |
2594 | 2871 | }, |
|
2595 | // Handle multiple events separated by a space
|
- | |
2596 | // jQuery(...).bind("mouseover mouseout", fn);
|
- | |
2597 | types = types.split( /\s+/ ); |
- | |
2598 | var type, i=0; |
- | |
2599 | while ( (type = types[ i++ ]) ) { |
- | |
2600 | // Namespaced event handlers
|
- | |
2601 | var namespaces = type.split("."); |
- | |
2602 | type = namespaces.shift(); |
- | |
2603 | handler.type = namespaces.slice(0).sort().join("."); |
- | |
2604 | 2872 | ||
- | 2873 | add: function( selector ) { |
|
2605 | // Get the current list of functions bound to this event
|
2874 | var set = typeof selector === "string" ? |
- | 2875 | jQuery( selector ) : |
|
2606 | var handlers = events[ type ], |
2876 | jQuery.makeArray( selector ), |
2607 | special = this.special[ type ] || {}; |
2877 | all = jQuery.merge( this.get(), set ); |
2608 | 2878 | ||
2609 | if ( special.add ) { |
- | |
2610 | var modifiedHandler = special.add.call( elem, handler, data, namespaces ); |
2879 | return this.pushStack( set[0] && (set[0].setInterval || set[0].nodeType === 9 || (set[0].parentNode && set[0].parentNode.nodeType !== 11)) ? |
2611 | if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { |
- | |
2612 | modifiedHandler.guid = modifiedHandler.guid || handler.guid; |
- | |
2613 | handler = modifiedHandler; |
2880 | jQuery.unique( all ) : |
2614 | }
|
2881 | all ); |
2615 | }
|
2882 | }, |
2616 | 2883 | ||
- | 2884 | eq: function( i ) { |
|
2617 | // Init the event handler queue
|
2885 | return i === -1 ? |
2618 | if ( !handlers ) { |
2886 | this.slice( i ) : |
2619 | handlers = events[ type ] = {}; |
2887 | this.slice( i, +i + 1 ); |
- | 2888 | }, |
|
2620 | 2889 | ||
2621 | // Check for a special event handler
|
- | |
2622 | // Only use addEventListener/attachEvent if the special
|
- | |
2623 | // events handler returns false
|
- | |
2624 | if ( !special.setup || special.setup.call( elem, data, namespaces ) === false ) { |
- | |
2625 | // Bind the global event handler to the element
|
- | |
2626 | if ( elem.addEventListener ) { |
2890 | first: function() { |
2627 | elem.addEventListener( type, handle, false ); |
- | |
2628 | } else if ( elem.attachEvent ) { |
2891 | return this.eq( 0 ); |
2629 | elem.attachEvent( "on" + type, handle ); |
- | |
2630 | }
|
- | |
2631 | }
|
- | |
2632 | }
|
2892 | }, |
2633 | 2893 | ||
2634 | // Add the function to the element's handler list
|
2894 | last: function() { |
2635 | handlers[ handler.guid ] = handler; |
2895 | return this.eq( -1 ); |
- | 2896 | }, |
|
2636 | 2897 | ||
- | 2898 | slice: function() { |
|
2637 | // Keep track of which events have been used, for global triggering
|
2899 | return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
2638 | this.global[ type ] = true; |
2900 | "slice", Array.prototype.slice.call(arguments).join(",") ); |
2639 | }
|
2901 | }, |
2640 | 2902 | ||
- | 2903 | map: function( callback ) { |
|
- | 2904 | return this.pushStack( jQuery.map(this, function(elem, i){ |
|
2641 | // Nullify elem to prevent memory leaks in IE
|
2905 | return callback.call( elem, i, elem ); |
2642 | elem = null; |
2906 | })); |
2643 | }, |
2907 | }, |
2644 | 2908 | ||
2645 | guid: 1, |
2909 | andSelf: function() { |
- | 2910 | return this.add( this.prevObject ); |
|
2646 | global: {}, |
2911 | }, |
2647 | 2912 | ||
2648 | // Detach an event or set of events from an element
|
- | |
2649 | remove: function( elem, types, handler ) { |
2913 | end: function() { |
2650 | // don't do events on text and comment nodes
|
2914 | return this.prevObject || jQuery(null); |
2651 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
- | |
2652 | return; |
- | |
2653 | }
|
2915 | }
|
- | 2916 | }); |
|
2654 | 2917 | ||
- | 2918 | jQuery.each({ |
|
- | 2919 | parent: function(elem){return elem.parentNode;}, |
|
- | 2920 | parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
|
- | 2921 | next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
|
- | 2922 | prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
|
- | 2923 | nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
|
- | 2924 | prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
|
- | 2925 | siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
|
- | 2926 | children: function(elem){return jQuery.sibling(elem.firstChild);}, |
|
- | 2927 | contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
|
- | 2928 | }, function(name, fn){ |
|
- | 2929 | jQuery.fn[ name ] = function( selector ) { |
|
2655 | var events = jQuery.data( elem, "events" ), ret, type; |
2930 | var ret = jQuery.map( this, fn ); |
2656 | 2931 | ||
2657 | if ( events ) { |
- | |
2658 | // Unbind all events for the element
|
- | |
2659 | if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) { |
- | |
2660 | for ( type in events ) { |
- | |
2661 | this.remove( elem, type + (types || "") ); |
2932 | if ( selector && typeof selector === "string" ) { |
2662 | }
|
- | |
2663 | } else { |
- | |
2664 | // types is actually an event object here
|
2933 | ret = jQuery.multiFilter( selector, ret ); |
2665 | if ( types.type ) { |
- | |
2666 | handler = types.handler; |
- | |
2667 | types = types.type; |
- | |
2668 | }
|
2934 | }
|
2669 | 2935 | ||
2670 | // Handle multiple events seperated by a space
|
- | |
2671 | // jQuery(...).unbind("mouseover mouseout", fn);
|
- | |
2672 | types = types.split(/\s+/); |
- | |
2673 | var i = 0; |
- | |
2674 | while ( (type = types[ i++ ]) ) { |
- | |
2675 | // Namespaced event handlers
|
- | |
2676 | var namespaces = type.split("."); |
- | |
2677 | type = namespaces.shift(); |
- | |
2678 | var all = !namespaces.length, |
- | |
2679 | namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"), |
- | |
2680 | special = this.special[ type ] || {}; |
- | |
2681 | - | ||
2682 | if ( events[ type ] ) { |
- | |
2683 | // remove the given handler for the given type
|
2936 | ret = this.length > 1 ? jQuery.unique( ret ) : ret; |
2684 | if ( handler ) { |
- | |
2685 | delete events[ type ][ handler.guid ]; |
- | |
2686 | 2937 | ||
2687 | // remove all handlers for the given type
|
2938 | if ( name === "parents" && this.length > 1 ) { |
2688 | } else { |
2939 | ret = ret.reverse(); |
2689 | for ( var handle in events[ type ] ) { |
- | |
2690 | // Handle the removal of namespaced events
|
- | |
2691 | if ( all || namespace.test( events[ type ][ handle ].type ) ) { |
- | |
2692 | delete events[ type ][ handle ]; |
- | |
2693 | }
|
- | |
2694 | }
|
- | |
2695 | }
|
2940 | }
|
2696 | 2941 | ||
- | 2942 | return this.pushStack( ret, name, selector ); |
|
- | 2943 | }; |
|
- | 2944 | }); |
|
- | 2945 | jQuery.fn.extend({ |
|
2697 | if ( special.remove ) { |
2946 | attr: function( name, value ) { |
2698 | special.remove.call( elem, namespaces ); |
2947 | return access(this, name, value, true, jQuery.attr); |
2699 | }
|
2948 | }, |
2700 | 2949 | ||
- | 2950 | addClass: function( value ) { |
|
2701 | // remove generic event handler if no more handlers exist
|
2951 | if ( value && typeof value === "string" ) { |
- | 2952 | var classNames = (value || "").split(/\s+/); |
|
- | 2953 | ||
2702 | for ( ret in events[ type ] ) { |
2954 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2703 | break; |
2955 | var elem = this[i]; |
2704 | }
|
2956 | |
- | 2957 | if ( elem.nodeType === 1 ) { |
|
2705 | if ( !ret ) { |
2958 | if ( !elem.className ) { |
2706 | if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { |
2959 | elem.className = value; |
- | 2960 | } else { |
|
2707 | if ( elem.removeEventListener ) { |
2961 | var className = " " + elem.className + " "; |
2708 | elem.removeEventListener( type, jQuery.data( elem, "handle" ), false ); |
2962 | for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
2709 | } else if ( elem.detachEvent ) { |
2963 | if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { |
2710 | elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) ); |
2964 | elem.className += " " + classNames[c]; |
2711 | }
|
2965 | }
|
2712 | }
|
2966 | }
|
2713 | ret = null; |
- | |
2714 | delete events[ type ]; |
- | |
2715 | }
|
2967 | }
|
2716 | }
|
2968 | }
|
2717 | }
|
2969 | }
|
2718 | }
|
2970 | }
|
2719 | 2971 | ||
2720 | // Remove the expando if it's no longer used
|
- | |
2721 | for ( ret in events ) { |
- | |
2722 | break; |
2972 | return this; |
2723 | }
|
- | |
2724 | if ( !ret ) { |
- | |
2725 | var handle = jQuery.data( elem, "handle" ); |
- | |
2726 | if ( handle ) { |
- | |
2727 | handle.elem = null; |
- | |
2728 | }
|
- | |
2729 | jQuery.removeData( elem, "events" ); |
- | |
2730 | jQuery.removeData( elem, "handle" ); |
- | |
2731 | }
|
- | |
2732 | }
|
- | |
2733 | }, |
2973 | }, |
2734 | 2974 | ||
2735 | // bubbling is internal
|
2975 | removeClass: function( value ) { |
2736 | trigger: function( event, data, elem /*, bubbling */ ) { |
2976 | if ( (value && typeof value === "string") || value === undefined ) { |
2737 | // Event object or event type
|
- | |
2738 | var type = event.type || event, |
2977 | var classNames = (value || "").split(/\s+/); |
2739 | bubbling = arguments[3]; |
- | |
2740 | 2978 | ||
2741 | if ( !bubbling ) { |
- | |
2742 | event = typeof event === "object" ? |
- | |
2743 | // jQuery.Event object
|
- | |
2744 | event[expando] ? event : |
- | |
2745 | // Object literal
|
- | |
2746 | jQuery.extend( jQuery.Event(type), event ) : |
2979 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2747 | // Just the event type (string)
|
- | |
2748 | jQuery.Event(type); |
2980 | var elem = this[i]; |
2749 | 2981 | ||
2750 | if ( type.indexOf("!") >= 0 ) { |
2982 | if ( elem.nodeType === 1 && elem.className ) { |
- | 2983 | if ( value ) { |
|
2751 | event.type = type = type.slice(0, -1); |
2984 | var className = " " + elem.className + " "; |
- | 2985 | for ( var c = 0, cl = classNames.length; c < cl; c++ ) { |
|
- | 2986 | className = className.replace(" " + classNames[c] + " ", " "); |
|
- | 2987 | }
|
|
- | 2988 | elem.className = className.substring(1, className.length - 1); |
|
- | 2989 | } else { |
|
2752 | event.exclusive = true; |
2990 | elem.className = ""; |
2753 | }
|
2991 | }
|
2754 | - | ||
2755 | // Handle a global trigger
|
- | |
2756 | if ( !elem ) { |
- | |
2757 | // Don't bubble custom events when global (to avoid too much overhead)
|
- | |
2758 | event.stopPropagation(); |
- | |
2759 | // Only trigger if we've ever bound an event for it
|
- | |
2760 | if ( this.global[ type ] ) { |
- | |
2761 | jQuery.each( jQuery.cache, function() { |
- | |
2762 | if ( this.events && this.events[type] ) { |
- | |
2763 | jQuery.event.trigger( event, data, this.handle.elem ); |
- | |
2764 | }
|
2992 | }
|
2765 | }); |
- | |
2766 | }
|
2993 | }
|
2767 | }
|
2994 | }
|
2768 | 2995 | ||
2769 | // Handle triggering a single element
|
2996 | return this; |
- | 2997 | }, |
|
2770 | 2998 | ||
- | 2999 | hasClass: function( selector ) { |
|
- | 3000 | var className = " " + selector + " "; |
|
2771 | // don't do events on text and comment nodes
|
3001 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2772 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
3002 | if ( (" " + this[i].className + " ").indexOf( className ) > -1 ) { |
2773 | return undefined; |
3003 | return true; |
- | 3004 | }
|
|
2774 | }
|
3005 | }
|
2775 | 3006 | ||
2776 | // Clean up in case it is reused
|
- | |
2777 | event.result = undefined; |
- | |
2778 | event.target = elem; |
3007 | return false; |
- | 3008 | }, |
|
2779 | 3009 | ||
2780 | // Clone the incoming data, if any
|
3010 | val: function( value ) { |
2781 | data = jQuery.makeArray( data ); |
3011 | if ( value === undefined ) { |
2782 | data.unshift( event ); |
3012 | var elem = this[0]; |
2783 | }
|
- | |
2784 | 3013 | ||
- | 3014 | if ( elem ) { |
|
2785 | event.currentTarget = elem; |
3015 | if( jQuery.nodeName( elem, 'option' ) ) |
- | 3016 | return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
|
2786 | 3017 | ||
2787 | // Trigger the event, it is assumed that "handle" is a function
|
3018 | // We need to handle select boxes special
|
2788 | var handle = jQuery.data( elem, "handle" ); |
3019 | if ( jQuery.nodeName( elem, "select" ) ) { |
- | 3020 | var index = elem.selectedIndex, |
|
2789 | if ( handle ) { |
3021 | values = [], |
2790 | handle.apply( elem, data ); |
3022 | options = elem.options, |
2791 | }
|
- | |
- | 3023 | one = elem.type == "select-one"; |
|
2792 | 3024 | ||
2793 | var nativeFn, nativeHandler; |
3025 | // Nothing was selected
|
- | 3026 | if ( index < 0 ) |
|
2794 | try { |
3027 | return null; |
- | 3028 | ||
- | 3029 | // Loop through all the selected options
|
|
- | 3030 | for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
|
2795 | nativeFn = elem[ type ]; |
3031 | var option = options[ i ]; |
- | 3032 | ||
- | 3033 | if ( option.selected ) { |
|
- | 3034 | // Get the specifc value for the option
|
|
2796 | nativeHandler = elem[ "on" + type ]; |
3035 | value = jQuery(option).val(); |
- | 3036 | ||
2797 | // prevent IE from throwing an error for some elements with some event types, see #3533
|
3037 | // We don't need an array for one selects
|
2798 | } catch (e) {} |
3038 | if ( one ) |
2799 | // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
|
3039 | return value; |
- | 3040 | ||
2800 | if ( (!nativeFn || (jQuery.nodeName(elem, 'a') && type === "click")) && nativeHandler && nativeHandler.apply( elem, data ) === false ) { |
3041 | // Multi-Selects return an array
|
2801 | event.result = false; |
3042 | values.push( value ); |
- | 3043 | }
|
|
2802 | }
|
3044 | }
|
2803 | 3045 | ||
2804 | // Trigger the native events (except for clicks on links)
|
- | |
2805 | if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) { |
- | |
2806 | this.triggered = true; |
- | |
2807 | try { |
- | |
2808 | nativeFn(); |
3046 | return values; |
2809 | // prevent IE from throwing an error for some hidden elements
|
- | |
2810 | } catch (e) {} |
- | |
2811 | }
|
3047 | }
|
2812 | 3048 | ||
2813 | this.triggered = false; |
3049 | // Everything else, we just grab the value
|
- | 3050 | return (elem.value || "").replace(/\r/g, ""); |
|
2814 | 3051 | ||
2815 | if ( !event.isPropagationStopped() ) { |
- | |
2816 | var parent = elem.parentNode || elem.ownerDocument; |
- | |
2817 | if ( parent ) { |
- | |
2818 | jQuery.event.trigger( event, data, parent, true ); |
- | |
2819 | }
|
- | |
2820 | }
|
3052 | }
|
2821 | }, |
- | |
2822 | 3053 | ||
2823 | handle: function( event ) { |
- | |
2824 | // returned undefined or false
|
3054 | return undefined; |
2825 | var all, handlers; |
3055 | }
|
2826 | 3056 | ||
2827 | event = arguments[0] = jQuery.event.fix( event || window.event ); |
3057 | // Typecast once if the value is a number
|
2828 | event.currentTarget = this; |
3058 | if ( typeof value === "number" ) |
- | 3059 | value += ''; |
|
2829 | 3060 | ||
2830 | // Namespaced event handlers
|
3061 | var val = value; |
2831 | var namespaces = event.type.split("."); |
- | |
2832 | event.type = namespaces.shift(); |
- | |
2833 | 3062 | ||
- | 3063 | return this.each(function(){ |
|
- | 3064 | if(jQuery.isFunction(value)) { |
|
- | 3065 | val = value.call(this); |
|
2834 | // Cache this now, all = true means, any handler
|
3066 | // Typecast each time if the value is a Function and the appended
|
2835 | all = !namespaces.length && !event.exclusive; |
3067 | // value is therefore different each time.
|
- | 3068 | if( typeof val === "number" ) val += ''; |
|
- | 3069 | }
|
|
2836 | 3070 | ||
2837 | var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"); |
3071 | if ( this.nodeType != 1 ) |
- | 3072 | return; |
|
2838 | 3073 | ||
- | 3074 | if ( jQuery.isArray(val) && /radio|checkbox/.test( this.type ) ) |
|
2839 | handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; |
3075 | this.checked = jQuery.inArray(this.value || this.name, val) >= 0; |
2840 | 3076 | ||
2841 | for ( var j in handlers ) { |
3077 | else if ( jQuery.nodeName( this, "select" ) ) { |
2842 | var handler = handlers[ j ]; |
3078 | var values = jQuery.makeArray(val); |
2843 | 3079 | ||
2844 | // Filter the functions by class
|
- | |
2845 | if ( all || namespace.test(handler.type) ) { |
3080 | jQuery( "option", this ).each(function(){ |
2846 | // Pass in a reference to the handler function itself
|
3081 | this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; |
2847 | // So that we can later remove it
|
- | |
2848 | event.handler = handler; |
3082 | }); |
2849 | event.data = handler.data; |
- | |
2850 | 3083 | ||
2851 | var ret = handler.apply( this, arguments ); |
3084 | if ( !values.length ) |
- | 3085 | this.selectedIndex = -1; |
|
2852 | 3086 | ||
2853 | if ( ret !== undefined ) { |
- | |
2854 | event.result = ret; |
3087 | } else |
2855 | if ( ret === false ) { |
3088 | this.value = val; |
2856 | event.preventDefault(); |
- | |
2857 | event.stopPropagation(); |
- | |
2858 | }
|
3089 | }); |
2859 | }
|
3090 | }
|
- | 3091 | }); |
|
2860 | 3092 | ||
- | 3093 | jQuery.each({ |
|
2861 | if ( event.isImmediatePropagationStopped() ) { |
3094 | removeAttr: function( name ) { |
- | 3095 | jQuery.attr( this, name, "" ); |
|
- | 3096 | if (this.nodeType == 1) |
|
2862 | break; |
3097 | this.removeAttribute( name ); |
2863 | }
|
3098 | }, |
2864 | 3099 | ||
- | 3100 | toggleClass: function( classNames, state ) { |
|
- | 3101 | var type = typeof classNames; |
|
- | 3102 | if ( type === "string" ) { |
|
- | 3103 | // toggle individual class names
|
|
- | 3104 | var isBool = typeof state === "boolean", className, i = 0, |
|
- | 3105 | classNames = classNames.split( /\s+/ ); |
|
- | 3106 | while ( (className = classNames[ i++ ]) ) { |
|
- | 3107 | // check each className given, space seperated list
|
|
- | 3108 | state = isBool ? state : !jQuery(this).hasClass( className ); |
|
- | 3109 | jQuery(this)[ state ? "addClass" : "removeClass" ]( className ); |
|
2865 | }
|
3110 | }
|
- | 3111 | } else if ( type === "undefined" || type === "boolean" ) { |
|
- | 3112 | if ( this.className ) { |
|
- | 3113 | // store className if set
|
|
- | 3114 | jQuery.data( this, "__className__", this.className ); |
|
2866 | }
|
3115 | }
|
- | 3116 | // toggle whole className
|
|
- | 3117 | this.className = this.className || classNames === false ? "" : jQuery.data( this, "__className__" ) || ""; |
|
- | 3118 | }
|
|
- | 3119 | }
|
|
- | 3120 | }, function(name, fn){ |
|
- | 3121 | jQuery.fn[ name ] = function(){ |
|
- | 3122 | return this.each( fn, arguments ); |
|
2867 | }, |
3123 | }; |
- | 3124 | }); |
|
2868 | 3125 | ||
- | 3126 | jQuery.extend({ |
|
- | 3127 | attr: function( elem, name, value ) { |
|
- | 3128 | // don't set attributes on text and comment nodes
|
|
2869 | props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
3129 | if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
- | 3130 | return undefined; |
|
2870 | 3131 | ||
2871 | fix: function( event ) { |
- | |
2872 | if ( event[ expando ] ) { |
3132 | if ( name in jQuery.fn && name !== "attr" ) { |
2873 | return event; |
3133 | return jQuery(elem)[name](value); |
2874 | }
|
3134 | }
|
2875 | 3135 | ||
2876 | // store a copy of the original event object
|
3136 | var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
2877 | // and "clone" to set read-only properties
|
3137 | // Whether we are setting (or getting)
|
2878 | var originalEvent = event; |
3138 | set = value !== undefined; |
2879 | event = jQuery.Event( originalEvent ); |
- | |
2880 | 3139 | ||
2881 | for ( var i = this.props.length, prop; i; ) { |
- | |
2882 | prop = this.props[ --i ]; |
3140 | // Try to normalize/fix the name
|
2883 | event[ prop ] = originalEvent[ prop ]; |
3141 | name = notxml && jQuery.props[ name ] || name; |
2884 | }
|
- | |
2885 | 3142 | ||
2886 | // Fix target property, if necessary
|
3143 | // Only do all the following if this is a node (faster for style)
|
2887 | if ( !event.target ) { |
3144 | if ( elem.nodeType === 1 ) { |
2888 | event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
- | |
2889 | }
|
- | |
2890 | 3145 | ||
2891 | // check if target is a textnode (safari)
|
3146 | // These attributes require special treatment
|
2892 | if ( event.target.nodeType === 3 ) { |
- | |
2893 | event.target = event.target.parentNode; |
3147 | var special = /href|src|style/.test( name ); |
2894 | }
|
- | |
2895 | 3148 | ||
- | 3149 | // Safari mis-reports the default selected property of a hidden option
|
|
2896 | // Add relatedTarget, if necessary
|
3150 | // Accessing the parent's selectedIndex property fixes it
|
2897 | if ( !event.relatedTarget && event.fromElement ) { |
3151 | if ( name == "selected" && elem.parentNode ) |
2898 | event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
3152 | elem.parentNode.selectedIndex; |
2899 | }
|
- | |
2900 | 3153 | ||
2901 | // Calculate pageX/Y if missing and clientX/Y available
|
3154 | // If applicable, access the attribute via the DOM 0 way
|
2902 | if ( event.pageX == null && event.clientX != null ) { |
3155 | if ( name in elem && notxml && !special ) { |
- | 3156 | if ( set ){ |
|
2903 | var doc = document.documentElement, body = document.body; |
3157 | // We can't allow the type property to be changed (since it causes problems in IE)
|
2904 | event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
3158 | if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode ) |
2905 | event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
3159 | throw "type property can't be changed"; |
2906 | }
|
- | |
2907 | 3160 | ||
2908 | // Add which for key events
|
3161 | elem[ name ] = value; |
2909 | if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { |
- | |
2910 | event.which = event.charCode || event.keyCode; |
- | |
2911 | }
|
3162 | }
|
2912 | 3163 | ||
2913 | // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
3164 | // browsers index elements by id/name on forms, give priority to attributes.
|
- | 3165 | if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
|
- | 3166 | return elem.getAttributeNode( name ).nodeValue; |
|
- | 3167 | ||
- | 3168 | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
|
- | 3169 | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
|
2914 | if ( !event.metaKey && event.ctrlKey ) { |
3170 | if ( name == "tabIndex" ) { |
- | 3171 | var attributeNode = elem.getAttributeNode( "tabIndex" ); |
|
- | 3172 | return attributeNode && attributeNode.specified |
|
2915 | event.metaKey = event.ctrlKey; |
3173 | ? attributeNode.value |
- | 3174 | : /(button|input|object|select|textarea)/i.test(elem.nodeName) |
|
- | 3175 | ? 0 |
|
- | 3176 | : /^(a|area)$/i.test(elem.nodeName) && elem.href |
|
- | 3177 | ? 0 |
|
- | 3178 | : undefined; |
|
2916 | }
|
3179 | }
|
2917 | 3180 | ||
2918 | // Add which for click: 1 == left; 2 == middle; 3 == right
|
- | |
2919 | // Note: button is not normalized, so don't use it
|
3181 | return elem[ name ]; |
2920 | if ( !event.which && event.button !== undefined ) { |
- | |
2921 | event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
- | |
2922 | }
|
3182 | }
|
2923 | 3183 | ||
- | 3184 | if ( !jQuery.support.style && notxml && name == "style" ) { |
|
2924 | return event; |
3185 | if ( set ) |
2925 | }, |
- | |
- | 3186 | elem.style.cssText = "" + value; |
|
2926 | 3187 | ||
2927 | proxy: function( fn, proxy, thisObject ) { |
- | |
2928 | if ( proxy !== undefined && !jQuery.isFunction( proxy ) ) { |
- | |
2929 | thisObject = proxy; |
3188 | return elem.style.cssText; |
2930 | proxy = undefined; |
- | |
2931 | }
|
3189 | }
|
2932 | // FIXME: Should proxy be redefined to be applied with thisObject if defined?
|
- | |
2933 | proxy = proxy || function() { return fn.apply( thisObject !== undefined ? thisObject : this, arguments ); }; |
- | |
2934 | // Set the guid of unique handler to the same of original handler, so it can be removed
|
- | |
2935 | proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; |
- | |
2936 | // So proxy can be declared as an argument
|
- | |
2937 | return proxy; |
- | |
2938 | }, |
- | |
2939 | - | ||
2940 | special: { |
- | |
2941 | ready: { |
- | |
2942 | // Make sure the ready event is setup
|
- | |
2943 | setup: bindReady, |
- | |
2944 | teardown: function() {} |
- | |
2945 | }, |
- | |
2946 | 3190 | ||
2947 | live: { |
3191 | if ( set ) |
2948 | add: function( proxy, data, namespaces ) { |
3192 | // convert the value to a string (all browsers do this but IE) see #1070
|
2949 | jQuery.extend( proxy, data || {} ); |
3193 | elem.setAttribute( name, "" + value ); |
2950 | proxy.guid += data.selector + data.live; |
- | |
2951 | jQuery.event.add( this, data.live, liveHandler ); |
- | |
2952 | }, |
- | |
2953 | 3194 | ||
- | 3195 | var attr = !jQuery.support.hrefNormalized && notxml && special |
|
2954 | remove: function( namespaces ) { |
3196 | // Some attributes require a special call on IE
|
2955 | if ( namespaces.length ) { |
3197 | ? elem.getAttribute( name, 2 ) |
2956 | var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); |
3198 | : elem.getAttribute( name ); |
2957 | 3199 | ||
2958 | jQuery.each( (jQuery.data(this, "events").live || {}), function() { |
3200 | // Non-existent attributes return null, we normalize to undefined
|
2959 | if ( name.test(this.type) ) { |
3201 | return attr === null ? undefined : attr; |
2960 | remove++;
|
- | |
2961 | }
|
3202 | }
|
2962 | }); |
- | |
2963 | 3203 | ||
2964 | if ( remove < 1 ) { |
3204 | // elem is actually elem.style ... set the style
|
- | 3205 | // Using attr for specific style information is now deprecated. Use style insead.
|
|
2965 | jQuery.event.remove( this, namespaces[0], liveHandler ); |
3206 | return jQuery.style(elem, name, value); |
2966 | }
|
- | |
2967 | }
|
- | |
2968 | }
|
- | |
2969 | }
|
- | |
2970 | }
|
3207 | }
|
- | 3208 | }); |
|
- | 3209 | var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, |
|
- | 3210 | rleadingWhitespace = /^\s+/, |
|
- | 3211 | rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, |
|
- | 3212 | rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i, |
|
- | 3213 | rtagName = /<([\w:]+)/, |
|
- | 3214 | rtbody = /<tbody/i, |
|
- | 3215 | rhtml = /</, |
|
- | 3216 | fcloseTag = function(all, front, tag){ |
|
- | 3217 | return rselfClosing.test(tag) ? |
|
- | 3218 | all :
|
|
- | 3219 | front + "></" + tag + ">"; |
|
- | 3220 | }, |
|
- | 3221 | wrapMap = { |
|
- | 3222 | option: [ 1, "<select multiple='multiple'>", "</select>" ], |
|
- | 3223 | legend: [ 1, "<fieldset>", "</fieldset>" ], |
|
- | 3224 | thead: [ 1, "<table>", "</table>" ], |
|
- | 3225 | tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
|
- | 3226 | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
|
- | 3227 | col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], |
|
- | 3228 | _default: [ 0, "", "" ] |
|
2971 | }; |
3229 | }; |
2972 | 3230 | ||
2973 | jQuery.Event = function( src ){ |
3231 | wrapMap.optgroup = wrapMap.option; |
2974 | // Allow instantiation without the 'new' keyword
|
3232 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
2975 | if ( !this.preventDefault ) { |
3233 | wrapMap.th = wrapMap.td; |
2976 | return new jQuery.Event( src ); |
- | |
2977 | }
|
- | |
2978 | 3234 | ||
2979 | // Event object
|
3235 | // IE can't serialize <link> and <script> tags normally
|
2980 | if ( src && src.type ) { |
3236 | if ( !jQuery.support.htmlSerialize ) { |
2981 | this.originalEvent = src; |
3237 | wrapMap._default = [ 1, "div<div>", "</div>" ]; |
2982 | this.type = src.type; |
- | |
2983 | // Event type
|
- | |
2984 | } else { |
- | |
2985 | this.type = src; |
- | |
2986 | }
|
3238 | }
|
2987 | 3239 | ||
- | 3240 | jQuery.fn.extend({ |
|
2988 | // timeStamp is buggy for some events on Firefox(#3843)
|
3241 | text: function( text ) { |
2989 | // So we won't rely on the native value
|
3242 | if ( typeof text !== "object" && text !== undefined ) |
2990 | this.timeStamp = now(); |
3243 | return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
2991 | 3244 | ||
2992 | // Mark it as fixed
|
3245 | var ret = ""; |
2993 | this[ expando ] = true; |
- | |
2994 | }; |
- | |
2995 | 3246 | ||
- | 3247 | jQuery.each( text || this, function(){ |
|
- | 3248 | jQuery.each( this.childNodes, function(){ |
|
2996 | function returnFalse() { |
3249 | if ( this.nodeType !== 8 ) { |
2997 | return false; |
3250 | ret += this.nodeType !== 1 ? |
2998 | }
|
- | |
2999 | function returnTrue() { |
3251 | this.nodeValue : |
3000 | return true; |
3252 | jQuery.fn.text( [ this ] ); |
3001 | }
|
3253 | }
|
- | 3254 | }); |
|
- | 3255 | }); |
|
3002 | 3256 | ||
3003 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
- | |
3004 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
- | |
3005 | jQuery.Event.prototype = { |
- | |
3006 | preventDefault: function() { |
- | |
3007 | this.isDefaultPrevented = returnTrue; |
- | |
3008 | - | ||
3009 | var e = this.originalEvent; |
- | |
3010 | if ( !e ) { |
- | |
3011 | return; |
3257 | return ret; |
3012 | }
|
- | |
3013 | // if preventDefault exists run it on the original event
|
- | |
3014 | if ( e.preventDefault ) { |
- | |
3015 | e.preventDefault(); |
- | |
3016 | }
|
- | |
3017 | // otherwise set the returnValue property of the original event to false (IE)
|
- | |
3018 | e.returnValue = false; |
- | |
3019 | }, |
3258 | }, |
3020 | stopPropagation: function() { |
- | |
3021 | this.isPropagationStopped = returnTrue; |
- | |
3022 | 3259 | ||
3023 | var e = this.originalEvent; |
3260 | wrapAll: function( html ) { |
3024 | if ( !e ) { |
3261 | if ( jQuery.isFunction( html ) ) { |
- | 3262 | return this.each(function() { |
|
- | 3263 | jQuery(this).wrapAll( html.apply(this, arguments) ); |
|
3025 | return; |
3264 | }); |
3026 | }
|
3265 | }
|
- | 3266 | ||
- | 3267 | if ( this[0] ) { |
|
3027 | // if stopPropagation exists run it on the original event
|
3268 | // The elements to wrap the target around
|
- | 3269 | var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(); |
|
- | 3270 | ||
3028 | if ( e.stopPropagation ) { |
3271 | if ( this[0].parentNode ) { |
3029 | e.stopPropagation(); |
3272 | wrap.insertBefore( this[0] ); |
3030 | }
|
3273 | }
|
3031 | // otherwise set the cancelBubble property of the original event to true (IE)
|
- | |
3032 | e.cancelBubble = true; |
- | |
3033 | }, |
3274 | |
3034 | stopImmediatePropagation: function(){ |
- | |
3035 | this.isImmediatePropagationStopped = returnTrue; |
- | |
3036 | this.stopPropagation(); |
3275 | wrap.map(function(){ |
3037 | }, |
- | |
3038 | isDefaultPrevented: returnFalse, |
3276 | var elem = this; |
3039 | isPropagationStopped: returnFalse, |
- | |
3040 | isImmediatePropagationStopped: returnFalse
|
- | |
3041 | }; |
3277 | |
3042 | // Checks if an event happened on an element within another element
|
3278 | while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
3043 | // Used in jQuery.event.special.mouseenter and mouseleave handlers
|
- | |
3044 | var withinElement = function( event ) { |
- | |
3045 | // Check if mouse(over|out) are still within the same parent element
|
- | |
3046 | var parent = event.relatedTarget; |
3279 | elem = elem.firstChild; |
3047 | // Traverse up the tree
|
- | |
3048 | while ( parent && parent != this ) { |
- | |
3049 | // Firefox sometimes assigns relatedTarget a XUL element
|
- | |
3050 | // which we cannot access the parentNode property of
|
- | |
3051 | try { parent = parent.parentNode; } |
- | |
3052 | // assuming we've left the element since we most likely mousedover a xul element
|
- | |
3053 | catch(e) { break; } |
- | |
3054 | }
|
3280 | }
|
3055 | 3281 | ||
3056 | if ( parent != this ) { |
3282 | return elem; |
3057 | // set the correct event type
|
- | |
3058 | event.type = event.data; |
3283 | }).append(this); |
3059 | // handle event if we actually just moused on to a non sub-element
|
- | |
3060 | jQuery.event.handle.apply( this, arguments ); |
- | |
3061 | }
|
3284 | }
|
3062 | }; |
- | |
3063 | 3285 | ||
3064 | jQuery.each({ |
- | |
3065 | mouseover: 'mouseenter', |
- | |
3066 | mouseout: 'mouseleave' |
- | |
3067 | }, function( orig, fix ) { |
- | |
3068 | jQuery.event.special[ fix ] = { |
- | |
3069 | setup: function(){ |
3286 | return this; |
3070 | jQuery.event.add( this, orig, withinElement, fix ); |
- | |
3071 | }, |
3287 | }, |
- | 3288 | ||
- | 3289 | wrapInner: function( html ) { |
|
3072 | teardown: function(){ |
3290 | return this.each(function(){ |
3073 | jQuery.event.remove( this, orig, withinElement ); |
3291 | jQuery( this ).contents().wrapAll( html ); |
3074 | }
|
- | |
3075 | }; |
- | |
3076 | }); |
3292 | }); |
- | 3293 | }, |
|
3077 | 3294 | ||
3078 | jQuery.fn.extend({ |
- | |
3079 | bind: function( type, data, fn, thisObject ) { |
- | |
3080 | if ( jQuery.isFunction( data ) ) { |
3295 | wrap: function( html ) { |
3081 | if ( fn !== undefined ) { |
3296 | return this.each(function(){ |
3082 | thisObject = fn; |
- | |
3083 | }
|
- | |
3084 | fn = data; |
- | |
3085 | data = undefined; |
- | |
3086 | }
|
- | |
3087 | fn = thisObject === undefined ? fn : jQuery.event.proxy( fn, thisObject ); |
- | |
3088 | return type === "unload" ? this.one(type, data, fn, thisObject) : this.each(function() { |
- | |
3089 | jQuery.event.add( this, type, fn, data ); |
3297 | jQuery( this ).wrapAll( html ); |
3090 | }); |
3298 | }); |
3091 | }, |
3299 | }, |
3092 | 3300 | ||
3093 | one: function( type, data, fn, thisObject ) { |
3301 | unwrap: function() { |
3094 | if ( jQuery.isFunction( data ) ) { |
3302 | return this.parent().each(function(){ |
3095 | if ( fn !== undefined ) { |
3303 | if ( !jQuery.nodeName( this, "body" ) ) { |
3096 | thisObject = fn; |
3304 | jQuery( this ).replaceWith( this.childNodes ); |
3097 | }
|
3305 | }
|
3098 | fn = data; |
3306 | }).end(); |
- | 3307 | }, |
|
- | 3308 | ||
3099 | data = undefined; |
3309 | append: function() { |
- | 3310 | return this.domManip(arguments, true, function(elem){ |
|
- | 3311 | if ( this.nodeType === 1 ) { |
|
- | 3312 | this.appendChild( elem ); |
|
3100 | }
|
3313 | }
|
3101 | fn = thisObject === undefined ? fn : jQuery.event.proxy( fn, thisObject ); |
- | |
3102 | var one = jQuery.event.proxy( fn, function( event ) { |
- | |
3103 | jQuery( this ).unbind( event, one ); |
- | |
3104 | return fn.apply( this, arguments ); |
- | |
3105 | }); |
- | |
3106 | return this.each(function() { |
- | |
3107 | jQuery.event.add( this, type, one, data ); |
- | |
3108 | }); |
3314 | }); |
3109 | }, |
3315 | }, |
3110 | 3316 | ||
3111 | unbind: function( type, fn ) { |
3317 | prepend: function() { |
- | 3318 | return this.domManip(arguments, true, function(elem){ |
|
3112 | return this.each(function() { |
3319 | if ( this.nodeType === 1 ) { |
3113 | jQuery.event.remove( this, type, fn ); |
3320 | this.insertBefore( elem, this.firstChild ); |
- | 3321 | }
|
|
3114 | }); |
3322 | }); |
3115 | }, |
3323 | }, |
3116 | 3324 | ||
3117 | trigger: function( type, data ) { |
3325 | before: function() { |
- | 3326 | if ( this[0] && this[0].parentNode ) { |
|
3118 | return this.each(function() { |
3327 | return this.domManip(arguments, false, function(elem){ |
3119 | jQuery.event.trigger( type, data, this ); |
3328 | this.parentNode.insertBefore( elem, this ); |
3120 | }); |
3329 | }); |
- | 3330 | } else if ( arguments.length ) { |
|
- | 3331 | var set = jQuery(arguments[0]); |
|
- | 3332 | set.push.apply( set, this.toArray() ); |
|
- | 3333 | return this.pushStack( set, "before", arguments ); |
|
- | 3334 | }
|
|
3121 | }, |
3335 | }, |
3122 | 3336 | ||
3123 | triggerHandler: function( type, data ) { |
3337 | after: function() { |
3124 | if ( this[0] ) { |
3338 | if ( this[0] && this[0].parentNode ) { |
- | 3339 | return this.domManip(arguments, false, function(elem){ |
|
3125 | var event = jQuery.Event( type ); |
3340 | this.parentNode.insertBefore( elem, this.nextSibling ); |
- | 3341 | }); |
|
3126 | event.preventDefault(); |
3342 | } else if ( arguments.length ) { |
3127 | event.stopPropagation(); |
3343 | var set = this.pushStack( this, "after", arguments ); |
3128 | jQuery.event.trigger( event, data, this[0] ); |
3344 | set.push.apply( set, jQuery(arguments[0]).toArray() ); |
3129 | return event.result; |
3345 | return set; |
3130 | }
|
3346 | }
|
3131 | }, |
3347 | }, |
3132 | 3348 | ||
3133 | toggle: function( fn ) { |
3349 | clone: function( events ) { |
- | 3350 | // Do the clone
|
|
- | 3351 | var ret = this.map(function(){ |
|
- | 3352 | if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
|
- | 3353 | // IE copies events bound via attachEvent when
|
|
- | 3354 | // using cloneNode. Calling detachEvent on the
|
|
- | 3355 | // clone will also remove the events from the orignal
|
|
3134 | // Save reference to arguments for access in closure
|
3356 | // In order to get around this, we use innerHTML.
|
- | 3357 | // Unfortunately, this means some modifications to
|
|
- | 3358 | // attributes in IE that are actually only stored
|
|
- | 3359 | // as properties will not be copied (such as the
|
|
- | 3360 | // the name attribute on an input).
|
|
- | 3361 | var html = this.outerHTML, ownerDocument = this.ownerDocument; |
|
- | 3362 | if ( !html ) { |
|
- | 3363 | var div = ownerDocument.createElement("div"); |
|
- | 3364 | div.appendChild( this.cloneNode(true) ); |
|
3135 | var args = arguments, i = 1; |
3365 | html = div.innerHTML; |
- | 3366 | }
|
|
3136 | 3367 | ||
- | 3368 | return jQuery.clean([html.replace(rinlinejQuery, "") |
|
3137 | // link all the functions, so any of them can unbind this click handler
|
3369 | .replace(rleadingWhitespace, "")], ownerDocument)[0]; |
3138 | while( i < args.length ) { |
3370 | } else { |
3139 | jQuery.event.proxy( fn, args[ i++ ] ); |
3371 | return this.cloneNode(true); |
3140 | }
|
3372 | }
|
- | 3373 | }); |
|
3141 | 3374 | ||
3142 | return this.click( jQuery.event.proxy( fn, function( event ) { |
3375 | // Copy the events from the original to the clone
|
3143 | // Figure out which function to execute
|
3376 | if ( events === true ) { |
3144 | this.lastToggle = ( this.lastToggle || 0 ) % i; |
3377 | var orig = this.find("*").andSelf(), i = 0; |
3145 | 3378 | ||
3146 | // Make sure that clicks stop
|
3379 | ret.find("*").andSelf().each(function(){ |
3147 | event.preventDefault(); |
3380 | if ( this.nodeName !== orig[i].nodeName ) { return; } |
3148 | 3381 | ||
3149 | // and execute the function
|
- | |
3150 | return args[ this.lastToggle++ ].apply( this, arguments ) || false; |
3382 | var events = jQuery.data( orig[i], "events" ); |
3151 | })); |
- | |
3152 | }, |
- | |
3153 | 3383 | ||
3154 | hover: function( fnOver, fnOut ) { |
3384 | for ( var type in events ) { |
- | 3385 | for ( var handler in events[ type ] ) { |
|
3155 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
3386 | jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
- | 3387 | }
|
|
- | 3388 | }
|
|
- | 3389 | ||
- | 3390 | i++;
|
|
- | 3391 | }); |
|
- | 3392 | }
|
|
- | 3393 | ||
- | 3394 | // Return the cloned set
|
|
- | 3395 | return ret; |
|
3156 | }, |
3396 | }, |
3157 | 3397 | ||
3158 | ready: function( fn ) { |
3398 | html: function( value ) { |
- | 3399 | if ( value === undefined ) { |
|
3159 | // Attach the listeners
|
3400 | return this[0] ? |
- | 3401 | this[0].innerHTML.replace(rinlinejQuery, "") : |
|
3160 | bindReady(); |
3402 | null; |
3161 | 3403 | ||
- | 3404 | // See if we can take a shortcut and just use innerHTML
|
|
- | 3405 | } else if ( typeof value === "string" && !/<script/i.test( value ) && |
|
- | 3406 | (!jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && |
|
- | 3407 | !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { |
|
- | 3408 | ||
- | 3409 | try { |
|
- | 3410 | for ( var i = 0, l = this.length; i < l; i++ ) { |
|
3162 | // If the DOM is already ready
|
3411 | // Remove element nodes and prevent memory leaks
|
3163 | if ( jQuery.isReady ) { |
3412 | if ( this[i].nodeType === 1 ) { |
3164 | // Execute the function immediately
|
3413 | cleanData( this[i].getElementsByTagName("*") ); |
- | 3414 | this[i].innerHTML = value; |
|
- | 3415 | }
|
|
- | 3416 | }
|
|
- | 3417 | ||
- | 3418 | // If using innerHTML throws an exception, use the fallback method
|
|
- | 3419 | } catch(e) { |
|
3165 | fn.call( document, jQuery ); |
3420 | this.empty().append( value ); |
- | 3421 | }
|
|
3166 | 3422 | ||
3167 | // Otherwise, remember the function for later
|
- | |
3168 | } else { |
3423 | } else { |
3169 | // Add the function to the wait list
|
- | |
3170 | jQuery.readyList.push( fn ); |
3424 | this.empty().append( value ); |
3171 | }
|
3425 | }
|
3172 | 3426 | ||
3173 | return this; |
3427 | return this; |
3174 | }, |
3428 | }, |
3175 | 3429 | ||
3176 | live: function( type, data, fn, thisObject ) { |
- | |
3177 | if ( jQuery.isFunction( data ) ) { |
3430 | replaceWith: function( value ) { |
3178 | if ( fn !== undefined ) { |
3431 | if ( this[0] && this[0].parentNode ) { |
3179 | thisObject = fn; |
3432 | return this.after( value ).remove(); |
3180 | }
|
- | |
3181 | fn = data; |
3433 | } else { |
3182 | data = undefined; |
3434 | return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); |
3183 | }
|
3435 | }
|
3184 | jQuery( this.context ).bind( liveConvert( type, this.selector ), { |
- | |
3185 | data: data, selector: this.selector, live: type |
- | |
3186 | }, fn, thisObject ); |
- | |
3187 | return this; |
- | |
3188 | }, |
3436 | }, |
3189 | 3437 | ||
3190 | die: function( type, fn ) { |
3438 | detach: function( selector ) { |
3191 | jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null ); |
- | |
3192 | return this; |
3439 | return this.remove( selector, true ); |
3193 | }
|
3440 | }, |
3194 | }); |
- | |
3195 | 3441 | ||
3196 | function liveHandler( event ) { |
3442 | domManip: function( args, table, callback ) { |
3197 | var stop = true, elems = [], args = arguments; |
3443 | var results, first, value = args[0], scripts = []; |
3198 | 3444 | ||
3199 | jQuery.each( jQuery.data( this, "events" ).live || [], function( i, fn ) { |
3445 | if ( jQuery.isFunction(value) ) { |
3200 | if ( fn.live === event.type ) { |
3446 | return this.each(function() { |
- | 3447 | args[0] = value.call(this); |
|
3201 | var elem = jQuery( event.target ).closest( fn.selector )[0]; |
3448 | return jQuery(this).domManip( args, table, callback ); |
3202 | if ( elem ) { |
3449 | }); |
3203 | elems.push({ elem: elem, fn: fn }); |
- | |
3204 | }
|
3450 | }
|
- | 3451 | ||
- | 3452 | if ( this[0] ) { |
|
- | 3453 | // If we're in a fragment, just use that instead of building a new one
|
|
- | 3454 | if ( args[0] && args[0].parentNode && args[0].parentNode.nodeType === 11 ) { |
|
- | 3455 | results = { fragment: args[0].parentNode }; |
|
- | 3456 | } else { |
|
- | 3457 | results = buildFragment( args, this, scripts ); |
|
3205 | }
|
3458 | }
|
3206 | }); |
- | |
3207 | 3459 | ||
3208 | elems.sort(function( a, b ) { |
3460 | first = results.fragment.firstChild; |
3209 | return jQuery.data( a.elem, "closest" ) - jQuery.data( b.elem, "closest" ); |
- | |
3210 | }); |
- | |
3211 | 3461 | ||
3212 | jQuery.each(elems, function() { |
3462 | if ( first ) { |
3213 | event.currentTarget = this.elem; |
- | |
3214 | event.data = this.fn.data; |
- | |
3215 | if ( this.fn.apply( this.elem, args ) === false ) { |
3463 | table = table && jQuery.nodeName( first, "tr" ); |
3216 | return (stop = false); |
- | |
3217 | }
|
- | |
3218 | }); |
- | |
3219 | 3464 | ||
- | 3465 | for ( var i = 0, l = this.length; i < l; i++ ) { |
|
- | 3466 | callback.call( |
|
3220 | return stop; |
3467 | table ?
|
- | 3468 | root(this[i], first) : |
|
- | 3469 | this[i], |
|
- | 3470 | results.cacheable || this.length > 1 || i > 0 ? |
|
- | 3471 | results.fragment.cloneNode(true) : |
|
- | 3472 | results.fragment
|
|
- | 3473 | ); |
|
- | 3474 | }
|
|
3221 | }
|
3475 | }
|
3222 | 3476 | ||
3223 | function liveConvert( type, selector ) { |
3477 | if ( scripts ) { |
3224 | return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); |
3478 | jQuery.each( scripts, evalScript ); |
- | 3479 | }
|
|
3225 | }
|
3480 | }
|
3226 | 3481 | ||
3227 | jQuery.extend({ |
- | |
3228 | isReady: false, |
3482 | return this; |
3229 | readyList: [], |
- | |
3230 | // Handle when the DOM is ready
|
- | |
3231 | ready: function() { |
- | |
3232 | // Make sure that the DOM is not already loaded
|
- | |
3233 | if ( !jQuery.isReady ) { |
- | |
3234 | // Remember that the DOM is ready
|
- | |
3235 | jQuery.isReady = true; |
- | |
3236 | 3483 | ||
3237 | // If there are functions bound, to execute
|
3484 | function root( elem, cur ) { |
3238 | if ( jQuery.readyList ) { |
3485 | return jQuery.nodeName(elem, "table") ? |
3239 | // Execute all of them
|
3486 | (elem.getElementsByTagName("tbody")[0] || |
3240 | var fn, i = 0; |
- | |
3241 | while ( (fn = jQuery.readyList[ i++ ]) ) { |
3487 | elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
3242 | fn.call( document, jQuery ); |
3488 | elem;
|
3243 | }
|
3489 | }
|
3244 | - | ||
3245 | // Reset the list of functions
|
- | |
3246 | jQuery.readyList = null; |
- | |
3247 | }
|
3490 | }
|
- | 3491 | }); |
|
3248 | 3492 | ||
- | 3493 | function buildFragment(args, nodes, scripts){ |
|
3249 | // Trigger any bound ready events
|
3494 | var fragment, cacheable, cached, cacheresults, doc; |
- | 3495 | ||
- | 3496 | if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) { |
|
- | 3497 | cacheable = true; |
|
3250 | jQuery( document ).triggerHandler( "ready" ); |
3498 | cacheresults = jQuery.fragments[ args[0] ]; |
- | 3499 | if ( cacheresults ) { |
|
- | 3500 | if ( cacheresults !== 1 ) { |
|
- | 3501 | fragment = cacheresults; |
|
- | 3502 | }
|
|
- | 3503 | cached = true; |
|
3251 | }
|
3504 | }
|
3252 | }
|
3505 | }
|
3253 | }); |
- | |
3254 | 3506 | ||
3255 | var readyBound = false; |
3507 | if ( !fragment ) { |
- | 3508 | doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); |
|
- | 3509 | fragment = doc.createDocumentFragment(); |
|
- | 3510 | jQuery.clean( args, doc, fragment, scripts ); |
|
- | 3511 | }
|
|
3256 | 3512 | ||
3257 | function bindReady() { |
3513 | if ( cacheable ) { |
3258 | if ( readyBound ) return; |
3514 | jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; |
3259 | readyBound = true; |
3515 | }
|
3260 | 3516 | ||
3261 | // Catch cases where $(document).ready() is called after the
|
- | |
3262 | // browser event has already occurred.
|
3517 | return { fragment: fragment, cacheable: cacheable }; |
3263 | if ( document.readyState === "complete" ) { |
- | |
3264 | return jQuery.ready(); |
- | |
3265 | }
|
3518 | }
|
3266 | 3519 | ||
3267 | // Mozilla, Opera and webkit nightlies currently support this event
|
- | |
3268 | if ( document.addEventListener ) { |
- | |
3269 | // Use the handy event callback
|
- | |
3270 | document.addEventListener( "DOMContentLoaded", function() { |
- | |
3271 | document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); |
- | |
3272 | jQuery.ready(); |
3520 | jQuery.fragments = {}; |
3273 | }, false ); |
- | |
3274 | 3521 | ||
- | 3522 | jQuery.each({ |
|
3275 | // If IE event model is used
|
3523 | appendTo: "append", |
3276 | } else if ( document.attachEvent ) { |
3524 | prependTo: "prepend", |
3277 | // ensure firing before onload,
|
3525 | insertBefore: "before", |
- | 3526 | insertAfter: "after", |
|
- | 3527 | replaceAll: "replaceWith" |
|
- | 3528 | }, function(name, original){ |
|
3278 | // maybe late but safe also for iframes
|
3529 | jQuery.fn[ name ] = function( selector ) { |
3279 | document.attachEvent("onreadystatechange", function() { |
3530 | var ret = [], insert = jQuery( selector ); |
- | 3531 | ||
3280 | if ( document.readyState === "complete" ) { |
3532 | for ( var i = 0, l = insert.length; i < l; i++ ) { |
- | 3533 | var elems = (i > 0 ? this.clone(true) : this).get(); |
|
3281 | document.detachEvent( "onreadystatechange", arguments.callee ); |
3534 | jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
3282 | jQuery.ready(); |
3535 | ret = ret.concat( elems ); |
3283 | }
|
3536 | }
|
- | 3537 | return this.pushStack( ret, name, insert.selector ); |
|
- | 3538 | }; |
|
3284 | }); |
3539 | }); |
3285 | 3540 | ||
- | 3541 | jQuery.each({ |
|
3286 | // If IE and not an iframe
|
3542 | // keepData is for internal use only--do not document
|
3287 | // continually check to see if the document is ready
|
3543 | remove: function( selector, keepData ) { |
3288 | if ( document.documentElement.doScroll && window === window.top ) (function() { |
3544 | if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { |
3289 | if ( jQuery.isReady ) { |
3545 | if ( !keepData && this.nodeType === 1 ) { |
- | 3546 | cleanData( this.getElementsByTagName("*") ); |
|
3290 | return; |
3547 | cleanData( [ this ] ); |
3291 | }
|
3548 | }
|
3292 | 3549 | ||
3293 | try { |
- | |
3294 | // If IE is used, use the trick by Diego Perini
|
- | |
3295 | // http://javascript.nwbox.com/IEContentLoaded/
|
- | |
3296 | document.documentElement.doScroll("left"); |
- | |
3297 | } catch( error ) { |
3550 | if ( this.parentNode ) { |
3298 | setTimeout( arguments.callee, 0 ); |
3551 | this.parentNode.removeChild( this ); |
3299 | return; |
- | |
3300 | }
|
3552 | }
|
3301 | - | ||
3302 | // and execute any waiting functions
|
- | |
3303 | jQuery.ready(); |
- | |
3304 | })(); |
- | |
3305 | }
|
3553 | }
|
- | 3554 | }, |
|
3306 | 3555 | ||
- | 3556 | empty: function() { |
|
3307 | // A fallback to window.onload, that will always work
|
3557 | // Remove element nodes and prevent memory leaks
|
- | 3558 | if ( this.nodeType === 1 ) { |
|
3308 | jQuery.event.add( window, "load", jQuery.ready ); |
3559 | cleanData( this.getElementsByTagName("*") ); |
3309 | }
|
3560 | }
|
3310 | 3561 | ||
3311 | jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
- | |
3312 | "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + |
- | |
3313 | "change,select,submit,keydown,keypress,keyup,error").split(","), function( i, name ) { |
- | |
3314 | - | ||
3315 | // Handle event binding
|
3562 | // Remove any remaining nodes
|
3316 | jQuery.fn[ name ] = function( fn ) { |
- | |
3317 | return fn ? this.bind( name, fn ) : this.trigger( name ); |
- | |
3318 | }; |
- | |
3319 | }); |
- | |
3320 | - | ||
3321 | // Prevent memory leaks in IE
|
- | |
3322 | // And prevent errors on refresh with events like mouseover in other browsers
|
- | |
3323 | // Window isn't included so as not to unbind existing unload events
|
- | |
3324 | // More info:
|
- | |
3325 | // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
|
- | |
3326 | // - https://bugzilla.mozilla.org/show_bug.cgi?id=252542
|
- | |
3327 | jQuery( window ).bind( 'unload', function() { |
- | |
3328 | for ( var id in jQuery.cache ) { |
3563 | while ( this.firstChild ) { |
3329 | // Skip the window
|
- | |
3330 | if ( id != 1 && jQuery.cache[ id ].handle ) { |
- | |
3331 | jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
3564 | this.removeChild( this.firstChild ); |
3332 | }
|
3565 | }
|
3333 | }
|
3566 | }
|
- | 3567 | }, function(name, fn){ |
|
- | 3568 | jQuery.fn[ name ] = function(){ |
|
- | 3569 | return this.each( fn, arguments ); |
|
- | 3570 | }; |
|
3334 | }); |
3571 | }); |
3335 | (function(){ |
- | |
3336 | - | ||
3337 | jQuery.support = {}; |
- | |
3338 | 3572 | ||
3339 | var root = document.documentElement, |
3573 | jQuery.extend({ |
3340 | script = document.createElement("script"), |
3574 | clean: function( elems, context, fragment, scripts ) { |
3341 | div = document.createElement("div"), |
- | |
3342 | id = "script" + (new Date).getTime(); |
3575 | context = context || document; |
3343 | 3576 | ||
- | 3577 | // !context.createElement fails in IE with an error but returns typeof 'object'
|
|
3344 | div.style.display = "none"; |
3578 | if ( typeof context.createElement === "undefined" ) { |
3345 | div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>'; |
3579 | context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
- | 3580 | }
|
|
3346 | 3581 | ||
3347 | var all = div.getElementsByTagName("*"), |
3582 | var ret = [], div = context.createElement("div"); |
3348 | a = div.getElementsByTagName("a")[0]; |
- | |
3349 | 3583 | ||
3350 | // Can't get basic test support
|
3584 | jQuery.each(elems, function(i, elem){ |
3351 | if ( !all || !all.length || !a ) { |
3585 | if ( typeof elem === "number" ) { |
3352 | return; |
3586 | elem += ''; |
3353 | }
|
3587 | }
|
3354 | 3588 | ||
3355 | jQuery.support = { |
3589 | if ( !elem ) { return; } |
3356 | // IE strips leading whitespace when .innerHTML is used
|
- | |
3357 | leadingWhitespace: div.firstChild.nodeType == 3, |
- | |
3358 | 3590 | ||
3359 | // Make sure that tbody elements aren't automatically inserted
|
3591 | // Convert html string into DOM nodes
|
3360 | // IE will insert them into empty tables
|
3592 | if ( typeof elem === "string" && !rhtml.test( elem ) ) { |
3361 | tbody: !div.getElementsByTagName("tbody").length, |
3593 | elem = context.createTextNode( elem ); |
3362 | 3594 | ||
3363 | // Make sure that link elements get serialized correctly by innerHTML
|
3595 | } else if ( typeof elem === "string" ) { |
3364 | // This requires a wrapper element in IE
|
3596 | // Fix "XHTML"-style tags in all browsers
|
3365 | htmlSerialize: !!div.getElementsByTagName("link").length, |
3597 | elem = elem.replace(rxhtmlTag, fcloseTag); |
3366 | 3598 | ||
3367 | // Get the style information from getAttribute
|
3599 | // Trim whitespace, otherwise indexOf won't work as expected
|
3368 | // (IE uses .cssText insted)
|
3600 | var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), |
3369 | style: /red/.test( a.getAttribute("style") ), |
3601 | wrap = wrapMap[ tag ] || wrapMap._default, |
- | 3602 | depth = wrap[0]; |
|
3370 | 3603 | ||
3371 | // Make sure that URLs aren't manipulated
|
3604 | // Go to html and back, then peel off extra wrappers
|
3372 | // (IE normalizes it by default)
|
- | |
3373 | hrefNormalized: a.getAttribute("href") === "/a", |
3605 | div.innerHTML = wrap[1] + elem + wrap[2]; |
3374 | 3606 | ||
3375 | // Make sure that element opacity exists
|
3607 | // Move to the right depth
|
3376 | // (IE uses filter instead)
|
3608 | while ( depth-- ) { |
3377 | opacity: a.style.opacity === "0.5", |
3609 | div = div.lastChild; |
- | 3610 | }
|
|
3378 | 3611 | ||
3379 | // Verify style float existence
|
- | |
3380 | // (IE uses styleFloat instead of cssFloat)
|
3612 | // Remove IE's autoinserted <tbody> from table fragments
|
3381 | cssFloat: !!a.style.cssFloat, |
3613 | if ( !jQuery.support.tbody ) { |
3382 | 3614 | ||
3383 | // Will be defined later
|
3615 | // String was a <table>, *may* have spurious <tbody>
|
3384 | scriptEval: false, |
3616 | var hasBody = rtbody.test(elem), |
3385 | noCloneEvent: true, |
3617 | tbody = tag === "table" && !hasBody ? |
3386 | boxModel: null |
3618 | div.firstChild && div.firstChild.childNodes : |
3387 | }; |
- | |
3388 | 3619 | ||
3389 | script.type = "text/javascript"; |
3620 | // String was a bare <thead> or <tfoot>
|
3390 | try { |
- | |
3391 | script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
3621 | wrap[1] == "<table>" && !hasBody ? |
- | 3622 | div.childNodes : |
|
3392 | } catch(e){} |
3623 | []; |
3393 | 3624 | ||
- | 3625 | for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
|
- | 3626 | if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
|
3394 | root.insertBefore( script, root.firstChild ); |
3627 | tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
- | 3628 | }
|
|
- | 3629 | }
|
|
3395 | 3630 | ||
3396 | // Make sure that the execution of code works by injecting a script
|
- | |
3397 | // tag with appendChild/createTextNode
|
- | |
3398 | // (IE doesn't support this, fails, and uses .text instead)
|
- | |
3399 | if ( window[ id ] ) { |
- | |
3400 | jQuery.support.scriptEval = true; |
- | |
3401 | delete window[ id ]; |
- | |
3402 | }
|
3631 | }
|
3403 | 3632 | ||
3404 | root.removeChild( script ); |
3633 | // IE completely kills leading whitespace when innerHTML is used
|
- | 3634 | if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
|
- | 3635 | div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
|
- | 3636 | }
|
|
3405 | 3637 | ||
3406 | if ( div.attachEvent && div.fireEvent ) { |
3638 | elem = jQuery.makeArray( div.childNodes ); |
3407 | div.attachEvent("onclick", function click(){ |
- | |
3408 | // Cloning a node shouldn't copy over any
|
- | |
3409 | // bound event handlers (IE does this)
|
- | |
3410 | jQuery.support.noCloneEvent = false; |
- | |
3411 | div.detachEvent("onclick", click); |
- | |
3412 | }); |
- | |
3413 | div.cloneNode(true).fireEvent("onclick"); |
- | |
3414 | }
|
3639 | }
|
3415 | 3640 | ||
3416 | // Figure out if the W3C box model works as expected
|
3641 | if ( elem.nodeType ) { |
3417 | // document.body must exist before we can do this
|
3642 | ret.push( elem ); |
3418 | jQuery(function(){ |
3643 | } else { |
3419 | var div = document.createElement("div"); |
3644 | ret = jQuery.merge( ret, elem ); |
3420 | div.style.width = div.style.paddingLeft = "1px"; |
- | |
- | 3645 | }
|
|
3421 | 3646 | ||
3422 | document.body.appendChild( div ); |
- | |
3423 | jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
- | |
3424 | document.body.removeChild( div ).style.display = 'none'; |
- | |
3425 | div = null; |
- | |
3426 | }); |
3647 | }); |
3427 | 3648 | ||
3428 | // release memory in IE
|
3649 | if ( fragment ) { |
3429 | root = script = div = all = a = null; |
3650 | for ( var i = 0; ret[i]; i++ ) { |
- | 3651 | if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
|
- | 3652 | scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
|
- | 3653 | } else { |
|
- | 3654 | if ( ret[i].nodeType === 1 ) { |
|
- | 3655 | ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
|
- | 3656 | }
|
|
- | 3657 | fragment.appendChild( ret[i] ); |
|
3430 | })(); |
3658 | }
|
- | 3659 | }
|
|
- | 3660 | }
|
|
3431 | 3661 | ||
3432 | jQuery.props = { |
3662 | return ret; |
3433 | "for": "htmlFor", |
3663 | }
|
- | 3664 | }); |
|
- | 3665 | ||
3434 | "class": "className", |
3666 | function cleanData( elems ) { |
3435 | readonly: "readOnly", |
3667 | for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) { |
3436 | maxlength: "maxLength", |
3668 | if ( (id = elem[expando]) ) { |
3437 | cellspacing: "cellSpacing", |
3669 | delete jQuery.cache[ id ]; |
3438 | rowspan: "rowSpan", |
3670 | }
|
3439 | colspan: "colSpan", |
3671 | }
|
3440 | tabindex: "tabIndex" |
- | |
3441 | }; |
3672 | }
|
3442 | // exclude the following css properties to add px
|
3673 | // exclude the following css properties to add px
|
3443 | var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
3674 | var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
3444 | ralpha = /alpha\([^)]*\)/, |
3675 | ralpha = /alpha\([^)]*\)/, |
3445 | ropacity = /opacity=([^)]*)/, |
3676 | ropacity = /opacity=([^)]*)/, |
3446 | rfloat = /float/i, |
3677 | rfloat = /float/i, |
Строка 3456... | Строка 3687... | ||
3456 | fcamelCase = function(all, letter){ |
3687 | fcamelCase = function(all, letter){ |
3457 | return letter.toUpperCase(); |
3688 | return letter.toUpperCase(); |
3458 | }; |
3689 | }; |
3459 | 3690 | ||
3460 | jQuery.fn.css = function( name, value ) { |
3691 | jQuery.fn.css = function( name, value ) { |
3461 | var options = name, isFunction = jQuery.isFunction( value ); |
3692 | return access( this, name, value, true, function( elem, name, value ) { |
3462 | - | ||
3463 | if ( typeof name === "string" ) { |
- | |
3464 | // Are we setting the style?
|
- | |
3465 | if ( value === undefined ) { |
3693 | if (value === undefined) { |
3466 | return this.length ? |
- | |
3467 | jQuery.css( this[0], name ) : |
3694 | return jQuery.css( elem, name ); |
3468 | null; |
- | |
3469 | - | ||
3470 | // Convert name, value params to options hash format
|
- | |
3471 | } else { |
- | |
3472 | options = {}; |
- | |
3473 | options[ name ] = value; |
- | |
3474 | }
|
- | |
3475 | }
|
- | |
3476 | - | ||
3477 | var isFunction = {}; |
- | |
3478 | - | ||
3479 | // For each value, determine whether it's a Function so we don't
|
- | |
3480 | // need to determine it again for each element
|
- | |
3481 | for ( var prop in options ) { |
- | |
3482 | isFunction[prop] = jQuery.isFunction( options[prop] ); |
- | |
3483 | }
|
- | |
3484 | - | ||
3485 | // For each element...
|
- | |
3486 | for ( var i = 0, l = this.length; i < l; i++ ) { |
- | |
3487 | var elem = this[i]; |
- | |
3488 | - | ||
3489 | // Set all the styles
|
- | |
3490 | for ( var prop in options ) { |
- | |
3491 | value = options[prop]; |
- | |
3492 | - | ||
3493 | if ( isFunction[prop] ) { |
- | |
3494 | value = value.call( elem, i ); |
- | |
3495 | }
|
3695 | }
|
3496 | 3696 | ||
3497 | if ( typeof value === "number" && !rexclude.test(prop) ) { |
3697 | if ( typeof value === "number" && !rexclude.test(name) ) { |
3498 | value = value + "px"; |
3698 | value += "px"; |
3499 | }
|
3699 | }
|
3500 | 3700 | ||
3501 | jQuery.style( elem, prop, value ); |
3701 | jQuery.style( elem, name, value ); |
3502 | }
|
- | |
3503 | }
|
3702 | }); |
3504 | - | ||
3505 | return this; |
- | |
3506 | }; |
3703 | }; |
3507 | 3704 | ||
3508 | jQuery.extend({ |
3705 | jQuery.extend({ |
3509 | style: function( elem, name, value ) { |
3706 | style: function( elem, name, value ) { |
3510 | // don't set styles on text and comment nodes
|
3707 | // don't set styles on text and comment nodes
|
Строка 3713... | Строка 3910... | ||
3713 | params = jQuery.param( params ); |
3910 | params = jQuery.param( params ); |
3714 | type = "POST"; |
3911 | type = "POST"; |
3715 | }
|
3912 | }
|
3716 | }
|
3913 | }
|
3717 | 3914 | ||
3718 | var self = this; |
- | |
3719 | - | ||
3720 | // Request the remote document
|
3915 | // Request the remote document
|
3721 | jQuery.ajax({ |
3916 | jQuery.ajax({ |
3722 | url: url, |
3917 | url: url, |
3723 | type: type, |
3918 | type: type, |
3724 | dataType: "html", |
3919 | dataType: "html", |
3725 | data: params, |
3920 | data: params, |
- | 3921 | context:this, |
|
3726 | complete: function(res, status){ |
3922 | complete: function(res, status){ |
3727 | // If successful, inject the HTML into all the matched elements
|
3923 | // If successful, inject the HTML into all the matched elements
|
3728 | if ( status === "success" || status === "notmodified" ) { |
3924 | if ( status === "success" || status === "notmodified" ) { |
3729 | // See if a selector was specified
|
3925 | // See if a selector was specified
|
3730 | self.html( selector ? |
3926 | this.html( selector ? |
3731 | // Create a dummy div to hold the results
|
3927 | // Create a dummy div to hold the results
|
3732 | jQuery("<div/>") |
3928 | jQuery("<div />") |
3733 | // inject the contents of the document in, removing the scripts
|
3929 | // inject the contents of the document in, removing the scripts
|
3734 | // to avoid any 'Permission Denied' errors in IE
|
3930 | // to avoid any 'Permission Denied' errors in IE
|
3735 | .append(res.responseText.replace(rscript, "")) |
3931 | .append(res.responseText.replace(rscript, "")) |
Строка 3740... | Строка 3936... | ||
3740 | // If not, just inject the full result
|
3936 | // If not, just inject the full result
|
3741 | res.responseText ); |
3937 | res.responseText ); |
3742 | }
|
3938 | }
|
3743 | 3939 | ||
3744 | if ( callback ) { |
3940 | if ( callback ) { |
3745 | self.each( callback, [res.responseText, status, res] ); |
3941 | this.each( callback, [res.responseText, status, res] ); |
3746 | }
|
3942 | }
|
3747 | }
|
3943 | }
|
3748 | }); |
3944 | }); |
3749 | 3945 | ||
3750 | return this; |
3946 | return this; |
Строка 3784... | Строка 3980... | ||
3784 | }); |
3980 | }); |
3785 | 3981 | ||
3786 | jQuery.extend({ |
3982 | jQuery.extend({ |
3787 | 3983 | ||
3788 | get: function( url, data, callback, type ) { |
3984 | get: function( url, data, callback, type ) { |
3789 | // shift arguments if data argument was ommited
|
3985 | // shift arguments if data argument was omited
|
3790 | if ( jQuery.isFunction( data ) ) { |
3986 | if ( jQuery.isFunction( data ) ) { |
- | 3987 | type = type || callback; |
|
3791 | callback = data; |
3988 | callback = data; |
3792 | data = null; |
3989 | data = null; |
3793 | }
|
3990 | }
|
3794 | 3991 | ||
3795 | return jQuery.ajax({ |
3992 | return jQuery.ajax({ |
Строка 3808... | Строка 4005... | ||
3808 | getJSON: function( url, data, callback ) { |
4005 | getJSON: function( url, data, callback ) { |
3809 | return jQuery.get(url, data, callback, "json"); |
4006 | return jQuery.get(url, data, callback, "json"); |
3810 | }, |
4007 | }, |
3811 | 4008 | ||
3812 | post: function( url, data, callback, type ) { |
4009 | post: function( url, data, callback, type ) { |
- | 4010 | // shift arguments if data argument was omited
|
|
3813 | if ( jQuery.isFunction( data ) ) { |
4011 | if ( jQuery.isFunction( data ) ) { |
- | 4012 | type = type || callback; |
|
3814 | callback = data; |
4013 | callback = data; |
3815 | data = {}; |
4014 | data = {}; |
3816 | }
|
4015 | }
|
3817 | 4016 | ||
3818 | return jQuery.ajax({ |
4017 | return jQuery.ajax({ |
Строка 3867... | Строка 4066... | ||
3867 | // Extend the settings, but re-extend 's' so that it can be
|
4066 | // Extend the settings, but re-extend 's' so that it can be
|
3868 | // checked again later (in the test suite, specifically)
|
4067 | // checked again later (in the test suite, specifically)
|
3869 | s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
4068 | s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
3870 | 4069 | ||
3871 | var jsonp, status, data, |
4070 | var jsonp, status, data, |
- | 4071 | callbackContext = s.context || window, |
|
3872 | type = s.type.toUpperCase(); |
4072 | type = s.type.toUpperCase(); |
3873 | 4073 | ||
3874 | // convert data if not already a string
|
4074 | // convert data if not already a string
|
3875 | if ( s.data && s.processData && typeof s.data !== "string" ) { |
4075 | if ( s.data && s.processData && typeof s.data !== "string" ) { |
3876 | s.data = jQuery.param(s.data); |
4076 | s.data = jQuery.param(s.data); |
Строка 3947... | Строка 4147... | ||
3947 | // If we're requesting a remote document
|
4147 | // If we're requesting a remote document
|
3948 | // and trying to load JSON or Script with a GET
|
4148 | // and trying to load JSON or Script with a GET
|
3949 | if ( s.dataType === "script" && type === "GET" && parts |
4149 | if ( s.dataType === "script" && type === "GET" && parts |
3950 | && ( parts[1] && parts[1] !== location.protocol || parts[2] !== location.host )) { |
4150 | && ( parts[1] && parts[1] !== location.protocol || parts[2] !== location.host )) { |
3951 | 4151 | ||
3952 | var head = document.getElementsByTagName("head")[0]; |
4152 | var head = document.getElementsByTagName("head")[0] || document.documentElement; |
3953 | var script = document.createElement("script"); |
4153 | var script = document.createElement("script"); |
3954 | script.src = s.url; |
4154 | script.src = s.url; |
3955 | if ( s.scriptCharset ) { |
4155 | if ( s.scriptCharset ) { |
3956 | script.charset = s.scriptCharset; |
4156 | script.charset = s.scriptCharset; |
3957 | }
|
4157 | }
|
Строка 4024... | Строка 4224... | ||
4024 | s.accepts[ s.dataType ] + ", */*" : |
4224 | s.accepts[ s.dataType ] + ", */*" : |
4025 | s.accepts._default ); |
4225 | s.accepts._default ); |
4026 | } catch(e){} |
4226 | } catch(e){} |
4027 | 4227 | ||
4028 | // Allow custom headers/mimetypes and early abort
|
4228 | // Allow custom headers/mimetypes and early abort
|
4029 | if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { |
4229 | if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { |
4030 | // Handle the global AJAX counter
|
4230 | // Handle the global AJAX counter
|
4031 | if ( s.global && ! --jQuery.active ) { |
4231 | if ( s.global && ! --jQuery.active ) { |
4032 | jQuery.event.trigger( "ajaxStop" ); |
4232 | jQuery.event.trigger( "ajaxStop" ); |
4033 | }
|
4233 | }
|
4034 | 4234 | ||
Строка 4036... | Строка 4236... | ||
4036 | xhr.abort(); |
4236 | xhr.abort(); |
4037 | return false; |
4237 | return false; |
4038 | }
|
4238 | }
|
4039 | 4239 | ||
4040 | if ( s.global ) { |
4240 | if ( s.global ) { |
4041 | jQuery.event.trigger("ajaxSend", [xhr, s]); |
4241 | trigger("ajaxSend", [xhr, s]); |
4042 | }
|
4242 | }
|
4043 | 4243 | ||
4044 | // Wait for a response to come back
|
4244 | // Wait for a response to come back
|
4045 | var onreadystatechange = function(isTimeout){ |
4245 | var onreadystatechange = function(isTimeout){ |
4046 | // The request was aborted, clear the interval and decrement jQuery.active
|
4246 | // The request was aborted, clear the interval and decrement jQuery.active
|
4047 | if ( xhr.readyState === 0 ) { |
4247 | if ( !xhr || xhr.readyState === 0 ) { |
4048 | if ( ival ) { |
4248 | if ( ival ) { |
4049 | // clear poll interval
|
4249 | // clear poll interval
|
4050 | clearInterval( ival ); |
4250 | clearInterval( ival ); |
4051 | ival = null; |
4251 | ival = null; |
4052 | 4252 | ||
Строка 4136... | Строка 4336... | ||
4136 | }
|
4336 | }
|
4137 | 4337 | ||
4138 | function success(){ |
4338 | function success(){ |
4139 | // If a local callback was specified, fire it and pass it the data
|
4339 | // If a local callback was specified, fire it and pass it the data
|
4140 | if ( s.success ) { |
4340 | if ( s.success ) { |
4141 | s.success( data, status ); |
4341 | s.success.call( callbackContext, data, status ); |
4142 | }
|
4342 | }
|
4143 | 4343 | ||
4144 | // Fire the global callback
|
4344 | // Fire the global callback
|
4145 | if ( s.global ) { |
4345 | if ( s.global ) { |
4146 | jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); |
4346 | trigger( "ajaxSuccess", [xhr, s] ); |
4147 | }
|
4347 | }
|
4148 | }
|
4348 | }
|
4149 | 4349 | ||
4150 | function complete(){ |
4350 | function complete(){ |
4151 | // Process result
|
4351 | // Process result
|
4152 | if ( s.complete ) { |
4352 | if ( s.complete ) { |
4153 | s.complete(xhr, status); |
4353 | s.complete.call( callbackContext, xhr, status); |
4154 | }
|
4354 | }
|
4155 | 4355 | ||
4156 | // The request was completed
|
4356 | // The request was completed
|
4157 | if ( s.global ) { |
4357 | if ( s.global ) { |
4158 | jQuery.event.trigger( "ajaxComplete", [xhr, s] ); |
4358 | trigger( "ajaxComplete", [xhr, s] ); |
4159 | }
|
4359 | }
|
4160 | 4360 | ||
4161 | // Handle the global AJAX counter
|
4361 | // Handle the global AJAX counter
|
4162 | if ( s.global && ! --jQuery.active ) { |
4362 | if ( s.global && ! --jQuery.active ) { |
4163 | jQuery.event.trigger( "ajaxStop" ); |
4363 | jQuery.event.trigger( "ajaxStop" ); |
4164 | }
|
4364 | }
|
4165 | }
|
4365 | }
|
4166 | 4366 | ||
- | 4367 | function trigger(type, args){ |
|
- | 4368 | (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); |
|
- | 4369 | }
|
|
- | 4370 | ||
4167 | // return XMLHttpRequest to allow aborting the request etc.
|
4371 | // return XMLHttpRequest to allow aborting the request etc.
|
4168 | return xhr; |
4372 | return xhr; |
4169 | }, |
4373 | }, |
4170 | 4374 | ||
4171 | handleError: function( s, xhr, status, e ) { |
4375 | handleError: function( s, xhr, status, e ) { |
4172 | // If a local callback was specified, fire it
|
4376 | // If a local callback was specified, fire it
|
4173 | if ( s.error ) { |
4377 | if ( s.error ) { |
4174 | s.error( xhr, status, e ); |
4378 | s.error.call( s.context || window, xhr, status, e ); |
4175 | }
|
4379 | }
|
4176 | 4380 | ||
4177 | // Fire the global callback
|
4381 | // Fire the global callback
|
4178 | if ( s.global ) { |
4382 | if ( s.global ) { |
4179 | jQuery.event.trigger( "ajaxError", [xhr, s, e] ); |
4383 | (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] ); |
4180 | }
|
4384 | }
|
4181 | }, |
4385 | }, |
4182 | 4386 | ||
4183 | // Counter for holding the number of active queries
|
4387 | // Counter for holding the number of active queries
|
4184 | active: 0, |
4388 | active: 0, |
Строка 4196... | Строка 4400... | ||
4196 | return false; |
4400 | return false; |
4197 | }, |
4401 | }, |
4198 | 4402 | ||
4199 | // Determines if an XMLHttpRequest returns NotModified
|
4403 | // Determines if an XMLHttpRequest returns NotModified
|
4200 | httpNotModified: function( xhr, url ) { |
4404 | httpNotModified: function( xhr, url ) { |
4201 | var last_modified = xhr.getResponseHeader("Last-Modified"), |
4405 | var lastModified = xhr.getResponseHeader("Last-Modified"), |
4202 | etag = xhr.getResponseHeader("Etag"); |
4406 | etag = xhr.getResponseHeader("Etag"); |
4203 | 4407 | ||
4204 | if ( last_modified ) { |
4408 | if ( lastModified ) { |
4205 | jQuery.lastModified[url] = last_modified; |
4409 | jQuery.lastModified[url] = lastModified; |
4206 | }
|
4410 | }
|
4207 | 4411 | ||
4208 | if ( etag ) { |
4412 | if ( etag ) { |
4209 | jQuery.etag[url] = etag; |
4413 | jQuery.etag[url] = etag; |
4210 | }
|
4414 | }
|
Строка 4250... | Строка 4454... | ||
4250 | }, |
4454 | }, |
4251 | 4455 | ||
4252 | // Serialize an array of form elements or a set of
|
4456 | // Serialize an array of form elements or a set of
|
4253 | // key/values into a query string
|
4457 | // key/values into a query string
|
4254 | param: function( a ) { |
4458 | param: function( a ) { |
4255 | var s = []; |
4459 | var s = [], |
- | 4460 | param_traditional = jQuery.param.traditional; |
|
4256 | 4461 | ||
4257 | function add( key, value ){ |
4462 | function add( key, value ){ |
- | 4463 | // If value is a function, invoke it and return its value
|
|
- | 4464 | value = jQuery.isFunction(value) ? value() : value; |
|
4258 | s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); |
4465 | s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); |
4259 | }
|
4466 | }
|
4260 | 4467 | ||
4261 | // If an array was passed in, assume that it is an array
|
4468 | // If an array was passed in, assume that it is an array
|
4262 | // of form elements
|
4469 | // of form elements
|
4263 | if ( jQuery.isArray(a) || a.jquery ) { |
4470 | if ( jQuery.isArray(a) || a.jquery ) |
4264 | // Serialize the form elements
|
4471 | // Serialize the form elements
|
4265 | jQuery.each( a, function(){ |
4472 | jQuery.each( a, function() { |
4266 | add( this.name, this.value ); |
4473 | add( this.name, this.value ); |
4267 | }); |
4474 | }); |
4268 | 4475 | ||
4269 | // Otherwise, assume that it's an object of key/value pairs
|
- | |
4270 | } else { |
4476 | else
|
4271 | // Serialize the key/values
|
4477 | // Encode parameters from object, recursively. If
|
- | 4478 | // jQuery.param.traditional is set, encode the "old" way
|
|
4272 | for ( var j in a ) { |
4479 | // (the way 1.3.2 or older did it)
|
4273 | // If the value is an array then the key names need to be repeated
|
4480 | jQuery.each( a, function buildParams( prefix, obj ) { |
- | 4481 | ||
4274 | if ( jQuery.isArray(a[j]) ) { |
4482 | if ( jQuery.isArray(obj) ) |
4275 | jQuery.each( a[j], function(){ |
4483 | jQuery.each( obj, function(i,v){ |
- | 4484 | // Due to rails' limited request param syntax, numeric array
|
|
- | 4485 | // indices are not supported. To avoid serialization ambiguity
|
|
- | 4486 | // issues, serialized arrays can only contain scalar values. php
|
|
- | 4487 | // does not have this issue, but we should go with the lowest
|
|
- | 4488 | // common denominator
|
|
- | 4489 | add( prefix + ( param_traditional ? "" : "[]" ), v ); |
|
- | 4490 | }); |
|
- | 4491 | ||
- | 4492 | else if ( typeof obj == "object" ) |
|
- | 4493 | if ( param_traditional ) |
|
4276 | add( j, this ); |
4494 | add( prefix, obj ); |
- | 4495 | ||
- | 4496 | else
|
|
- | 4497 | jQuery.each( obj, function(k,v){ |
|
- | 4498 | buildParams( prefix ? prefix + "[" + k + "]" : k, v ); |
|
- | 4499 | }); |
|
- | 4500 | ||
- | 4501 | else
|
|
- | 4502 | add( prefix, obj ); |
|
- | 4503 | ||
4277 | }); |
4504 | }); |
4278 | } else { |
- | |
4279 | add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); |
- | |
4280 | }
|
- | |
4281 | }
|
- | |
4282 | }
|
- | |
4283 | 4505 | ||
4284 | // Return the resulting serialization
|
4506 | // Return the resulting serialization
|
4285 | return s.join("&").replace(r20, "+"); |
4507 | return s.join("&").replace(r20, "+"); |
4286 | }
|
4508 | }
|
4287 | 4509 | ||
Строка 4305... | Строка 4527... | ||
4305 | return obj; |
4527 | return obj; |
4306 | }
|
4528 | }
|
4307 | 4529 | ||
4308 | jQuery.fn.extend({ |
4530 | jQuery.fn.extend({ |
4309 | show: function(speed,callback){ |
4531 | show: function(speed,callback){ |
4310 | if ( speed ) { |
4532 | if ( speed !== undefined ) { |
4311 | return this.animate( genFx("show", 3), speed, callback); |
4533 | return this.animate( genFx("show", 3), speed, callback); |
4312 | } else { |
4534 | } else { |
4313 | for ( var i = 0, l = this.length; i < l; i++ ){ |
4535 | for ( var i = 0, l = this.length; i < l; i++ ){ |
4314 | var old = jQuery.data(this[i], "olddisplay"); |
4536 | var old = jQuery.data(this[i], "olddisplay"); |
4315 | 4537 | ||
Строка 4345... | Строка 4567... | ||
4345 | return this; |
4567 | return this; |
4346 | }
|
4568 | }
|
4347 | }, |
4569 | }, |
4348 | 4570 | ||
4349 | hide: function(speed,callback){ |
4571 | hide: function(speed,callback){ |
4350 | if ( speed ) { |
4572 | if ( speed !== undefined ) { |
4351 | return this.animate( genFx("hide", 3), speed, callback); |
4573 | return this.animate( genFx("hide", 3), speed, callback); |
4352 | } else { |
4574 | } else { |
4353 | for ( var i = 0, l = this.length; i < l; i++ ){ |
4575 | for ( var i = 0, l = this.length; i < l; i++ ){ |
4354 | var old = jQuery.data(this[i], "olddisplay"); |
4576 | var old = jQuery.data(this[i], "olddisplay"); |
4355 | if ( !old && old !== "none" ) |
4577 | if ( !old && old !== "none" ) |
Строка 4707... | Строка 4929... | ||
4707 | fx.elem[ fx.prop ] = fx.now; |
4929 | fx.elem[ fx.prop ] = fx.now; |
4708 | }
|
4930 | }
|
4709 | }
|
4931 | }
|
4710 | }); |
4932 | }); |
4711 | if ( "getBoundingClientRect" in document.documentElement ) { |
4933 | if ( "getBoundingClientRect" in document.documentElement ) { |
4712 | jQuery.fn.offset = function() { |
4934 | jQuery.fn.offset = function( options ) { |
4713 | var elem = this[0]; |
4935 | var elem = this[0]; |
4714 | if ( !elem || !elem.ownerDocument ) { return null; } |
4936 | if ( !elem || !elem.ownerDocument ) { return null; } |
- | 4937 | if ( options ) { |
|
- | 4938 | return this.each(function() { |
|
- | 4939 | jQuery.offset.setOffset( this, options ); |
|
- | 4940 | }); |
|
- | 4941 | }
|
|
4715 | if ( elem === elem.ownerDocument.body ) { |
4942 | if ( elem === elem.ownerDocument.body ) { |
4716 | return jQuery.offset.bodyOffset( elem ); |
4943 | return jQuery.offset.bodyOffset( elem ); |
4717 | }
|
4944 | }
|
4718 | 4945 | ||
4719 | var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, |
4946 | var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, |
Строка 4721... | Строка 4948... | ||
4721 | top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
4948 | top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
4722 | left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
4949 | left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
4723 | return { top: top, left: left }; |
4950 | return { top: top, left: left }; |
4724 | }; |
4951 | }; |
4725 | } else { |
4952 | } else { |
4726 | jQuery.fn.offset = function() { |
4953 | jQuery.fn.offset = function( options ) { |
4727 | var elem = this[0]; |
4954 | var elem = this[0]; |
4728 | if ( !elem || !elem.ownerDocument ) { return null; } |
4955 | if ( !elem || !elem.ownerDocument ) { return null; } |
- | 4956 | if ( options ) { |
|
- | 4957 | return this.each(function() { |
|
- | 4958 | jQuery.offset.setOffset( this, options ); |
|
- | 4959 | }); |
|
- | 4960 | }
|
|
4729 | if ( elem === elem.ownerDocument.body ) { |
4961 | if ( elem === elem.ownerDocument.body ) { |
4730 | return jQuery.offset.bodyOffset( elem ); |
4962 | return jQuery.offset.bodyOffset( elem ); |
4731 | }
|
4963 | }
|
4732 | 4964 | ||
4733 | jQuery.offset.initialize(); |
4965 | jQuery.offset.initialize(); |
Строка 4819... | Строка 5051... | ||
4819 | top += parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0; |
5051 | top += parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0; |
4820 | left += parseFloat( jQuery.curCSS(body, 'marginLeft', true) ) || 0; |
5052 | left += parseFloat( jQuery.curCSS(body, 'marginLeft', true) ) || 0; |
4821 | }
|
5053 | }
|
4822 | 5054 | ||
4823 | return { top: top, left: left }; |
5055 | return { top: top, left: left }; |
- | 5056 | }, |
|
- | 5057 | ||
- | 5058 | setOffset: function( elem, options ) { |
|
- | 5059 | // set position first, in-case top/left are set even on static elem
|
|
- | 5060 | if ( /static/.test( jQuery.curCSS( elem, 'position' ) ) ) { |
|
- | 5061 | elem.style.position = 'relative'; |
|
- | 5062 | }
|
|
- | 5063 | var curElem = jQuery( elem ), |
|
- | 5064 | curOffset = curElem.offset(), |
|
- | 5065 | curTop = parseInt( jQuery.curCSS( elem, 'top', true ), 10 ) || 0, |
|
- | 5066 | curLeft = parseInt( jQuery.curCSS( elem, 'left', true ), 10) || 0, |
|
- | 5067 | props = { |
|
- | 5068 | top: (options.top - curOffset.top) + curTop, |
|
- | 5069 | left: (options.left - curOffset.left) + curLeft |
|
- | 5070 | }; |
|
- | 5071 | ||
- | 5072 | if ( 'using' in options ) { |
|
- | 5073 | options.using.call( elem, props ); |
|
- | 5074 | } else { |
|
- | 5075 | curElem.css( props ); |
|
- | 5076 | }
|
|
4824 | }
|
5077 | }
|
4825 | }; |
5078 | }; |
4826 | 5079 | ||
4827 | 5080 | ||
4828 | jQuery.fn.extend({ |
5081 | jQuery.fn.extend({ |
Строка 4952... | Строка 5205... | ||
4952 | // Set the width or height on the element (default to pixels if value is unitless)
|
5205 | // Set the width or height on the element (default to pixels if value is unitless)
|
4953 | this.css( type, typeof size === "string" ? size : size + "px" ); |
5206 | this.css( type, typeof size === "string" ? size : size + "px" ); |
4954 | }; |
5207 | }; |
4955 | 5208 | ||
4956 | }); |
5209 | }); |
- | 5210 | // Expose jQuery to the global object
|
|
- | 5211 | window.jQuery = window.$ = jQuery; |
|
- | 5212 | ||
4957 | })(window); |
5213 | })(window); |