Changeset 18630
- Timestamp:
- Oct 12, 2012, 10:32:30 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 27 added
- 29 deleted
- 104 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/plugins_new.tpl
r11222 r18630 1 1 {combine_script id='jquery.sort' load='footer' path='themes/default/js/plugins/jquery.sort.js'} 2 2 3 {footer_script require='jquery. effects.blind,jquery.sort'}{literal}3 {footer_script require='jquery.ui.effect-blind,jquery.sort'}{literal} 4 4 var sortOrder = 'date'; 5 5 var sortPlugins = (function(a, b) { -
trunk/admin/themes/default/template/updates_ext.tpl
r12427 r18630 3 3 {combine_css path="admin/themes/default/uploadify.jGrowl.css"} 4 4 5 {footer_script require='jquery. effects.blind,jquery.ajaxmanager,jquery.jgrowl'}5 {footer_script require='jquery.ui.effect-blind,jquery.ajaxmanager,jquery.jgrowl'} 6 6 var pwg_token = '{$PWG_TOKEN}'; 7 7 var extType = '{$EXT_TYPE}'; -
trunk/include/template.class.php
r17675 r18630 543 543 $minw=null; 544 544 $minh=null; 545 545 546 546 if (isset($params['crop'])) 547 547 { … … 937 937 'jquery' => 'themes/default/js/jquery.min.js', 938 938 'jquery.ui' => 'themes/default/js/ui/minified/jquery.ui.core.min.js', 939 'jquery. effects' => 'themes/default/js/ui/minified/jquery.effects.core.min.js',939 'jquery.ui.effect' => 'themes/default/js/ui/minified/jquery.ui.effect.min.js', 940 940 ); 941 941 … … 1154 1154 $required_ids = array('jquery'); 1155 1155 1156 if ( strncmp($id, 'jquery.ui.', 10)==0 ) 1156 if ( strncmp($id, 'jquery.ui.effect-', 17)==0 ) 1157 { 1158 $required_ids = array('jquery', 'jquery.ui.effect'); 1159 1160 if ( empty($script->path) ) 1161 $script->path = dirname(self::$known_paths['jquery.ui.effect'])."/$id.min.js"; 1162 } 1163 elseif ( strncmp($id, 'jquery.ui.', 10)==0 ) 1157 1164 { 1158 1165 if ( !isset(self::$ui_core_dependencies[$id]) ) … … 1162 1169 $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js"; 1163 1170 } 1164 elseif ( strncmp($id, 'jquery.effects.', 15)==0 )1165 {1166 $required_ids = array('jquery', 'jquery.effects');1167 1168 if ( empty($script->path) )1169 $script->path = dirname(self::$known_paths['jquery.effects'])."/$id.min.js";1170 }1171 1171 1172 1172 foreach ($required_ids as $required_id) … … 1180 1180 private function load_known_required_script($id, $load_mode) 1181 1181 { 1182 if ( isset(self::$known_paths[$id]) or strncmp($id, 'jquery.ui.', 10)==0 or strncmp($id, 'jquery.effects.', 15)==0)1182 if ( isset(self::$known_paths[$id]) or strncmp($id, 'jquery.ui.', 10)==0 ) 1183 1183 { 1184 1184 $this->add($id, $load_mode, array(), null); -
trunk/themes/default/js/jquery.js
r14027 r18630 1 1 /*! 2 * jQuery JavaScript Library v1. 7.22 * jQuery JavaScript Library v1.8.2 3 3 * http://jquery.com/ 4 *5 * Copyright 2011, John Resig6 * Dual licensed under the MIT or GPL Version 2 licenses.7 * http://jquery.org/license8 4 * 9 5 * Includes Sizzle.js 10 6 * http://sizzlejs.com/ 11 * Copyright 2011, The Dojo Foundation12 * Released under the MIT, BSD, and GPL Licenses.13 7 * 14 * Date: Wed Mar 21 12:46:34 2012 -0700 8 * Copyright 2012 jQuery Foundation and other contributors 9 * Released under the MIT license 10 * http://jquery.org/license 11 * 12 * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time) 15 13 */ 16 14 (function( window, undefined ) { 17 18 // Use the correct document accordingly with window argument (sandbox) 19 var document = window.document, 15 var 16 // A central reference to the root jQuery(document) 17 rootjQuery, 18 19 // The deferred used on DOM ready 20 readyList, 21 22 // Use the correct document accordingly with window argument (sandbox) 23 document = window.document, 24 location = window.location, 20 25 navigator = window.navigator, 21 location = window.location; 22 var jQuery = (function() { 23 24 // Define a local copy of jQuery 25 var jQuery = function( selector, context ) { 26 27 // Map over jQuery in case of overwrite 28 _jQuery = window.jQuery, 29 30 // Map over the $ in case of overwrite 31 _$ = window.$, 32 33 // Save a reference to some core methods 34 core_push = Array.prototype.push, 35 core_slice = Array.prototype.slice, 36 core_indexOf = Array.prototype.indexOf, 37 core_toString = Object.prototype.toString, 38 core_hasOwn = Object.prototype.hasOwnProperty, 39 core_trim = String.prototype.trim, 40 41 // Define a local copy of jQuery 42 jQuery = function( selector, context ) { 26 43 // The jQuery object is actually just the init constructor 'enhanced' 27 44 return new jQuery.fn.init( selector, context, rootjQuery ); 28 45 }, 29 46 30 // Map over jQuery in case of overwrite 31 _jQuery = window.jQuery, 32 33 // Map over the $ in case of overwrite 34 _$ = window.$, 35 36 // A central reference to the root jQuery(document) 37 rootjQuery, 38 39 // A simple way to check for HTML strings or ID strings 47 // Used for matching numbers 48 core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, 49 50 // Used for detecting and trimming whitespace 51 core_rnotwhite = /\S/, 52 core_rspace = /\s+/, 53 54 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) 55 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 56 57 // A simple way to check for HTML strings 40 58 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 41 quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 42 43 // Check if a string has a non-whitespace character in it 44 rnotwhite = /\S/, 45 46 // Used for trimming whitespace 47 trimLeft = /^\s+/, 48 trimRight = /\s+$/, 59 rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, 49 60 50 61 // Match a standalone tag 51 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1> )?$/,62 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, 52 63 53 64 // JSON RegExp 54 65 rvalidchars = /^[\],:{}\s]*$/, 55 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,56 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,57 66 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 58 59 // Useragent RegExp 60 rwebkit = /(webkit)[ \/]([\w.]+)/, 61 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 62 rmsie = /(msie) ([\w.]+)/, 63 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 67 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, 68 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, 64 69 65 70 // Matches dashed string for camelizing 66 rdashAlpha = /-([a-z]|[0-9])/ig,67 71 rmsPrefix = /^-ms-/, 72 rdashAlpha = /-([\da-z])/gi, 68 73 69 74 // Used by jQuery.camelCase as callback to replace() … … 72 77 }, 73 78 74 // Keep a UserAgent string for use with jQuery.browser 75 userAgent = navigator.userAgent, 76 77 // For matching the engine and version of the browser 78 browserMatch, 79 80 // The deferred used on DOM ready 81 readyList, 82 83 // The ready event handler 84 DOMContentLoaded, 85 86 // Save a reference to some core methods 87 toString = Object.prototype.toString, 88 hasOwn = Object.prototype.hasOwnProperty, 89 push = Array.prototype.push, 90 slice = Array.prototype.slice, 91 trim = String.prototype.trim, 92 indexOf = Array.prototype.indexOf, 79 // The ready event handler and self cleanup method 80 DOMContentLoaded = function() { 81 if ( document.addEventListener ) { 82 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 83 jQuery.ready(); 84 } else if ( document.readyState === "complete" ) { 85 // we're here because readyState === "complete" in oldIE 86 // which is good enough for us to call the dom ready! 87 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 88 jQuery.ready(); 89 } 90 }, 93 91 94 92 // [[Class]] -> type pairs … … 100 98 var match, elem, ret, doc; 101 99 102 // Handle $(""), $(null), or $(undefined)100 // Handle $(""), $(null), $(undefined), $(false) 103 101 if ( !selector ) { 104 102 return this; … … 112 110 } 113 111 114 // The body element only exists once, optimize finding it115 if ( selector === "body" && !context && document.body ) {116 this.context = document;117 this[0] = document.body;118 this.selector = selector;119 this.length = 1;120 return this;121 }122 123 112 // Handle HTML strings 124 113 if ( typeof selector === "string" ) { 125 // Are we dealing with HTML string or an ID?126 114 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { 127 115 // Assume that strings that start and end with <> are HTML and skip the regex check … … 129 117 130 118 } else { 131 match = quickExpr.exec( selector );132 } 133 134 // Verify a match, and that no context was specified for #id119 match = rquickExpr.exec( selector ); 120 } 121 122 // Match html or make sure no context is specified for #id 135 123 if ( match && (match[1] || !context) ) { 136 124 … … 138 126 if ( match[1] ) { 139 127 context = context instanceof jQuery ? context[0] : context; 140 doc = ( context ? context.ownerDocument || context : document ); 141 142 // If a single string is passed in and it's a single tag 143 // just do a createElement and skip the rest 144 ret = rsingleTag.exec( selector ); 145 146 if ( ret ) { 147 if ( jQuery.isPlainObject( context ) ) { 148 selector = [ document.createElement( ret[1] ) ]; 149 jQuery.fn.attr.call( selector, context, true ); 150 151 } else { 152 selector = [ doc.createElement( ret[1] ) ]; 153 } 154 155 } else { 156 ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); 157 selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; 128 doc = ( context && context.nodeType ? context.ownerDocument || context : document ); 129 130 // scripts is true for back-compat 131 selector = jQuery.parseHTML( match[1], doc, true ); 132 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { 133 this.attr.call( selector, context, true ); 158 134 } 159 135 160 136 return jQuery.merge( this, selector ); 161 137 162 // HANDLE: $( "#id")138 // HANDLE: $(#id) 163 139 } else { 164 140 elem = document.getElementById( match[2] ); … … 211 187 212 188 // The current version of jQuery being used 213 jquery: "1. 7.2",189 jquery: "1.8.2", 214 190 215 191 // The default length of a jQuery object is 0 … … 222 198 223 199 toArray: function() { 224 return slice.call( this, 0);200 return core_slice.call( this ); 225 201 }, 226 202 … … 240 216 // (returning the new matched element set) 241 217 pushStack: function( elems, name, selector ) { 218 242 219 // Build a new jQuery matched element set 243 var ret = this.constructor(); 244 245 if ( jQuery.isArray( elems ) ) { 246 push.apply( ret, elems ); 247 248 } else { 249 jQuery.merge( ret, elems ); 250 } 220 var ret = jQuery.merge( this.constructor(), elems ); 251 221 252 222 // Add the old object onto the stack (as a reference) … … 273 243 274 244 ready: function( fn ) { 275 // Attach the listeners276 jQuery.bindReady();277 278 245 // Add the callback 279 readyList.add( fn );246 jQuery.ready.promise().done( fn ); 280 247 281 248 return this; … … 298 265 299 266 slice: function() { 300 return this.pushStack( slice.apply( this, arguments ),301 "slice", slice.call(arguments).join(",") );267 return this.pushStack( core_slice.apply( this, arguments ), 268 "slice", core_slice.call(arguments).join(",") ); 302 269 }, 303 270 … … 314 281 // For internal use only. 315 282 // Behaves like an Array's method, not like a jQuery method. 316 push: push,283 push: core_push, 317 284 sort: [].sort, 318 285 splice: [].splice … … 417 384 // Handle when the DOM is ready 418 385 ready: function( wait ) { 419 // Either a released hold or an DOMready/load event and not yet ready 420 if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { 421 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 422 if ( !document.body ) { 423 return setTimeout( jQuery.ready, 1 ); 424 } 425 426 // Remember that the DOM is ready 427 jQuery.isReady = true; 428 429 // If a normal DOM Ready event fired, decrement, and wait if need be 430 if ( wait !== true && --jQuery.readyWait > 0 ) { 431 return; 432 } 433 434 // If there are functions bound, to execute 435 readyList.fireWith( document, [ jQuery ] ); 436 437 // Trigger any bound ready events 438 if ( jQuery.fn.trigger ) { 439 jQuery( document ).trigger( "ready" ).off( "ready" ); 440 } 441 } 442 }, 443 444 bindReady: function() { 445 if ( readyList ) { 386 387 // Abort if there are pending holds or we're already ready 388 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 446 389 return; 447 390 } 448 391 449 readyList = jQuery.Callbacks( "once memory" ); 450 451 // Catch cases where $(document).ready() is called after the 452 // browser event has already occurred. 453 if ( document.readyState === "complete" ) { 454 // Handle it asynchronously to allow scripts the opportunity to delay ready 392 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 393 if ( !document.body ) { 455 394 return setTimeout( jQuery.ready, 1 ); 456 395 } 457 396 458 // Mozilla, Opera and webkit nightlies currently support this event 459 if ( document.addEventListener ) { 460 // Use the handy event callback 461 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 462 463 // A fallback to window.onload, that will always work 464 window.addEventListener( "load", jQuery.ready, false ); 465 466 // If IE event model is used 467 } else if ( document.attachEvent ) { 468 // ensure firing before onload, 469 // maybe late but safe also for iframes 470 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 471 472 // A fallback to window.onload, that will always work 473 window.attachEvent( "onload", jQuery.ready ); 474 475 // If IE and not a frame 476 // continually check to see if the document is ready 477 var toplevel = false; 478 479 try { 480 toplevel = window.frameElement == null; 481 } catch(e) {} 482 483 if ( document.documentElement.doScroll && toplevel ) { 484 doScrollCheck(); 485 } 397 // Remember that the DOM is ready 398 jQuery.isReady = true; 399 400 // If a normal DOM Ready event fired, decrement, and wait if need be 401 if ( wait !== true && --jQuery.readyWait > 0 ) { 402 return; 403 } 404 405 // If there are functions bound, to execute 406 readyList.resolveWith( document, [ jQuery ] ); 407 408 // Trigger any bound ready events 409 if ( jQuery.fn.trigger ) { 410 jQuery( document ).trigger("ready").off("ready"); 486 411 } 487 412 }, … … 509 434 return obj == null ? 510 435 String( obj ) : 511 class2type[ toString.call(obj) ] || "object";436 class2type[ core_toString.call(obj) ] || "object"; 512 437 }, 513 438 … … 523 448 // Not own constructor property must be Object 524 449 if ( obj.constructor && 525 ! hasOwn.call(obj, "constructor") &&526 ! hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {450 !core_hasOwn.call(obj, "constructor") && 451 !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 527 452 return false; 528 453 } … … 538 463 for ( key in obj ) {} 539 464 540 return key === undefined || hasOwn.call( obj, key );465 return key === undefined || core_hasOwn.call( obj, key ); 541 466 }, 542 467 543 468 isEmptyObject: function( obj ) { 544 for ( var name in obj ) { 469 var name; 470 for ( name in obj ) { 545 471 return false; 546 472 } … … 552 478 }, 553 479 480 // data: string of html 481 // context (optional): If specified, the fragment will be created in this context, defaults to document 482 // scripts (optional): If true, will include scripts passed in the html string 483 parseHTML: function( data, context, scripts ) { 484 var parsed; 485 if ( !data || typeof data !== "string" ) { 486 return null; 487 } 488 if ( typeof context === "boolean" ) { 489 scripts = context; 490 context = 0; 491 } 492 context = context || document; 493 494 // Single tag 495 if ( (parsed = rsingleTag.exec( data )) ) { 496 return [ context.createElement( parsed[1] ) ]; 497 } 498 499 parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); 500 return jQuery.merge( [], 501 (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); 502 }, 503 554 504 parseJSON: function( data ) { 555 if ( typeof data !== "string" || !data) {505 if ( !data || typeof data !== "string") { 556 506 return null; 557 507 } … … 579 529 // Cross-browser xml parsing 580 530 parseXML: function( data ) { 581 if ( typeof data !== "string" || !data ) { 531 var xml, tmp; 532 if ( !data || typeof data !== "string" ) { 582 533 return null; 583 534 } 584 var xml, tmp;585 535 try { 586 536 if ( window.DOMParser ) { // Standard … … 607 557 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 608 558 globalEval: function( data ) { 609 if ( data && rnotwhite.test( data ) ) {559 if ( data && core_rnotwhite.test( data ) ) { 610 560 // We use execScript on Internet Explorer 611 561 // We use an anonymous function so that context is window … … 624 574 625 575 nodeName: function( elem, name ) { 626 return elem.nodeName && elem.nodeName.to UpperCase() === name.toUpperCase();576 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 627 577 }, 628 578 629 579 // args is for internal usage only 630 each: function( object, callback, args ) { 631 var name, i = 0, 632 length = object.length, 633 isObj = length === undefined || jQuery.isFunction( object ); 580 each: function( obj, callback, args ) { 581 var name, 582 i = 0, 583 length = obj.length, 584 isObj = length === undefined || jQuery.isFunction( obj ); 634 585 635 586 if ( args ) { 636 587 if ( isObj ) { 637 for ( name in obj ect) {638 if ( callback.apply( obj ect[ name ], args ) === false ) {588 for ( name in obj ) { 589 if ( callback.apply( obj[ name ], args ) === false ) { 639 590 break; 640 591 } … … 642 593 } else { 643 594 for ( ; i < length; ) { 644 if ( callback.apply( obj ect[ i++ ], args ) === false ) {595 if ( callback.apply( obj[ i++ ], args ) === false ) { 645 596 break; 646 597 } … … 651 602 } else { 652 603 if ( isObj ) { 653 for ( name in obj ect) {654 if ( callback.call( obj ect[ name ], name, object[ name ] ) === false ) {604 for ( name in obj ) { 605 if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { 655 606 break; 656 607 } … … 658 609 } else { 659 610 for ( ; i < length; ) { 660 if ( callback.call( obj ect[ i ], i, object[ i++ ] ) === false ) {611 if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { 661 612 break; 662 613 } … … 665 616 } 666 617 667 return obj ect;618 return obj; 668 619 }, 669 620 670 621 // Use native String.trim function wherever possible 671 trim: trim?622 trim: core_trim && !core_trim.call("\uFEFF\xA0") ? 672 623 function( text ) { 673 624 return text == null ? 674 625 "" : 675 trim.call( text );626 core_trim.call( text ); 676 627 } : 677 628 … … 680 631 return text == null ? 681 632 "" : 682 text.toString().replace( trimLeft, "" ).replace( trimRight, "" );633 ( text + "" ).replace( rtrim, "" ); 683 634 }, 684 635 685 636 // results is for internal usage only 686 makeArray: function( array, results ) { 687 var ret = results || []; 688 689 if ( array != null ) { 637 makeArray: function( arr, results ) { 638 var type, 639 ret = results || []; 640 641 if ( arr != null ) { 690 642 // The window, strings (and functions) also have 'length' 691 643 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 692 var type = jQuery.type( array);693 694 if ( arr ay.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array) ) {695 push.call( ret, array);644 type = jQuery.type( arr ); 645 646 if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { 647 core_push.call( ret, arr ); 696 648 } else { 697 jQuery.merge( ret, arr ay);649 jQuery.merge( ret, arr ); 698 650 } 699 651 } … … 702 654 }, 703 655 704 inArray: function( elem, arr ay, i ) {656 inArray: function( elem, arr, i ) { 705 657 var len; 706 658 707 if ( arr ay) {708 if ( indexOf ) {709 return indexOf.call( array, elem, i );710 } 711 712 len = arr ay.length;659 if ( arr ) { 660 if ( core_indexOf ) { 661 return core_indexOf.call( arr, elem, i ); 662 } 663 664 len = arr.length; 713 665 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 714 666 715 667 for ( ; i < len; i++ ) { 716 668 // Skip accessing in sparse arrays 717 if ( i in arr ay && array[ i ] === elem ) {669 if ( i in arr && arr[ i ] === elem ) { 718 670 return i; 719 671 } … … 725 677 726 678 merge: function( first, second ) { 727 var i = first.length, 679 var l = second.length, 680 i = first.length, 728 681 j = 0; 729 682 730 if ( typeof second.length=== "number" ) {731 for ( var l = second.length; j < l; j++ ) {683 if ( typeof l === "number" ) { 684 for ( ; j < l; j++ ) { 732 685 first[ i++ ] = second[ j ]; 733 686 } … … 745 698 746 699 grep: function( elems, callback, inv ) { 747 var ret = [], retVal; 700 var retVal, 701 ret = [], 702 i = 0, 703 length = elems.length; 748 704 inv = !!inv; 749 705 750 706 // Go through the array, only saving the items 751 707 // that pass the validator function 752 for ( var i = 0, length = elems.length; i < length; i++ ) {708 for ( ; i < length; i++ ) { 753 709 retVal = !!callback( elems[ i ], i ); 754 710 if ( inv !== retVal ) { … … 762 718 // arg is for internal usage only 763 719 map: function( elems, callback, arg ) { 764 var value, key, ret = [], 720 var value, key, 721 ret = [], 765 722 i = 0, 766 723 length = elems.length, … … 799 756 // arguments. 800 757 proxy: function( fn, context ) { 758 var tmp, args, proxy; 759 801 760 if ( typeof context === "string" ) { 802 vartmp = fn[ context ];761 tmp = fn[ context ]; 803 762 context = fn; 804 763 fn = tmp; … … 812 771 813 772 // Simulated bind 814 var args = slice.call( arguments, 2 ),815 816 return fn.apply( context, args.concat(slice.call( arguments ) ) );817 773 args = core_slice.call( arguments, 2 ); 774 proxy = function() { 775 return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); 776 }; 818 777 819 778 // Set the guid of unique handler to the same of original handler, so it can be removed 820 proxy.guid = fn.guid = fn.guid || proxy.guid ||jQuery.guid++;779 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 821 780 822 781 return proxy; 823 782 }, 824 783 825 // Mu tifunctional method to get and set values toa collection784 // Multifunctional method to get and set values of a collection 826 785 // The value/s can optionally be executed if it's a function 827 786 access: function( elems, fn, key, value, chainable, emptyGet, pass ) { … … 878 837 now: function() { 879 838 return ( new Date() ).getTime(); 880 }, 881 882 // Use of jQuery.browser is frowned upon. 883 // More details: http://docs.jquery.com/Utilities/jQuery.browser 884 uaMatch: function( ua ) { 885 ua = ua.toLowerCase(); 886 887 var match = rwebkit.exec( ua ) || 888 ropera.exec( ua ) || 889 rmsie.exec( ua ) || 890 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 891 []; 892 893 return { browser: match[1] || "", version: match[2] || "0" }; 894 }, 895 896 sub: function() { 897 function jQuerySub( selector, context ) { 898 return new jQuerySub.fn.init( selector, context ); 899 } 900 jQuery.extend( true, jQuerySub, this ); 901 jQuerySub.superclass = this; 902 jQuerySub.fn = jQuerySub.prototype = this(); 903 jQuerySub.fn.constructor = jQuerySub; 904 jQuerySub.sub = this.sub; 905 jQuerySub.fn.init = function init( selector, context ) { 906 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { 907 context = jQuerySub( context ); 908 } 909 910 return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); 911 }; 912 jQuerySub.fn.init.prototype = jQuerySub.fn; 913 var rootjQuerySub = jQuerySub(document); 914 return jQuerySub; 915 }, 916 917 browser: {} 839 } 918 840 }); 841 842 jQuery.ready.promise = function( obj ) { 843 if ( !readyList ) { 844 845 readyList = jQuery.Deferred(); 846 847 // Catch cases where $(document).ready() is called after the browser event has already occurred. 848 // we once tried to use readyState "interactive" here, but it caused issues like the one 849 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 850 if ( document.readyState === "complete" ) { 851 // Handle it asynchronously to allow scripts the opportunity to delay ready 852 setTimeout( jQuery.ready, 1 ); 853 854 // Standards-based browsers support DOMContentLoaded 855 } else if ( document.addEventListener ) { 856 // Use the handy event callback 857 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 858 859 // A fallback to window.onload, that will always work 860 window.addEventListener( "load", jQuery.ready, false ); 861 862 // If IE event model is used 863 } else { 864 // Ensure firing before onload, maybe late but safe also for iframes 865 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 866 867 // A fallback to window.onload, that will always work 868 window.attachEvent( "onload", jQuery.ready ); 869 870 // If IE and not a frame 871 // continually check to see if the document is ready 872 var top = false; 873 874 try { 875 top = window.frameElement == null && document.documentElement; 876 } catch(e) {} 877 878 if ( top && top.doScroll ) { 879 (function doScrollCheck() { 880 if ( !jQuery.isReady ) { 881 882 try { 883 // Use the trick by Diego Perini 884 // http://javascript.nwbox.com/IEContentLoaded/ 885 top.doScroll("left"); 886 } catch(e) { 887 return setTimeout( doScrollCheck, 50 ); 888 } 889 890 // and execute any waiting functions 891 jQuery.ready(); 892 } 893 })(); 894 } 895 } 896 } 897 return readyList.promise( obj ); 898 }; 919 899 920 900 // Populate the class2type map … … 923 903 }); 924 904 925 browserMatch = jQuery.uaMatch( userAgent );926 if ( browserMatch.browser ) {927 jQuery.browser[ browserMatch.browser ] = true;928 jQuery.browser.version = browserMatch.version;929 }930 931 // Deprecated, use jQuery.browser.webkit instead932 if ( jQuery.browser.webkit ) {933 jQuery.browser.safari = true;934 }935 936 // IE doesn't match non-breaking spaces with \s937 if ( rnotwhite.test( "\xA0" ) ) {938 trimLeft = /^[\s\xA0]+/;939 trimRight = /[\s\xA0]+$/;940 }941 942 905 // All jQuery objects should point back to these 943 906 rootjQuery = jQuery(document); 944 945 // Cleanup functions for the document ready method 946 if ( document.addEventListener ) { 947 DOMContentLoaded = function() { 948 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 949 jQuery.ready(); 950 }; 951 952 } else if ( document.attachEvent ) { 953 DOMContentLoaded = function() { 954 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 955 if ( document.readyState === "complete" ) { 956 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 957 jQuery.ready(); 958 } 959 }; 960 } 961 962 // The DOM ready check for Internet Explorer 963 function doScrollCheck() { 964 if ( jQuery.isReady ) { 965 return; 966 } 967 968 try { 969 // If IE is used, use the trick by Diego Perini 970 // http://javascript.nwbox.com/IEContentLoaded/ 971 document.documentElement.doScroll("left"); 972 } catch(e) { 973 setTimeout( doScrollCheck, 1 ); 974 return; 975 } 976 977 // and execute any waiting functions 978 jQuery.ready(); 979 } 980 981 return jQuery; 982 983 })(); 984 985 986 // String to Object flags format cache 987 var flagsCache = {}; 988 989 // Convert String-formatted flags into Object-formatted ones and store in cache 990 function createFlags( flags ) { 991 var object = flagsCache[ flags ] = {}, 992 i, length; 993 flags = flags.split( /\s+/ ); 994 for ( i = 0, length = flags.length; i < length; i++ ) { 995 object[ flags[i] ] = true; 996 } 907 // String to Object options format cache 908 var optionsCache = {}; 909 910 // Convert String-formatted options into Object-formatted ones and store in cache 911 function createOptions( options ) { 912 var object = optionsCache[ options ] = {}; 913 jQuery.each( options.split( core_rspace ), function( _, flag ) { 914 object[ flag ] = true; 915 }); 997 916 return object; 998 917 } … … 1001 920 * Create a callback list using the following parameters: 1002 921 * 1003 * flags: an optional list of space-separated flags that will change how1004 * the callback list behaves 922 * options: an optional list of space-separated options that will change how 923 * the callback list behaves or a more traditional option object 1005 924 * 1006 925 * By default a callback list will act like an event callback list and can be 1007 926 * "fired" multiple times. 1008 927 * 1009 * Possible flags:928 * Possible options: 1010 929 * 1011 930 * once: will ensure the callback list can only be fired once (like a Deferred) … … 1020 939 * 1021 940 */ 1022 jQuery.Callbacks = function( flags ) {1023 1024 // Convert flags from String-formatted to Object-formatted941 jQuery.Callbacks = function( options ) { 942 943 // Convert options from String-formatted to Object-formatted if needed 1025 944 // (we check in cache first) 1026 flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; 1027 1028 var // Actual callback list 1029 list = [], 1030 // Stack of fire calls for repeatable lists 1031 stack = [], 1032 // Last fire value (for non-forgettable lists) 945 options = typeof options === "string" ? 946 ( optionsCache[ options ] || createOptions( options ) ) : 947 jQuery.extend( {}, options ); 948 949 var // Last fire value (for non-forgettable lists) 1033 950 memory, 1034 951 // Flag to know if list was already fired … … 1042 959 // Index of currently firing callback (modified by remove if needed) 1043 960 firingIndex, 1044 // Add one or several callbacks to the list 1045 add = function( args ) { 1046 var i, 1047 length, 1048 elem, 1049 type, 1050 actual; 1051 for ( i = 0, length = args.length; i < length; i++ ) { 1052 elem = args[ i ]; 1053 type = jQuery.type( elem ); 1054 if ( type === "array" ) { 1055 // Inspect recursively 1056 add( elem ); 1057 } else if ( type === "function" ) { 1058 // Add if not in unique mode and callback is not in 1059 if ( !flags.unique || !self.has( elem ) ) { 1060 list.push( elem ); 1061 } 1062 } 1063 } 1064 }, 961 // Actual callback list 962 list = [], 963 // Stack of fire calls for repeatable lists 964 stack = !options.once && [], 1065 965 // Fire callbacks 1066 fire = function( context, args ) { 1067 args = args || []; 1068 memory = !flags.memory || [ context, args ]; 966 fire = function( data ) { 967 memory = options.memory && data; 1069 968 fired = true; 1070 firing = true;1071 969 firingIndex = firingStart || 0; 1072 970 firingStart = 0; 1073 971 firingLength = list.length; 972 firing = true; 1074 973 for ( ; list && firingIndex < firingLength; firingIndex++ ) { 1075 if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {1076 memory = true; // Mark as halted974 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { 975 memory = false; // To prevent further calls using add 1077 976 break; 1078 977 } … … 1080 979 firing = false; 1081 980 if ( list ) { 1082 if ( !flags.once ) { 1083 if ( stack && stack.length ) { 1084 memory = stack.shift(); 1085 self.fireWith( memory[ 0 ], memory[ 1 ] ); 981 if ( stack ) { 982 if ( stack.length ) { 983 fire( stack.shift() ); 1086 984 } 1087 } else if ( memory === true ) { 985 } else if ( memory ) { 986 list = []; 987 } else { 1088 988 self.disable(); 1089 } else {1090 list = [];1091 989 } 1092 990 } … … 1097 995 add: function() { 1098 996 if ( list ) { 1099 var length = list.length; 1100 add( arguments ); 997 // First, we save the current length 998 var start = list.length; 999 (function add( args ) { 1000 jQuery.each( args, function( _, arg ) { 1001 var type = jQuery.type( arg ); 1002 if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { 1003 list.push( arg ); 1004 } else if ( arg && arg.length && type !== "string" ) { 1005 // Inspect recursively 1006 add( arg ); 1007 } 1008 }); 1009 })( arguments ); 1101 1010 // Do we need to add the callbacks to the 1102 1011 // current firing batch? … … 1104 1013 firingLength = list.length; 1105 1014 // With memory, if we're not firing then 1106 // we should call right away, unless previous 1107 // firing was halted (stopOnFalse) 1108 } else if ( memory && memory !== true ) { 1109 firingStart = length; 1110 fire( memory[ 0 ], memory[ 1 ] ); 1015 // we should call right away 1016 } else if ( memory ) { 1017 firingStart = start; 1018 fire( memory ); 1111 1019 } 1112 1020 } … … 1116 1024 remove: function() { 1117 1025 if ( list ) { 1118 var args = arguments, 1119 argIndex = 0, 1120 argLength = args.length; 1121 for ( ; argIndex < argLength ; argIndex++ ) { 1122 for ( var i = 0; i < list.length; i++ ) { 1123 if ( args[ argIndex ] === list[ i ] ) { 1124 // Handle firingIndex and firingLength 1125 if ( firing ) { 1126 if ( i <= firingLength ) { 1127 firingLength--; 1128 if ( i <= firingIndex ) { 1129 firingIndex--; 1130 } 1131 } 1026 jQuery.each( arguments, function( _, arg ) { 1027 var index; 1028 while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 1029 list.splice( index, 1 ); 1030 // Handle firing indexes 1031 if ( firing ) { 1032 if ( index <= firingLength ) { 1033 firingLength--; 1132 1034 } 1133 // Remove the element 1134 list.splice( i--, 1 ); 1135 // If we have some unicity property then 1136 // we only need to do this once 1137 if ( flags.unique ) { 1138 break; 1035 if ( index <= firingIndex ) { 1036 firingIndex--; 1139 1037 } 1140 1038 } 1141 1039 } 1142 } 1040 }); 1143 1041 } 1144 1042 return this; … … 1146 1044 // Control if a given callback is in the list 1147 1045 has: function( fn ) { 1148 if ( list ) { 1149 var i = 0, 1150 length = list.length; 1151 for ( ; i < length; i++ ) { 1152 if ( fn === list[ i ] ) { 1153 return true; 1154 } 1155 } 1156 } 1157 return false; 1046 return jQuery.inArray( fn, list ) > -1; 1158 1047 }, 1159 1048 // Remove all callbacks from the list … … 1174 1063 lock: function() { 1175 1064 stack = undefined; 1176 if ( !memory || memory === true) {1065 if ( !memory ) { 1177 1066 self.disable(); 1178 1067 } … … 1185 1074 // Call all callbacks with the given context and arguments 1186 1075 fireWith: function( context, args ) { 1187 if ( stack ) { 1076 args = args || []; 1077 args = [ context, args.slice ? args.slice() : args ]; 1078 if ( list && ( !fired || stack ) ) { 1188 1079 if ( firing ) { 1189 if ( !flags.once ) { 1190 stack.push( [ context, args ] ); 1191 } 1192 } else if ( !( flags.once && memory ) ) { 1193 fire( context, args ); 1080 stack.push( args ); 1081 } else { 1082 fire( args ); 1194 1083 } 1195 1084 } … … 1209 1098 return self; 1210 1099 }; 1211 1212 1213 1214 1215 var // Static reference to slice1216 sliceDeferred = [].slice;1217 1218 1100 jQuery.extend({ 1219 1101 1220 1102 Deferred: function( func ) { 1221 var doneList = jQuery.Callbacks( "once memory" ), 1222 failList = jQuery.Callbacks( "once memory" ), 1223 progressList = jQuery.Callbacks( "memory" ), 1103 var tuples = [ 1104 // action, add listener, listener list, final state 1105 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], 1106 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], 1107 [ "notify", "progress", jQuery.Callbacks("memory") ] 1108 ], 1224 1109 state = "pending", 1225 lists = {1226 resolve: doneList,1227 reject: failList,1228 notify: progressList1229 },1230 1110 promise = { 1231 done: doneList.add,1232 fail: failList.add,1233 progress: progressList.add,1234 1235 1111 state: function() { 1236 1112 return state; 1237 1113 }, 1238 1239 // Deprecated 1240 isResolved: doneList.fired, 1241 isRejected: failList.fired, 1242 1243 then: function( doneCallbacks, failCallbacks, progressCallbacks ) { 1244 deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); 1114 always: function() { 1115 deferred.done( arguments ).fail( arguments ); 1245 1116 return this; 1246 1117 }, 1247 always: function() { 1248 deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); 1249 return this; 1250 }, 1251 pipe: function( fnDone, fnFail, fnProgress ) { 1118 then: function( /* fnDone, fnFail, fnProgress */ ) { 1119 var fns = arguments; 1252 1120 return jQuery.Deferred(function( newDefer ) { 1253 jQuery.each( { 1254 done: [ fnDone, "resolve" ], 1255 fail: [ fnFail, "reject" ], 1256 progress: [ fnProgress, "notify" ] 1257 }, function( handler, data ) { 1258 var fn = data[ 0 ], 1259 action = data[ 1 ], 1260 returned; 1261 if ( jQuery.isFunction( fn ) ) { 1262 deferred[ handler ](function() { 1263 returned = fn.apply( this, arguments ); 1121 jQuery.each( tuples, function( i, tuple ) { 1122 var action = tuple[ 0 ], 1123 fn = fns[ i ]; 1124 // deferred[ done | fail | progress ] for forwarding actions to newDefer 1125 deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? 1126 function() { 1127 var returned = fn.apply( this, arguments ); 1264 1128 if ( returned && jQuery.isFunction( returned.promise ) ) { 1265 returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); 1129 returned.promise() 1130 .done( newDefer.resolve ) 1131 .fail( newDefer.reject ) 1132 .progress( newDefer.notify ); 1266 1133 } else { 1267 1134 newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); 1268 1135 } 1269 }); 1270 } else { 1271 deferred[ handler ]( newDefer[ action ] ); 1272 } 1136 } : 1137 newDefer[ action ] 1138 ); 1273 1139 }); 1140 fns = null; 1274 1141 }).promise(); 1275 1142 }, … … 1277 1144 // If obj is provided, the promise aspect is added to the object 1278 1145 promise: function( obj ) { 1279 if ( obj == null ) { 1280 obj = promise; 1281 } else { 1282 for ( var key in promise ) { 1283 obj[ key ] = promise[ key ]; 1284 } 1285 } 1286 return obj; 1146 return obj != null ? jQuery.extend( obj, promise ) : promise; 1287 1147 } 1288 1148 }, 1289 deferred = promise.promise({}), 1290 key; 1291 1292 for ( key in lists ) { 1293 deferred[ key ] = lists[ key ].fire; 1294 deferred[ key + "With" ] = lists[ key ].fireWith; 1295 } 1296 1297 // Handle state 1298 deferred.done( function() { 1299 state = "resolved"; 1300 }, failList.disable, progressList.lock ).fail( function() { 1301 state = "rejected"; 1302 }, doneList.disable, progressList.lock ); 1149 deferred = {}; 1150 1151 // Keep pipe for back-compat 1152 promise.pipe = promise.then; 1153 1154 // Add list-specific methods 1155 jQuery.each( tuples, function( i, tuple ) { 1156 var list = tuple[ 2 ], 1157 stateString = tuple[ 3 ]; 1158 1159 // promise[ done | fail | progress ] = list.add 1160 promise[ tuple[1] ] = list.add; 1161 1162 // Handle state 1163 if ( stateString ) { 1164 list.add(function() { 1165 // state = [ resolved | rejected ] 1166 state = stateString; 1167 1168 // [ reject_list | resolve_list ].disable; progress_list.lock 1169 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 1170 } 1171 1172 // deferred[ resolve | reject | notify ] = list.fire 1173 deferred[ tuple[0] ] = list.fire; 1174 deferred[ tuple[0] + "With" ] = list.fireWith; 1175 }); 1176 1177 // Make the deferred a promise 1178 promise.promise( deferred ); 1303 1179 1304 1180 // Call given func if any … … 1312 1188 1313 1189 // Deferred helper 1314 when: function( firstParam ) { 1315 var args = sliceDeferred.call( arguments, 0 ), 1316 i = 0, 1317 length = args.length, 1318 pValues = new Array( length ), 1319 count = length, 1320 pCount = length, 1321 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? 1322 firstParam : 1323 jQuery.Deferred(), 1324 promise = deferred.promise(); 1325 function resolveFunc( i ) { 1326 return function( value ) { 1327 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1328 if ( !( --count ) ) { 1329 deferred.resolveWith( deferred, args ); 1330 } 1331 }; 1332 } 1333 function progressFunc( i ) { 1334 return function( value ) { 1335 pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; 1336 deferred.notifyWith( promise, pValues ); 1337 }; 1338 } 1190 when: function( subordinate /* , ..., subordinateN */ ) { 1191 var i = 0, 1192 resolveValues = core_slice.call( arguments ), 1193 length = resolveValues.length, 1194 1195 // the count of uncompleted subordinates 1196 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 1197 1198 // the master Deferred. If resolveValues consist of only a single Deferred, just use that. 1199 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 1200 1201 // Update function for both resolve and progress values 1202 updateFunc = function( i, contexts, values ) { 1203 return function( value ) { 1204 contexts[ i ] = this; 1205 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; 1206 if( values === progressValues ) { 1207 deferred.notifyWith( contexts, values ); 1208 } else if ( !( --remaining ) ) { 1209 deferred.resolveWith( contexts, values ); 1210 } 1211 }; 1212 }, 1213 1214 progressValues, progressContexts, resolveContexts; 1215 1216 // add listeners to Deferred subordinates; treat others as resolved 1339 1217 if ( length > 1 ) { 1218 progressValues = new Array( length ); 1219 progressContexts = new Array( length ); 1220 resolveContexts = new Array( length ); 1340 1221 for ( ; i < length; i++ ) { 1341 if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { 1342 args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); 1222 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 1223 resolveValues[ i ].promise() 1224 .done( updateFunc( i, resolveContexts, resolveValues ) ) 1225 .fail( deferred.reject ) 1226 .progress( updateFunc( i, progressContexts, progressValues ) ); 1343 1227 } else { 1344 --count; 1345 } 1346 } 1347 if ( !count ) { 1348 deferred.resolveWith( deferred, args ); 1349 } 1350 } else if ( deferred !== firstParam ) { 1351 deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); 1352 } 1353 return promise; 1228 --remaining; 1229 } 1230 } 1231 } 1232 1233 // if we're not waiting on anything, resolve the master 1234 if ( !remaining ) { 1235 deferred.resolveWith( resolveContexts, resolveValues ); 1236 } 1237 1238 return deferred.promise(); 1354 1239 } 1355 1240 }); 1356 1357 1358 1359 1360 1241 jQuery.support = (function() { 1361 1242 … … 1367 1248 input, 1368 1249 fragment, 1369 tds,1370 events,1371 1250 eventName, 1372 1251 i, 1373 1252 isSupported, 1374 div = document.createElement( "div" ),1375 d ocumentElement = document.documentElement;1253 clickFn, 1254 div = document.createElement("div"); 1376 1255 1377 1256 // Preliminary tests 1378 div.setAttribute("className", "t"); 1379 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; 1380 1381 all = div.getElementsByTagName( "*" ); 1382 a = div.getElementsByTagName( "a" )[ 0 ]; 1257 div.setAttribute( "className", "t" ); 1258 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 1259 1260 all = div.getElementsByTagName("*"); 1261 a = div.getElementsByTagName("a")[ 0 ]; 1262 a.style.cssText = "top:1px;float:left;opacity:.5"; 1383 1263 1384 1264 // Can't get basic test support 1385 if ( !all || !all.length || !a) {1265 if ( !all || !all.length ) { 1386 1266 return {}; 1387 1267 } 1388 1268 1389 1269 // First batch of supports tests 1390 select = document.createElement( "select");1270 select = document.createElement("select"); 1391 1271 opt = select.appendChild( document.createElement("option") ); 1392 input = div.getElementsByTagName( "input")[ 0 ];1272 input = div.getElementsByTagName("input")[ 0 ]; 1393 1273 1394 1274 support = { … … 1415 1295 // (IE uses filter instead) 1416 1296 // Use a regex to work around a WebKit issue. See #5145 1417 opacity: /^0.5 5/.test( a.style.opacity ),1297 opacity: /^0.5/.test( a.style.opacity ), 1418 1298 1419 1299 // Verify style float existence … … 1439 1319 // Where outerHTML is undefined, this still works 1440 1320 html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", 1321 1322 // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode 1323 boxModel: ( document.compatMode === "CSS1Compat" ), 1441 1324 1442 1325 // Will be defined later … … 1449 1332 shrinkWrapBlocks: false, 1450 1333 reliableMarginRight: true, 1451 pixelMargin: true 1334 boxSizingReliable: true, 1335 pixelPosition: false 1452 1336 }; 1453 1454 // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead1455 jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");1456 1337 1457 1338 // Make sure checked status is properly cloned … … 1473 1354 1474 1355 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { 1475 div.attachEvent( "onclick", function() {1356 div.attachEvent( "onclick", clickFn = function() { 1476 1357 // Cloning a node shouldn't copy over any 1477 1358 // bound event handlers (IE does this) 1478 1359 support.noCloneEvent = false; 1479 1360 }); 1480 div.cloneNode( true ).fireEvent( "onclick" ); 1361 div.cloneNode( true ).fireEvent("onclick"); 1362 div.detachEvent( "onclick", clickFn ); 1481 1363 } 1482 1364 … … 1485 1367 input = document.createElement("input"); 1486 1368 input.value = "t"; 1487 input.setAttribute( "type", "radio");1369 input.setAttribute( "type", "radio" ); 1488 1370 support.radioValue = input.value === "t"; 1489 1371 1490 input.setAttribute( "checked", "checked");1372 input.setAttribute( "checked", "checked" ); 1491 1373 1492 1374 // #11217 - WebKit loses check when the name is after the checked attribute … … 1515 1397 if ( div.attachEvent ) { 1516 1398 for ( i in { 1517 submit: 1,1518 change: 1,1519 focusin: 11399 submit: true, 1400 change: true, 1401 focusin: true 1520 1402 }) { 1521 1403 eventName = "on" + i; … … 1529 1411 } 1530 1412 1531 fragment.removeChild( div );1532 1533 // Null elements to avoid leaks in IE1534 fragment = select = opt = div = input = null;1535 1536 1413 // Run tests that need a body at doc ready 1537 1414 jQuery(function() { 1538 var container, outer, inner, table, td, offsetSupport, 1539 marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, 1540 paddingMarginBorderVisibility, paddingMarginBorder, 1415 var container, div, tds, marginDiv, 1416 divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", 1541 1417 body = document.getElementsByTagName("body")[0]; 1542 1418 … … 1546 1422 } 1547 1423 1548 conMarginTop = 1;1549 paddingMarginBorder = "padding:0;margin:0;border:";1550 positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";1551 paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";1552 style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";1553 html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +1554 "<table " + style + "' cellpadding='0' cellspacing='0'>" +1555 "<tr><td></td></tr></table>";1556 1557 1424 container = document.createElement("div"); 1558 container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";1425 container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; 1559 1426 body.insertBefore( container, body.firstChild ); 1560 1427 … … 1570 1437 // hidden; don safety goggles and see bug #4512 for more information). 1571 1438 // (only IE 8 fails this test) 1572 div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>"; 1573 tds = div.getElementsByTagName( "td" ); 1439 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 1440 tds = div.getElementsByTagName("td"); 1441 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; 1574 1442 isSupported = ( tds[ 0 ].offsetHeight === 0 ); 1575 1443 … … 1581 1449 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); 1582 1450 1583 // Check if div with explicit width and no margin-right incorrectly 1584 // gets computed margin-right based on width of container. For more 1585 // info see bug #3333 1586 // Fails in WebKit before Feb 2011 nightlies 1587 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1451 // Check box-sizing and margin behavior 1452 div.innerHTML = ""; 1453 div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; 1454 support.boxSizing = ( div.offsetWidth === 4 ); 1455 support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); 1456 1457 // NOTE: To any future maintainer, we've window.getComputedStyle 1458 // because jsdom on node.js will break without it. 1588 1459 if ( window.getComputedStyle ) { 1589 div.innerHTML = ""; 1590 marginDiv = document.createElement( "div" ); 1591 marginDiv.style.width = "0"; 1592 marginDiv.style.marginRight = "0"; 1593 div.style.width = "2px"; 1460 support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; 1461 support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; 1462 1463 // Check if div with explicit width and no margin-right incorrectly 1464 // gets computed margin-right based on width of container. For more 1465 // info see bug #3333 1466 // Fails in WebKit before Feb 2011 nightlies 1467 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 1468 marginDiv = document.createElement("div"); 1469 marginDiv.style.cssText = div.style.cssText = divReset; 1470 marginDiv.style.marginRight = marginDiv.style.width = "0"; 1471 div.style.width = "1px"; 1594 1472 div.appendChild( marginDiv ); 1595 1473 support.reliableMarginRight = 1596 ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;1474 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); 1597 1475 } 1598 1476 … … 1603 1481 // (IE < 8 does this) 1604 1482 div.innerHTML = ""; 1605 div.style.width = div.style.padding = "1px"; 1606 div.style.border = 0; 1607 div.style.overflow = "hidden"; 1608 div.style.display = "inline"; 1609 div.style.zoom = 1; 1483 div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; 1610 1484 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); 1611 1485 … … 1614 1488 div.style.display = "block"; 1615 1489 div.style.overflow = "visible"; 1616 div.innerHTML = "<div style='width:5px;'></div>"; 1490 div.innerHTML = "<div></div>"; 1491 div.firstChild.style.width = "5px"; 1617 1492 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); 1618 } 1619 1620 div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; 1621 div.innerHTML = html; 1622 1623 outer = div.firstChild; 1624 inner = outer.firstChild; 1625 td = outer.nextSibling.firstChild.firstChild; 1626 1627 offsetSupport = { 1628 doesNotAddBorder: ( inner.offsetTop !== 5 ), 1629 doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) 1630 }; 1631 1632 inner.style.position = "fixed"; 1633 inner.style.top = "20px"; 1634 1635 // safari subtracts parent border width here which is 5px 1636 offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); 1637 inner.style.position = inner.style.top = ""; 1638 1639 outer.style.overflow = "hidden"; 1640 outer.style.position = "relative"; 1641 1642 offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); 1643 offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); 1644 1645 if ( window.getComputedStyle ) { 1646 div.style.marginTop = "1%"; 1647 support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; 1648 } 1649 1650 if ( typeof container.style.zoom !== "undefined" ) { 1493 1651 1494 container.style.zoom = 1; 1652 1495 } 1653 1496 1497 // Null elements to avoid leaks in IE 1654 1498 body.removeChild( container ); 1655 marginDiv = div = container = null; 1656 1657 jQuery.extend( support, offsetSupport ); 1499 container = div = tds = marginDiv = null; 1658 1500 }); 1501 1502 // Null elements to avoid leaks in IE 1503 fragment.removeChild( div ); 1504 all = a = select = opt = input = fragment = div = null; 1659 1505 1660 1506 return support; 1661 1507 })(); 1662 1663 1664 1665 1666 var rbrace = /^(?:\{.*\}|\[.*\])$/, 1508 var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, 1667 1509 rmultiDash = /([A-Z])/g; 1668 1510 … … 1670 1512 cache: {}, 1671 1513 1672 // Please use with caution 1514 deletedIds: [], 1515 1516 // Remove at next major release (1.9/2.0) 1673 1517 uuid: 0, 1674 1518 … … 1696 1540 } 1697 1541 1698 var privateCache,thisCache, ret,1542 var thisCache, ret, 1699 1543 internalKey = jQuery.expando, 1700 1544 getByName = typeof name === "string", … … 1710 1554 // Only defining an ID for JS objects if its cache already exists allows 1711 1555 // the code to shortcut on the same path as a DOM node with no cache 1712 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, 1713 isEvents = name === "events"; 1556 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 1714 1557 1715 1558 // Avoid doing any more work than we need to when trying to get data on an 1716 1559 // object that has no data at all 1717 if ( (!id || !cache[id] || (! isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {1560 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { 1718 1561 return; 1719 1562 } … … 1723 1566 // ends up in the global cache 1724 1567 if ( isNode ) { 1725 elem[ internalKey ] = id = ++jQuery.uuid;1568 elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; 1726 1569 } else { 1727 1570 id = internalKey; … … 1749 1592 } 1750 1593 1751 privateCache =thisCache = cache[ id ];1594 thisCache = cache[ id ]; 1752 1595 1753 1596 // jQuery data() is stored in a separate object inside the object's internal data … … 1766 1609 } 1767 1610 1768 // Users should not attempt to inspect the internal events object using jQuery.data,1769 // it is undocumented and subject to change. But does anyone listen? No.1770 if ( isEvents && !thisCache[ name ] ) {1771 return privateCache.events;1772 }1773 1774 1611 // Check for both converted-to-camel and non-converted data property names 1775 1612 // If a data property was specified … … 1799 1636 var thisCache, i, l, 1800 1637 1801 // Reference to internal data cache key1802 internalKey = jQuery.expando,1803 1804 1638 isNode = elem.nodeType, 1805 1639 1806 1640 // See jQuery.data for more information 1807 1641 cache = isNode ? jQuery.cache : elem, 1808 1809 // See jQuery.data for more information 1810 id = isNode ? elem[ internalKey ] : internalKey; 1642 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 1811 1643 1812 1644 // If there is already no cache entry for this object, there is no … … 1835 1667 name = [ name ]; 1836 1668 } else { 1837 name = name.split( " ");1669 name = name.split(" "); 1838 1670 } 1839 1671 } … … 1858 1690 // Don't destroy the parent cache unless the internal data object 1859 1691 // had been the only thing left in it 1860 if ( !isEmptyDataObject( cache[ id ]) ) {1692 if ( !isEmptyDataObject( cache[ id ] ) ) { 1861 1693 return; 1862 1694 } 1863 1695 } 1864 1696 1865 // Browsers that fail expando deletion also refuse to delete expandos on 1866 // the window, but it will allow it on all other JS objects; other browsers 1867 // don't care 1868 // Ensure that `cache` is not a window object #10080 1869 if ( jQuery.support.deleteExpando || !cache.setInterval ) { 1697 // Destroy the cache 1698 if ( isNode ) { 1699 jQuery.cleanData( [ elem ], true ); 1700 1701 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 1702 } else if ( jQuery.support.deleteExpando || cache != cache.window ) { 1870 1703 delete cache[ id ]; 1704 1705 // When all else fails, null 1871 1706 } else { 1872 1707 cache[ id ] = null; 1873 }1874 1875 // We destroyed the cache and need to eliminate the expando on the node to avoid1876 // false lookups in the cache for entries that no longer exist1877 if ( isNode ) {1878 // IE does not allow us to delete expando properties from nodes,1879 // nor does it have a removeAttribute function on Document nodes;1880 // we must handle all of these cases1881 if ( jQuery.support.deleteExpando ) {1882 delete elem[ internalKey ];1883 } else if ( elem.removeAttribute ) {1884 elem.removeAttribute( internalKey );1885 } else {1886 elem[ internalKey ] = null;1887 }1888 1708 } 1889 1709 }, … … 1896 1716 // A method for determining if a DOM node can handle the data expando 1897 1717 acceptData: function( elem ) { 1898 if ( elem.nodeName ) { 1899 var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; 1900 1901 if ( match ) { 1902 return !(match === true || elem.getAttribute("classid") !== match); 1903 } 1904 } 1905 1906 return true; 1718 var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; 1719 1720 // nodes accept data unless otherwise specified; rejection can be conditional 1721 return !noData || noData !== true && elem.getAttribute("classid") === noData; 1907 1722 } 1908 1723 }); … … 1925 1740 name = attr[i].name; 1926 1741 1927 if ( name.indexOf( "data-" ) === 0) {1742 if ( !name.indexOf( "data-" ) ) { 1928 1743 name = jQuery.camelCase( name.substring(5) ); 1929 1744 … … 1997 1812 data === "false" ? false : 1998 1813 data === "null" ? null : 1999 jQuery.isNumeric( data ) ? +data : 2000 rbrace.test( data ) ? jQuery.parseJSON( data ) : 1814 // Only convert to a number if it doesn't change the string 1815 +data + "" === data ? +data : 1816 rbrace.test( data ) ? jQuery.parseJSON( data ) : 2001 1817 data; 2002 1818 } catch( e ) {} … … 2015 1831 // checks a cache object for emptiness 2016 1832 function isEmptyDataObject( obj ) { 2017 for ( var name in obj ) { 1833 var name; 1834 for ( name in obj ) { 2018 1835 2019 1836 // if the public data object is empty, the private is still empty … … 2028 1845 return true; 2029 1846 } 2030 2031 2032 2033 2034 function handleQueueMarkDefer( elem, type, src ) {2035 var deferDataKey = type + "defer",2036 queueDataKey = type + "queue",2037 markDataKey = type + "mark",2038 defer = jQuery._data( elem, deferDataKey );2039 if ( defer &&2040 ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&2041 ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {2042 // Give room for hard-coded callbacks to fire first2043 // and eventually mark/queue something else on the element2044 setTimeout( function() {2045 if ( !jQuery._data( elem, queueDataKey ) &&2046 !jQuery._data( elem, markDataKey ) ) {2047 jQuery.removeData( elem, deferDataKey, true );2048 defer.fire();2049 }2050 }, 0 );2051 }2052 }2053 2054 1847 jQuery.extend({ 2055 2056 _mark: function( elem, type ) {2057 if ( elem ) {2058 type = ( type || "fx" ) + "mark";2059 jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );2060 }2061 },2062 2063 _unmark: function( force, elem, type ) {2064 if ( force !== true ) {2065 type = elem;2066 elem = force;2067 force = false;2068 }2069 if ( elem ) {2070 type = type || "fx";2071 var key = type + "mark",2072 count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );2073 if ( count ) {2074 jQuery._data( elem, key, count );2075 } else {2076 jQuery.removeData( elem, key, true );2077 handleQueueMarkDefer( elem, type, "mark" );2078 }2079 }2080 },2081 2082 1848 queue: function( elem, type, data ) { 2083 var q; 1849 var queue; 1850 2084 1851 if ( elem ) { 2085 1852 type = ( type || "fx" ) + "queue"; 2086 q = jQuery._data( elem, type );1853 queue = jQuery._data( elem, type ); 2087 1854 2088 1855 // Speed up dequeue by getting out quickly if this is just a lookup 2089 1856 if ( data ) { 2090 if ( !q || jQuery.isArray(data) ) {2091 q = jQuery._data( elem, type, jQuery.makeArray(data) );1857 if ( !queue || jQuery.isArray(data) ) { 1858 queue = jQuery._data( elem, type, jQuery.makeArray(data) ); 2092 1859 } else { 2093 q .push( data );2094 } 2095 } 2096 return q || [];1860 queue.push( data ); 1861 } 1862 } 1863 return queue || []; 2097 1864 } 2098 1865 }, … … 2102 1869 2103 1870 var queue = jQuery.queue( elem, type ), 1871 startLength = queue.length, 2104 1872 fn = queue.shift(), 2105 hooks = {}; 1873 hooks = jQuery._queueHooks( elem, type ), 1874 next = function() { 1875 jQuery.dequeue( elem, type ); 1876 }; 2106 1877 2107 1878 // If the fx queue is dequeued, always remove the progress sentinel 2108 1879 if ( fn === "inprogress" ) { 2109 1880 fn = queue.shift(); 1881 startLength--; 2110 1882 } 2111 1883 2112 1884 if ( fn ) { 1885 2113 1886 // Add a progress sentinel to prevent the fx queue from being 2114 1887 // automatically dequeued … … 2117 1890 } 2118 1891 2119 jQuery._data( elem, type + ".run", hooks ); 2120 fn.call( elem, function() { 2121 jQuery.dequeue( elem, type ); 2122 }, hooks ); 2123 } 2124 2125 if ( !queue.length ) { 2126 jQuery.removeData( elem, type + "queue " + type + ".run", true ); 2127 handleQueueMarkDefer( elem, type, "queue" ); 2128 } 1892 // clear up the last queue stop function 1893 delete hooks.stop; 1894 fn.call( elem, next, hooks ); 1895 } 1896 1897 if ( !startLength && hooks ) { 1898 hooks.empty.fire(); 1899 } 1900 }, 1901 1902 // not intended for public consumption - generates a queueHooks object, or returns the current one 1903 _queueHooks: function( elem, type ) { 1904 var key = type + "queueHooks"; 1905 return jQuery._data( elem, key ) || jQuery._data( elem, key, { 1906 empty: jQuery.Callbacks("once memory").add(function() { 1907 jQuery.removeData( elem, type + "queue", true ); 1908 jQuery.removeData( elem, key, true ); 1909 }) 1910 }); 2129 1911 } 2130 1912 }); … … 2148 1930 this.each(function() { 2149 1931 var queue = jQuery.queue( this, type, data ); 1932 1933 // ensure a hooks for this queue 1934 jQuery._queueHooks( this, type ); 2150 1935 2151 1936 if ( type === "fx" && queue[0] !== "inprogress" ) { … … 2177 1962 // Get a promise resolved when queues of a certain type 2178 1963 // are emptied (fx is the type by default) 2179 promise: function( type, object ) { 1964 promise: function( type, obj ) { 1965 var tmp, 1966 count = 1, 1967 defer = jQuery.Deferred(), 1968 elements = this, 1969 i = this.length, 1970 resolve = function() { 1971 if ( !( --count ) ) { 1972 defer.resolveWith( elements, [ elements ] ); 1973 } 1974 }; 1975 2180 1976 if ( typeof type !== "string" ) { 2181 obj ect= type;1977 obj = type; 2182 1978 type = undefined; 2183 1979 } 2184 1980 type = type || "fx"; 2185 var defer = jQuery.Deferred(), 2186 elements = this, 2187 i = elements.length, 2188 count = 1, 2189 deferDataKey = type + "defer", 2190 queueDataKey = type + "queue", 2191 markDataKey = type + "mark", 2192 tmp; 2193 function resolve() { 2194 if ( !( --count ) ) { 2195 defer.resolveWith( elements, [ elements ] ); 2196 } 2197 } 1981 2198 1982 while( i-- ) { 2199 if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || 2200 ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || 2201 jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && 2202 jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { 1983 tmp = jQuery._data( elements[ i ], type + "queueHooks" ); 1984 if ( tmp && tmp.empty ) { 2203 1985 count++; 2204 tmp. add( resolve );1986 tmp.empty.add( resolve ); 2205 1987 } 2206 1988 } 2207 1989 resolve(); 2208 return defer.promise( obj ect);1990 return defer.promise( obj ); 2209 1991 } 2210 1992 }); 2211 2212 2213 2214 2215 var rclass = /[\n\t\r]/g, 2216 rspace = /\s+/, 1993 var nodeHook, boolHook, fixSpecified, 1994 rclass = /[\t\r\n]/g, 2217 1995 rreturn = /\r/g, 2218 1996 rtype = /^(?:button|input)$/i, 2219 1997 rfocusable = /^(?:button|input|object|select|textarea)$/i, 2220 rclickable = /^a(?:rea )?$/i,1998 rclickable = /^a(?:rea|)$/i, 2221 1999 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, 2222 getSetAttribute = jQuery.support.getSetAttribute, 2223 nodeHook, boolHook, fixSpecified; 2000 getSetAttribute = jQuery.support.getSetAttribute; 2224 2001 2225 2002 jQuery.fn.extend({ … … 2260 2037 2261 2038 if ( value && typeof value === "string" ) { 2262 classNames = value.split( rspace );2039 classNames = value.split( core_rspace ); 2263 2040 2264 2041 for ( i = 0, l = this.length; i < l; i++ ) { … … 2273 2050 2274 2051 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2275 if ( !~setClass.indexOf( " " + classNames[ c ] + " " )) {2052 if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { 2276 2053 setClass += classNames[ c ] + " "; 2277 2054 } … … 2287 2064 2288 2065 removeClass: function( value ) { 2289 var classNames, i, l, elem, className, c, cl;2066 var removes, className, elem, c, cl, i, l; 2290 2067 2291 2068 if ( jQuery.isFunction( value ) ) { … … 2294 2071 }); 2295 2072 } 2296 2297 2073 if ( (value && typeof value === "string") || value === undefined ) { 2298 classNames = ( value || "" ).split(rspace );2074 removes = ( value || "" ).split( core_rspace ); 2299 2075 2300 2076 for ( i = 0, l = this.length; i < l; i++ ) { 2301 2077 elem = this[ i ]; 2302 2303 2078 if ( elem.nodeType === 1 && elem.className ) { 2304 if ( value ) { 2305 className = (" " + elem.className + " ").replace( rclass, " " ); 2306 for ( c = 0, cl = classNames.length; c < cl; c++ ) { 2307 className = className.replace(" " + classNames[ c ] + " ", " "); 2079 2080 className = (" " + elem.className + " ").replace( rclass, " " ); 2081 2082 // loop over each item in the removal list 2083 for ( c = 0, cl = removes.length; c < cl; c++ ) { 2084 // Remove until there is nothing to remove, 2085 while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { 2086 className = className.replace( " " + removes[ c ] + " " , " " ); 2308 2087 } 2309 elem.className = jQuery.trim( className );2310 2311 } else {2312 elem.className = "";2313 2088 } 2089 elem.className = value ? jQuery.trim( className ) : ""; 2314 2090 } 2315 2091 } … … 2336 2112 self = jQuery( this ), 2337 2113 state = stateVal, 2338 classNames = value.split( rspace );2114 classNames = value.split( core_rspace ); 2339 2115 2340 2116 while ( (className = classNames[ i++ ]) ) { 2341 // check each className given, space sep erated list2117 // check each className given, space separated list 2342 2118 state = isBool ? state : !self.hasClass( className ); 2343 2119 self[ state ? "addClass" : "removeClass" ]( className ); … … 2361 2137 l = this.length; 2362 2138 for ( ; i < l; i++ ) { 2363 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1) {2139 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { 2364 2140 return true; 2365 2141 } … … 2396 2172 2397 2173 return this.each(function( i ) { 2398 var self = jQuery(this), val; 2174 var val, 2175 self = jQuery(this); 2399 2176 2400 2177 if ( this.nodeType !== 1 ) { … … 2498 2275 }, 2499 2276 2500 attrFn: { 2501 val: true, 2502 css: true, 2503 html: true, 2504 text: true, 2505 data: true, 2506 width: true, 2507 height: true, 2508 offset: true 2509 }, 2277 // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 2278 attrFn: {}, 2510 2279 2511 2280 attr: function( elem, name, value, pass ) { … … 2518 2287 } 2519 2288 2520 if ( pass && name in jQuery.attrFn) {2289 if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { 2521 2290 return jQuery( elem )[ name ]( value ); 2522 2291 } … … 2546 2315 2547 2316 } else { 2548 elem.setAttribute( name, "" + value);2317 elem.setAttribute( name, value + "" ); 2549 2318 return value; 2550 2319 } … … 2565 2334 2566 2335 removeAttr: function( elem, value ) { 2567 var propName, attrNames, name, l,isBool,2336 var propName, attrNames, name, isBool, 2568 2337 i = 0; 2569 2338 2570 2339 if ( value && elem.nodeType === 1 ) { 2571 attrNames = value.toLowerCase().split( rspace ); 2572 l = attrNames.length;2573 2574 for ( ; i < l; i++ ) {2340 2341 attrNames = value.split( core_rspace ); 2342 2343 for ( ; i < attrNames.length; i++ ) { 2575 2344 name = attrNames[ i ]; 2576 2345 … … 2702 2471 }); 2703 2472 2704 // Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)2705 jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;2706 2707 2473 // Hook for boolean attributes 2708 2474 boolHook = { … … 2751 2517 var ret; 2752 2518 ret = elem.getAttributeNode( name ); 2753 return ret && ( fixSpecified[ name ] ? ret. nodeValue !== "" : ret.specified ) ?2754 ret. nodeValue :2519 return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? 2520 ret.value : 2755 2521 undefined; 2756 2522 }, … … 2762 2528 elem.setAttributeNode( ret ); 2763 2529 } 2764 return ( ret. nodeValue = value + "" );2530 return ( ret.value = value + "" ); 2765 2531 } 2766 2532 }; 2767 2768 // Apply the nodeHook to tabindex2769 jQuery.attrHooks.tabindex.set = nodeHook.set;2770 2533 2771 2534 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) … … 2816 2579 }, 2817 2580 set: function( elem, value ) { 2818 return ( elem.style.cssText = "" + value);2581 return ( elem.style.cssText = value + "" ); 2819 2582 } 2820 2583 }; … … 2866 2629 }); 2867 2630 }); 2868 2869 2870 2871 2872 2631 var rformElems = /^(?:textarea|input|select)$/i, 2873 rtypenamespace = /^([^\.]* )?(?:\.(.+))?$/,2874 rhoverHack = /(?:^|\s)hover(\.\S+ )?\b/,2632 rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, 2633 rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, 2875 2634 rkeyEvent = /^key/, 2876 2635 rmouseEvent = /^(?:mouse|contextmenu)|click/, 2877 2636 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 2878 rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,2879 quickParse = function( selector ) {2880 var quick = rquickIs.exec( selector );2881 if ( quick ) {2882 // 0 1 2 32883 // [ _, tag, id, class ]2884 quick[1] = ( quick[1] || "" ).toLowerCase();2885 quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );2886 }2887 return quick;2888 },2889 quickIs = function( elem, m ) {2890 var attrs = elem.attributes || {};2891 return (2892 (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&2893 (!m[2] || (attrs.id || {}).value === m[2]) &&2894 (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))2895 );2896 },2897 2637 hoverHack = function( events ) { 2898 2638 return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); … … 2909 2649 var elemData, eventHandle, events, 2910 2650 t, tns, type, namespaces, handleObj, 2911 handleObjIn, quick,handlers, special;2651 handleObjIn, handlers, special; 2912 2652 2913 2653 // Don't attach events to noData or text/comment nodes (allow plain objects tho) … … 2972 2712 guid: handler.guid, 2973 2713 selector: selector, 2974 quick: selector && quickParse( selector ),2714 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 2975 2715 namespace: namespaces.join(".") 2976 2716 }, handleObjIn ); … … 3022 2762 remove: function( elem, types, handler, selector, mappedTypes ) { 3023 2763 3024 var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),3025 t, tns, type, origType, namespaces, origCount,3026 j, events, special, handle, eventType, handleObj;2764 var t, tns, type, origType, namespaces, origCount, 2765 j, events, special, eventType, handleObj, 2766 elemData = jQuery.hasData( elem ) && jQuery._data( elem ); 3027 2767 3028 2768 if ( !elemData || !(events = elemData.events) ) { … … 3049 2789 eventType = events[ type ] || []; 3050 2790 origCount = eventType.length; 3051 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\. )?") + "(\\.|$)") : null;2791 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 3052 2792 3053 2793 // Remove matching events … … 3073 2813 // (avoids potential for endless recursion during removal of special event handlers) 3074 2814 if ( eventType.length === 0 && origCount !== eventType.length ) { 3075 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {2815 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 3076 2816 jQuery.removeEvent( elem, type, elemData.handle ); 3077 2817 } … … 3083 2823 // Remove the expando if it's no longer used 3084 2824 if ( jQuery.isEmptyObject( events ) ) { 3085 handle = elemData.handle; 3086 if ( handle ) { 3087 handle.elem = null; 3088 } 2825 delete elemData.handle; 3089 2826 3090 2827 // removeData also checks for emptiness and clears the expando if empty 3091 2828 // so use it instead of delete 3092 jQuery.removeData( elem, [ "events", "handle" ], true );2829 jQuery.removeData( elem, "events", true ); 3093 2830 } 3094 2831 }, … … 3109 2846 3110 2847 // Event object or event type 3111 var type = event.type || event,3112 namespaces = [],3113 cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;2848 var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, 2849 type = event.type || event, 2850 namespaces = []; 3114 2851 3115 2852 // focus/blur morphs to focusin/out; ensure we're not firing them right now … … 3149 2886 event.exclusive = exclusive; 3150 2887 event.namespace = namespaces.join( "." ); 3151 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\. )?") + "(\\.|$)") : null;2888 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 3152 2889 ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; 3153 2890 … … 3188 2925 bubbleType = special.delegateType || type; 3189 2926 cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; 3190 old = null; 3191 for ( ; cur; cur = cur.parentNode ) { 2927 for ( old = elem; cur; cur = cur.parentNode ) { 3192 2928 eventPath.push([ cur, bubbleType ]); 3193 2929 old = cur; … … 3195 2931 3196 2932 // Only add window if we got to document (e.g., not plain obj or detached DOM) 3197 if ( old && old === elem.ownerDocument) {2933 if ( old === (elem.ownerDocument || document) ) { 3198 2934 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); 3199 2935 } … … 3212 2948 // Note that this is a bare JS function and not a jQuery handler 3213 2949 handle = ontype && cur[ ontype ]; 3214 if ( handle && jQuery.acceptData( cur ) && handle.apply ( cur, data ) === false ) {2950 if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { 3215 2951 event.preventDefault(); 3216 2952 } … … 3257 2993 event = jQuery.event.fix( event || window.event ); 3258 2994 3259 var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), 2995 var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, 2996 handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), 3260 2997 delegateCount = handlers.delegateCount, 3261 args = [].slice.call( arguments, 0),2998 args = core_slice.call( arguments ), 3262 2999 run_all = !event.exclusive && !event.namespace, 3263 3000 special = jQuery.event.special[ event.type ] || {}, 3264 handlerQueue = [], 3265 i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; 3001 handlerQueue = []; 3266 3002 3267 3003 // Use the fix-ed jQuery.Event rather than the (read-only) native event … … 3278 3014 if ( delegateCount && !(event.button && event.type === "click") ) { 3279 3015 3280 // Pregenerate a single jQuery object for reuse with .is()3281 jqcur = jQuery(this);3282 jqcur.context = this.ownerDocument || this;3283 3284 3016 for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { 3285 3017 3286 // Don't process events on disabled elements (#6911, #8165)3287 if ( cur.disabled !== true ) {3018 // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) 3019 if ( cur.disabled !== true || event.type !== "click" ) { 3288 3020 selMatch = {}; 3289 3021 matches = []; 3290 jqcur[0] = cur;3291 3022 for ( i = 0; i < delegateCount; i++ ) { 3292 3023 handleObj = handlers[ i ]; … … 3294 3025 3295 3026 if ( selMatch[ sel ] === undefined ) { 3296 selMatch[ sel ] = (3297 handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )3298 );3027 selMatch[ sel ] = handleObj.needsContext ? 3028 jQuery( sel, this ).index( cur ) >= 0 : 3029 jQuery.find( sel, this, null, [ cur ] ).length; 3299 3030 } 3300 3031 if ( selMatch[ sel ] ) { … … 3430 3161 } 3431 3162 3432 // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) 3433 if ( event.metaKey === undefined ) { 3434 event.metaKey = event.ctrlKey; 3435 } 3163 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) 3164 event.metaKey = !!event.metaKey; 3436 3165 3437 3166 return fixHook.filter? fixHook.filter( event, originalEvent ) : event; … … 3439 3168 3440 3169 special: { 3441 ready: {3442 // Make sure the ready event is setup3443 setup: jQuery.bindReady3444 },3445 3446 3170 load: { 3447 3171 // Prevent triggered image.load events from bubbling to window.load … … 3506 3230 } : 3507 3231 function( elem, type, handle ) { 3232 var name = "on" + type; 3233 3508 3234 if ( elem.detachEvent ) { 3509 elem.detachEvent( "on" + type, handle ); 3235 3236 // #8545, #7054, preventing memory leaks for custom events in IE6-8 – 3237 // detachEvent needed property on element, by name of that event, to properly expose it to GC 3238 if ( typeof elem[ name ] === "undefined" ) { 3239 elem[ name ] = null; 3240 } 3241 3242 elem.detachEvent( name, handle ); 3510 3243 } 3511 3244 }; … … 3604 3337 3605 3338 handle: function( event ) { 3606 var target = this, 3339 var ret, 3340 target = this, 3607 3341 related = event.relatedTarget, 3608 3342 handleObj = event.handleObj, 3609 selector = handleObj.selector, 3610 ret; 3343 selector = handleObj.selector; 3611 3344 3612 3345 // For mousenter/leave call the handler if related is outside the target. … … 3637 3370 var elem = e.target, 3638 3371 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; 3639 if ( form && ! form._submit_attached) {3372 if ( form && !jQuery._data( form, "_submit_attached" ) ) { 3640 3373 jQuery.event.add( form, "submit._submit", function( event ) { 3641 3374 event._submit_bubble = true; 3642 3375 }); 3643 form._submit_attached = true;3376 jQuery._data( form, "_submit_attached", true ); 3644 3377 } 3645 3378 }); 3646 3379 // return undefined since we don't need an event listener 3647 3380 }, 3648 3381 3649 3382 postDispatch: function( event ) { 3650 3383 // If form was submitted by the user, bubble the event up the tree … … 3689 3422 if ( this._just_changed && !event.isTrigger ) { 3690 3423 this._just_changed = false; 3691 jQuery.event.simulate( "change", this, event, true );3692 3424 } 3425 // Allow triggered, simulated change events (#11500) 3426 jQuery.event.simulate( "change", this, event, true ); 3693 3427 }); 3694 3428 } … … 3699 3433 var elem = e.target; 3700 3434 3701 if ( rformElems.test( elem.nodeName ) && ! elem._change_attached) {3435 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { 3702 3436 jQuery.event.add( elem, "change._change", function( event ) { 3703 3437 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { … … 3705 3439 } 3706 3440 }); 3707 elem._change_attached = true;3441 jQuery._data( elem, "_change_attached", true ); 3708 3442 } 3709 3443 }); … … 3722 3456 jQuery.event.remove( this, "._change" ); 3723 3457 3724 return rformElems.test( this.nodeName );3458 return !rformElems.test( this.nodeName ); 3725 3459 } 3726 3460 }; … … 3811 3545 }, 3812 3546 off: function( types, selector, fn ) { 3547 var handleObj, type; 3813 3548 if ( types && types.preventDefault && types.handleObj ) { 3814 3549 // ( event ) dispatched jQuery.Event 3815 varhandleObj = types.handleObj;3550 handleObj = types.handleObj; 3816 3551 jQuery( types.delegateTarget ).off( 3817 3552 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, … … 3823 3558 if ( typeof types === "object" ) { 3824 3559 // ( types-object [, selector] ) 3825 for ( vartype in types ) {3560 for ( type in types ) { 3826 3561 this.off( type, selector, types[ type ] ); 3827 3562 } … … 3862 3597 undelegate: function( selector, types, fn ) { 3863 3598 // ( namespace ) or ( selector, types [, fn] ) 3864 return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );3599 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); 3865 3600 }, 3866 3601 … … 3923 3658 }; 3924 3659 3925 if ( jQuery.attrFn ) {3926 jQuery.attrFn[ name ] = true;3927 }3928 3929 3660 if ( rkeyEvent.test( name ) ) { 3930 3661 jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; … … 3935 3666 } 3936 3667 }); 3937 3938 3939 3940 3668 /*! 3941 3669 * Sizzle CSS Selector Engine 3942 * Copyright 2011, The Dojo Foundation3943 * Released under the MIT, BSD, and GPL Licenses.3944 * More information:http://sizzlejs.com/3670 * Copyright 2012 jQuery Foundation and other contributors 3671 * Released under the MIT license 3672 * http://sizzlejs.com/ 3945 3673 */ 3946 (function(){ 3947 3948 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 3949 expando = "sizcache" + (Math.random() + '').replace('.', ''), 3674 (function( window, undefined ) { 3675 3676 var cachedruns, 3677 assertGetIdNotName, 3678 Expr, 3679 getText, 3680 isXML, 3681 contains, 3682 compile, 3683 sortOrder, 3684 hasDuplicate, 3685 outermostContext, 3686 3687 baseHasDuplicate = true, 3688 strundefined = "undefined", 3689 3690 expando = ( "sizcache" + Math.random() ).replace( ".", "" ), 3691 3692 Token = String, 3693 document = window.document, 3694 docElem = document.documentElement, 3695 dirruns = 0, 3950 3696 done = 0, 3951 toString = Object.prototype.toString, 3952 hasDuplicate = false, 3953 baseHasDuplicate = true, 3954 rBackslash = /\\/g, 3955 rReturn = /\r\n/g, 3956 rNonWord = /\W/; 3957 3958 // Here we check if the JavaScript engine is using some sort of 3959 // optimization where it does not always call our comparision 3960 // function. If that is the case, discard the hasDuplicate value. 3961 // Thus far that includes Google Chrome. 3962 [0, 0].sort(function() { 3963 baseHasDuplicate = false; 3964 return 0; 3965 }); 3966 3967 var Sizzle = function( selector, context, results, seed ) { 3697 pop = [].pop, 3698 push = [].push, 3699 slice = [].slice, 3700 // Use a stripped-down indexOf if a native one is unavailable 3701 indexOf = [].indexOf || function( elem ) { 3702 var i = 0, 3703 len = this.length; 3704 for ( ; i < len; i++ ) { 3705 if ( this[i] === elem ) { 3706 return i; 3707 } 3708 } 3709 return -1; 3710 }, 3711 3712 // Augment a function for special use by Sizzle 3713 markFunction = function( fn, value ) { 3714 fn[ expando ] = value == null || value; 3715 return fn; 3716 }, 3717 3718 createCache = function() { 3719 var cache = {}, 3720 keys = []; 3721 3722 return markFunction(function( key, value ) { 3723 // Only keep the most recent entries 3724 if ( keys.push( key ) > Expr.cacheLength ) { 3725 delete cache[ keys.shift() ]; 3726 } 3727 3728 return (cache[ key ] = value); 3729 }, cache ); 3730 }, 3731 3732 classCache = createCache(), 3733 tokenCache = createCache(), 3734 compilerCache = createCache(), 3735 3736 // Regex 3737 3738 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace 3739 whitespace = "[\\x20\\t\\r\\n\\f]", 3740 // http://www.w3.org/TR/css3-syntax/#characters 3741 characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", 3742 3743 // Loosely modeled on CSS identifier characters 3744 // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) 3745 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 3746 identifier = characterEncoding.replace( "w", "w#" ), 3747 3748 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors 3749 operators = "([*^$|!~]?=)", 3750 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + 3751 "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", 3752 3753 // Prefer arguments not in parens/brackets, 3754 // then attribute selectors and non-pseudos (denoted by :), 3755 // then anything else 3756 // These preferences are here to reduce the number of selectors 3757 // needing tokenize in the PSEUDO preFilter 3758 pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", 3759 3760 // For matchExpr.POS and matchExpr.needsContext 3761 pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 3762 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", 3763 3764 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 3765 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 3766 3767 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 3768 rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), 3769 rpseudo = new RegExp( pseudos ), 3770 3771 // Easily-parseable/retrievable ID or TAG or CLASS selectors 3772 rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, 3773 3774 rnot = /^:not/, 3775 rsibling = /[\x20\t\r\n\f]*[+~]/, 3776 rendsWithNot = /:not\($/, 3777 3778 rheader = /h\d/i, 3779 rinputs = /input|select|textarea|button/i, 3780 3781 rbackslash = /\\(?!\\)/g, 3782 3783 matchExpr = { 3784 "ID": new RegExp( "^#(" + characterEncoding + ")" ), 3785 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), 3786 "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), 3787 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), 3788 "ATTR": new RegExp( "^" + attributes ), 3789 "PSEUDO": new RegExp( "^" + pseudos ), 3790 "POS": new RegExp( pos, "i" ), 3791 "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + 3792 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 3793 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 3794 // For use in libraries implementing .is() 3795 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) 3796 }, 3797 3798 // Support 3799 3800 // Used for testing something on an element 3801 assert = function( fn ) { 3802 var div = document.createElement("div"); 3803 3804 try { 3805 return fn( div ); 3806 } catch (e) { 3807 return false; 3808 } finally { 3809 // release memory in IE 3810 div = null; 3811 } 3812 }, 3813 3814 // Check if getElementsByTagName("*") returns only elements 3815 assertTagNameNoComments = assert(function( div ) { 3816 div.appendChild( document.createComment("") ); 3817 return !div.getElementsByTagName("*").length; 3818 }), 3819 3820 // Check if getAttribute returns normalized href attributes 3821 assertHrefNotNormalized = assert(function( div ) { 3822 div.innerHTML = "<a href='#'></a>"; 3823 return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && 3824 div.firstChild.getAttribute("href") === "#"; 3825 }), 3826 3827 // Check if attributes should be retrieved by attribute nodes 3828 assertAttributes = assert(function( div ) { 3829 div.innerHTML = "<select></select>"; 3830 var type = typeof div.lastChild.getAttribute("multiple"); 3831 // IE8 returns a string for some attributes even when not present 3832 return type !== "boolean" && type !== "string"; 3833 }), 3834 3835 // Check if getElementsByClassName can be trusted 3836 assertUsableClassName = assert(function( div ) { 3837 // Opera can't find a second classname (in 9.6) 3838 div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; 3839 if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { 3840 return false; 3841 } 3842 3843 // Safari 3.2 caches class attributes and doesn't catch changes 3844 div.lastChild.className = "e"; 3845 return div.getElementsByClassName("e").length === 2; 3846 }), 3847 3848 // Check if getElementById returns elements by name 3849 // Check if getElementsByName privileges form controls or returns elements by ID 3850 assertUsableName = assert(function( div ) { 3851 // Inject content 3852 div.id = expando + 0; 3853 div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; 3854 docElem.insertBefore( div, docElem.firstChild ); 3855 3856 // Test 3857 var pass = document.getElementsByName && 3858 // buggy browsers will return fewer than the correct 2 3859 document.getElementsByName( expando ).length === 2 + 3860 // buggy browsers will return more than the correct 0 3861 document.getElementsByName( expando + 0 ).length; 3862 assertGetIdNotName = !document.getElementById( expando ); 3863 3864 // Cleanup 3865 docElem.removeChild( div ); 3866 3867 return pass; 3868 }); 3869 3870 // If slice is not available, provide a backup 3871 try { 3872 slice.call( docElem.childNodes, 0 )[0].nodeType; 3873 } catch ( e ) { 3874 slice = function( i ) { 3875 var elem, 3876 results = []; 3877 for ( ; (elem = this[i]); i++ ) { 3878 results.push( elem ); 3879 } 3880 return results; 3881 }; 3882 } 3883 3884 function Sizzle( selector, context, results, seed ) { 3968 3885 results = results || []; 3969 3886 context = context || document; 3970 3971 var origContext = context; 3972 3973 if ( context.nodeType !== 1 && context.nodeType !== 9 ) { 3974 return []; 3975 } 3887 var match, elem, xml, m, 3888 nodeType = context.nodeType; 3976 3889 3977 3890 if ( !selector || typeof selector !== "string" ) { … … 3979 3892 } 3980 3893 3981 var m, set, checkSet, extra, ret, cur, pop, i, 3982 prune = true, 3983 contextXML = Sizzle.isXML( context ), 3984 parts = [], 3985 soFar = selector; 3986 3987 // Reset the position of the chunker regexp (start from head) 3988 do { 3989 chunker.exec( "" ); 3990 m = chunker.exec( soFar ); 3991 3992 if ( m ) { 3993 soFar = m[3]; 3994 3995 parts.push( m[1] ); 3996 3997 if ( m[2] ) { 3998 extra = m[3]; 3999 break; 4000 } 4001 } 4002 } while ( m ); 4003 4004 if ( parts.length > 1 && origPOS.exec( selector ) ) { 4005 4006 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 4007 set = posProcess( parts[0] + parts[1], context, seed ); 4008 4009 } else { 4010 set = Expr.relative[ parts[0] ] ? 4011 [ context ] : 4012 Sizzle( parts.shift(), context ); 4013 4014 while ( parts.length ) { 4015 selector = parts.shift(); 4016 4017 if ( Expr.relative[ selector ] ) { 4018 selector += parts.shift(); 4019 } 4020 4021 set = posProcess( selector, set, seed ); 4022 } 4023 } 4024 3894 if ( nodeType !== 1 && nodeType !== 9 ) { 3895 return []; 3896 } 3897 3898 xml = isXML( context ); 3899 3900 if ( !xml && !seed ) { 3901 if ( (match = rquickExpr.exec( selector )) ) { 3902 // Speed-up: Sizzle("#ID") 3903 if ( (m = match[1]) ) { 3904 if ( nodeType === 9 ) { 3905 elem = context.getElementById( m ); 3906 // Check parentNode to catch when Blackberry 4.6 returns 3907 // nodes that are no longer in the document #6963 3908 if ( elem && elem.parentNode ) { 3909 // Handle the case where IE, Opera, and Webkit return items 3910 // by name instead of ID 3911 if ( elem.id === m ) { 3912 results.push( elem ); 3913 return results; 3914 } 3915 } else { 3916 return results; 3917 } 3918 } else { 3919 // Context is not a document 3920 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && 3921 contains( context, elem ) && elem.id === m ) { 3922 results.push( elem ); 3923 return results; 3924 } 3925 } 3926 3927 // Speed-up: Sizzle("TAG") 3928 } else if ( match[2] ) { 3929 push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); 3930 return results; 3931 3932 // Speed-up: Sizzle(".CLASS") 3933 } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { 3934 push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); 3935 return results; 3936 } 3937 } 3938 } 3939 3940 // All others 3941 return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); 3942 } 3943 3944 Sizzle.matches = function( expr, elements ) { 3945 return Sizzle( expr, null, null, elements ); 3946 }; 3947 3948 Sizzle.matchesSelector = function( elem, expr ) { 3949 return Sizzle( expr, null, null, [ elem ] ).length > 0; 3950 }; 3951 3952 // Returns a function to use in pseudos for input types 3953 function createInputPseudo( type ) { 3954 return function( elem ) { 3955 var name = elem.nodeName.toLowerCase(); 3956 return name === "input" && elem.type === type; 3957 }; 3958 } 3959 3960 // Returns a function to use in pseudos for buttons 3961 function createButtonPseudo( type ) { 3962 return function( elem ) { 3963 var name = elem.nodeName.toLowerCase(); 3964 return (name === "input" || name === "button") && elem.type === type; 3965 }; 3966 } 3967 3968 // Returns a function to use in pseudos for positionals 3969 function createPositionalPseudo( fn ) { 3970 return markFunction(function( argument ) { 3971 argument = +argument; 3972 return markFunction(function( seed, matches ) { 3973 var j, 3974 matchIndexes = fn( [], seed.length, argument ), 3975 i = matchIndexes.length; 3976 3977 // Match elements found at the specified indexes 3978 while ( i-- ) { 3979 if ( seed[ (j = matchIndexes[i]) ] ) { 3980 seed[j] = !(matches[j] = seed[j]); 3981 } 3982 } 3983 }); 3984 }); 3985 } 3986 3987 /** 3988 * Utility function for retrieving the text value of an array of DOM nodes 3989 * @param {Array|Element} elem 3990 */ 3991 getText = Sizzle.getText = function( elem ) { 3992 var node, 3993 ret = "", 3994 i = 0, 3995 nodeType = elem.nodeType; 3996 3997 if ( nodeType ) { 3998 if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 3999 // Use textContent for elements 4000 // innerText usage removed for consistency of new lines (see #11153) 4001 if ( typeof elem.textContent === "string" ) { 4002 return elem.textContent; 4003 } else { 4004 // Traverse its children 4005 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 4006 ret += getText( elem ); 4007 } 4008 } 4009 } else if ( nodeType === 3 || nodeType === 4 ) { 4010 return elem.nodeValue; 4011 } 4012 // Do not include comment or processing instruction nodes 4025 4013 } else { 4026 // Take a shortcut and set the context if the root selector is an ID 4027 // (but not if it'll be faster if the inner selector is an ID) 4028 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 4029 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { 4030 4031 ret = Sizzle.find( parts.shift(), context, contextXML ); 4032 context = ret.expr ? 4033 Sizzle.filter( ret.expr, ret.set )[0] : 4034 ret.set[0]; 4035 } 4036 4037 if ( context ) { 4038 ret = seed ? 4039 { expr: parts.pop(), set: makeArray(seed) } : 4040 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); 4041 4042 set = ret.expr ? 4043 Sizzle.filter( ret.expr, ret.set ) : 4044 ret.set; 4045 4046 if ( parts.length > 0 ) { 4047 checkSet = makeArray( set ); 4048 4049 } else { 4050 prune = false; 4051 } 4052 4053 while ( parts.length ) { 4054 cur = parts.pop(); 4055 pop = cur; 4056 4057 if ( !Expr.relative[ cur ] ) { 4058 cur = ""; 4059 } else { 4060 pop = parts.pop(); 4061 } 4062 4063 if ( pop == null ) { 4064 pop = context; 4065 } 4066 4067 Expr.relative[ cur ]( checkSet, pop, contextXML ); 4068 } 4069 4070 } else { 4071 checkSet = parts = []; 4072 } 4073 } 4074 4075 if ( !checkSet ) { 4076 checkSet = set; 4077 } 4078 4079 if ( !checkSet ) { 4080 Sizzle.error( cur || selector ); 4081 } 4082 4083 if ( toString.call(checkSet) === "[object Array]" ) { 4084 if ( !prune ) { 4085 results.push.apply( results, checkSet ); 4086 4087 } else if ( context && context.nodeType === 1 ) { 4088 for ( i = 0; checkSet[i] != null; i++ ) { 4089 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { 4090 results.push( set[i] ); 4091 } 4092 } 4093 4094 } else { 4095 for ( i = 0; checkSet[i] != null; i++ ) { 4096 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 4097 results.push( set[i] ); 4098 } 4099 } 4100 } 4101 4102 } else { 4103 makeArray( checkSet, results ); 4104 } 4105 4106 if ( extra ) { 4107 Sizzle( extra, origContext, results, seed ); 4108 Sizzle.uniqueSort( results ); 4109 } 4110 4111 return results; 4014 4015 // If no nodeType, this is expected to be an array 4016 for ( ; (node = elem[i]); i++ ) { 4017 // Do not traverse comment nodes 4018 ret += getText( node ); 4019 } 4020 } 4021 return ret; 4112 4022 }; 4113 4023 4114 Sizzle.uniqueSort = function( results ) { 4115 if ( sortOrder ) { 4116 hasDuplicate = baseHasDuplicate; 4117 results.sort( sortOrder ); 4118 4119 if ( hasDuplicate ) { 4120 for ( var i = 1; i < results.length; i++ ) { 4121 if ( results[i] === results[ i - 1 ] ) { 4122 results.splice( i--, 1 ); 4123 } 4124 } 4125 } 4126 } 4127 4128 return results; 4024 isXML = Sizzle.isXML = function( elem ) { 4025 // documentElement is verified for cases where it doesn't yet exist 4026 // (such as loading iframes in IE - #4833) 4027 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 4028 return documentElement ? documentElement.nodeName !== "HTML" : false; 4129 4029 }; 4130 4030 4131 Sizzle.matches = function( expr, set ) { 4132 return Sizzle( expr, null, null, set ); 4031 // Element contains another 4032 contains = Sizzle.contains = docElem.contains ? 4033 function( a, b ) { 4034 var adown = a.nodeType === 9 ? a.documentElement : a, 4035 bup = b && b.parentNode; 4036 return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); 4037 } : 4038 docElem.compareDocumentPosition ? 4039 function( a, b ) { 4040 return b && !!( a.compareDocumentPosition( b ) & 16 ); 4041 } : 4042 function( a, b ) { 4043 while ( (b = b.parentNode) ) { 4044 if ( b === a ) { 4045 return true; 4046 } 4047 } 4048 return false; 4049 }; 4050 4051 Sizzle.attr = function( elem, name ) { 4052 var val, 4053 xml = isXML( elem ); 4054 4055 if ( !xml ) { 4056 name = name.toLowerCase(); 4057 } 4058 if ( (val = Expr.attrHandle[ name ]) ) { 4059 return val( elem ); 4060 } 4061 if ( xml || assertAttributes ) { 4062 return elem.getAttribute( name ); 4063 } 4064 val = elem.getAttributeNode( name ); 4065 return val ? 4066 typeof elem[ name ] === "boolean" ? 4067 elem[ name ] ? name : null : 4068 val.specified ? val.value : null : 4069 null; 4133 4070 }; 4134 4071 4135 Sizzle.matchesSelector = function( node, expr ) { 4136 return Sizzle( expr, null, null, [node] ).length > 0; 4137 }; 4138 4139 Sizzle.find = function( expr, context, isXML ) { 4140 var set, i, len, match, type, left; 4141 4142 if ( !expr ) { 4143 return []; 4144 } 4145 4146 for ( i = 0, len = Expr.order.length; i < len; i++ ) { 4147 type = Expr.order[i]; 4148 4149 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { 4150 left = match[1]; 4151 match.splice( 1, 1 ); 4152 4153 if ( left.substr( left.length - 1 ) !== "\\" ) { 4154 match[1] = (match[1] || "").replace( rBackslash, "" ); 4155 set = Expr.find[ type ]( match, context, isXML ); 4156 4157 if ( set != null ) { 4158 expr = expr.replace( Expr.match[ type ], "" ); 4159 break; 4160 } 4161 } 4162 } 4163 } 4164 4165 if ( !set ) { 4166 set = typeof context.getElementsByTagName !== "undefined" ? 4167 context.getElementsByTagName( "*" ) : 4168 []; 4169 } 4170 4171 return { set: set, expr: expr }; 4172 }; 4173 4174 Sizzle.filter = function( expr, set, inplace, not ) { 4175 var match, anyFound, 4176 type, found, item, filter, left, 4177 i, pass, 4178 old = expr, 4179 result = [], 4180 curLoop = set, 4181 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); 4182 4183 while ( expr && set.length ) { 4184 for ( type in Expr.filter ) { 4185 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { 4186 filter = Expr.filter[ type ]; 4187 left = match[1]; 4188 4189 anyFound = false; 4190 4191 match.splice(1,1); 4192 4193 if ( left.substr( left.length - 1 ) === "\\" ) { 4194 continue; 4195 } 4196 4197 if ( curLoop === result ) { 4198 result = []; 4199 } 4200 4201 if ( Expr.preFilter[ type ] ) { 4202 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); 4203 4204 if ( !match ) { 4205 anyFound = found = true; 4206 4207 } else if ( match === true ) { 4208 continue; 4072 Expr = Sizzle.selectors = { 4073 4074 // Can be adjusted by the user 4075 cacheLength: 50, 4076 4077 createPseudo: markFunction, 4078 4079 match: matchExpr, 4080 4081 // IE6/7 return a modified href 4082 attrHandle: assertHrefNotNormalized ? 4083 {} : 4084 { 4085 "href": function( elem ) { 4086 return elem.getAttribute( "href", 2 ); 4087 }, 4088 "type": function( elem ) { 4089 return elem.getAttribute("type"); 4090 } 4091 }, 4092 4093 find: { 4094 "ID": assertGetIdNotName ? 4095 function( id, context, xml ) { 4096 if ( typeof context.getElementById !== strundefined && !xml ) { 4097 var m = context.getElementById( id ); 4098 // Check parentNode to catch when Blackberry 4.6 returns 4099 // nodes that are no longer in the document #6963 4100 return m && m.parentNode ? [m] : []; 4101 } 4102 } : 4103 function( id, context, xml ) { 4104 if ( typeof context.getElementById !== strundefined && !xml ) { 4105 var m = context.getElementById( id ); 4106 4107 return m ? 4108 m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? 4109 [m] : 4110 undefined : 4111 []; 4112 } 4113 }, 4114 4115 "TAG": assertTagNameNoComments ? 4116 function( tag, context ) { 4117 if ( typeof context.getElementsByTagName !== strundefined ) { 4118 return context.getElementsByTagName( tag ); 4119 } 4120 } : 4121 function( tag, context ) { 4122 var results = context.getElementsByTagName( tag ); 4123 4124 // Filter out possible comments 4125 if ( tag === "*" ) { 4126 var elem, 4127 tmp = [], 4128 i = 0; 4129 4130 for ( ; (elem = results[i]); i++ ) { 4131 if ( elem.nodeType === 1 ) { 4132 tmp.push( elem ); 4133 } 4209 4134 } 4210 } 4211 4212 if ( match ) { 4213 for ( i = 0; (item = curLoop[i]) != null; i++ ) { 4214 if ( item ) { 4215 found = filter( item, match, i, curLoop ); 4216 pass = not ^ found; 4217 4218 if ( inplace && found != null ) { 4219 if ( pass ) { 4220 anyFound = true; 4221 4222 } else { 4223 curLoop[i] = false; 4135 4136 return tmp; 4137 } 4138 return results; 4139 }, 4140 4141 "NAME": assertUsableName && function( tag, context ) { 4142 if ( typeof context.getElementsByName !== strundefined ) { 4143 return context.getElementsByName( name ); 4144 } 4145 }, 4146 4147 "CLASS": assertUsableClassName && function( className, context, xml ) { 4148 if ( typeof context.getElementsByClassName !== strundefined && !xml ) { 4149 return context.getElementsByClassName( className ); 4150 } 4151 } 4152 }, 4153 4154 relative: { 4155 ">": { dir: "parentNode", first: true }, 4156 " ": { dir: "parentNode" }, 4157 "+": { dir: "previousSibling", first: true }, 4158 "~": { dir: "previousSibling" } 4159 }, 4160 4161 preFilter: { 4162 "ATTR": function( match ) { 4163 match[1] = match[1].replace( rbackslash, "" ); 4164 4165 // Move the given value to match[3] whether quoted or unquoted 4166 match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); 4167 4168 if ( match[2] === "~=" ) { 4169 match[3] = " " + match[3] + " "; 4170 } 4171 4172 return match.slice( 0, 4 ); 4173 }, 4174 4175 "CHILD": function( match ) { 4176 /* matches from matchExpr["CHILD"] 4177 1 type (only|nth|...) 4178 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4179 3 xn-component of xn+y argument ([+-]?\d*n|) 4180 4 sign of xn-component 4181 5 x of xn-component 4182 6 sign of y-component 4183 7 y of y-component 4184 */ 4185 match[1] = match[1].toLowerCase(); 4186 4187 if ( match[1] === "nth" ) { 4188 // nth-child requires argument 4189 if ( !match[2] ) { 4190 Sizzle.error( match[0] ); 4191 } 4192 4193 // numeric x and y parameters for Expr.filter.CHILD 4194 // remember that false/true cast respectively to 0/1 4195 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); 4196 match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); 4197 4198 // other types prohibit arguments 4199 } else if ( match[2] ) { 4200 Sizzle.error( match[0] ); 4201 } 4202 4203 return match; 4204 }, 4205 4206 "PSEUDO": function( match ) { 4207 var unquoted, excess; 4208 if ( matchExpr["CHILD"].test( match[0] ) ) { 4209 return null; 4210 } 4211 4212 if ( match[3] ) { 4213 match[2] = match[3]; 4214 } else if ( (unquoted = match[4]) ) { 4215 // Only check arguments that contain a pseudo 4216 if ( rpseudo.test(unquoted) && 4217 // Get excess from tokenize (recursively) 4218 (excess = tokenize( unquoted, true )) && 4219 // advance to the next closing parenthesis 4220 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 4221 4222 // excess is a negative index 4223 unquoted = unquoted.slice( 0, excess ); 4224 match[0] = match[0].slice( 0, excess ); 4225 } 4226 match[2] = unquoted; 4227 } 4228 4229 // Return only captures needed by the pseudo filter method (type and argument) 4230 return match.slice( 0, 3 ); 4231 } 4232 }, 4233 4234 filter: { 4235 "ID": assertGetIdNotName ? 4236 function( id ) { 4237 id = id.replace( rbackslash, "" ); 4238 return function( elem ) { 4239 return elem.getAttribute("id") === id; 4240 }; 4241 } : 4242 function( id ) { 4243 id = id.replace( rbackslash, "" ); 4244 return function( elem ) { 4245 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); 4246 return node && node.value === id; 4247 }; 4248 }, 4249 4250 "TAG": function( nodeName ) { 4251 if ( nodeName === "*" ) { 4252 return function() { return true; }; 4253 } 4254 nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); 4255 4256 return function( elem ) { 4257 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 4258 }; 4259 }, 4260 4261 "CLASS": function( className ) { 4262 var pattern = classCache[ expando ][ className ]; 4263 if ( !pattern ) { 4264 pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") ); 4265 } 4266 return function( elem ) { 4267 return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); 4268 }; 4269 }, 4270 4271 "ATTR": function( name, operator, check ) { 4272 return function( elem, context ) { 4273 var result = Sizzle.attr( elem, name ); 4274 4275 if ( result == null ) { 4276 return operator === "!="; 4277 } 4278 if ( !operator ) { 4279 return true; 4280 } 4281 4282 result += ""; 4283 4284 return operator === "=" ? result === check : 4285 operator === "!=" ? result !== check : 4286 operator === "^=" ? check && result.indexOf( check ) === 0 : 4287 operator === "*=" ? check && result.indexOf( check ) > -1 : 4288 operator === "$=" ? check && result.substr( result.length - check.length ) === check : 4289 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : 4290 operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : 4291 false; 4292 }; 4293 }, 4294 4295 "CHILD": function( type, argument, first, last ) { 4296 4297 if ( type === "nth" ) { 4298 return function( elem ) { 4299 var node, diff, 4300 parent = elem.parentNode; 4301 4302 if ( first === 1 && last === 0 ) { 4303 return true; 4304 } 4305 4306 if ( parent ) { 4307 diff = 0; 4308 for ( node = parent.firstChild; node; node = node.nextSibling ) { 4309 if ( node.nodeType === 1 ) { 4310 diff++; 4311 if ( elem === node ) { 4312 break; 4224 4313 } 4225 4226 } else if ( pass ) {4227 result.push( item );4228 anyFound = true;4229 4314 } 4230 4315 } 4231 4316 } 4232 } 4233 4234 if ( found !== undefined ) { 4235 if ( !inplace ) { 4236 curLoop = result; 4317 4318 // Incorporate the offset (or cast to NaN), then check against cycle size 4319 diff -= last; 4320 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 4321 }; 4322 } 4323 4324 return function( elem ) { 4325 var node = elem; 4326 4327 switch ( type ) { 4328 case "only": 4329 case "first": 4330 while ( (node = node.previousSibling) ) { 4331 if ( node.nodeType === 1 ) { 4332 return false; 4333 } 4334 } 4335 4336 if ( type === "first" ) { 4337 return true; 4338 } 4339 4340 node = elem; 4341 4342 /* falls through */ 4343 case "last": 4344 while ( (node = node.nextSibling) ) { 4345 if ( node.nodeType === 1 ) { 4346 return false; 4347 } 4348 } 4349 4350 return true; 4351 } 4352 }; 4353 }, 4354 4355 "PSEUDO": function( pseudo, argument ) { 4356 // pseudo-class names are case-insensitive 4357 // http://www.w3.org/TR/selectors/#pseudo-classes 4358 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 4359 // Remember that setFilters inherits from pseudos 4360 var args, 4361 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 4362 Sizzle.error( "unsupported pseudo: " + pseudo ); 4363 4364 // The user may use createPseudo to indicate that 4365 // arguments are needed to create the filter function 4366 // just as Sizzle does 4367 if ( fn[ expando ] ) { 4368 return fn( argument ); 4369 } 4370 4371 // But maintain support for old signatures 4372 if ( fn.length > 1 ) { 4373 args = [ pseudo, pseudo, "", argument ]; 4374 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 4375 markFunction(function( seed, matches ) { 4376 var idx, 4377 matched = fn( seed, argument ), 4378 i = matched.length; 4379 while ( i-- ) { 4380 idx = indexOf.call( seed, matched[i] ); 4381 seed[ idx ] = !( matches[ idx ] = matched[i] ); 4382 } 4383 }) : 4384 function( elem ) { 4385 return fn( elem, 0, args ); 4386 }; 4387 } 4388 4389 return fn; 4390 } 4391 }, 4392 4393 pseudos: { 4394 "not": markFunction(function( selector ) { 4395 // Trim the selector passed to compile 4396 // to avoid treating leading and trailing 4397 // spaces as combinators 4398 var input = [], 4399 results = [], 4400 matcher = compile( selector.replace( rtrim, "$1" ) ); 4401 4402 return matcher[ expando ] ? 4403 markFunction(function( seed, matches, context, xml ) { 4404 var elem, 4405 unmatched = matcher( seed, null, xml, [] ), 4406 i = seed.length; 4407 4408 // Match elements unmatched by `matcher` 4409 while ( i-- ) { 4410 if ( (elem = unmatched[i]) ) { 4411 seed[i] = !(matches[i] = elem); 4412 } 4237 4413 } 4238 4239 expr = expr.replace( Expr.match[ type ], "" ); 4240 4241 if ( !anyFound ) { 4242 return []; 4243 } 4244 4245 break; 4246 } 4247 } 4248 } 4249 4250 // Improper expression 4251 if ( expr === old ) { 4252 if ( anyFound == null ) { 4253 Sizzle.error( expr ); 4254 4255 } else { 4256 break; 4257 } 4258 } 4259 4260 old = expr; 4261 } 4262 4263 return curLoop; 4264 }; 4265 4266 Sizzle.error = function( msg ) { 4267 throw new Error( "Syntax error, unrecognized expression: " + msg ); 4268 }; 4269 4270 /** 4271 * Utility function for retreiving the text value of an array of DOM nodes 4272 * @param {Array|Element} elem 4273 */ 4274 var getText = Sizzle.getText = function( elem ) { 4275 var i, node, 4276 nodeType = elem.nodeType, 4277 ret = ""; 4278 4279 if ( nodeType ) { 4280 if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 4281 // Use textContent || innerText for elements 4282 if ( typeof elem.textContent === 'string' ) { 4283 return elem.textContent; 4284 } else if ( typeof elem.innerText === 'string' ) { 4285 // Replace IE's carriage returns 4286 return elem.innerText.replace( rReturn, '' ); 4287 } else { 4288 // Traverse it's children 4289 for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { 4290 ret += getText( elem ); 4291 } 4292 } 4293 } else if ( nodeType === 3 || nodeType === 4 ) { 4294 return elem.nodeValue; 4295 } 4296 } else { 4297 4298 // If no nodeType, this is expected to be an array 4299 for ( i = 0; (node = elem[i]); i++ ) { 4300 // Do not traverse comment nodes 4301 if ( node.nodeType !== 8 ) { 4302 ret += getText( node ); 4303 } 4304 } 4305 } 4306 return ret; 4307 }; 4308 4309 var Expr = Sizzle.selectors = { 4310 order: [ "ID", "NAME", "TAG" ], 4311 4312 match: { 4313 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4314 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, 4315 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, 4316 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, 4317 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, 4318 CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, 4319 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, 4320 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ 4321 }, 4322 4323 leftMatch: {}, 4324 4325 attrMap: { 4326 "class": "className", 4327 "for": "htmlFor" 4328 }, 4329 4330 attrHandle: { 4331 href: function( elem ) { 4332 return elem.getAttribute( "href" ); 4414 }) : 4415 function( elem, context, xml ) { 4416 input[0] = elem; 4417 matcher( input, null, xml, results ); 4418 return !results.pop(); 4419 }; 4420 }), 4421 4422 "has": markFunction(function( selector ) { 4423 return function( elem ) { 4424 return Sizzle( selector, elem ).length > 0; 4425 }; 4426 }), 4427 4428 "contains": markFunction(function( text ) { 4429 return function( elem ) { 4430 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 4431 }; 4432 }), 4433 4434 "enabled": function( elem ) { 4435 return elem.disabled === false; 4333 4436 }, 4334 type: function( elem ) { 4335 return elem.getAttribute( "type" ); 4336 } 4337 }, 4338 4339 relative: { 4340 "+": function(checkSet, part){ 4341 var isPartStr = typeof part === "string", 4342 isTag = isPartStr && !rNonWord.test( part ), 4343 isPartStrNotTag = isPartStr && !isTag; 4344 4345 if ( isTag ) { 4346 part = part.toLowerCase(); 4347 } 4348 4349 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { 4350 if ( (elem = checkSet[i]) ) { 4351 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} 4352 4353 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? 4354 elem || false : 4355 elem === part; 4356 } 4357 } 4358 4359 if ( isPartStrNotTag ) { 4360 Sizzle.filter( part, checkSet, true ); 4361 } 4362 }, 4363 4364 ">": function( checkSet, part ) { 4365 var elem, 4366 isPartStr = typeof part === "string", 4367 i = 0, 4368 l = checkSet.length; 4369 4370 if ( isPartStr && !rNonWord.test( part ) ) { 4371 part = part.toLowerCase(); 4372 4373 for ( ; i < l; i++ ) { 4374 elem = checkSet[i]; 4375 4376 if ( elem ) { 4377 var parent = elem.parentNode; 4378 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; 4379 } 4380 } 4381 4382 } else { 4383 for ( ; i < l; i++ ) { 4384 elem = checkSet[i]; 4385 4386 if ( elem ) { 4387 checkSet[i] = isPartStr ? 4388 elem.parentNode : 4389 elem.parentNode === part; 4390 } 4391 } 4392 4393 if ( isPartStr ) { 4394 Sizzle.filter( part, checkSet, true ); 4395 } 4396 } 4397 }, 4398 4399 "": function(checkSet, part, isXML){ 4400 var nodeCheck, 4401 doneName = done++, 4402 checkFn = dirCheck; 4403 4404 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4405 part = part.toLowerCase(); 4406 nodeCheck = part; 4407 checkFn = dirNodeCheck; 4408 } 4409 4410 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); 4411 }, 4412 4413 "~": function( checkSet, part, isXML ) { 4414 var nodeCheck, 4415 doneName = done++, 4416 checkFn = dirCheck; 4417 4418 if ( typeof part === "string" && !rNonWord.test( part ) ) { 4419 part = part.toLowerCase(); 4420 nodeCheck = part; 4421 checkFn = dirNodeCheck; 4422 } 4423 4424 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); 4425 } 4426 }, 4427 4428 find: { 4429 ID: function( match, context, isXML ) { 4430 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4431 var m = context.getElementById(match[1]); 4432 // Check parentNode to catch when Blackberry 4.6 returns 4433 // nodes that are no longer in the document #6963 4434 return m && m.parentNode ? [m] : []; 4435 } 4436 }, 4437 4438 NAME: function( match, context ) { 4439 if ( typeof context.getElementsByName !== "undefined" ) { 4440 var ret = [], 4441 results = context.getElementsByName( match[1] ); 4442 4443 for ( var i = 0, l = results.length; i < l; i++ ) { 4444 if ( results[i].getAttribute("name") === match[1] ) { 4445 ret.push( results[i] ); 4446 } 4447 } 4448 4449 return ret.length === 0 ? null : ret; 4450 } 4451 }, 4452 4453 TAG: function( match, context ) { 4454 if ( typeof context.getElementsByTagName !== "undefined" ) { 4455 return context.getElementsByTagName( match[1] ); 4456 } 4457 } 4458 }, 4459 preFilter: { 4460 CLASS: function( match, curLoop, inplace, result, not, isXML ) { 4461 match = " " + match[1].replace( rBackslash, "" ) + " "; 4462 4463 if ( isXML ) { 4464 return match; 4465 } 4466 4467 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { 4468 if ( elem ) { 4469 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { 4470 if ( !inplace ) { 4471 result.push( elem ); 4472 } 4473 4474 } else if ( inplace ) { 4475 curLoop[i] = false; 4476 } 4477 } 4478 } 4479 4480 return false; 4481 }, 4482 4483 ID: function( match ) { 4484 return match[1].replace( rBackslash, "" ); 4485 }, 4486 4487 TAG: function( match, curLoop ) { 4488 return match[1].replace( rBackslash, "" ).toLowerCase(); 4489 }, 4490 4491 CHILD: function( match ) { 4492 if ( match[1] === "nth" ) { 4493 if ( !match[2] ) { 4494 Sizzle.error( match[0] ); 4495 } 4496 4497 match[2] = match[2].replace(/^\+|\s*/g, ''); 4498 4499 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 4500 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( 4501 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || 4502 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 4503 4504 // calculate the numbers (first)n+(last) including if they are negative 4505 match[2] = (test[1] + (test[2] || 1)) - 0; 4506 match[3] = test[3] - 0; 4507 } 4508 else if ( match[2] ) { 4509 Sizzle.error( match[0] ); 4510 } 4511 4512 // TODO: Move to normal caching system 4513 match[0] = done++; 4514 4515 return match; 4516 }, 4517 4518 ATTR: function( match, curLoop, inplace, result, not, isXML ) { 4519 var name = match[1] = match[1].replace( rBackslash, "" ); 4520 4521 if ( !isXML && Expr.attrMap[name] ) { 4522 match[1] = Expr.attrMap[name]; 4523 } 4524 4525 // Handle if an un-quoted value was used 4526 match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); 4527 4528 if ( match[2] === "~=" ) { 4529 match[4] = " " + match[4] + " "; 4530 } 4531 4532 return match; 4533 }, 4534 4535 PSEUDO: function( match, curLoop, inplace, result, not ) { 4536 if ( match[1] === "not" ) { 4537 // If we're dealing with a complex expression, or a simple one 4538 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { 4539 match[3] = Sizzle(match[3], null, null, curLoop); 4540 4541 } else { 4542 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 4543 4544 if ( !inplace ) { 4545 result.push.apply( result, ret ); 4546 } 4547 4548 return false; 4549 } 4550 4551 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { 4552 return true; 4553 } 4554 4555 return match; 4556 }, 4557 4558 POS: function( match ) { 4559 match.unshift( true ); 4560 4561 return match; 4562 } 4563 }, 4564 4565 filters: { 4566 enabled: function( elem ) { 4567 return elem.disabled === false && elem.type !== "hidden"; 4568 }, 4569 4570 disabled: function( elem ) { 4437 4438 "disabled": function( elem ) { 4571 4439 return elem.disabled === true; 4572 4440 }, 4573 4441 4574 checked: function( elem ) { 4575 return elem.checked === true; 4442 "checked": function( elem ) { 4443 // In CSS3, :checked should return both checked and selected elements 4444 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 4445 var nodeName = elem.nodeName.toLowerCase(); 4446 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 4576 4447 }, 4577 4448 4578 selected: function( elem ) {4449 "selected": function( elem ) { 4579 4450 // Accessing this property makes selected-by-default 4580 4451 // options in Safari work properly … … 4586 4457 }, 4587 4458 4588 parent: function( elem ) {4589 return ! !elem.firstChild;4459 "parent": function( elem ) { 4460 return !Expr.pseudos["empty"]( elem ); 4590 4461 }, 4591 4462 4592 empty: function( elem ) { 4593 return !elem.firstChild; 4463 "empty": function( elem ) { 4464 // http://www.w3.org/TR/selectors/#empty-pseudo 4465 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), 4466 // not comment, processing instructions, or others 4467 // Thanks to Diego Perini for the nodeName shortcut 4468 // Greater than "@" means alpha characters (specifically not starting with "#" or "?") 4469 var nodeType; 4470 elem = elem.firstChild; 4471 while ( elem ) { 4472 if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { 4473 return false; 4474 } 4475 elem = elem.nextSibling; 4476 } 4477 return true; 4594 4478 }, 4595 4479 4596 has: function( elem, i, match) {4597 return !!Sizzle( match[3], elem ).length;4480 "header": function( elem ) { 4481 return rheader.test( elem.nodeName ); 4598 4482 }, 4599 4483 4600 header: function( elem ) { 4601 return (/h\d/i).test( elem.nodeName ); 4602 }, 4603 4604 text: function( elem ) { 4605 var attr = elem.getAttribute( "type" ), type = elem.type; 4484 "text": function( elem ) { 4485 var type, attr; 4606 4486 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) 4607 4487 // use getAttribute instead to test this case 4608 return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); 4488 return elem.nodeName.toLowerCase() === "input" && 4489 (type = elem.type) === "text" && 4490 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); 4609 4491 }, 4610 4492 4611 radio: function( elem ) { 4612 return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; 4493 // Input types 4494 "radio": createInputPseudo("radio"), 4495 "checkbox": createInputPseudo("checkbox"), 4496 "file": createInputPseudo("file"), 4497 "password": createInputPseudo("password"), 4498 "image": createInputPseudo("image"), 4499 4500 "submit": createButtonPseudo("submit"), 4501 "reset": createButtonPseudo("reset"), 4502 4503 "button": function( elem ) { 4504 var name = elem.nodeName.toLowerCase(); 4505 return name === "input" && elem.type === "button" || name === "button"; 4613 4506 }, 4614 4507 4615 checkbox: function( elem ) {4616 return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;4508 "input": function( elem ) { 4509 return rinputs.test( elem.nodeName ); 4617 4510 }, 4618 4511 4619 file: function( elem ) { 4620 return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; 4512 "focus": function( elem ) { 4513 var doc = elem.ownerDocument; 4514 return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href); 4621 4515 }, 4622 4516 4623 password: function( elem ) {4624 return elem .nodeName.toLowerCase() === "input" && "password" === elem.type;4517 "active": function( elem ) { 4518 return elem === elem.ownerDocument.activeElement; 4625 4519 }, 4626 4520 4627 submit: function( elem ) { 4628 var name = elem.nodeName.toLowerCase(); 4629 return (name === "input" || name === "button") && "submit" === elem.type; 4630 }, 4631 4632 image: function( elem ) { 4633 return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; 4634 }, 4635 4636 reset: function( elem ) { 4637 var name = elem.nodeName.toLowerCase(); 4638 return (name === "input" || name === "button") && "reset" === elem.type; 4639 }, 4640 4641 button: function( elem ) { 4642 var name = elem.nodeName.toLowerCase(); 4643 return name === "input" && "button" === elem.type || name === "button"; 4644 }, 4645 4646 input: function( elem ) { 4647 return (/input|select|textarea|button/i).test( elem.nodeName ); 4648 }, 4649 4650 focus: function( elem ) { 4651 return elem === elem.ownerDocument.activeElement; 4652 } 4653 }, 4654 setFilters: { 4655 first: function( elem, i ) { 4656 return i === 0; 4657 }, 4658 4659 last: function( elem, i, match, array ) { 4660 return i === array.length - 1; 4661 }, 4662 4663 even: function( elem, i ) { 4664 return i % 2 === 0; 4665 }, 4666 4667 odd: function( elem, i ) { 4668 return i % 2 === 1; 4669 }, 4670 4671 lt: function( elem, i, match ) { 4672 return i < match[3] - 0; 4673 }, 4674 4675 gt: function( elem, i, match ) { 4676 return i > match[3] - 0; 4677 }, 4678 4679 nth: function( elem, i, match ) { 4680 return match[3] - 0 === i; 4681 }, 4682 4683 eq: function( elem, i, match ) { 4684 return match[3] - 0 === i; 4685 } 4686 }, 4687 filter: { 4688 PSEUDO: function( elem, match, i, array ) { 4689 var name = match[1], 4690 filter = Expr.filters[ name ]; 4691 4692 if ( filter ) { 4693 return filter( elem, i, match, array ); 4694 4695 } else if ( name === "contains" ) { 4696 return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; 4697 4698 } else if ( name === "not" ) { 4699 var not = match[3]; 4700 4701 for ( var j = 0, l = not.length; j < l; j++ ) { 4702 if ( not[j] === elem ) { 4703 return false; 4704 } 4705 } 4706 4707 return true; 4708 4709 } else { 4710 Sizzle.error( name ); 4711 } 4712 }, 4713 4714 CHILD: function( elem, match ) { 4715 var first, last, 4716 doneName, parent, cache, 4717 count, diff, 4718 type = match[1], 4719 node = elem; 4720 4721 switch ( type ) { 4722 case "only": 4723 case "first": 4724 while ( (node = node.previousSibling) ) { 4725 if ( node.nodeType === 1 ) { 4726 return false; 4727 } 4728 } 4729 4730 if ( type === "first" ) { 4731 return true; 4732 } 4733 4734 node = elem; 4735 4736 /* falls through */ 4737 case "last": 4738 while ( (node = node.nextSibling) ) { 4739 if ( node.nodeType === 1 ) { 4740 return false; 4741 } 4742 } 4743 4744 return true; 4745 4746 case "nth": 4747 first = match[2]; 4748 last = match[3]; 4749 4750 if ( first === 1 && last === 0 ) { 4751 return true; 4752 } 4753 4754 doneName = match[0]; 4755 parent = elem.parentNode; 4756 4757 if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { 4758 count = 0; 4759 4760 for ( node = parent.firstChild; node; node = node.nextSibling ) { 4761 if ( node.nodeType === 1 ) { 4762 node.nodeIndex = ++count; 4763 } 4764 } 4765 4766 parent[ expando ] = doneName; 4767 } 4768 4769 diff = elem.nodeIndex - last; 4770 4771 if ( first === 0 ) { 4772 return diff === 0; 4773 4774 } else { 4775 return ( diff % first === 0 && diff / first >= 0 ); 4776 } 4777 } 4778 }, 4779 4780 ID: function( elem, match ) { 4781 return elem.nodeType === 1 && elem.getAttribute("id") === match; 4782 }, 4783 4784 TAG: function( elem, match ) { 4785 return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; 4786 }, 4787 4788 CLASS: function( elem, match ) { 4789 return (" " + (elem.className || elem.getAttribute("class")) + " ") 4790 .indexOf( match ) > -1; 4791 }, 4792 4793 ATTR: function( elem, match ) { 4794 var name = match[1], 4795 result = Sizzle.attr ? 4796 Sizzle.attr( elem, name ) : 4797 Expr.attrHandle[ name ] ? 4798 Expr.attrHandle[ name ]( elem ) : 4799 elem[ name ] != null ? 4800 elem[ name ] : 4801 elem.getAttribute( name ), 4802 value = result + "", 4803 type = match[2], 4804 check = match[4]; 4805 4806 return result == null ? 4807 type === "!=" : 4808 !type && Sizzle.attr ? 4809 result != null : 4810 type === "=" ? 4811 value === check : 4812 type === "*=" ? 4813 value.indexOf(check) >= 0 : 4814 type === "~=" ? 4815 (" " + value + " ").indexOf(check) >= 0 : 4816 !check ? 4817 value && result !== false : 4818 type === "!=" ? 4819 value !== check : 4820 type === "^=" ? 4821 value.indexOf(check) === 0 : 4822 type === "$=" ? 4823 value.substr(value.length - check.length) === check : 4824 type === "|=" ? 4825 value === check || value.substr(0, check.length + 1) === check + "-" : 4826 false; 4827 }, 4828 4829 POS: function( elem, match, i, array ) { 4830 var name = match[2], 4831 filter = Expr.setFilters[ name ]; 4832 4833 if ( filter ) { 4834 return filter( elem, i, match, array ); 4835 } 4836 } 4521 // Positional types 4522 "first": createPositionalPseudo(function( matchIndexes, length, argument ) { 4523 return [ 0 ]; 4524 }), 4525 4526 "last": createPositionalPseudo(function( matchIndexes, length, argument ) { 4527 return [ length - 1 ]; 4528 }), 4529 4530 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 4531 return [ argument < 0 ? argument + length : argument ]; 4532 }), 4533 4534 "even": createPositionalPseudo(function( matchIndexes, length, argument ) { 4535 for ( var i = 0; i < length; i += 2 ) { 4536 matchIndexes.push( i ); 4537 } 4538 return matchIndexes; 4539 }), 4540 4541 "odd": createPositionalPseudo(function( matchIndexes, length, argument ) { 4542 for ( var i = 1; i < length; i += 2 ) { 4543 matchIndexes.push( i ); 4544 } 4545 return matchIndexes; 4546 }), 4547 4548 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 4549 for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { 4550 matchIndexes.push( i ); 4551 } 4552 return matchIndexes; 4553 }), 4554 4555 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 4556 for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { 4557 matchIndexes.push( i ); 4558 } 4559 return matchIndexes; 4560 }) 4837 4561 } 4838 4562 }; 4839 4563 4840 var origPOS = Expr.match.POS, 4841 fescape = function(all, num){ 4842 return "\\" + (num - 0 + 1); 4843 }; 4844 4845 for ( var type in Expr.match ) { 4846 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); 4847 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); 4564 function siblingCheck( a, b, ret ) { 4565 if ( a === b ) { 4566 return ret; 4567 } 4568 4569 var cur = a.nextSibling; 4570 4571 while ( cur ) { 4572 if ( cur === b ) { 4573 return -1; 4574 } 4575 4576 cur = cur.nextSibling; 4577 } 4578 4579 return 1; 4848 4580 } 4849 // Expose origPOS 4850 // "global" as in regardless of relation to brackets/parens 4851 Expr.match.globalPOS = origPOS; 4852 4853 var makeArray = function( array, results ) { 4854 array = Array.prototype.slice.call( array, 0 ); 4855 4856 if ( results ) { 4857 results.push.apply( results, array ); 4858 return results; 4859 } 4860 4861 return array; 4862 }; 4863 4864 // Perform a simple check to determine if the browser is capable of 4865 // converting a NodeList to an array using builtin methods. 4866 // Also verifies that the returned array holds DOM nodes 4867 // (which is not the case in the Blackberry browser) 4868 try { 4869 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; 4870 4871 // Provide a fallback method if it does not work 4872 } catch( e ) { 4873 makeArray = function( array, results ) { 4874 var i = 0, 4875 ret = results || []; 4876 4877 if ( toString.call(array) === "[object Array]" ) { 4878 Array.prototype.push.apply( ret, array ); 4879 4880 } else { 4881 if ( typeof array.length === "number" ) { 4882 for ( var l = array.length; i < l; i++ ) { 4883 ret.push( array[i] ); 4884 } 4885 4886 } else { 4887 for ( ; array[i]; i++ ) { 4888 ret.push( array[i] ); 4889 } 4890 } 4891 } 4892 4893 return ret; 4894 }; 4895 } 4896 4897 var sortOrder, siblingCheck; 4898 4899 if ( document.documentElement.compareDocumentPosition ) { 4900 sortOrder = function( a, b ) { 4581 4582 sortOrder = docElem.compareDocumentPosition ? 4583 function( a, b ) { 4901 4584 if ( a === b ) { 4902 4585 hasDuplicate = true; … … 4904 4587 } 4905 4588 4906 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { 4907 return a.compareDocumentPosition ? -1 : 1; 4908 } 4909 4910 return a.compareDocumentPosition(b) & 4 ? -1 : 1; 4911 }; 4912 4913 } else { 4914 sortOrder = function( a, b ) { 4589 return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? 4590 a.compareDocumentPosition : 4591 a.compareDocumentPosition(b) & 4 4592 ) ? -1 : 1; 4593 } : 4594 function( a, b ) { 4915 4595 // The nodes are identical, we can exit early 4916 4596 if ( a === b ) { … … 4972 4652 }; 4973 4653 4974 siblingCheck = function( a, b, ret ) { 4975 if ( a === b ) { 4976 return ret; 4977 } 4978 4979 var cur = a.nextSibling; 4980 4981 while ( cur ) { 4982 if ( cur === b ) { 4983 return -1; 4984 } 4985 4986 cur = cur.nextSibling; 4987 } 4988 4989 return 1; 4990 }; 4654 // Always assume the presence of duplicates if sort doesn't 4655 // pass them to our comparison function (as in Google Chrome). 4656 [0, 0].sort( sortOrder ); 4657 baseHasDuplicate = !hasDuplicate; 4658 4659 // Document sorting and removing duplicates 4660 Sizzle.uniqueSort = function( results ) { 4661 var elem, 4662 i = 1; 4663 4664 hasDuplicate = baseHasDuplicate; 4665 results.sort( sortOrder ); 4666 4667 if ( hasDuplicate ) { 4668 for ( ; (elem = results[i]); i++ ) { 4669 if ( elem === results[ i - 1 ] ) { 4670 results.splice( i--, 1 ); 4671 } 4672 } 4673 } 4674 4675 return results; 4676 }; 4677 4678 Sizzle.error = function( msg ) { 4679 throw new Error( "Syntax error, unrecognized expression: " + msg ); 4680 }; 4681 4682 function tokenize( selector, parseOnly ) { 4683 var matched, match, tokens, type, soFar, groups, preFilters, 4684 cached = tokenCache[ expando ][ selector ]; 4685 4686 if ( cached ) { 4687 return parseOnly ? 0 : cached.slice( 0 ); 4688 } 4689 4690 soFar = selector; 4691 groups = []; 4692 preFilters = Expr.preFilter; 4693 4694 while ( soFar ) { 4695 4696 // Comma and first run 4697 if ( !matched || (match = rcomma.exec( soFar )) ) { 4698 if ( match ) { 4699 soFar = soFar.slice( match[0].length ); 4700 } 4701 groups.push( tokens = [] ); 4702 } 4703 4704 matched = false; 4705 4706 // Combinators 4707 if ( (match = rcombinators.exec( soFar )) ) { 4708 tokens.push( matched = ne