1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <title>PowerTOP report</title>
5 <meta http-equiv="content-type" content="text/html;charset=utf-8">
6 <script type="text/javascript">
8 * jQuery JavaScript Library v1.8.0
12 * http://sizzlejs.com/
14 * Copyright 2012 jQuery Foundation and other contributors
15 * Released under the MIT license
16 * http://jquery.org/license
18 * Date: Thu Aug 09 2012 16:24:48 GMT-0400 (Eastern Daylight Time)
20 (function( window, undefined ) {
22 // A central reference to the root jQuery(document)
25 // The deferred used on DOM ready
28 // Use the correct document accordingly with window argument (sandbox)
29 document = window.document,
30 location = window.location,
31 navigator = window.navigator,
33 // Map over jQuery in case of overwrite
34 _jQuery = window.jQuery,
36 // Map over the $ in case of overwrite
39 // Save a reference to some core methods
40 core_push = Array.prototype.push,
41 core_slice = Array.prototype.slice,
42 core_indexOf = Array.prototype.indexOf,
43 core_toString = Object.prototype.toString,
44 core_hasOwn = Object.prototype.hasOwnProperty,
45 core_trim = String.prototype.trim,
47 // Define a local copy of jQuery
48 jQuery = function( selector, context ) {
49 // The jQuery object is actually just the init constructor 'enhanced'
50 return new jQuery.fn.init( selector, context, rootjQuery );
53 // Used for matching numbers
54 core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
56 // Used for detecting and trimming whitespace
57 core_rnotwhite = /\S/,
60 // IE doesn't match non-breaking spaces with \s
61 rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
63 // A simple way to check for HTML strings
64 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
65 rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
67 // Match a standalone tag
68 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
71 rvalidchars = /^[\],:{}\s]*$/,
72 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
73 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
74 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
76 // Matches dashed string for camelizing
78 rdashAlpha = /-([\da-z])/gi,
80 // Used by jQuery.camelCase as callback to replace()
81 fcamelCase = function( all, letter ) {
82 return ( letter + "" ).toUpperCase();
85 // The ready event handler and self cleanup method
86 DOMContentLoaded = function() {
87 if ( document.addEventListener ) {
88 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
90 } else if ( document.readyState === "complete" ) {
91 // we're here because readyState === "complete" in oldIE
92 // which is good enough for us to call the dom ready!
93 document.detachEvent( "onreadystatechange", DOMContentLoaded );
98 // [[Class]] -> type pairs
101 jQuery.fn = jQuery.prototype = {
103 init: function( selector, context, rootjQuery ) {
104 var match, elem, ret, doc;
106 // Handle $(""), $(null), $(undefined), $(false)
111 // Handle $(DOMElement)
112 if ( selector.nodeType ) {
113 this.context = this[0] = selector;
118 // Handle HTML strings
119 if ( typeof selector === "string" ) {
120 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
121 // Assume that strings that start and end with <> are HTML and skip the regex check
122 match = [ null, selector, null ];
125 match = rquickExpr.exec( selector );
128 // Match html or make sure no context is specified for #id
129 if ( match && (match[1] || !context) ) {
131 // HANDLE: $(html) -> $(array)
133 context = context instanceof jQuery ? context[0] : context;
134 doc = ( context && context.nodeType ? context.ownerDocument || context : document );
136 // scripts is true for back-compat
137 selector = jQuery.parseHTML( match[1], doc, true );
138 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
139 this.attr.call( selector, context, true );
142 return jQuery.merge( this, selector );
146 elem = document.getElementById( match[2] );
148 // Check parentNode to catch when Blackberry 4.6 returns
149 // nodes that are no longer in the document #6963
150 if ( elem && elem.parentNode ) {
151 // Handle the case where IE and Opera return items
152 // by name instead of ID
153 if ( elem.id !== match[2] ) {
154 return rootjQuery.find( selector );
157 // Otherwise, we inject the element directly into the jQuery object
162 this.context = document;
163 this.selector = selector;
167 // HANDLE: $(expr, $(...))
168 } else if ( !context || context.jquery ) {
169 return ( context || rootjQuery ).find( selector );
171 // HANDLE: $(expr, context)
172 // (which is just equivalent to: $(context).find(expr)
174 return this.constructor( context ).find( selector );
177 // HANDLE: $(function)
178 // Shortcut for document ready
179 } else if ( jQuery.isFunction( selector ) ) {
180 return rootjQuery.ready( selector );
183 if ( selector.selector !== undefined ) {
184 this.selector = selector.selector;
185 this.context = selector.context;
188 return jQuery.makeArray( selector, this );
191 // Start with an empty selector
194 // The current version of jQuery being used
197 // The default length of a jQuery object is 0
200 // The number of elements contained in the matched element set
205 toArray: function() {
206 return core_slice.call( this );
209 // Get the Nth element in the matched element set OR
210 // Get the whole matched element set as a clean array
211 get: function( num ) {
214 // Return a 'clean' array
217 // Return just the object
218 ( num < 0 ? this[ this.length + num ] : this[ num ] );
221 // Take an array of elements and push it onto the stack
222 // (returning the new matched element set)
223 pushStack: function( elems, name, selector ) {
225 // Build a new jQuery matched element set
226 var ret = jQuery.merge( this.constructor(), elems );
228 // Add the old object onto the stack (as a reference)
229 ret.prevObject = this;
231 ret.context = this.context;
233 if ( name === "find" ) {
234 ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
236 ret.selector = this.selector + "." + name + "(" + selector + ")";
239 // Return the newly-formed element set
243 // Execute a callback for every element in the matched set.
244 // (You can seed the arguments with an array of args, but this is
245 // only used internally.)
246 each: function( callback, args ) {
247 return jQuery.each( this, callback, args );
250 ready: function( fn ) {
252 jQuery.ready.promise().done( fn );
261 this.slice( i, i + 1 );
269 return this.eq( -1 );
273 return this.pushStack( core_slice.apply( this, arguments ),
274 "slice", core_slice.call(arguments).join(",") );
277 map: function( callback ) {
278 return this.pushStack( jQuery.map(this, function( elem, i ) {
279 return callback.call( elem, i, elem );
284 return this.prevObject || this.constructor(null);
287 // For internal use only.
288 // Behaves like an Array's method, not like a jQuery method.
294 // Give the init function the jQuery prototype for later instantiation
295 jQuery.fn.init.prototype = jQuery.fn;
297 jQuery.extend = jQuery.fn.extend = function() {
298 var options, name, src, copy, copyIsArray, clone,
299 target = arguments[0] || {},
301 length = arguments.length,
304 // Handle a deep copy situation
305 if ( typeof target === "boolean" ) {
307 target = arguments[1] || {};
308 // skip the boolean and the target
312 // Handle case when target is a string or something (possible in deep copy)
313 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
317 // extend jQuery itself if only one argument is passed
318 if ( length === i ) {
323 for ( ; i < length; i++ ) {
324 // Only deal with non-null/undefined values
325 if ( (options = arguments[ i ]) != null ) {
326 // Extend the base object
327 for ( name in options ) {
328 src = target[ name ];
329 copy = options[ name ];
331 // Prevent never-ending loop
332 if ( target === copy ) {
336 // Recurse if we're merging plain objects or arrays
337 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
340 clone = src && jQuery.isArray(src) ? src : [];
343 clone = src && jQuery.isPlainObject(src) ? src : {};
346 // Never move original objects, clone them
347 target[ name ] = jQuery.extend( deep, clone, copy );
349 // Don't bring in undefined values
350 } else if ( copy !== undefined ) {
351 target[ name ] = copy;
357 // Return the modified object
362 noConflict: function( deep ) {
363 if ( window.$ === jQuery ) {
367 if ( deep && window.jQuery === jQuery ) {
368 window.jQuery = _jQuery;
374 // Is the DOM ready to be used? Set to true once it occurs.
377 // A counter to track how many items to wait for before
378 // the ready event fires. See #6781
381 // Hold (or release) the ready event
382 holdReady: function( hold ) {
386 jQuery.ready( true );
390 // Handle when the DOM is ready
391 ready: function( wait ) {
393 // Abort if there are pending holds or we're already ready
394 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
398 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
399 if ( !document.body ) {
400 return setTimeout( jQuery.ready, 1 );
403 // Remember that the DOM is ready
404 jQuery.isReady = true;
406 // If a normal DOM Ready event fired, decrement, and wait if need be
407 if ( wait !== true && --jQuery.readyWait > 0 ) {
411 // If there are functions bound, to execute
412 readyList.resolveWith( document, [ jQuery ] );
414 // Trigger any bound ready events
415 if ( jQuery.fn.trigger ) {
416 jQuery( document ).trigger("ready").off("ready");
420 // See test/unit/core.js for details concerning isFunction.
421 // Since version 1.3, DOM methods and functions like alert
422 // aren't supported. They return false on IE (#2968).
423 isFunction: function( obj ) {
424 return jQuery.type(obj) === "function";
427 isArray: Array.isArray || function( obj ) {
428 return jQuery.type(obj) === "array";
431 isWindow: function( obj ) {
432 return obj != null && obj == obj.window;
435 isNumeric: function( obj ) {
436 return !isNaN( parseFloat(obj) ) && isFinite( obj );
439 type: function( obj ) {
442 class2type[ core_toString.call(obj) ] || "object";
445 isPlainObject: function( obj ) {
446 // Must be an Object.
447 // Because of IE, we also have to check the presence of the constructor property.
448 // Make sure that DOM nodes and window objects don't pass through, as well
449 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
454 // Not own constructor property must be Object
455 if ( obj.constructor &&
456 !core_hasOwn.call(obj, "constructor") &&
457 !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
461 // IE8,9 Will throw exceptions on certain host objects #9897
465 // Own properties are enumerated firstly, so to speed up,
466 // if last one is own, then all properties are own.
469 for ( key in obj ) {}
471 return key === undefined || core_hasOwn.call( obj, key );
474 isEmptyObject: function( obj ) {
476 for ( name in obj ) {
482 error: function( msg ) {
483 throw new Error( msg );
486 // data: string of html
487 // context (optional): If specified, the fragment will be created in this context, defaults to document
488 // scripts (optional): If true, will include scripts passed in the html string
489 parseHTML: function( data, context, scripts ) {
491 if ( !data || typeof data !== "string" ) {
494 if ( typeof context === "boolean" ) {
498 context = context || document;
501 if ( (parsed = rsingleTag.exec( data )) ) {
502 return [ context.createElement( parsed[1] ) ];
505 parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
506 return jQuery.merge( [],
507 (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
510 parseJSON: function( data ) {
511 if ( !data || typeof data !== "string") {
515 // Make sure leading/trailing whitespace is removed (IE can't handle it)
516 data = jQuery.trim( data );
518 // Attempt to parse using the native JSON parser first
519 if ( window.JSON && window.JSON.parse ) {
520 return window.JSON.parse( data );
523 // Make sure the incoming data is actual JSON
524 // Logic borrowed from http://json.org/json2.js
525 if ( rvalidchars.test( data.replace( rvalidescape, "@" )
526 .replace( rvalidtokens, "]" )
527 .replace( rvalidbraces, "")) ) {
529 return ( new Function( "return " + data ) )();
532 jQuery.error( "Invalid JSON: " + data );
535 // Cross-browser xml parsing
536 parseXML: function( data ) {
538 if ( !data || typeof data !== "string" ) {
542 if ( window.DOMParser ) { // Standard
543 tmp = new DOMParser();
544 xml = tmp.parseFromString( data , "text/xml" );
546 xml = new ActiveXObject( "Microsoft.XMLDOM" );
553 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
554 jQuery.error( "Invalid XML: " + data );
561 // Evaluates a script in a global context
562 // Workarounds based on findings by Jim Driscoll
563 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
564 globalEval: function( data ) {
565 if ( data && core_rnotwhite.test( data ) ) {
566 // We use execScript on Internet Explorer
567 // We use an anonymous function so that context is window
568 // rather than jQuery in Firefox
569 ( window.execScript || function( data ) {
570 window[ "eval" ].call( window, data );
575 // Convert dashed to camelCase; used by the css and data modules
576 // Microsoft forgot to hump their vendor prefix (#9572)
577 camelCase: function( string ) {
578 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
581 nodeName: function( elem, name ) {
582 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
585 // args is for internal usage only
586 each: function( obj, callback, args ) {
590 isObj = length === undefined || jQuery.isFunction( obj );
594 for ( name in obj ) {
595 if ( callback.apply( obj[ name ], args ) === false ) {
600 for ( ; i < length; ) {
601 if ( callback.apply( obj[ i++ ], args ) === false ) {
607 // A special, fast, case for the most common use of each
610 for ( name in obj ) {
611 if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
616 for ( ; i < length; ) {
617 if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
627 // Use native String.trim function wherever possible
630 return text == null ?
632 core_trim.call( text );
635 // Otherwise use our own trimming functionality
637 return text == null ?
639 text.toString().replace( rtrim, "" );
642 // results is for internal usage only
643 makeArray: function( arr, results ) {
648 // The window, strings (and functions) also have 'length'
649 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
650 type = jQuery.type( arr );
652 if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
653 core_push.call( ret, arr );
655 jQuery.merge( ret, arr );
662 inArray: function( elem, arr, i ) {
666 if ( core_indexOf ) {
667 return core_indexOf.call( arr, elem, i );
671 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
673 for ( ; i < len; i++ ) {
674 // Skip accessing in sparse arrays
675 if ( i in arr && arr[ i ] === elem ) {
684 merge: function( first, second ) {
685 var l = second.length,
689 if ( typeof l === "number" ) {
690 for ( ; j < l; j++ ) {
691 first[ i++ ] = second[ j ];
695 while ( second[j] !== undefined ) {
696 first[ i++ ] = second[ j++ ];
705 grep: function( elems, callback, inv ) {
709 length = elems.length;
712 // Go through the array, only saving the items
713 // that pass the validator function
714 for ( ; i < length; i++ ) {
715 retVal = !!callback( elems[ i ], i );
716 if ( inv !== retVal ) {
717 ret.push( elems[ i ] );
724 // arg is for internal usage only
725 map: function( elems, callback, arg ) {
729 length = elems.length,
730 // jquery objects are treated as arrays
731 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
733 // Go through the array, translating each of the items to their
735 for ( ; i < length; i++ ) {
736 value = callback( elems[ i ], i, arg );
738 if ( value != null ) {
739 ret[ ret.length ] = value;
743 // Go through every key on the object,
745 for ( key in elems ) {
746 value = callback( elems[ key ], key, arg );
748 if ( value != null ) {
749 ret[ ret.length ] = value;
754 // Flatten any nested arrays
755 return ret.concat.apply( [], ret );
758 // A global GUID counter for objects
761 // Bind a function to a context, optionally partially applying any
763 proxy: function( fn, context ) {
764 var tmp, args, proxy;
766 if ( typeof context === "string" ) {
772 // Quick check to determine if target is callable, in the spec
773 // this throws a TypeError, but we will just return undefined.
774 if ( !jQuery.isFunction( fn ) ) {
779 args = core_slice.call( arguments, 2 );
781 return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
784 // Set the guid of unique handler to the same of original handler, so it can be removed
785 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
790 // Multifunctional method to get and set values of a collection
791 // The value/s can optionally be executed if it's a function
792 access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
796 length = elems.length;
799 if ( key && typeof key === "object" ) {
801 jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
806 } else if ( value !== undefined ) {
807 // Optionally, function values get executed if exec is true
808 exec = pass === undefined && jQuery.isFunction( value );
811 // Bulk operations only iterate when executing function values
814 fn = function( elem, key, value ) {
815 return exec.call( jQuery( elem ), value );
818 // Otherwise they run against the entire set
820 fn.call( elems, value );
826 for (; i < length; i++ ) {
827 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
840 length ? fn( elems[0], key ) : emptyGet;
844 return ( new Date() ).getTime();
848 jQuery.ready.promise = function( obj ) {
851 readyList = jQuery.Deferred();
853 // Catch cases where $(document).ready() is called after the
854 // browser event has already occurred.
855 if ( document.readyState === "complete" || ( document.readyState !== "loading" && document.addEventListener ) ) {
856 // Handle it asynchronously to allow scripts the opportunity to delay ready
857 setTimeout( jQuery.ready, 1 );
859 // Standards-based browsers support DOMContentLoaded
860 } else if ( document.addEventListener ) {
861 // Use the handy event callback
862 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
864 // A fallback to window.onload, that will always work
865 window.addEventListener( "load", jQuery.ready, false );
867 // If IE event model is used
869 // Ensure firing before onload, maybe late but safe also for iframes
870 document.attachEvent( "onreadystatechange", DOMContentLoaded );
872 // A fallback to window.onload, that will always work
873 window.attachEvent( "onload", jQuery.ready );
875 // If IE and not a frame
876 // continually check to see if the document is ready
880 top = window.frameElement == null && document.documentElement;
883 if ( top && top.doScroll ) {
884 (function doScrollCheck() {
885 if ( !jQuery.isReady ) {
888 // Use the trick by Diego Perini
889 // http://javascript.nwbox.com/IEContentLoaded/
890 top.doScroll("left");
892 return setTimeout( doScrollCheck, 50 );
895 // and execute any waiting functions
902 return readyList.promise( obj );
905 // Populate the class2type map
906 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
907 class2type[ "[object " + name + "]" ] = name.toLowerCase();
910 // All jQuery objects should point back to these
911 rootjQuery = jQuery(document);
912 // String to Object options format cache
913 var optionsCache = {};
915 // Convert String-formatted options into Object-formatted ones and store in cache
916 function createOptions( options ) {
917 var object = optionsCache[ options ] = {};
918 jQuery.each( options.split( core_rspace ), function( _, flag ) {
919 object[ flag ] = true;
925 * Create a callback list using the following parameters:
927 * options: an optional list of space-separated options that will change how
928 * the callback list behaves or a more traditional option object
930 * By default a callback list will act like an event callback list and can be
931 * "fired" multiple times.
935 * once: will ensure the callback list can only be fired once (like a Deferred)
937 * memory: will keep track of previous values and will call any callback added
938 * after the list has been fired right away with the latest "memorized"
939 * values (like a Deferred)
941 * unique: will ensure a callback can only be added once (no duplicate in the list)
943 * stopOnFalse: interrupt callings when a callback returns false
946 jQuery.Callbacks = function( options ) {
948 // Convert options from String-formatted to Object-formatted if needed
949 // (we check in cache first)
950 options = typeof options === "string" ?
951 ( optionsCache[ options ] || createOptions( options ) ) :
952 jQuery.extend( {}, options );
954 var // Last fire value (for non-forgettable lists)
956 // Flag to know if list was already fired
958 // Flag to know if list is currently firing
960 // First callback to fire (used internally by add and fireWith)
962 // End of the loop when firing
964 // Index of currently firing callback (modified by remove if needed)
966 // Actual callback list
968 // Stack of fire calls for repeatable lists
969 stack = !options.once && [],
971 fire = function( data ) {
972 memory = options.memory && data;
974 firingIndex = firingStart || 0;
976 firingLength = list.length;
978 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
979 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
980 memory = false; // To prevent further calls using add
987 if ( stack.length ) {
988 fire( stack.shift() );
990 } else if ( memory ) {
997 // Actual Callbacks object
999 // Add a callback or a collection of callbacks to the list
1002 // First, we save the current length
1003 var start = list.length;
1004 (function add( args ) {
1005 jQuery.each( args, function( _, arg ) {
1006 if ( jQuery.isFunction( arg ) && ( !options.unique || !self.has( arg ) ) ) {
1008 } else if ( arg && arg.length ) {
1009 // Inspect recursively
1014 // Do we need to add the callbacks to the
1015 // current firing batch?
1017 firingLength = list.length;
1018 // With memory, if we're not firing then
1019 // we should call right away
1020 } else if ( memory ) {
1021 firingStart = start;
1027 // Remove a callback from the list
1028 remove: function() {
1030 jQuery.each( arguments, function( _, arg ) {
1032 while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
1033 list.splice( index, 1 );
1034 // Handle firing indexes
1036 if ( index <= firingLength ) {
1039 if ( index <= firingIndex ) {
1048 // Control if a given callback is in the list
1049 has: function( fn ) {
1050 return jQuery.inArray( fn, list ) > -1;
1052 // Remove all callbacks from the list
1057 // Have the list do nothing anymore
1058 disable: function() {
1059 list = stack = memory = undefined;
1063 disabled: function() {
1066 // Lock the list in its current state
1075 locked: function() {
1078 // Call all callbacks with the given context and arguments
1079 fireWith: function( context, args ) {
1081 args = [ context, args.slice ? args.slice() : args ];
1082 if ( list && ( !fired || stack ) ) {
1091 // Call all the callbacks with the given arguments
1093 self.fireWith( this, arguments );
1096 // To know if the callbacks have already been called at least once
1106 Deferred: function( func ) {
1108 // action, add listener, listener list, final state
1109 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
1110 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
1111 [ "notify", "progress", jQuery.Callbacks("memory") ]
1118 always: function() {
1119 deferred.done( arguments ).fail( arguments );
1122 then: function( /* fnDone, fnFail, fnProgress */ ) {
1123 var fns = arguments;
1124 return jQuery.Deferred(function( newDefer ) {
1125 jQuery.each( tuples, function( i, tuple ) {
1126 var action = tuple[ 0 ],
1128 // deferred[ done | fail | progress ] for forwarding actions to newDefer
1129 deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
1131 var returned = fn.apply( this, arguments );
1132 if ( returned && jQuery.isFunction( returned.promise ) ) {
1134 .done( newDefer.resolve )
1135 .fail( newDefer.reject )
1136 .progress( newDefer.notify );
1138 newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
1147 // Get a promise for this deferred
1148 // If obj is provided, the promise aspect is added to the object
1149 promise: function( obj ) {
1150 return typeof obj === "object" ? jQuery.extend( obj, promise ) : promise;
1155 // Keep pipe for back-compat
1156 promise.pipe = promise.then;
1158 // Add list-specific methods
1159 jQuery.each( tuples, function( i, tuple ) {
1160 var list = tuple[ 2 ],
1161 stateString = tuple[ 3 ];
1163 // promise[ done | fail | progress ] = list.add
1164 promise[ tuple[1] ] = list.add;
1167 if ( stateString ) {
1168 list.add(function() {
1169 // state = [ resolved | rejected ]
1170 state = stateString;
1172 // [ reject_list | resolve_list ].disable; progress_list.lock
1173 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1176 // deferred[ resolve | reject | notify ] = list.fire
1177 deferred[ tuple[0] ] = list.fire;
1178 deferred[ tuple[0] + "With" ] = list.fireWith;
1181 // Make the deferred a promise
1182 promise.promise( deferred );
1184 // Call given func if any
1186 func.call( deferred, deferred );
1194 when: function( subordinate /* , ..., subordinateN */ ) {
1196 resolveValues = core_slice.call( arguments ),
1197 length = resolveValues.length,
1199 // the count of uncompleted subordinates
1200 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1202 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1203 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1205 // Update function for both resolve and progress values
1206 updateFunc = function( i, contexts, values ) {
1207 return function( value ) {
1208 contexts[ i ] = this;
1209 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
1210 if( values === progressValues ) {
1211 deferred.notifyWith( contexts, values );
1212 } else if ( !( --remaining ) ) {
1213 deferred.resolveWith( contexts, values );
1218 progressValues, progressContexts, resolveContexts;
1220 // add listeners to Deferred subordinates; treat others as resolved
1222 progressValues = new Array( length );
1223 progressContexts = new Array( length );
1224 resolveContexts = new Array( length );
1225 for ( ; i < length; i++ ) {
1226 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1227 resolveValues[ i ].promise()
1228 .done( updateFunc( i, resolveContexts, resolveValues ) )
1229 .fail( deferred.reject )
1230 .progress( updateFunc( i, progressContexts, progressValues ) );
1237 // if we're not waiting on anything, resolve the master
1239 deferred.resolveWith( resolveContexts, resolveValues );
1242 return deferred.promise();
1245 jQuery.support = (function() {
1258 div = document.createElement("div");
1260 // Preliminary tests
1261 div.setAttribute( "className", "t" );
1262 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
1264 all = div.getElementsByTagName("*");
1265 a = div.getElementsByTagName("a")[ 0 ];
1266 a.style.cssText = "top:1px;float:left;opacity:.5";
1268 // Can't get basic test support
1269 if ( !all || !all.length || !a ) {
1273 // First batch of supports tests
1274 select = document.createElement("select");
1275 opt = select.appendChild( document.createElement("option") );
1276 input = div.getElementsByTagName("input")[ 0 ];
1279 // IE strips leading whitespace when .innerHTML is used
1280 leadingWhitespace: ( div.firstChild.nodeType === 3 ),
1282 // Make sure that tbody elements aren't automatically inserted
1283 // IE will insert them into empty tables
1284 tbody: !div.getElementsByTagName("tbody").length,
1286 // Make sure that link elements get serialized correctly by innerHTML
1287 // This requires a wrapper element in IE
1288 htmlSerialize: !!div.getElementsByTagName("link").length,
1290 // Get the style information from getAttribute
1291 // (IE uses .cssText instead)
1292 style: /top/.test( a.getAttribute("style") ),
1294 // Make sure that URLs aren't manipulated
1295 // (IE normalizes it by default)
1296 hrefNormalized: ( a.getAttribute("href") === "/a" ),
1298 // Make sure that element opacity exists
1299 // (IE uses filter instead)
1300 // Use a regex to work around a WebKit issue. See #5145
1301 opacity: /^0.5/.test( a.style.opacity ),
1303 // Verify style float existence
1304 // (IE uses styleFloat instead of cssFloat)
1305 cssFloat: !!a.style.cssFloat,
1307 // Make sure that if no value is specified for a checkbox
1308 // that it defaults to "on".
1309 // (WebKit defaults to "" instead)
1310 checkOn: ( input.value === "on" ),
1312 // Make sure that a selected-by-default option has a working selected property.
1313 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1314 optSelected: opt.selected,
1316 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1317 getSetAttribute: div.className !== "t",
1319 // Tests for enctype support on a form(#6743)
1320 enctype: !!document.createElement("form").enctype,
1322 // Makes sure cloning an html5 element does not cause problems
1323 // Where outerHTML is undefined, this still works
1324 html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
1326 // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
1327 boxModel: ( document.compatMode === "CSS1Compat" ),
1329 // Will be defined later
1330 submitBubbles: true,
1331 changeBubbles: true,
1332 focusinBubbles: false,
1333 deleteExpando: true,
1335 inlineBlockNeedsLayout: false,
1336 shrinkWrapBlocks: false,
1337 reliableMarginRight: true,
1338 boxSizingReliable: true,
1339 pixelPosition: false
1342 // Make sure checked status is properly cloned
1343 input.checked = true;
1344 support.noCloneChecked = input.cloneNode( true ).checked;
1346 // Make sure that the options inside disabled selects aren't marked as disabled
1347 // (WebKit marks them as disabled)
1348 select.disabled = true;
1349 support.optDisabled = !opt.disabled;
1351 // Test to see if it's possible to delete an expando from an element
1352 // Fails in Internet Explorer
1356 support.deleteExpando = false;
1359 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1360 div.attachEvent( "onclick", clickFn = function() {
1361 // Cloning a node shouldn't copy over any
1362 // bound event handlers (IE does this)
1363 support.noCloneEvent = false;
1365 div.cloneNode( true ).fireEvent("onclick");
1366 div.detachEvent( "onclick", clickFn );
1369 // Check if a radio maintains its value
1370 // after being appended to the DOM
1371 input = document.createElement("input");
1373 input.setAttribute( "type", "radio" );
1374 support.radioValue = input.value === "t";
1376 input.setAttribute( "checked", "checked" );
1378 // #11217 - WebKit loses check when the name is after the checked attribute
1379 input.setAttribute( "name", "t" );
1381 div.appendChild( input );
1382 fragment = document.createDocumentFragment();
1383 fragment.appendChild( div.lastChild );
1385 // WebKit doesn't clone checked state correctly in fragments
1386 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1388 // Check if a disconnected checkbox will retain its checked
1389 // value of true after appended to the DOM (IE6/7)
1390 support.appendChecked = input.checked;
1392 fragment.removeChild( input );
1393 fragment.appendChild( div );
1395 // Technique from Juriy Zaytsev
1396 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
1397 // We only care about the case where non-standard event systems
1398 // are used, namely in IE. Short-circuiting here helps us to
1399 // avoid an eval call (in setAttribute) which can cause CSP
1400 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1401 if ( div.attachEvent ) {
1407 eventName = "on" + i;
1408 isSupported = ( eventName in div );
1409 if ( !isSupported ) {
1410 div.setAttribute( eventName, "return;" );
1411 isSupported = ( typeof div[ eventName ] === "function" );
1413 support[ i + "Bubbles" ] = isSupported;
1417 // Run tests that need a body at doc ready
1419 var container, div, tds, marginDiv,
1420 divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
1421 body = document.getElementsByTagName("body")[0];
1424 // Return for frameset docs that don't have a body
1428 container = document.createElement("div");
1429 container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
1430 body.insertBefore( container, body.firstChild );
1432 // Construct the test element
1433 div = document.createElement("div");
1434 container.appendChild( div );
1436 // Check if table cells still have offsetWidth/Height when they are set
1437 // to display:none and there are still other visible table cells in a
1438 // table row; if so, offsetWidth/Height are not reliable for use when
1439 // determining if an element has been hidden directly using
1440 // display:none (it is still safe to use offsets if a parent element is
1441 // hidden; don safety goggles and see bug #4512 for more information).
1442 // (only IE 8 fails this test)
1443 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
1444 tds = div.getElementsByTagName("td");
1445 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
1446 isSupported = ( tds[ 0 ].offsetHeight === 0 );
1448 tds[ 0 ].style.display = "";
1449 tds[ 1 ].style.display = "none";
1451 // Check if empty table cells still have offsetWidth/Height
1452 // (IE <= 8 fail this test)
1453 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1455 // Check box-sizing and margin behavior
1457 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%;";
1458 support.boxSizing = ( div.offsetWidth === 4 );
1459 support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
1461 // NOTE: To any future maintainer, window.getComputedStyle was used here
1462 // instead of getComputedStyle because it gave a better gzip size.
1463 // The difference between window.getComputedStyle and getComputedStyle is
1465 if ( window.getComputedStyle ) {
1466 support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
1467 support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
1469 // Check if div with explicit width and no margin-right incorrectly
1470 // gets computed margin-right based on width of container. For more
1471 // info see bug #3333
1472 // Fails in WebKit before Feb 2011 nightlies
1473 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1474 marginDiv = document.createElement("div");
1475 marginDiv.style.cssText = div.style.cssText = divReset;
1476 marginDiv.style.marginRight = marginDiv.style.width = "0";
1477 div.style.width = "1px";
1478 div.appendChild( marginDiv );
1479 support.reliableMarginRight =
1480 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
1483 if ( typeof div.style.zoom !== "undefined" ) {
1484 // Check if natively block-level elements act like inline-block
1485 // elements when setting their display to 'inline' and giving
1487 // (IE < 8 does this)
1489 div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
1490 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1492 // Check if elements with layout shrink-wrap their children
1494 div.style.display = "block";
1495 div.style.overflow = "visible";
1496 div.innerHTML = "<div></div>";
1497 div.firstChild.style.width = "5px";
1498 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1500 container.style.zoom = 1;
1503 // Null elements to avoid leaks in IE
1504 body.removeChild( container );
1505 container = div = tds = marginDiv = null;
1508 // Null elements to avoid leaks in IE
1509 fragment.removeChild( div );
1510 all = a = select = opt = input = fragment = div = null;
1514 var rbrace = /^(?:\{.*\}|\[.*\])$/,
1515 rmultiDash = /([A-Z])/g;
1522 // Please use with caution
1525 // Unique for each copy of jQuery on the page
1526 // Non-digits removed to match rinlinejQuery
1527 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1529 // The following elements throw uncatchable exceptions if you
1530 // attempt to add expando properties to them.
1533 // Ban all objects except for Flash (which handle expandos)
1534 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1538 hasData: function( elem ) {
1539 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1540 return !!elem && !isEmptyDataObject( elem );
1543 data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1544 if ( !jQuery.acceptData( elem ) ) {
1549 internalKey = jQuery.expando,
1550 getByName = typeof name === "string",
1552 // We have to handle DOM nodes and JS objects differently because IE6-7
1553 // can't GC object references properly across the DOM-JS boundary
1554 isNode = elem.nodeType,
1556 // Only DOM nodes need the global jQuery cache; JS object data is
1557 // attached directly to the object so GC can occur automatically
1558 cache = isNode ? jQuery.cache : elem,
1560 // Only defining an ID for JS objects if its cache already exists allows
1561 // the code to shortcut on the same path as a DOM node with no cache
1562 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
1564 // Avoid doing any more work than we need to when trying to get data on an
1565 // object that has no data at all
1566 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
1571 // Only DOM nodes need a new unique ID for each element since their data
1572 // ends up in the global cache
1574 elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid;
1580 if ( !cache[ id ] ) {
1583 // Avoids exposing jQuery metadata on plain JS objects when the object
1584 // is serialized using JSON.stringify
1586 cache[ id ].toJSON = jQuery.noop;
1590 // An object can be passed to jQuery.data instead of a key/value pair; this gets
1591 // shallow copied over onto the existing cache
1592 if ( typeof name === "object" || typeof name === "function" ) {
1594 cache[ id ] = jQuery.extend( cache[ id ], name );
1596 cache[ id ].data = jQuery.extend( cache[ id ].data, name );
1600 thisCache = cache[ id ];
1602 // jQuery data() is stored in a separate object inside the object's internal data
1603 // cache in order to avoid key collisions between internal data and user-defined
1606 if ( !thisCache.data ) {
1607 thisCache.data = {};
1610 thisCache = thisCache.data;
1613 if ( data !== undefined ) {
1614 thisCache[ jQuery.camelCase( name ) ] = data;
1617 // Check for both converted-to-camel and non-converted data property names
1618 // If a data property was specified
1621 // First Try to find as-is property data
1622 ret = thisCache[ name ];
1624 // Test for null|undefined property data
1625 if ( ret == null ) {
1627 // Try to find the camelCased property
1628 ret = thisCache[ jQuery.camelCase( name ) ];
1637 removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1638 if ( !jQuery.acceptData( elem ) ) {
1642 var thisCache, i, l,
1644 isNode = elem.nodeType,
1646 // See jQuery.data for more information
1647 cache = isNode ? jQuery.cache : elem,
1648 id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1650 // If there is already no cache entry for this object, there is no
1651 // purpose in continuing
1652 if ( !cache[ id ] ) {
1658 thisCache = pvt ? cache[ id ] : cache[ id ].data;
1662 // Support array or space separated string names for data keys
1663 if ( !jQuery.isArray( name ) ) {
1665 // try the string as a key before any manipulation
1666 if ( name in thisCache ) {
1670 // split the camel cased version by spaces unless a key with the spaces exists
1671 name = jQuery.camelCase( name );
1672 if ( name in thisCache ) {
1675 name = name.split(" ");
1680 for ( i = 0, l = name.length; i < l; i++ ) {
1681 delete thisCache[ name[i] ];
1684 // If there is no data left in the cache, we want to continue
1685 // and let the cache object itself get destroyed
1686 if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
1692 // See jQuery.data for more information
1694 delete cache[ id ].data;
1696 // Don't destroy the parent cache unless the internal data object
1697 // had been the only thing left in it
1698 if ( !isEmptyDataObject( cache[ id ] ) ) {
1703 // Destroy the cache
1705 jQuery.cleanData( [ elem ], true );
1707 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
1708 } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
1711 // When all else fails, null
1717 // For internal use only.
1718 _data: function( elem, name, data ) {
1719 return jQuery.data( elem, name, data, true );
1722 // A method for determining if a DOM node can handle the data expando
1723 acceptData: function( elem ) {
1724 var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
1726 // nodes accept data unless otherwise specified; rejection can be conditional
1727 return !noData || noData !== true && elem.getAttribute("classid") === noData;
1732 data: function( key, value ) {
1733 var parts, part, attr, name, l,
1739 if ( key === undefined ) {
1740 if ( this.length ) {
1741 data = jQuery.data( elem );
1743 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
1744 attr = elem.attributes;
1745 for ( l = attr.length; i < l; i++ ) {
1746 name = attr[i].name;
1748 if ( name.indexOf( "data-" ) === 0 ) {
1749 name = jQuery.camelCase( name.substring(5) );
1751 dataAttr( elem, name, data[ name ] );
1754 jQuery._data( elem, "parsedAttrs", true );
1761 // Sets multiple values
1762 if ( typeof key === "object" ) {
1763 return this.each(function() {
1764 jQuery.data( this, key );
1768 parts = key.split( ".", 2 );
1769 parts[1] = parts[1] ? "." + parts[1] : "";
1770 part = parts[1] + "!";
1772 return jQuery.access( this, function( value ) {
1774 if ( value === undefined ) {
1775 data = this.triggerHandler( "getData" + part, [ parts[0] ] );
1777 // Try to fetch any internally stored data first
1778 if ( data === undefined && elem ) {
1779 data = jQuery.data( elem, key );
1780 data = dataAttr( elem, key, data );
1783 return data === undefined && parts[1] ?
1784 this.data( parts[0] ) :
1789 this.each(function() {
1790 var self = jQuery( this );
1792 self.triggerHandler( "setData" + part, parts );
1793 jQuery.data( this, key, value );
1794 self.triggerHandler( "changeData" + part, parts );
1796 }, null, value, arguments.length > 1, null, false );
1799 removeData: function( key ) {
1800 return this.each(function() {
1801 jQuery.removeData( this, key );
1806 function dataAttr( elem, key, data ) {
1807 // If nothing was found internally, try to fetch any
1808 // data from the HTML5 data-* attribute
1809 if ( data === undefined && elem.nodeType === 1 ) {
1811 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1813 data = elem.getAttribute( name );
1815 if ( typeof data === "string" ) {
1817 data = data === "true" ? true :
1818 data === "false" ? false :
1819 data === "null" ? null :
1820 // Only convert to a number if it doesn't change the string
1821 +data + "" === data ? +data :
1822 rbrace.test( data ) ? jQuery.parseJSON( data ) :
1826 // Make sure we set the data so it isn't changed later
1827 jQuery.data( elem, key, data );
1837 // checks a cache object for emptiness
1838 function isEmptyDataObject( obj ) {
1840 for ( name in obj ) {
1842 // if the public data object is empty, the private is still empty
1843 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
1846 if ( name !== "toJSON" ) {
1854 queue: function( elem, type, data ) {
1858 type = ( type || "fx" ) + "queue";
1859 queue = jQuery._data( elem, type );
1861 // Speed up dequeue by getting out quickly if this is just a lookup
1863 if ( !queue || jQuery.isArray(data) ) {
1864 queue = jQuery._data( elem, type, jQuery.makeArray(data) );
1873 dequeue: function( elem, type ) {
1874 type = type || "fx";
1876 var queue = jQuery.queue( elem, type ),
1878 hooks = jQuery._queueHooks( elem, type ),
1880 jQuery.dequeue( elem, type );
1883 // If the fx queue is dequeued, always remove the progress sentinel
1884 if ( fn === "inprogress" ) {
1890 // Add a progress sentinel to prevent the fx queue from being
1891 // automatically dequeued
1892 if ( type === "fx" ) {
1893 queue.unshift( "inprogress" );
1896 // clear up the last queue stop function
1898 fn.call( elem, next, hooks );
1900 if ( !queue.length && hooks ) {
1905 // not intended for public consumption - generates a queueHooks object, or returns the current one
1906 _queueHooks: function( elem, type ) {
1907 var key = type + "queueHooks";
1908 return jQuery._data( elem, key ) || jQuery._data( elem, key, {
1909 empty: jQuery.Callbacks("once memory").add(function() {
1910 jQuery.removeData( elem, type + "queue", true );
1911 jQuery.removeData( elem, key, true );
1918 queue: function( type, data ) {
1921 if ( typeof type !== "string" ) {
1927 if ( arguments.length < setter ) {
1928 return jQuery.queue( this[0], type );
1931 return data === undefined ?
1933 this.each(function() {
1934 var queue = jQuery.queue( this, type, data );
1936 // ensure a hooks for this queue
1937 jQuery._queueHooks( this, type );
1939 if ( type === "fx" && queue[0] !== "inprogress" ) {
1940 jQuery.dequeue( this, type );
1944 dequeue: function( type ) {
1945 return this.each(function() {
1946 jQuery.dequeue( this, type );
1949 // Based off of the plugin by Clint Helfers, with permission.
1950 // http://blindsignals.com/index.php/2009/07/jquery-delay/
1951 delay: function( time, type ) {
1952 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
1953 type = type || "fx";
1955 return this.queue( type, function( next, hooks ) {
1956 var timeout = setTimeout( next, time );
1957 hooks.stop = function() {
1958 clearTimeout( timeout );
1962 clearQueue: function( type ) {
1963 return this.queue( type || "fx", [] );
1965 // Get a promise resolved when queues of a certain type
1966 // are emptied (fx is the type by default)
1967 promise: function( type, obj ) {
1970 defer = jQuery.Deferred(),
1973 resolve = function() {
1974 if ( !( --count ) ) {
1975 defer.resolveWith( elements, [ elements ] );
1979 if ( typeof type !== "string" ) {
1983 type = type || "fx";
1986 if ( (tmp = jQuery._data( elements[ i ], type + "queueHooks" )) && tmp.empty ) {
1988 tmp.empty.add( resolve );
1992 return defer.promise( obj );
1995 var nodeHook, boolHook, fixSpecified,
1996 rclass = /[\t\r\n]/g,
1998 rtype = /^(?:button|input)$/i,
1999 rfocusable = /^(?:button|input|object|select|textarea)$/i,
2000 rclickable = /^a(?:rea|)$/i,
2001 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
2002 getSetAttribute = jQuery.support.getSetAttribute;
2005 attr: function( name, value ) {
2006 return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
2009 removeAttr: function( name ) {
2010 return this.each(function() {
2011 jQuery.removeAttr( this, name );
2015 prop: function( name, value ) {
2016 return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
2019 removeProp: function( name ) {
2020 name = jQuery.propFix[ name ] || name;
2021 return this.each(function() {
2022 // try/catch handles cases where IE balks (such as removing a property on window)
2024 this[ name ] = undefined;
2025 delete this[ name ];
2030 addClass: function( value ) {
2031 var classNames, i, l, elem,
2034 if ( jQuery.isFunction( value ) ) {
2035 return this.each(function( j ) {
2036 jQuery( this ).addClass( value.call(this, j, this.className) );
2040 if ( value && typeof value === "string" ) {
2041 classNames = value.split( core_rspace );
2043 for ( i = 0, l = this.length; i < l; i++ ) {
2046 if ( elem.nodeType === 1 ) {
2047 if ( !elem.className && classNames.length === 1 ) {
2048 elem.className = value;
2051 setClass = " " + elem.className + " ";
2053 for ( c = 0, cl = classNames.length; c < cl; c++ ) {
2054 if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
2055 setClass += classNames[ c ] + " ";
2058 elem.className = jQuery.trim( setClass );
2067 removeClass: function( value ) {
2068 var removes, className, elem, c, cl, i, l;
2070 if ( jQuery.isFunction( value ) ) {
2071 return this.each(function( j ) {
2072 jQuery( this ).removeClass( value.call(this, j, this.className) );
2075 if ( (value && typeof value === "string") || value === undefined ) {
2076 removes = ( value || "" ).split( core_rspace );
2078 for ( i = 0, l = this.length; i < l; i++ ) {
2080 if ( elem.nodeType === 1 && elem.className ) {
2082 className = (" " + elem.className + " ").replace( rclass, " " );
2084 // loop over each item in the removal list
2085 for ( c = 0, cl = removes.length; c < cl; c++ ) {
2086 // Remove until there is nothing to remove,
2087 while ( className.indexOf(" " + removes[ c ] + " ") > -1 ) {
2088 className = className.replace( " " + removes[ c ] + " " , " " );
2091 elem.className = value ? jQuery.trim( className ) : "";
2099 toggleClass: function( value, stateVal ) {
2100 var type = typeof value,
2101 isBool = typeof stateVal === "boolean";
2103 if ( jQuery.isFunction( value ) ) {
2104 return this.each(function( i ) {
2105 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
2109 return this.each(function() {
2110 if ( type === "string" ) {
2111 // toggle individual class names
2114 self = jQuery( this ),
2116 classNames = value.split( core_rspace );
2118 while ( (className = classNames[ i++ ]) ) {
2119 // check each className given, space separated list
2120 state = isBool ? state : !self.hasClass( className );
2121 self[ state ? "addClass" : "removeClass" ]( className );
2124 } else if ( type === "undefined" || type === "boolean" ) {
2125 if ( this.className ) {
2126 // store className if set
2127 jQuery._data( this, "__className__", this.className );
2130 // toggle whole className
2131 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
2136 hasClass: function( selector ) {
2137 var className = " " + selector + " ",
2140 for ( ; i < l; i++ ) {
2141 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
2149 val: function( value ) {
2150 var hooks, ret, isFunction,
2153 if ( !arguments.length ) {
2155 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
2157 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
2163 return typeof ret === "string" ?
2164 // handle most common string cases
2165 ret.replace(rreturn, "") :
2166 // handle cases where value is null/undef or number
2167 ret == null ? "" : ret;
2173 isFunction = jQuery.isFunction( value );
2175 return this.each(function( i ) {
2177 self = jQuery(this);
2179 if ( this.nodeType !== 1 ) {
2184 val = value.call( this, i, self.val() );
2189 // Treat null/undefined as ""; convert numbers to string
2190 if ( val == null ) {
2192 } else if ( typeof val === "number" ) {
2194 } else if ( jQuery.isArray( val ) ) {
2195 val = jQuery.map(val, function ( value ) {
2196 return value == null ? "" : value + "";
2200 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
2202 // If set returns undefined, fall back to normal setting
2203 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
2213 get: function( elem ) {
2214 // attributes.value is undefined in Blackberry 4.7 but
2215 // uses .value. See #6932
2216 var val = elem.attributes.value;
2217 return !val || val.specified ? elem.value : elem.text;
2221 get: function( elem ) {
2222 var value, i, max, option,
2223 index = elem.selectedIndex,
2225 options = elem.options,
2226 one = elem.type === "select-one";
2228 // Nothing was selected
2233 // Loop through all the selected options
2234 i = one ? index : 0;
2235 max = one ? index + 1 : options.length;
2236 for ( ; i < max; i++ ) {
2237 option = options[ i ];
2239 // Don't return options that are disabled or in a disabled optgroup
2240 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
2241 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
2243 // Get the specific value for the option
2244 value = jQuery( option ).val();
2246 // We don't need an array for one selects
2251 // Multi-Selects return an array
2252 values.push( value );
2256 // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
2257 if ( one && !values.length && options.length ) {
2258 return jQuery( options[ index ] ).val();
2264 set: function( elem, value ) {
2265 var values = jQuery.makeArray( value );
2267 jQuery(elem).find("option").each(function() {
2268 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
2271 if ( !values.length ) {
2272 elem.selectedIndex = -1;
2279 // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
2282 attr: function( elem, name, value, pass ) {
2283 var ret, hooks, notxml,
2284 nType = elem.nodeType;
2286 // don't get/set attributes on text, comment and attribute nodes
2287 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2291 if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
2292 return jQuery( elem )[ name ]( value );
2295 // Fallback to prop when attributes are not supported
2296 if ( typeof elem.getAttribute === "undefined" ) {
2297 return jQuery.prop( elem, name, value );
2300 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2302 // All attributes are lowercase
2303 // Grab necessary hook if one is defined
2305 name = name.toLowerCase();
2306 hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
2309 if ( value !== undefined ) {
2311 if ( value === null ) {
2312 jQuery.removeAttr( elem, name );
2315 } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
2319 elem.setAttribute( name, "" + value );
2323 } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
2328 ret = elem.getAttribute( name );
2330 // Non-existent attributes return null, we normalize to undefined
2331 return ret === null ?
2337 removeAttr: function( elem, value ) {
2338 var propName, attrNames, name, isBool,
2341 if ( value && elem.nodeType === 1 ) {
2343 attrNames = value.split( core_rspace );
2345 for ( ; i < attrNames.length; i++ ) {
2346 name = attrNames[ i ];
2349 propName = jQuery.propFix[ name ] || name;
2350 isBool = rboolean.test( name );
2352 // See #9699 for explanation of this approach (setting first, then removal)
2353 // Do not do this for boolean attributes (see #10870)
2355 jQuery.attr( elem, name, "" );
2357 elem.removeAttribute( getSetAttribute ? name : propName );
2359 // Set corresponding property to false for boolean attributes
2360 if ( isBool && propName in elem ) {
2361 elem[ propName ] = false;
2370 set: function( elem, value ) {
2371 // We can't allow the type property to be changed (since it causes problems in IE)
2372 if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
2373 jQuery.error( "type property can't be changed" );
2374 } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
2375 // Setting the type on a radio button after the value resets the value in IE6-9
2376 // Reset value to it's default in case type is set after value
2377 // This is for element creation
2378 var val = elem.value;
2379 elem.setAttribute( "type", value );
2387 // Use the value property for back compat
2388 // Use the nodeHook for button elements in IE6/7 (#1954)
2390 get: function( elem, name ) {
2391 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
2392 return nodeHook.get( elem, name );
2394 return name in elem ?
2398 set: function( elem, value, name ) {
2399 if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
2400 return nodeHook.set( elem, value, name );
2402 // Does not return so that setAttribute is also used
2409 tabindex: "tabIndex",
2410 readonly: "readOnly",
2412 "class": "className",
2413 maxlength: "maxLength",
2414 cellspacing: "cellSpacing",
2415 cellpadding: "cellPadding",
2419 frameborder: "frameBorder",
2420 contenteditable: "contentEditable"
2423 prop: function( elem, name, value ) {
2424 var ret, hooks, notxml,
2425 nType = elem.nodeType;
2427 // don't get/set properties on text, comment and attribute nodes
2428 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2432 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2435 // Fix name and attach hooks
2436 name = jQuery.propFix[ name ] || name;
2437 hooks = jQuery.propHooks[ name ];
2440 if ( value !== undefined ) {
2441 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2445 return ( elem[ name ] = value );
2449 if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
2453 return elem[ name ];
2460 get: function( elem ) {
2461 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2462 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2463 var attributeNode = elem.getAttributeNode("tabindex");
2465 return attributeNode && attributeNode.specified ?
2466 parseInt( attributeNode.value, 10 ) :
2467 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2475 // Hook for boolean attributes
2477 get: function( elem, name ) {
2478 // Align boolean attributes with corresponding properties
2479 // Fall back to attribute presence where some booleans are not supported
2481 property = jQuery.prop( elem, name );
2482 return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
2483 name.toLowerCase() :
2486 set: function( elem, value, name ) {
2488 if ( value === false ) {
2489 // Remove boolean attributes when set to false
2490 jQuery.removeAttr( elem, name );
2492 // value is true since we know at this point it's type boolean and not false
2493 // Set boolean attributes to the same name and set the DOM property
2494 propName = jQuery.propFix[ name ] || name;
2495 if ( propName in elem ) {
2496 // Only set the IDL specifically if it already exists on the element
2497 elem[ propName ] = true;
2500 elem.setAttribute( name, name.toLowerCase() );
2506 // IE6/7 do not support getting/setting some attributes with get/setAttribute
2507 if ( !getSetAttribute ) {
2515 // Use this for any attribute in IE6/7
2516 // This fixes almost every IE6/7 issue
2517 nodeHook = jQuery.valHooks.button = {
2518 get: function( elem, name ) {
2520 ret = elem.getAttributeNode( name );
2521 return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
2525 set: function( elem, value, name ) {
2526 // Set the existing or create a new attribute node
2527 var ret = elem.getAttributeNode( name );
2529 ret = document.createAttribute( name );
2530 elem.setAttributeNode( ret );
2532 return ( ret.value = value + "" );
2536 // Set width and height to auto instead of 0 on empty string( Bug #8150 )
2537 // This is for removals
2538 jQuery.each([ "width", "height" ], function( i, name ) {
2539 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2540 set: function( elem, value ) {
2541 if ( value === "" ) {
2542 elem.setAttribute( name, "auto" );
2549 // Set contenteditable to false on removals(#10429)
2550 // Setting to empty string throws an error as an invalid value
2551 jQuery.attrHooks.contenteditable = {
2553 set: function( elem, value, name ) {
2554 if ( value === "" ) {
2557 nodeHook.set( elem, value, name );
2563 // Some attributes require a special call on IE
2564 if ( !jQuery.support.hrefNormalized ) {
2565 jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
2566 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2567 get: function( elem ) {
2568 var ret = elem.getAttribute( name, 2 );
2569 return ret === null ? undefined : ret;
2575 if ( !jQuery.support.style ) {
2576 jQuery.attrHooks.style = {
2577 get: function( elem ) {
2578 // Return undefined in the case of empty string
2579 // Normalize to lowercase since IE uppercases css property names
2580 return elem.style.cssText.toLowerCase() || undefined;
2582 set: function( elem, value ) {
2583 return ( elem.style.cssText = "" + value );
2588 // Safari mis-reports the default selected property of an option
2589 // Accessing the parent's selectedIndex property fixes it
2590 if ( !jQuery.support.optSelected ) {
2591 jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
2592 get: function( elem ) {
2593 var parent = elem.parentNode;
2596 parent.selectedIndex;
2598 // Make sure that it also works with optgroups, see #5701
2599 if ( parent.parentNode ) {
2600 parent.parentNode.selectedIndex;
2608 // IE6/7 call enctype encoding
2609 if ( !jQuery.support.enctype ) {
2610 jQuery.propFix.enctype = "encoding";
2613 // Radios and checkboxes getter/setter
2614 if ( !jQuery.support.checkOn ) {
2615 jQuery.each([ "radio", "checkbox" ], function() {
2616 jQuery.valHooks[ this ] = {
2617 get: function( elem ) {
2618 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
2619 return elem.getAttribute("value") === null ? "on" : elem.value;
2624 jQuery.each([ "radio", "checkbox" ], function() {
2625 jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
2626 set: function( elem, value ) {
2627 if ( jQuery.isArray( value ) ) {
2628 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
2633 var rformElems = /^(?:textarea|input|select)$/i,
2634 rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
2635 rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
2637 rmouseEvent = /^(?:mouse|contextmenu)|click/,
2638 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2639 hoverHack = function( events ) {
2640 return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
2644 * Helper functions for managing events -- not part of the public interface.
2645 * Props to Dean Edwards' addEvent library for many of the ideas.
2649 add: function( elem, types, handler, data, selector ) {
2651 var elemData, eventHandle, events,
2652 t, tns, type, namespaces, handleObj,
2653 handleObjIn, handlers, special;
2655 // Don't attach events to noData or text/comment nodes (allow plain objects tho)
2656 if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
2660 // Caller can pass in an object of custom data in lieu of the handler
2661 if ( handler.handler ) {
2662 handleObjIn = handler;
2663 handler = handleObjIn.handler;
2664 selector = handleObjIn.selector;
2667 // Make sure that the handler has a unique ID, used to find/remove it later
2668 if ( !handler.guid ) {
2669 handler.guid = jQuery.guid++;
2672 // Init the element's event structure and main handler, if this is the first
2673 events = elemData.events;
2675 elemData.events = events = {};
2677 eventHandle = elemData.handle;
2678 if ( !eventHandle ) {
2679 elemData.handle = eventHandle = function( e ) {
2680 // Discard the second event of a jQuery.event.trigger() and
2681 // when an event is called after a page has unloaded
2682 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
2683 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
2686 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
2687 eventHandle.elem = elem;
2690 // Handle multiple events separated by a space
2691 // jQuery(...).bind("mouseover mouseout", fn);
2692 types = jQuery.trim( hoverHack(types) ).split( " " );
2693 for ( t = 0; t < types.length; t++ ) {
2695 tns = rtypenamespace.exec( types[t] ) || [];
2697 namespaces = ( tns[2] || "" ).split( "." ).sort();
2699 // If event changes its type, use the special event handlers for the changed type
2700 special = jQuery.event.special[ type ] || {};
2702 // If selector defined, determine special event api type, otherwise given type
2703 type = ( selector ? special.delegateType : special.bindType ) || type;
2705 // Update special based on newly reset type
2706 special = jQuery.event.special[ type ] || {};
2708 // handleObj is passed to all event handlers
2709 handleObj = jQuery.extend({
2716 namespace: namespaces.join(".")
2719 // Init the event handler queue if we're the first
2720 handlers = events[ type ];
2722 handlers = events[ type ] = [];
2723 handlers.delegateCount = 0;
2725 // Only use addEventListener/attachEvent if the special events handler returns false
2726 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2727 // Bind the global event handler to the element
2728 if ( elem.addEventListener ) {
2729 elem.addEventListener( type, eventHandle, false );
2731 } else if ( elem.attachEvent ) {
2732 elem.attachEvent( "on" + type, eventHandle );
2737 if ( special.add ) {
2738 special.add.call( elem, handleObj );
2740 if ( !handleObj.handler.guid ) {
2741 handleObj.handler.guid = handler.guid;
2745 // Add to the element's handler list, delegates in front
2747 handlers.splice( handlers.delegateCount++, 0, handleObj );
2749 handlers.push( handleObj );
2752 // Keep track of which events have ever been used, for event optimization
2753 jQuery.event.global[ type ] = true;
2756 // Nullify elem to prevent memory leaks in IE
2762 // Detach an event or set of events from an element
2763 remove: function( elem, types, handler, selector, mappedTypes ) {
2765 var t, tns, type, origType, namespaces, origCount,
2766 j, events, special, eventType, handleObj,
2767 elemData = jQuery.hasData( elem ) && jQuery._data( elem );
2769 if ( !elemData || !(events = elemData.events) ) {
2773 // Once for each type.namespace in types; type may be omitted
2774 types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
2775 for ( t = 0; t < types.length; t++ ) {
2776 tns = rtypenamespace.exec( types[t] ) || [];
2777 type = origType = tns[1];
2778 namespaces = tns[2];
2780 // Unbind all events (on this namespace, if provided) for the element
2782 for ( type in events ) {
2783 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2788 special = jQuery.event.special[ type ] || {};
2789 type = ( selector? special.delegateType : special.bindType ) || type;
2790 eventType = events[ type ] || [];
2791 origCount = eventType.length;
2792 namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2794 // Remove matching events
2795 for ( j = 0; j < eventType.length; j++ ) {
2796 handleObj = eventType[ j ];
2798 if ( ( mappedTypes || origType === handleObj.origType ) &&
2799 ( !handler || handler.guid === handleObj.guid ) &&
2800 ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
2801 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2802 eventType.splice( j--, 1 );
2804 if ( handleObj.selector ) {
2805 eventType.delegateCount--;
2807 if ( special.remove ) {
2808 special.remove.call( elem, handleObj );
2813 // Remove generic event handler if we removed something and no more handlers exist
2814 // (avoids potential for endless recursion during removal of special event handlers)
2815 if ( eventType.length === 0 && origCount !== eventType.length ) {
2816 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2817 jQuery.removeEvent( elem, type, elemData.handle );
2820 delete events[ type ];
2824 // Remove the expando if it's no longer used
2825 if ( jQuery.isEmptyObject( events ) ) {
2826 delete elemData.handle;
2828 // removeData also checks for emptiness and clears the expando if empty
2829 // so use it instead of delete
2830 jQuery.removeData( elem, "events", true );
2834 // Events that are safe to short-circuit if no handlers are attached.
2835 // Native DOM events should not be added, they may have inline handlers.
2842 trigger: function( event, data, elem, onlyHandlers ) {
2843 // Don't do events on text and comment nodes
2844 if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
2848 // Event object or event type
2849 var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
2850 type = event.type || event,
2853 // focus/blur morphs to focusin/out; ensure we're not firing them right now
2854 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2858 if ( type.indexOf( "!" ) >= 0 ) {
2859 // Exclusive events trigger only for the exact event (no namespaces)
2860 type = type.slice(0, -1);
2864 if ( type.indexOf( "." ) >= 0 ) {
2865 // Namespaced trigger; create a regexp to match event type in handle()
2866 namespaces = type.split(".");
2867 type = namespaces.shift();
2871 if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
2872 // No jQuery handlers for this event type, and it can't have inline handlers
2876 // Caller can pass in an Event, Object, or just an event type string
2877 event = typeof event === "object" ?
2878 // jQuery.Event object
2879 event[ jQuery.expando ] ? event :
2881 new jQuery.Event( type, event ) :
2882 // Just the event type (string)
2883 new jQuery.Event( type );
2886 event.isTrigger = true;
2887 event.exclusive = exclusive;
2888 event.namespace = namespaces.join( "." );
2889 event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2890 ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
2892 // Handle a global trigger
2895 // TODO: Stop taunting the data cache; remove global events and always attach to document
2896 cache = jQuery.cache;
2897 for ( i in cache ) {
2898 if ( cache[ i ].events && cache[ i ].events[ type ] ) {
2899 jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
2905 // Clean up the event in case it is being reused
2906 event.result = undefined;
2907 if ( !event.target ) {
2908 event.target = elem;
2911 // Clone any incoming data and prepend the event, creating the handler arg list
2912 data = data != null ? jQuery.makeArray( data ) : [];
2913 data.unshift( event );
2915 // Allow special events to draw outside the lines
2916 special = jQuery.event.special[ type ] || {};
2917 if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
2921 // Determine event propagation path in advance, per W3C events spec (#9951)
2922 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2923 eventPath = [[ elem, special.bindType || type ]];
2924 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2926 bubbleType = special.delegateType || type;
2927 cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
2928 for ( old = elem; cur; cur = cur.parentNode ) {
2929 eventPath.push([ cur, bubbleType ]);
2933 // Only add window if we got to document (e.g., not plain obj or detached DOM)
2934 if ( old === (elem.ownerDocument || document) ) {
2935 eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
2939 // Fire handlers on the event path
2940 for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
2942 cur = eventPath[i][0];
2943 event.type = eventPath[i][1];
2945 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
2947 handle.apply( cur, data );
2949 // Note that this is a bare JS function and not a jQuery handler
2950 handle = ontype && cur[ ontype ];
2951 if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
2952 event.preventDefault();
2957 // If nobody prevented the default action, do it now
2958 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2960 if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
2961 !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
2963 // Call a native DOM method on the target with the same name name as the event.
2964 // Can't use an .isFunction() check here because IE6/7 fails that test.
2965 // Don't do default actions on window, that's where global variables be (#6170)
2966 // IE<9 dies on focus/blur to hidden element (#1486)
2967 if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
2969 // Don't re-trigger an onFOO event when we call its FOO() method
2970 old = elem[ ontype ];
2973 elem[ ontype ] = null;
2976 // Prevent re-triggering of the same event, since we already bubbled it above
2977 jQuery.event.triggered = type;
2979 jQuery.event.triggered = undefined;
2982 elem[ ontype ] = old;
2988 return event.result;
2991 dispatch: function( event ) {
2993 // Make a writable jQuery.Event from the native event object
2994 event = jQuery.event.fix( event || window.event );
2996 var i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related,
2997 handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
2998 delegateCount = handlers.delegateCount,
2999 args = [].slice.call( arguments ),
3000 run_all = !event.exclusive && !event.namespace,
3001 special = jQuery.event.special[ event.type ] || {},
3004 // Use the fix-ed jQuery.Event rather than the (read-only) native event
3006 event.delegateTarget = this;
3008 // Call the preDispatch hook for the mapped type, and let it bail if desired
3009 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
3013 // Determine handlers that should run if there are delegated events
3014 // Avoid non-left-click bubbling in Firefox (#3861)
3015 if ( delegateCount && !(event.button && event.type === "click") ) {
3017 // Pregenerate a single jQuery object for reuse with .is()
3018 jqcur = jQuery(this);
3019 jqcur.context = this;
3021 for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
3023 // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #xxxx)
3024 if ( cur.disabled !== true || event.type !== "click" ) {
3028 for ( i = 0; i < delegateCount; i++ ) {
3029 handleObj = handlers[ i ];
3030 sel = handleObj.selector;
3032 if ( selMatch[ sel ] === undefined ) {
3033 selMatch[ sel ] = jqcur.is( sel );
3035 if ( selMatch[ sel ] ) {
3036 matches.push( handleObj );
3039 if ( matches.length ) {
3040 handlerQueue.push({ elem: cur, matches: matches });
3046 // Add the remaining (directly-bound) handlers
3047 if ( handlers.length > delegateCount ) {
3048 handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
3051 // Run delegates first; they may want to stop propagation beneath us
3052 for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
3053 matched = handlerQueue[ i ];
3054 event.currentTarget = matched.elem;
3056 for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
3057 handleObj = matched.matches[ j ];
3059 // Triggered event must either 1) be non-exclusive and have no namespace, or
3060 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
3061 if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
3063 event.data = handleObj.data;
3064 event.handleObj = handleObj;
3066 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
3067 .apply( matched.elem, args );
3069 if ( ret !== undefined ) {
3071 if ( ret === false ) {
3072 event.preventDefault();
3073 event.stopPropagation();
3080 // Call the postDispatch hook for the mapped type
3081 if ( special.postDispatch ) {
3082 special.postDispatch.call( this, event );
3085 return event.result;
3088 // Includes some event props shared by KeyEvent and MouseEvent
3089 // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
3090 props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3095 props: "char charCode key keyCode".split(" "),
3096 filter: function( event, original ) {
3098 // Add which for key events
3099 if ( event.which == null ) {
3100 event.which = original.charCode != null ? original.charCode : original.keyCode;
3108 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3109 filter: function( event, original ) {
3110 var eventDoc, doc, body,
3111 button = original.button,
3112 fromElement = original.fromElement;
3114 // Calculate pageX/Y if missing and clientX/Y available
3115 if ( event.pageX == null && original.clientX != null ) {
3116 eventDoc = event.target.ownerDocument || document;
3117 doc = eventDoc.documentElement;
3118 body = eventDoc.body;
3120 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
3121 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
3124 // Add relatedTarget, if necessary
3125 if ( !event.relatedTarget && fromElement ) {
3126 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
3129 // Add which for click: 1 === left; 2 === middle; 3 === right
3130 // Note: button is not normalized, so don't use it
3131 if ( !event.which && button !== undefined ) {
3132 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
3139 fix: function( event ) {
3140 if ( event[ jQuery.expando ] ) {
3144 // Create a writable copy of the event object and normalize some properties
3146 originalEvent = event,
3147 fixHook = jQuery.event.fixHooks[ event.type ] || {},
3148 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
3150 event = jQuery.Event( originalEvent );
3152 for ( i = copy.length; i; ) {
3154 event[ prop ] = originalEvent[ prop ];
3157 // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
3158 if ( !event.target ) {
3159 event.target = originalEvent.srcElement || document;
3162 // Target should not be a text node (#504, Safari)
3163 if ( event.target.nodeType === 3 ) {
3164 event.target = event.target.parentNode;
3167 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
3168 event.metaKey = !!event.metaKey;
3170 return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
3175 // Make sure the ready event is setup
3176 setup: jQuery.bindReady
3180 // Prevent triggered image.load events from bubbling to window.load
3185 delegateType: "focusin"
3188 delegateType: "focusout"
3192 setup: function( data, namespaces, eventHandle ) {
3193 // We only want to do this special case on windows
3194 if ( jQuery.isWindow( this ) ) {
3195 this.onbeforeunload = eventHandle;
3199 teardown: function( namespaces, eventHandle ) {
3200 if ( this.onbeforeunload === eventHandle ) {
3201 this.onbeforeunload = null;
3207 simulate: function( type, elem, event, bubble ) {
3208 // Piggyback on a donor event to simulate a different one.
3209 // Fake originalEvent to avoid donor's stopPropagation, but if the
3210 // simulated event prevents default then we do the same on the donor.
3211 var e = jQuery.extend(
3220 jQuery.event.trigger( e, null, elem );
3222 jQuery.event.dispatch.call( elem, e );
3224 if ( e.isDefaultPrevented() ) {
3225 event.preventDefault();
3230 // Some plugins are using, but it's undocumented/deprecated and will be removed.
3231 // The 1.7 special event interface should provide all the hooks needed now.
3232 jQuery.event.handle = jQuery.event.dispatch;
3234 jQuery.removeEvent = document.removeEventListener ?
3235 function( elem, type, handle ) {
3236 if ( elem.removeEventListener ) {
3237 elem.removeEventListener( type, handle, false );
3240 function( elem, type, handle ) {
3241 var name = "on" + type;
3243 if ( elem.detachEvent ) {
3245 // #8545, #7054, preventing memory leaks for custom events in IE6-8 –
3246 // detachEvent needed property on element, by name of that event, to properly expose it to GC
3247 if ( typeof elem[ name ] === "undefined" ) {
3248 elem[ name ] = null;
3251 elem.detachEvent( name, handle );
3255 jQuery.Event = function( src, props ) {
3256 // Allow instantiation without the 'new' keyword
3257 if ( !(this instanceof jQuery.Event) ) {
3258 return new jQuery.Event( src, props );
3262 if ( src && src.type ) {
3263 this.originalEvent = src;
3264 this.type = src.type;
3266 // Events bubbling up the document may have been marked as prevented
3267 // by a handler lower down the tree; reflect the correct value.
3268 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
3269 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
3276 // Put explicitly provided properties onto the event object
3278 jQuery.extend( this, props );
3281 // Create a timestamp if incoming event doesn't have one
3282 this.timeStamp = src && src.timeStamp || jQuery.now();
3285 this[ jQuery.expando ] = true;
3288 function returnFalse() {
3291 function returnTrue() {
3295 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
3296 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
3297 jQuery.Event.prototype = {
3298 preventDefault: function() {
3299 this.isDefaultPrevented = returnTrue;
3301 var e = this.originalEvent;
3306 // if preventDefault exists run it on the original event
3307 if ( e.preventDefault ) {
3310 // otherwise set the returnValue property of the original event to false (IE)
3312 e.returnValue = false;
3315 stopPropagation: function() {
3316 this.isPropagationStopped = returnTrue;
3318 var e = this.originalEvent;
3322 // if stopPropagation exists run it on the original event
3323 if ( e.stopPropagation ) {
3324 e.stopPropagation();
3326 // otherwise set the cancelBubble property of the original event to true (IE)
3327 e.cancelBubble = true;
3329 stopImmediatePropagation: function() {
3330 this.isImmediatePropagationStopped = returnTrue;
3331 this.stopPropagation();
3333 isDefaultPrevented: returnFalse,
3334 isPropagationStopped: returnFalse,
3335 isImmediatePropagationStopped: returnFalse
3338 // Create mouseenter/leave events using mouseover/out and event-time checks
3340 mouseenter: "mouseover",
3341 mouseleave: "mouseout"
3342 }, function( orig, fix ) {
3343 jQuery.event.special[ orig ] = {
3347 handle: function( event ) {
3350 related = event.relatedTarget,
3351 handleObj = event.handleObj,
3352 selector = handleObj.selector;
3354 // For mousenter/leave call the handler if related is outside the target.
3355 // NB: No relatedTarget if the mouse left/entered the browser window
3356 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
3357 event.type = handleObj.origType;
3358 ret = handleObj.handler.apply( this, arguments );
3366 // IE submit delegation
3367 if ( !jQuery.support.submitBubbles ) {
3369 jQuery.event.special.submit = {
3371 // Only need this for delegated form submit events
3372 if ( jQuery.nodeName( this, "form" ) ) {
3376 // Lazy-add a submit handler when a descendant form may potentially be submitted
3377 jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
3378 // Node name check avoids a VML-related crash in IE (#9807)
3379 var elem = e.target,
3380 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
3381 if ( form && !jQuery._data( form, "_submit_attached" ) ) {
3382 jQuery.event.add( form, "submit._submit", function( event ) {
3383 event._submit_bubble = true;
3385 jQuery._data( form, "_submit_attached", true );
3388 // return undefined since we don't need an event listener
3391 postDispatch: function( event ) {
3392 // If form was submitted by the user, bubble the event up the tree
3393 if ( event._submit_bubble ) {
3394 delete event._submit_bubble;
3395 if ( this.parentNode && !event.isTrigger ) {
3396 jQuery.event.simulate( "submit", this.parentNode, event, true );
3401 teardown: function() {
3402 // Only need this for delegated form submit events
3403 if ( jQuery.nodeName( this, "form" ) ) {
3407 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
3408 jQuery.event.remove( this, "._submit" );
3413 // IE change delegation and checkbox/radio fix
3414 if ( !jQuery.support.changeBubbles ) {
3416 jQuery.event.special.change = {
3420 if ( rformElems.test( this.nodeName ) ) {
3421 // IE doesn't fire change on a check/radio until blur; trigger it on click
3422 // after a propertychange. Eat the blur-change in special.change.handle.
3423 // This still fires onchange a second time for check/radio after blur.
3424 if ( this.type === "checkbox" || this.type === "radio" ) {
3425 jQuery.event.add( this, "propertychange._change", function( event ) {
3426 if ( event.originalEvent.propertyName === "checked" ) {
3427 this._just_changed = true;
3430 jQuery.event.add( this, "click._change", function( event ) {
3431 if ( this._just_changed && !event.isTrigger ) {
3432 this._just_changed = false;
3434 // Allow triggered, simulated change events (#11500)
3435 jQuery.event.simulate( "change", this, event, true );
3440 // Delegated event; lazy-add a change handler on descendant inputs
3441 jQuery.event.add( this, "beforeactivate._change", function( e ) {
3442 var elem = e.target;
3444 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
3445 jQuery.event.add( elem, "change._change", function( event ) {
3446 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
3447 jQuery.event.simulate( "change", this.parentNode, event, true );
3450 jQuery._data( elem, "_change_attached", true );
3455 handle: function( event ) {
3456 var elem = event.target;
3458 // Swallow native change events from checkbox/radio, we already triggered them above
3459 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
3460 return event.handleObj.handler.apply( this, arguments );
3464 teardown: function() {
3465 jQuery.event.remove( this, "._change" );
3467 return rformElems.test( this.nodeName );
3472 // Create "bubbling" focus and blur events
3473 if ( !jQuery.support.focusinBubbles ) {
3474 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3476 // Attach a single capturing handler while someone wants focusin/focusout
3478 handler = function( event ) {
3479 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
3482 jQuery.event.special[ fix ] = {
3484 if ( attaches++ === 0 ) {
3485 document.addEventListener( orig, handler, true );
3488 teardown: function() {
3489 if ( --attaches === 0 ) {
3490 document.removeEventListener( orig, handler, true );
3499 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
3502 // Types can be a map of types/handlers
3503 if ( typeof types === "object" ) {
3504 // ( types-Object, selector, data )
3505 if ( typeof selector !== "string" ) { // && selector != null
3506 // ( types-Object, data )
3507 data = data || selector;
3508 selector = undefined;
3510 for ( type in types ) {
3511 this.on( type, selector, data, types[ type ], one );
3516 if ( data == null && fn == null ) {
3519 data = selector = undefined;
3520 } else if ( fn == null ) {
3521 if ( typeof selector === "string" ) {
3522 // ( types, selector, fn )
3526 // ( types, data, fn )
3529 selector = undefined;
3532 if ( fn === false ) {
3540 fn = function( event ) {
3541 // Can use an empty set, since event contains the info
3542 jQuery().off( event );
3543 return origFn.apply( this, arguments );
3545 // Use same guid so caller can remove using origFn
3546 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
3548 return this.each( function() {
3549 jQuery.event.add( this, types, fn, data, selector );
3552 one: function( types, selector, data, fn ) {
3553 return this.on( types, selector, data, fn, 1 );
3555 off: function( types, selector, fn ) {
3556 var handleObj, type;
3557 if ( types && types.preventDefault && types.handleObj ) {
3558 // ( event ) dispatched jQuery.Event
3559 handleObj = types.handleObj;
3560 jQuery( types.delegateTarget ).off(
3561 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3567 if ( typeof types === "object" ) {
3568 // ( types-object [, selector] )
3569 for ( type in types ) {
3570 this.off( type, selector, types[ type ] );
3574 if ( selector === false || typeof selector === "function" ) {
3577 selector = undefined;
3579 if ( fn === false ) {
3582 return this.each(function() {
3583 jQuery.event.remove( this, types, fn, selector );
3587 bind: function( types, data, fn ) {
3588 return this.on( types, null, data, fn );
3590 unbind: function( types, fn ) {
3591 return this.off( types, null, fn );
3594 live: function( types, data, fn ) {
3595 jQuery( this.context ).on( types, this.selector, data, fn );
3598 die: function( types, fn ) {
3599 jQuery( this.context ).off( types, this.selector || "**", fn );
3603 delegate: function( selector, types, data, fn ) {
3604 return this.on( types, selector, data, fn );
3606 undelegate: function( selector, types, fn ) {
3607 // ( namespace ) or ( selector, types [, fn] )
3608 return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3611 trigger: function( type, data ) {
3612 return this.each(function() {
3613 jQuery.event.trigger( type, data, this );
3616 triggerHandler: function( type, data ) {
3618 return jQuery.event.trigger( type, data, this[0], true );
3622 toggle: function( fn ) {
3623 // Save reference to arguments for access in closure
3624 var args = arguments,
3625 guid = fn.guid || jQuery.guid++,
3627 toggler = function( event ) {
3628 // Figure out which function to execute
3629 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3630 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3632 // Make sure that clicks stop
3633 event.preventDefault();
3635 // and execute the function
3636 return args[ lastToggle ].apply( this, arguments ) || false;
3639 // link all the functions, so any of them can unbind this click handler
3640 toggler.guid = guid;
3641 while ( i < args.length ) {
3642 args[ i++ ].guid = guid;
3645 return this.click( toggler );
3648 hover: function( fnOver, fnOut ) {
3649 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
3653 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
3654 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
3655 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
3657 // Handle event binding
3658 jQuery.fn[ name ] = function( data, fn ) {
3664 return arguments.length > 0 ?
3665 this.on( name, null, data, fn ) :
3666 this.trigger( name );
3669 if ( rkeyEvent.test( name ) ) {
3670 jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
3673 if ( rmouseEvent.test( name ) ) {
3674 jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
3678 * Sizzle CSS Selector Engine
\r
3679 * Copyright 2012 jQuery Foundation and other contributors
\r
3680 * Released under the MIT license
\r
3681 * http://sizzlejs.com/
\r
3683 (function( window, undefined ) {
\r
3689 assertGetIdNotName,
\r
3691 document = window.document,
\r
3692 docElem = document.documentElement,
\r
3694 strundefined = "undefined",
\r
3695 hasDuplicate = false,
\r
3696 baseHasDuplicate = true,
\r
3701 expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
\r
3705 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
\r
3706 whitespace = "[\\x20\\t\\r\\n\\f]",
\r
3707 // http://www.w3.org/TR/css3-syntax/#characters
\r
3708 characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
\r
3710 // Loosely modeled on CSS identifier characters
\r
3711 // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
\r
3712 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
\r
3713 identifier = characterEncoding.replace( "w", "w#" ),
\r
3715 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
\r
3716 operators = "([*^$|!~]?=)",
\r
3717 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
\r
3718 "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
\r
3719 pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",
\r
3720 pos = ":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",
\r
3721 combinators = whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*",
\r
3722 groups = "(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|" + attributes + "|" + pseudos.replace( 2, 7 ) + "|[^\\\\(),])+",
\r
3724 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
\r
3725 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
\r
3727 rcombinators = new RegExp( "^" + combinators ),
\r
3729 // All simple (non-comma) selectors, excluding insignifant trailing whitespace
\r
3730 rgroups = new RegExp( groups + "?(?=" + whitespace + "*,|$)", "g" ),
\r
3732 // A selector, or everything after leading whitespace
\r
3733 // Optionally followed in either case by a ")" for terminating sub-selectors
\r
3734 rselector = new RegExp( "^(?:(?!,)(?:(?:^|,)" + whitespace + "*" + groups + ")*?|" + whitespace + "*(.*?))(\\)|$)" ),
\r
3736 // All combinators and selector components (attribute test, tag, pseudo, etc.), the latter appearing together when consecutive
\r
3737 rtokens = new RegExp( groups.slice( 19, -6 ) + "\\x20\\t\\r\\n\\f>+~])+|" + combinators, "g" ),
\r
3739 // Easily-parseable/retrievable ID or TAG or CLASS selectors
\r
3740 rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
\r
3742 rsibling = /[\x20\t\r\n\f]*[+~]/,
\r
3743 rendsWithNot = /:not\($/,
\r
3746 rinputs = /input|select|textarea|button/i,
\r
3748 rbackslash = /\\(?!\\)/g,
\r
3751 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
\r
3752 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
\r
3753 "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
\r
3754 "TAG": new RegExp( "^(" + characterEncoding.replace( "[-", "[-\\*" ) + ")" ),
\r
3755 "ATTR": new RegExp( "^" + attributes ),
\r
3756 "PSEUDO": new RegExp( "^" + pseudos ),
\r
3757 "CHILD": new RegExp( "^:(only|nth|last|first)-child(?:\\(" + whitespace +
\r
3758 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
\r
3759 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
\r
3760 "POS": new RegExp( pos, "ig" ),
\r
3761 // For use in libraries implementing .is()
\r
3762 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
\r
3766 cachedClasses = [],
\r
3767 compilerCache = {},
\r
3768 cachedSelectors = [],
\r
3770 // Mark a function for use in filtering
\r
3771 markFunction = function( fn ) {
\r
3772 fn.sizzleFilter = true;
\r
3776 // Returns a function to use in pseudos for input types
\r
3777 createInputFunction = function( type ) {
\r
3778 return function( elem ) {
\r
3779 // Check the input's nodeName and type
\r
3780 return elem.nodeName.toLowerCase() === "input" && elem.type === type;
\r
3784 // Returns a function to use in pseudos for buttons
\r
3785 createButtonFunction = function( type ) {
\r
3786 return function( elem ) {
\r
3787 var name = elem.nodeName.toLowerCase();
\r
3788 return (name === "input" || name === "button") && elem.type === type;
\r
3792 // Used for testing something on an element
\r
3793 assert = function( fn ) {
\r
3795 div = document.createElement("div");
\r
3799 // release memory in IE
\r
3804 // Check if attributes should be retrieved by attribute nodes
\r
3805 assertAttributes = assert(function( div ) {
\r
3806 div.innerHTML = "<select></select>";
\r
3807 var type = typeof div.lastChild.getAttribute("multiple");
\r
3808 // IE8 returns a string for some attributes even when not present
\r
3809 return type !== "boolean" && type !== "string";
\r
3812 // Check if getElementById returns elements by name
\r
3813 // Check if getElementsByName privileges form controls or returns elements by ID
\r
3814 assertUsableName = assert(function( div ) {
\r
3816 div.id = expando + 0;
\r
3817 div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
\r
3818 docElem.insertBefore( div, docElem.firstChild );
\r
3821 var pass = document.getElementsByName &&
\r
3822 // buggy browsers will return fewer than the correct 2
\r
3823 document.getElementsByName( expando ).length ===
\r
3824 // buggy browsers will return more than the correct 0
\r
3825 2 + document.getElementsByName( expando + 0 ).length;
\r
3826 assertGetIdNotName = !document.getElementById( expando );
\r
3829 docElem.removeChild( div );
\r
3834 // Check if the browser returns only elements
\r
3835 // when doing getElementsByTagName("*")
\r
3836 assertTagNameNoComments = assert(function( div ) {
\r
3837 div.appendChild( document.createComment("") );
\r
3838 return div.getElementsByTagName("*").length === 0;
\r
3841 // Check if getAttribute returns normalized href attributes
\r
3842 assertHrefNotNormalized = assert(function( div ) {
\r
3843 div.innerHTML = "<a href='#'></a>";
\r
3844 return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
\r
3845 div.firstChild.getAttribute("href") === "#";
\r
3848 // Check if getElementsByClassName can be trusted
\r
3849 assertUsableClassName = assert(function( div ) {
\r
3850 // Opera can't find a second classname (in 9.6)
\r
3851 div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
\r
3852 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
\r
3856 // Safari caches class attributes, doesn't catch changes (in 3.2)
\r
3857 div.lastChild.className = "e";
\r
3858 return div.getElementsByClassName("e").length !== 1;
\r
3861 var Sizzle = function( selector, context, results, seed ) {
\r
3862 results = results || [];
\r
3863 context = context || document;
\r
3864 var match, elem, xml, m,
\r
3865 nodeType = context.nodeType;
\r
3867 if ( nodeType !== 1 && nodeType !== 9 ) {
\r
3871 if ( !selector || typeof selector !== "string" ) {
\r
3875 xml = isXML( context );
\r
3877 if ( !xml && !seed ) {
\r
3878 if ( (match = rquickExpr.exec( selector )) ) {
\r
3879 // Speed-up: Sizzle("#ID")
\r
3880 if ( (m = match[1]) ) {
\r
3881 if ( nodeType === 9 ) {
\r
3882 elem = context.getElementById( m );
\r
3883 // Check parentNode to catch when Blackberry 4.6 returns
\r
3884 // nodes that are no longer in the document #6963
\r
3885 if ( elem && elem.parentNode ) {
\r
3886 // Handle the case where IE, Opera, and Webkit return items
\r
3887 // by name instead of ID
\r
3888 if ( elem.id === m ) {
\r
3889 results.push( elem );
\r
3896 // Context is not a document
\r
3897 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
\r
3898 contains( context, elem ) && elem.id === m ) {
\r
3899 results.push( elem );
\r
3904 // Speed-up: Sizzle("TAG")
\r
3905 } else if ( match[2] ) {
\r
3906 push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
\r
3909 // Speed-up: Sizzle(".CLASS")
\r
3910 } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
\r
3911 push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
\r
3918 return select( selector, context, results, seed, xml );
\r
3921 var Expr = Sizzle.selectors = {
\r
3923 // Can be adjusted by the user
\r
3928 order: [ "ID", "TAG" ],
\r
3932 createPseudo: markFunction,
\r
3935 "ID": assertGetIdNotName ?
\r
3936 function( id, context, xml ) {
\r
3937 if ( typeof context.getElementById !== strundefined && !xml ) {
\r
3938 var m = context.getElementById( id );
\r
3939 // Check parentNode to catch when Blackberry 4.6 returns
\r
3940 // nodes that are no longer in the document #6963
\r
3941 return m && m.parentNode ? [m] : [];
\r
3944 function( id, context, xml ) {
\r
3945 if ( typeof context.getElementById !== strundefined && !xml ) {
\r
3946 var m = context.getElementById( id );
\r
3949 m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
\r
3956 "TAG": assertTagNameNoComments ?
\r
3957 function( tag, context ) {
\r
3958 if ( typeof context.getElementsByTagName !== strundefined ) {
\r
3959 return context.getElementsByTagName( tag );
\r
3962 function( tag, context ) {
\r
3963 var results = context.getElementsByTagName( tag );
\r
3965 // Filter out possible comments
\r
3966 if ( tag === "*" ) {
\r
3971 for ( ; (elem = results[i]); i++ ) {
\r
3972 if ( elem.nodeType === 1 ) {
\r
3984 ">": { dir: "parentNode", first: true },
\r
3985 " ": { dir: "parentNode" },
\r
3986 "+": { dir: "previousSibling", first: true },
\r
3987 "~": { dir: "previousSibling" }
\r
3991 "ATTR": function( match ) {
\r
3992 match[1] = match[1].replace( rbackslash, "" );
\r
3994 // Move the given value to match[3] whether quoted or unquoted
\r
3995 match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
\r
3997 if ( match[2] === "~=" ) {
\r
3998 match[3] = " " + match[3] + " ";
\r
4001 return match.slice( 0, 4 );
\r
4004 "CHILD": function( match ) {
\r
4005 /* matches from matchExpr.CHILD
\r
4006 1 type (only|nth|...)
\r
4007 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
\r
4008 3 xn-component of xn+y argument ([+-]?\d*n|)
\r
4009 4 sign of xn-component
\r
4010 5 x of xn-component
\r
4011 6 sign of y-component
\r
4012 7 y of y-component
\r
4014 match[1] = match[1].toLowerCase();
\r
4016 if ( match[1] === "nth" ) {
\r
4017 // nth-child requires argument
\r
4018 if ( !match[2] ) {
\r
4019 Sizzle.error( match[0] );
\r
4022 // numeric x and y parameters for Expr.filter.CHILD
\r
4023 // remember that false/true cast respectively to 0/1
\r
4024 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
\r
4025 match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
\r
4027 // other types prohibit arguments
\r
4028 } else if ( match[2] ) {
\r
4029 Sizzle.error( match[0] );
\r
4035 "PSEUDO": function( match ) {
\r
4037 unquoted = match[4];
\r
4039 if ( matchExpr["CHILD"].test( match[0] ) ) {
\r
4043 // Relinquish our claim on characters in `unquoted` from a closing parenthesis on
\r
4044 if ( unquoted && (argument = rselector.exec( unquoted )) && argument.pop() ) {
\r
4046 match[0] = match[0].slice( 0, argument[0].length - unquoted.length - 1 );
\r
4047 unquoted = argument[0].slice( 0, -1 );
\r
4050 // Quoted or unquoted, we have the full argument
\r
4051 // Return only captures needed by the pseudo filter method (type and argument)
\r
4052 match.splice( 2, 3, unquoted || match[3] );
\r
4058 "ID": assertGetIdNotName ?
\r
4060 id = id.replace( rbackslash, "" );
\r
4061 return function( elem ) {
\r
4062 return elem.getAttribute("id") === id;
\r
4066 id = id.replace( rbackslash, "" );
\r
4067 return function( elem ) {
\r
4068 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
\r
4069 return node && node.value === id;
\r
4073 "TAG": function( nodeName ) {
\r
4074 if ( nodeName === "*" ) {
\r
4075 return function() { return true; };
\r
4077 nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
\r
4079 return function( elem ) {
\r
4080 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
\r
4084 "CLASS": function( className ) {
\r
4085 var pattern = classCache[ className ];
\r
4087 pattern = classCache[ className ] = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" );
\r
4088 cachedClasses.push( className );
\r
4089 // Avoid too large of a cache
\r
4090 if ( cachedClasses.length > Expr.cacheLength ) {
\r
4091 delete classCache[ cachedClasses.shift() ];
\r
4094 return function( elem ) {
\r
4095 return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
\r
4099 "ATTR": function( name, operator, check ) {
\r
4100 if ( !operator ) {
\r
4101 return function( elem ) {
\r
4102 return Sizzle.attr( elem, name ) != null;
\r
4106 return function( elem ) {
\r
4107 var result = Sizzle.attr( elem, name ),
\r
4108 value = result + "";
\r
4110 if ( result == null ) {
\r
4111 return operator === "!=";
\r
4114 switch ( operator ) {
\r
4116 return value === check;
\r
4118 return value !== check;
\r
4120 return check && value.indexOf( check ) === 0;
\r
4122 return check && value.indexOf( check ) > -1;
\r
4124 return check && value.substr( value.length - check.length ) === check;
\r
4126 return ( " " + value + " " ).indexOf( check ) > -1;
\r
4128 return value === check || value.substr( 0, check.length + 1 ) === check + "-";
\r
4133 "CHILD": function( type, argument, first, last ) {
\r
4135 if ( type === "nth" ) {
\r
4136 var doneName = done++;
\r
4138 return function( elem ) {
\r
4143 if ( first === 1 && last === 0 ) {
\r
4147 parent = elem.parentNode;
\r
4149 if ( parent && (parent[ expando ] !== doneName || !elem.sizset) ) {
\r
4150 for ( node = parent.firstChild; node; node = node.nextSibling ) {
\r
4151 if ( node.nodeType === 1 ) {
\r
4152 node.sizset = ++count;
\r
4153 if ( node === elem ) {
\r
4159 parent[ expando ] = doneName;
\r
4162 diff = elem.sizset - last;
\r
4164 if ( first === 0 ) {
\r
4165 return diff === 0;
\r
4168 return ( diff % first === 0 && diff / first >= 0 );
\r
4173 return function( elem ) {
\r
4179 while ( (node = node.previousSibling) ) {
\r
4180 if ( node.nodeType === 1 ) {
\r
4185 if ( type === "first" ) {
\r
4191 /* falls through */
\r
4193 while ( (node = node.nextSibling) ) {
\r
4194 if ( node.nodeType === 1 ) {
\r
4204 "PSEUDO": function( pseudo, argument, context, xml ) {
\r
4205 // pseudo-class names are case-insensitive
\r
4206 // http://www.w3.org/TR/selectors/#pseudo-classes
\r
4207 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
\r
4208 var fn = Expr.pseudos[ pseudo ] || Expr.pseudos[ pseudo.toLowerCase() ];
\r
4211 Sizzle.error( "unsupported pseudo: " + pseudo );
\r
4214 // The user may set fn.sizzleFilter to indicate
\r
4215 // that arguments are needed to create the filter function
\r
4216 // just as Sizzle does
\r
4217 if ( !fn.sizzleFilter ) {
\r
4221 return fn( argument, context, xml );
\r
4226 "not": markFunction(function( selector, context, xml ) {
\r
4227 // Trim the selector passed to compile
\r
4228 // to avoid treating leading and trailing
\r
4229 // spaces as combinators
\r
4230 var matcher = compile( selector.replace( rtrim, "$1" ), context, xml );
\r
4231 return function( elem ) {
\r
4232 return !matcher( elem );
\r
4236 "enabled": function( elem ) {
\r
4237 return elem.disabled === false;
\r
4240 "disabled": function( elem ) {
\r
4241 return elem.disabled === true;
\r
4244 "checked": function( elem ) {
\r
4245 // In CSS3, :checked should return both checked and selected elements
\r
4246 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
\r
4247 var nodeName = elem.nodeName.toLowerCase();
\r
4248 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
\r
4251 "selected": function( elem ) {
\r
4252 // Accessing this property makes selected-by-default
\r
4253 // options in Safari work properly
\r
4254 if ( elem.parentNode ) {
\r
4255 elem.parentNode.selectedIndex;
\r
4258 return elem.selected === true;
\r
4261 "parent": function( elem ) {
\r
4262 return !Expr.pseudos["empty"]( elem );
\r
4265 "empty": function( elem ) {
\r
4266 // http://www.w3.org/TR/selectors/#empty-pseudo
\r
4267 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
\r
4268 // not comment, processing instructions, or others
\r
4269 // Thanks to Diego Perini for the nodeName shortcut
\r
4270 // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
\r
4272 elem = elem.firstChild;
\r
4274 if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
\r
4277 elem = elem.nextSibling;
\r
4282 "contains": markFunction(function( text ) {
\r
4283 return function( elem ) {
\r
4284 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
\r
4288 "has": markFunction(function( selector ) {
\r
4289 return function( elem ) {
\r
4290 return Sizzle( selector, elem ).length > 0;
\r
4294 "header": function( elem ) {
\r
4295 return rheader.test( elem.nodeName );
\r
4298 "text": function( elem ) {
\r
4300 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
\r
4301 // use getAttribute instead to test this case
\r
4302 return elem.nodeName.toLowerCase() === "input" &&
\r
4303 (type = elem.type) === "text" &&
\r
4304 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
\r
4308 "radio": createInputFunction("radio"),
\r
4309 "checkbox": createInputFunction("checkbox"),
\r
4310 "file": createInputFunction("file"),
\r
4311 "password": createInputFunction("password"),
\r
4312 "image": createInputFunction("image"),
\r
4314 "submit": createButtonFunction("submit"),
\r
4315 "reset": createButtonFunction("reset"),
\r
4317 "button": function( elem ) {
\r
4318 var name = elem.nodeName.toLowerCase();
\r
4319 return name === "input" && elem.type === "button" || name === "button";
\r
4322 "input": function( elem ) {
\r
4323 return rinputs.test( elem.nodeName );
\r
4326 "focus": function( elem ) {
\r
4327 var doc = elem.ownerDocument;
\r
4328 return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
\r
4331 "active": function( elem ) {
\r
4332 return elem === elem.ownerDocument.activeElement;
\r
4337 "first": function( elements, argument, not ) {
\r
4338 return not ? elements.slice( 1 ) : [ elements[0] ];
\r
4341 "last": function( elements, argument, not ) {
\r
4342 var elem = elements.pop();
\r
4343 return not ? elements : [ elem ];
\r
4346 "even": function( elements, argument, not ) {
\r
4349 len = elements.length;
\r
4350 for ( ; i < len; i = i + 2 ) {
\r
4351 results.push( elements[i] );
\r
4356 "odd": function( elements, argument, not ) {
\r
4359 len = elements.length;
\r
4360 for ( ; i < len; i = i + 2 ) {
\r
4361 results.push( elements[i] );
\r
4366 "lt": function( elements, argument, not ) {
\r
4367 return not ? elements.slice( +argument ) : elements.slice( 0, +argument );
\r
4370 "gt": function( elements, argument, not ) {
\r
4371 return not ? elements.slice( 0, +argument + 1 ) : elements.slice( +argument + 1 );
\r
4374 "eq": function( elements, argument, not ) {
\r
4375 var elem = elements.splice( +argument, 1 );
\r
4376 return not ? elements : elem;
\r
4382 Expr.setFilters["nth"] = Expr.setFilters["eq"];
\r
4385 Expr.filters = Expr.pseudos;
\r
4387 // IE6/7 return a modified href
\r
4388 if ( !assertHrefNotNormalized ) {
\r
4389 Expr.attrHandle = {
\r
4390 "href": function( elem ) {
\r
4391 return elem.getAttribute( "href", 2 );
\r
4393 "type": function( elem ) {
\r
4394 return elem.getAttribute("type");
\r
4399 // Add getElementsByName if usable
\r
4400 if ( assertUsableName ) {
\r
4401 Expr.order.push("NAME");
\r
4402 Expr.find["NAME"] = function( name, context ) {
\r
4403 if ( typeof context.getElementsByName !== strundefined ) {
\r
4404 return context.getElementsByName( name );
\r
4409 // Add getElementsByClassName if usable
\r
4410 if ( assertUsableClassName ) {
\r
4411 Expr.order.splice( 1, 0, "CLASS" );
\r
4412 Expr.find["CLASS"] = function( className, context, xml ) {
\r
4413 if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
\r
4414 return context.getElementsByClassName( className );
\r
4419 // If slice is not available, provide a backup
\r
4421 slice.call( docElem.childNodes, 0 )[0].nodeType;
\r
4423 slice = function( i ) {
\r
4424 var elem, results = [];
\r
4425 for ( ; (elem = this[i]); i++ ) {
\r
4426 results.push( elem );
\r
4432 var isXML = Sizzle.isXML = function( elem ) {
\r
4433 // documentElement is verified for cases where it doesn't yet exist
\r
4434 // (such as loading iframes in IE - #4833)
\r
4435 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
\r
4436 return documentElement ? documentElement.nodeName !== "HTML" : false;
\r
4439 // Element contains another
\r
4440 var contains = Sizzle.contains = docElem.compareDocumentPosition ?
\r
4441 function( a, b ) {
\r
4442 return !!( a.compareDocumentPosition( b ) & 16 );
\r
4444 docElem.contains ?
\r
4445 function( a, b ) {
\r
4446 var adown = a.nodeType === 9 ? a.documentElement : a,
\r
4447 bup = b.parentNode;
\r
4448 return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
\r
4450 function( a, b ) {
\r
4451 while ( (b = b.parentNode) ) {
\r
4460 * Utility function for retrieving the text value of an array of DOM nodes
\r
4461 * @param {Array|Element} elem
\r
4463 var getText = Sizzle.getText = function( elem ) {
\r
4467 nodeType = elem.nodeType;
\r
4470 if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
\r
4471 // Use textContent for elements
\r
4472 // innerText usage removed for consistency of new lines (see #11153)
\r
4473 if ( typeof elem.textContent === "string" ) {
\r
4474 return elem.textContent;
\r
4476 // Traverse its children
\r
4477 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
\r
4478 ret += getText( elem );
\r
4481 } else if ( nodeType === 3 || nodeType === 4 ) {
\r
4482 return elem.nodeValue;
\r
4484 // Do not include comment or processing instruction nodes
\r
4487 // If no nodeType, this is expected to be an array
\r
4488 for ( ; (node = elem[i]); i++ ) {
\r
4489 // Do not traverse comment nodes
\r
4490 ret += getText( node );
\r
4496 Sizzle.attr = function( elem, name ) {
\r
4498 xml = isXML( elem );
\r
4501 name = name.toLowerCase();
\r
4503 if ( Expr.attrHandle[ name ] ) {
\r
4504 return Expr.attrHandle[ name ]( elem );
\r
4506 if ( assertAttributes || xml ) {
\r
4507 return elem.getAttribute( name );
\r
4509 attr = elem.getAttributeNode( name );
\r
4511 typeof elem[ name ] === "boolean" ?
\r
4512 elem[ name ] ? name : null :
\r
4513 attr.specified ? attr.value : null :
\r
4517 Sizzle.error = function( msg ) {
\r
4518 throw new Error( "Syntax error, unrecognized expression: " + msg );
\r
4521 // Check if the JavaScript engine is using some sort of
\r
4522 // optimization where it does not always call our comparision
\r
4523 // function. If that is the case, discard the hasDuplicate value.
\r
4524 // Thus far that includes Google Chrome.
\r
4525 [0, 0].sort(function() {
\r
4526 return (baseHasDuplicate = 0);
\r
4530 if ( docElem.compareDocumentPosition ) {
\r
4531 sortOrder = function( a, b ) {
\r
4533 hasDuplicate = true;
\r
4537 return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
\r
4538 a.compareDocumentPosition :
\r
4539 a.compareDocumentPosition(b) & 4
\r
4544 sortOrder = function( a, b ) {
\r
4545 // The nodes are identical, we can exit early
\r
4547 hasDuplicate = true;
\r
4550 // Fallback to using sourceIndex (in IE) if it's available on both nodes
\r
4551 } else if ( a.sourceIndex && b.sourceIndex ) {
\r
4552 return a.sourceIndex - b.sourceIndex;
\r
4558 aup = a.parentNode,
\r
4559 bup = b.parentNode,
\r
4562 // If the nodes are siblings (or identical) we can do a quick check
\r
4563 if ( aup === bup ) {
\r
4564 return siblingCheck( a, b );
\r
4566 // If no parents were found then the nodes are disconnected
\r
4567 } else if ( !aup ) {
\r
4570 } else if ( !bup ) {
\r
4574 // Otherwise they're somewhere else in the tree so we need
\r
4575 // to build up a full list of the parentNodes for comparison
\r
4577 ap.unshift( cur );
\r
4578 cur = cur.parentNode;
\r
4584 bp.unshift( cur );
\r
4585 cur = cur.parentNode;
\r
4591 // Start walking down the tree looking for a discrepancy
\r
4592 for ( var i = 0; i < al && i < bl; i++ ) {
\r
4593 if ( ap[i] !== bp[i] ) {
\r
4594 return siblingCheck( ap[i], bp[i] );
\r
4598 // We ended someplace up the tree so do a sibling check
\r
4600 siblingCheck( a, bp[i], -1 ) :
\r
4601 siblingCheck( ap[i], b, 1 );
\r
4604 siblingCheck = function( a, b, ret ) {
\r
4609 var cur = a.nextSibling;
\r
4612 if ( cur === b ) {
\r
4616 cur = cur.nextSibling;
\r
4623 // Document sorting and removing duplicates
\r
4624 Sizzle.uniqueSort = function( results ) {
\r
4628 if ( sortOrder ) {
\r
4629 hasDuplicate = baseHasDuplicate;
\r
4630 results.sort( sortOrder );
\r
4632 if ( hasDuplicate ) {
\r
4633 for ( ; (elem = results[i]); i++ ) {
\r
4634 if ( elem === results[ i - 1 ] ) {
\r
4635 results.splice( i--, 1 );
\r
4644 function multipleContexts( selector, contexts, results, seed ) {
\r
4646 len = contexts.length;
\r
4647 for ( ; i < len; i++ ) {
\r
4648 Sizzle( selector, contexts[i], results, seed );
\r
4652 function handlePOSGroup( selector, posfilter, argument, contexts, seed, not ) {
\r
4654 fn = Expr.setFilters[ posfilter.toLowerCase() ];
\r
4657 Sizzle.error( posfilter );
\r
4660 if ( selector || !(results = seed) ) {
\r
4661 multipleContexts( selector || "*", contexts, (results = []), seed );
\r
4664 return results.length > 0 ? fn( results, argument, not ) : [];
\r
4667 function handlePOS( selector, context, results, seed, groups ) {
\r
4668 var match, not, anchor, ret, elements, currentContexts, part, lastIndex,
\r
4670 len = groups.length,
\r
4671 rpos = matchExpr["POS"],
\r
4672 // This is generated here in case matchExpr["POS"] is extended
\r
4673 rposgroups = new RegExp( "^" + rpos.source + "(?!" + whitespace + ")", "i" ),
\r
4674 // This is for making sure non-participating
\r
4675 // matching groups are represented cross-browser (IE6-8)
\r
4676 setUndefined = function() {
\r
4678 len = arguments.length - 2;
\r
4679 for ( ; i < len; i++ ) {
\r
4680 if ( arguments[i] === undefined ) {
\r
4681 match[i] = undefined;
\r
4686 for ( ; i < len; i++ ) {
\r
4687 // Reset regex index to 0
\r
4689 selector = groups[i];
\r
4693 while ( (match = rpos.exec( selector )) ) {
\r
4694 lastIndex = rpos.lastIndex = match.index + match[0].length;
\r
4695 if ( lastIndex > anchor ) {
\r
4696 part = selector.slice( anchor, match.index );
\r
4697 anchor = lastIndex;
\r
4698 currentContexts = [ context ];
\r
4700 if ( rcombinators.test(part) ) {
\r
4702 currentContexts = elements;
\r
4707 if ( (not = rendsWithNot.test( part )) ) {
\r
4708 part = part.slice( 0, -5 ).replace( rcombinators, "$&*" );
\r
4711 if ( match.length > 1 ) {
\r
4712 match[0].replace( rposgroups, setUndefined );
\r
4714 elements = handlePOSGroup( part, match[1], match[2], currentContexts, elements, not );
\r
4719 ret = ret.concat( elements );
\r
4721 if ( (part = selector.slice( anchor )) && part !== ")" ) {
\r
4722 if ( rcombinators.test(part) ) {
\r
4723 multipleContexts( part, ret, results, seed );
\r
4725 Sizzle( part, context, results, seed ? seed.concat(elements) : elements );
\r
4728 push.apply( results, ret );
\r
4731 Sizzle( selector, context, results, seed );
\r
4735 // Do not sort if this is a single filter
\r
4736 return len === 1 ? results : Sizzle.uniqueSort( results );
\r
4739 function tokenize( selector, context, xml ) {
\r
4740 var tokens, soFar, type,
\r
4744 // Catch obvious selector issues: terminal ")"; nonempty fallback match
\r
4745 // rselector never fails to match *something*
\r
4746 match = rselector.exec( selector ),
\r
4747 matched = !match.pop() && !match.pop(),
\r
4748 selectorGroups = matched && selector.match( rgroups ) || [""],
\r
4750 preFilters = Expr.preFilter,
\r
4751 filters = Expr.filter,
\r
4752 checkContext = !xml && context !== document;
\r
4754 for ( ; (soFar = selectorGroups[i]) != null && matched; i++ ) {
\r
4755 groups.push( tokens = [] );
\r
4757 // Need to make sure we're within a narrower context if necessary
\r
4758 // Adding a descendant combinator will generate what is needed
\r
4759 if ( checkContext ) {
\r
4760 soFar = " " + soFar;
\r
4767 if ( (match = rcombinators.exec( soFar )) ) {
\r
4768 soFar = soFar.slice( match[0].length );
\r
4770 // Cast descendant combinators to space
\r
4771 matched = tokens.push({ part: match.pop().replace( rtrim, " " ), captures: match });
\r
4775 for ( type in filters ) {
\r
4776 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
\r
4777 (match = preFilters[ type ]( match, context, xml )) ) ) {
\r
4779 soFar = soFar.slice( match.shift().length );
\r
4780 matched = tokens.push({ part: type, captures: match });
\r
4791 Sizzle.error( selector );
\r
4797 function addCombinator( matcher, combinator, context ) {
\r
4798 var dir = combinator.dir,
\r
4799 doneName = done++;
\r
4802 // If there is no matcher to check, check against the context
\r
4803 matcher = function( elem ) {
\r
4804 return elem === context;
\r
4807 return combinator.first ?
\r
4808 function( elem, context ) {
\r
4809 while ( (elem = elem[ dir ]) ) {
\r
4810 if ( elem.nodeType === 1 ) {
\r
4811 return matcher( elem, context ) && elem;
\r
4815 function( elem, context ) {
\r
4817 dirkey = doneName + "." + dirruns,
\r
4818 cachedkey = dirkey + "." + cachedruns;
\r
4819 while ( (elem = elem[ dir ]) ) {
\r
4820 if ( elem.nodeType === 1 ) {
\r
4821 if ( (cache = elem[ expando ]) === cachedkey ) {
\r
4822 return elem.sizset;
\r
4823 } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
\r
4824 if ( elem.sizset ) {
\r
4828 elem[ expando ] = cachedkey;
\r
4829 if ( matcher( elem, context ) ) {
\r
4830 elem.sizset = true;
\r
4833 elem.sizset = false;
\r
4840 function addMatcher( higher, deeper ) {
\r
4842 function( elem, context ) {
\r
4843 var result = deeper( elem, context );
\r
4844 return result && higher( result === true ? elem : result, context );
\r
4849 // ["TAG", ">", "ID", " ", "CLASS"]
\r
4850 function matcherFromTokens( tokens, context, xml ) {
\r
4851 var token, matcher,
\r
4854 for ( ; (token = tokens[i]); i++ ) {
\r
4855 if ( Expr.relative[ token.part ] ) {
\r
4856 matcher = addCombinator( matcher, Expr.relative[ token.part ], context );
\r
4858 token.captures.push( context, xml );
\r
4859 matcher = addMatcher( matcher, Expr.filter[ token.part ].apply( null, token.captures ) );
\r
4866 function matcherFromGroupMatchers( matchers ) {
\r
4867 return function( elem, context ) {
\r
4870 for ( ; (matcher = matchers[j]); j++ ) {
\r
4871 if ( matcher(elem, context) ) {
\r
4879 var compile = Sizzle.compile = function( selector, context, xml ) {
\r
4880 var tokens, group, i,
\r
4881 cached = compilerCache[ selector ];
\r
4883 // Return a cached group function if already generated (context dependent)
\r
4884 if ( cached && cached.context === context ) {
\r
4888 // Generate a function of recursive functions that can be used to check each element
\r
4889 group = tokenize( selector, context, xml );
\r
4890 for ( i = 0; (tokens = group[i]); i++ ) {
\r
4891 group[i] = matcherFromTokens( tokens, context, xml );
\r
4894 // Cache the compiled function
\r
4895 cached = compilerCache[ selector ] = matcherFromGroupMatchers( group );
\r
4896 cached.context = context;
\r
4897 cached.runs = cached.dirruns = 0;
\r
4898 cachedSelectors.push( selector );
\r
4899 // Ensure only the most recent are cached
\r
4900 if ( cachedSelectors.length > Expr.cacheLength ) {
\r
4901 delete compilerCache[ cachedSelectors.shift() ];
\r
4906 Sizzle.matches = function( expr, elements ) {
\r
4907 return Sizzle( expr, null, null, elements );
\r
4910 Sizzle.matchesSelector = function( elem, expr ) {
\r
4911 return Sizzle( expr, null, null, [ elem ] ).length > 0;
\r
4914 var select = function( selector, context, results, seed, xml ) {
\r
4915 // Remove excessive whitespace
\r
4916 selector = selector.replace( rtrim, "$1" );
\r
4917 var elements, matcher, i, len, elem, token,
\r
4918 type, findContext, notTokens,
\r
4919 match = selector.match( rgroups ),
\r
4920 tokens = selector.match( rtokens ),
\r
4921 contextNodeType = context.nodeType;
\r
4924 if ( matchExpr["POS"].test(selector) ) {
\r
4925 return handlePOS( selector, context, results, seed, match );
\r
4929 elements = slice.call( seed, 0 );
\r
4931 // To maintain document order, only narrow the
\r
4932 // set if there is one group
\r
4933 } else if ( match && match.length === 1 ) {
\r
4935 // Take a shortcut and set the context if the root selector is an ID
\r
4936 if ( tokens.length > 1 && contextNodeType === 9 && !xml &&
\r
4937 (match = matchExpr["ID"].exec( tokens[0] )) ) {
\r
4939 context = Expr.find["ID"]( match[1], context, xml )[0];
\r
4944 selector = selector.slice( tokens.shift().length );
\r
4947 findContext = ( (match = rsibling.exec( tokens[0] )) && !match.index && context.parentNode ) || context;
\r
4949 // Get the last token, excluding :not
\r
4950 notTokens = tokens.pop();
\r
4951 token = notTokens.split(":not")[0];
\r
4953 for ( i = 0, len = Expr.order.length; i < len; i++ ) {
\r
4954 type = Expr.order[i];
\r
4956 if ( (match = matchExpr[ type ].exec( token )) ) {
\r
4957 elements = Expr.find[ type ]( (match[1] || "").replace( rbackslash, "" ), findContext, xml );
\r
4959 if ( elements == null ) {
\r
4963 if ( token === notTokens ) {
\r
4964 selector = selector.slice( 0, selector.length - notTokens.length ) +
\r
4965 token.replace( matchExpr[ type ], "" );
\r
4967 if ( !selector ) {
\r
4968 push.apply( results, slice.call(elements, 0) );
\r
4976 // Only loop over the given elements once
\r
4977 // If selector is empty, we're already done
\r
4979 matcher = compile( selector, context, xml );
\r
4980 dirruns = matcher.dirruns++;
\r
4982 if ( elements == null ) {
\r
4983 elements = Expr.find["TAG"]( "*", (rsibling.test( selector ) && context.parentNode) || context );
\r
4985 for ( i = 0; (elem = elements[i]); i++ ) {
\r
4986 cachedruns = matcher.runs++;
\r
4987 if ( matcher(elem, context) ) {
\r
4988 results.push( elem );
\r
4996 if ( document.querySelectorAll ) {
\r
4998 var disconnectedMatch,
\r
4999 oldSelect = select,
\r
5000 rescape = /'|\\/g,
\r
5001 rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
\r
5003 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
\r
5004 // A support test would require too much code (would include document ready)
\r
5005 // just skip matchesSelector for :active
\r
5006 rbuggyMatches = [":active"],
\r
5007 matches = docElem.matchesSelector ||
\r
5008 docElem.mozMatchesSelector ||
\r
5009 docElem.webkitMatchesSelector ||
\r
5010 docElem.oMatchesSelector ||
\r
5011 docElem.msMatchesSelector;
\r
5013 // Build QSA regex
\r
5014 // Regex strategy adopted from Diego Perini
\r
5015 assert(function( div ) {
\r
5016 div.innerHTML = "<select><option selected></option></select>";
\r
5018 // IE8 - Some boolean attributes are not treated correctly
\r
5019 if ( !div.querySelectorAll("[selected]").length ) {
\r
5020 rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
\r
5023 // Webkit/Opera - :checked should return selected option elements
\r
5024 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
\r
5025 // IE8 throws error here (do not put tests after this one)
\r
5026 if ( !div.querySelectorAll(":checked").length ) {
\r
5027 rbuggyQSA.push(":checked");
\r
5031 assert(function( div ) {
\r
5033 // Opera 10-12/IE9 - ^= $= *= and empty values
\r
5034 // Should not select anything
\r
5035 div.innerHTML = "<p test=''></p>";
\r
5036 if ( div.querySelectorAll("[test^='']").length ) {
\r
5037 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
\r
5040 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
\r
5041 // IE8 throws error here (do not put tests after this one)
\r
5042 div.innerHTML = "<input type='hidden'>";
\r
5043 if ( !div.querySelectorAll(":enabled").length ) {
\r
5044 rbuggyQSA.push(":enabled", ":disabled");
\r
5048 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
\r
5050 select = function( selector, context, results, seed, xml ) {
\r
5051 // Only use querySelectorAll when not filtering,
\r
5052 // when this is not xml,
\r
5053 // and when no QSA bugs apply
\r
5054 if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
\r
5055 if ( context.nodeType === 9 ) {
\r
5057 push.apply( results, slice.call(context.querySelectorAll( selector ), 0) );
\r
5059 } catch(qsaError) {}
\r
5060 // qSA works strangely on Element-rooted queries
\r
5061 // We can work around this by specifying an extra ID on the root
\r
5062 // and working up from there (Thanks to Andrew Dupont for the technique)
\r
5063 // IE 8 doesn't work on object elements
\r
5064 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
\r
5065 var old = context.getAttribute("id"),
\r
5066 nid = old || expando,
\r
5067 newContext = rsibling.test( selector ) && context.parentNode || context;
\r
5070 nid = nid.replace( rescape, "\\$&" );
\r
5072 context.setAttribute( "id", nid );
\r
5076 push.apply( results, slice.call( newContext.querySelectorAll(
\r
5077 selector.replace( rgroups, "[id='" + nid + "'] $&" )
\r
5080 } catch(qsaError) {
\r
5083 context.removeAttribute("id");
\r
5089 return oldSelect( selector, context, results, seed, xml );
\r
5093 assert(function( div ) {
\r
5094 // Check to see if it's possible to do matchesSelector
\r
5095 // on a disconnected node (IE 9)
\r
5096 disconnectedMatch = matches.call( div, "div" );
\r
5098 // This should fail with an exception
\r
5099 // Gecko does not error, returns false instead
\r
5101 matches.call( div, "[test!='']:sizzle" );
\r
5102 rbuggyMatches.push( Expr.match.PSEUDO );
\r
5106 // rbuggyMatches always contains :active, so no need for a length check
\r
5107 rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
\r
5109 Sizzle.matchesSelector = function( elem, expr ) {
\r
5110 // Make sure that attribute selectors are quoted
\r
5111 expr = expr.replace( rattributeQuotes, "='$1']" );
\r
5113 // rbuggyMatches always contains :active, so no need for an existence check
\r
5114 if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
\r
5116 var ret = matches.call( elem, expr );
\r
5118 // IE 9's matchesSelector returns false on disconnected nodes
\r
5119 if ( ret || disconnectedMatch ||
\r
5120 // As well, disconnected nodes are said to be in a document
\r
5121 // fragment in IE 9
\r
5122 elem.document && elem.document.nodeType !== 11 ) {
\r
5128 return Sizzle( expr, null, null, [ elem ] ).length > 0;
\r
5134 // Override sizzle attribute retrieval
5135 Sizzle.attr = jQuery.attr;
5136 jQuery.find = Sizzle;
5137 jQuery.expr = Sizzle.selectors;
5138 jQuery.expr[":"] = jQuery.expr.pseudos;
5139 jQuery.unique = Sizzle.uniqueSort;
5140 jQuery.text = Sizzle.getText;
5141 jQuery.isXMLDoc = Sizzle.isXML;
5142 jQuery.contains = Sizzle.contains;
5146 var runtil = /Until$/,
5147 rparentsprev = /^(?:parents|prev(?:Until|All))/,
5148 isSimple = /^.[^:#\[\.,]*$/,
5149 rneedsContext = jQuery.expr.match.needsContext,
5150 // methods guaranteed to produce a unique set when starting from a unique set
5151 guaranteedUnique = {
5159 find: function( selector ) {
5160 var i, l, length, n, r, ret,
5163 if ( typeof selector !== "string" ) {
5164 return jQuery( selector ).filter(function() {
5165 for ( i = 0, l = self.length; i < l; i++ ) {
5166 if ( jQuery.contains( self[ i ], this ) ) {
5173 ret = this.pushStack( "", "find", selector );
5175 for ( i = 0, l = this.length; i < l; i++ ) {
5176 length = ret.length;
5177 jQuery.find( selector, this[i], ret );
5180 // Make sure that the results are unique
5181 for ( n = length; n < ret.length; n++ ) {
5182 for ( r = 0; r < length; r++ ) {
5183 if ( ret[r] === ret[n] ) {
5195 has: function( target ) {
5197 targets = jQuery( target, this ),
5198 len = targets.length;
5200 return this.filter(function() {
5201 for ( i = 0; i < len; i++ ) {
5202 if ( jQuery.contains( this, targets[i] ) ) {
5209 not: function( selector ) {
5210 return this.pushStack( winnow(this, selector, false), "not", selector);
5213 filter: function( selector ) {
5214 return this.pushStack( winnow(this, selector, true), "filter", selector );
5217 is: function( selector ) {
5218 return !!selector && (
5219 typeof selector === "string" ?
5220 // If this is a positional/relative selector, check membership in the returned set
5221 // so $("p:first").is("p:last") won't return true for a doc with two "p".
5222 rneedsContext.test( selector ) ?
5223 jQuery( selector, this.context ).index( this[0] ) >= 0 :
5224 jQuery.filter( selector, this ).length > 0 :
5225 this.filter( selector ).length > 0 );
5228 closest: function( selectors, context ) {
5233 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
5234 jQuery( selectors, context || this.context ) :
5237 for ( ; i < l; i++ ) {
5240 while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
5241 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
5245 cur = cur.parentNode;
5249 ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
5251 return this.pushStack( ret, "closest", selectors );
5254 // Determine the position of an element within
5255 // the matched set of elements
5256 index: function( elem ) {
5258 // No argument, return index in parent
5260 return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
5263 // index in selector
5264 if ( typeof elem === "string" ) {
5265 return jQuery.inArray( this[0], jQuery( elem ) );
5268 // Locate the position of the desired element
5269 return jQuery.inArray(
5270 // If it receives a jQuery object, the first element is used
5271 elem.jquery ? elem[0] : elem, this );
5274 add: function( selector, context ) {
5275 var set = typeof selector === "string" ?
5276 jQuery( selector, context ) :
5277 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
5278 all = jQuery.merge( this.get(), set );
5280 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
5282 jQuery.unique( all ) );
5285 addBack: function( selector ) {
5286 return this.add( selector == null ?
5287 this.prevObject : this.prevObject.filter(selector)
5292 jQuery.fn.andSelf = jQuery.fn.addBack;
5294 // A painfully simple check to see if an element is disconnected
5295 // from a document (should be improved, where feasible).
5296 function isDisconnected( node ) {
5297 return !node || !node.parentNode || node.parentNode.nodeType === 11;
5300 function sibling( cur, dir ) {
5303 } while ( cur && cur.nodeType !== 1 );
5309 parent: function( elem ) {
5310 var parent = elem.parentNode;
5311 return parent && parent.nodeType !== 11 ? parent : null;
5313 parents: function( elem ) {
5314 return jQuery.dir( elem, "parentNode" );
5316 parentsUntil: function( elem, i, until ) {
5317 return jQuery.dir( elem, "parentNode", until );
5319 next: function( elem ) {
5320 return sibling( elem, "nextSibling" );
5322 prev: function( elem ) {
5323 return sibling( elem, "previousSibling" );
5325 nextAll: function( elem ) {
5326 return jQuery.dir( elem, "nextSibling" );
5328 prevAll: function( elem ) {
5329 return jQuery.dir( elem, "previousSibling" );
5331 nextUntil: function( elem, i, until ) {
5332 return jQuery.dir( elem, "nextSibling", until );
5334 prevUntil: function( elem, i, until ) {
5335 return jQuery.dir( elem, "previousSibling", until );
5337 siblings: function( elem ) {
5338 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
5340 children: function( elem ) {
5341 return jQuery.sibling( elem.firstChild );
5343 contents: function( elem ) {
5344 return jQuery.nodeName( elem, "iframe" ) ?
5345 elem.contentDocument || elem.contentWindow.document :
5346 jQuery.merge( [], elem.childNodes );
5348 }, function( name, fn ) {
5349 jQuery.fn[ name ] = function( until, selector ) {
5350 var ret = jQuery.map( this, fn, until );
5352 if ( !runtil.test( name ) ) {
5356 if ( selector && typeof selector === "string" ) {
5357 ret = jQuery.filter( selector, ret );
5360 ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
5362 if ( this.length > 1 && rparentsprev.test( name ) ) {
5363 ret = ret.reverse();
5366 return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
5371 filter: function( expr, elems, not ) {
5373 expr = ":not(" + expr + ")";
5376 return elems.length === 1 ?
5377 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
5378 jQuery.find.matches(expr, elems);
5381 dir: function( elem, dir, until ) {
5385 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
5386 if ( cur.nodeType === 1 ) {
5387 matched.push( cur );
5394 sibling: function( n, elem ) {
5397 for ( ; n; n = n.nextSibling ) {
5398 if ( n.nodeType === 1 && n !== elem ) {
5407 // Implement the identical functionality for filter and not
5408 function winnow( elements, qualifier, keep ) {
5410 // Can't pass null or undefined to indexOf in Firefox 4
5411 // Set to 0 to skip string check
5412 qualifier = qualifier || 0;
5414 if ( jQuery.isFunction( qualifier ) ) {
5415 return jQuery.grep(elements, function( elem, i ) {
5416 var retVal = !!qualifier.call( elem, i, elem );
5417 return retVal === keep;
5420 } else if ( qualifier.nodeType ) {
5421 return jQuery.grep(elements, function( elem, i ) {
5422 return ( elem === qualifier ) === keep;
5425 } else if ( typeof qualifier === "string" ) {
5426 var filtered = jQuery.grep(elements, function( elem ) {
5427 return elem.nodeType === 1;
5430 if ( isSimple.test( qualifier ) ) {
5431 return jQuery.filter(qualifier, filtered, !keep);
5433 qualifier = jQuery.filter( qualifier, filtered );
5437 return jQuery.grep(elements, function( elem, i ) {
5438 return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
5441 function createSafeFragment( document ) {
5442 var list = nodeNames.split( "|" ),
5443 safeFrag = document.createDocumentFragment();
5445 if ( safeFrag.createElement ) {
5446 while ( list.length ) {
5447 safeFrag.createElement(
5455 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5456 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5457 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
5458 rleadingWhitespace = /^\s+/,
5459 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
5460 rtagName = /<([\w:]+)/,
5462 rhtml = /<|&#?\w+;/,
5463 rnoInnerhtml = /<(?:script|style|link)/i,
5464 rnocache = /<(?:script|object|embed|option|style)/i,
5465 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5466 rcheckableType = /^(?:checkbox|radio)$/,
5467 // checked="checked" or checked
5468 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5469 rscriptType = /\/(java|ecma)script/i,
5470 rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
5472 option: [ 1, "<select multiple='multiple'>", "</select>" ],
5473 legend: [ 1, "<fieldset>", "</fieldset>" ],
5474 thead: [ 1, "<table>", "</table>" ],
5475 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5476 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5477 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5478 area: [ 1, "<map>", "</map>" ],
5479 _default: [ 0, "", "" ]
5481 safeFragment = createSafeFragment( document ),
5482 fragmentDiv = safeFragment.appendChild( document.createElement("div") );
5484 wrapMap.optgroup = wrapMap.option;
5485 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5486 wrapMap.th = wrapMap.td;
5488 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5489 // unless wrapped in a div with non-breaking characters in front of it.
5490 if ( !jQuery.support.htmlSerialize ) {
5491 wrapMap._default = [ 1, "X<div>", "</div>" ];
5495 text: function( value ) {
5496 return jQuery.access( this, function( value ) {
5497 return value === undefined ?
5498 jQuery.text( this ) :
5499 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5500 }, null, value, arguments.length );
5503 wrapAll: function( html ) {
5504 if ( jQuery.isFunction( html ) ) {
5505 return this.each(function(i) {
5506 jQuery(this).wrapAll( html.call(this, i) );
5511 // The elements to wrap the target around
5512 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
5514 if ( this[0].parentNode ) {
5515 wrap.insertBefore( this[0] );
5518 wrap.map(function() {
5521 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
5522 elem = elem.firstChild;
5532 wrapInner: function( html ) {
5533 if ( jQuery.isFunction( html ) ) {
5534 return this.each(function(i) {
5535 jQuery(this).wrapInner( html.call(this, i) );
5539 return this.each(function() {
5540 var self = jQuery( this ),
5541 contents = self.contents();
5543 if ( contents.length ) {
5544 contents.wrapAll( html );
5547 self.append( html );
5552 wrap: function( html ) {
5553 var isFunction = jQuery.isFunction( html );
5555 return this.each(function(i) {
5556 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
5560 unwrap: function() {
5561 return this.parent().each(function() {
5562 if ( !jQuery.nodeName( this, "body" ) ) {
5563 jQuery( this ).replaceWith( this.childNodes );
5568 append: function() {
5569 return this.domManip(arguments, true, function( elem ) {
5570 if ( this.nodeType === 1 || this.nodeType === 11 ) {
5571 this.appendChild( elem );
5576 prepend: function() {
5577 return this.domManip(arguments, true, function( elem ) {
5578 if ( this.nodeType === 1 || this.nodeType === 11 ) {
5579 this.insertBefore( elem, this.firstChild );
5584 before: function() {
5585 if ( !isDisconnected( this[0] ) ) {
5586 return this.domManip(arguments, false, function( elem ) {
5587 this.parentNode.insertBefore( elem, this );
5591 if ( arguments.length ) {
5592 var set = jQuery.clean( arguments );
5593 return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
5598 if ( !isDisconnected( this[0] ) ) {
5599 return this.domManip(arguments, false, function( elem ) {
5600 this.parentNode.insertBefore( elem, this.nextSibling );
5604 if ( arguments.length ) {
5605 var set = jQuery.clean( arguments );
5606 return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
5610 // keepData is for internal use only--do not document
5611 remove: function( selector, keepData ) {
5615 for ( ; (elem = this[i]) != null; i++ ) {
5616 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
5617 if ( !keepData && elem.nodeType === 1 ) {
5618 jQuery.cleanData( elem.getElementsByTagName("*") );
5619 jQuery.cleanData( [ elem ] );
5622 if ( elem.parentNode ) {
5623 elem.parentNode.removeChild( elem );
5635 for ( ; (elem = this[i]) != null; i++ ) {
5636 // Remove element nodes and prevent memory leaks
5637 if ( elem.nodeType === 1 ) {
5638 jQuery.cleanData( elem.getElementsByTagName("*") );
5641 // Remove any remaining nodes
5642 while ( elem.firstChild ) {
5643 elem.removeChild( elem.firstChild );
5650 clone: function( dataAndEvents, deepDataAndEvents ) {
5651 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5652 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5654 return this.map( function () {
5655 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5659 html: function( value ) {
5660 return jQuery.access( this, function( value ) {
5661 var elem = this[0] || {},
5665 if ( value === undefined ) {
5666 return elem.nodeType === 1 ?
5667 elem.innerHTML.replace( rinlinejQuery, "" ) :
5671 // See if we can take a shortcut and just use innerHTML
5672 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5673 ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
5674 ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5675 !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
5677 value = value.replace( rxhtmlTag, "<$1></$2>" );
5680 for (; i < l; i++ ) {
5681 // Remove element nodes and prevent memory leaks
5682 elem = this[i] || {};
5683 if ( elem.nodeType === 1 ) {
5684 jQuery.cleanData( elem.getElementsByTagName( "*" ) );
5685 elem.innerHTML = value;
5691 // If using innerHTML throws an exception, use the fallback method
5696 this.empty().append( value );
5698 }, null, value, arguments.length );
5701 replaceWith: function( value ) {
5702 if ( !isDisconnected( this[0] ) ) {
5703 // Make sure that the elements are removed from the DOM before they are inserted
5704 // this can help fix replacing a parent with child elements
5705 if ( jQuery.isFunction( value ) ) {
5706 return this.each(function(i) {
5707 var self = jQuery(this), old = self.html();
5708 self.replaceWith( value.call( this, i, old ) );
5712 if ( typeof value !== "string" ) {
5713 value = jQuery( value ).detach();
5716 return this.each(function() {
5717 var next = this.nextSibling,
5718 parent = this.parentNode;
5720 jQuery( this ).remove();
5723 jQuery(next).before( value );
5725 jQuery(parent).append( value );
5730 return this.length ?
5731 this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
5735 detach: function( selector ) {
5736 return this.remove( selector, true );
5739 domManip: function( args, table, callback ) {
5741 // Flatten any nested arrays
5742 args = [].concat.apply( [], args );
5744 var results, first, fragment, iNoClone,
5750 // We can't cloneNode fragments that contain checked, in WebKit
5751 if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
5752 return this.each(function() {
5753 jQuery(this).domManip( args, table, callback );
5757 if ( jQuery.isFunction(value) ) {
5758 return this.each(function(i) {
5759 var self = jQuery(this);
5760 args[0] = value.call( this, i, table ? self.html() : undefined );
5761 self.domManip( args, table, callback );
5766 results = jQuery.buildFragment( args, this, scripts );
5767 fragment = results.fragment;
5768 first = fragment.firstChild;
5770 if ( fragment.childNodes.length === 1 ) {
5775 table = table && jQuery.nodeName( first, "tr" );
5777 // Use the original fragment for the last item instead of the first because it can end up
5778 // being emptied incorrectly in certain situations (#8070).
5779 // Fragments from the fragment cache must always be cloned and never used in place.
5780 for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
5782 table && jQuery.nodeName( this[i], "table" ) ?
5783 findOrAppend( this[i], "tbody" ) :
5787 jQuery.clone( fragment, true, true )
5792 // Fix #11809: Avoid leaking memory
5793 fragment = first = null;
5795 if ( scripts.length ) {
5796 jQuery.each( scripts, function( i, elem ) {
5798 if ( jQuery.ajax ) {
5808 jQuery.error("no ajax");
5811 jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
5814 if ( elem.parentNode ) {
5815 elem.parentNode.removeChild( elem );
5825 function findOrAppend( elem, tag ) {
5826 return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
5829 function cloneCopyEvent( src, dest ) {
5831 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5836 oldData = jQuery._data( src ),
5837 curData = jQuery._data( dest, oldData ),
5838 events = oldData.events;
5841 delete curData.handle;
5842 curData.events = {};
5844 for ( type in events ) {
5845 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5846 jQuery.event.add( dest, type, events[ type ][ i ] );
5851 // make the cloned public data object a copy from the original
5852 if ( curData.data ) {
5853 curData.data = jQuery.extend( {}, curData.data );
5857 function cloneFixAttributes( src, dest ) {
5860 // We do not need to do anything for non-Elements
5861 if ( dest.nodeType !== 1 ) {
5865 // clearAttributes removes the attributes, which we don't want,
5866 // but also removes the attachEvent events, which we *do* want
5867 if ( dest.clearAttributes ) {
5868 dest.clearAttributes();
5871 // mergeAttributes, in contrast, only merges back on the
5872 // original attributes, not the events
5873 if ( dest.mergeAttributes ) {
5874 dest.mergeAttributes( src );
5877 nodeName = dest.nodeName.toLowerCase();
5879 if ( nodeName === "object" ) {
5880 // IE6-10 improperly clones children of object elements using classid.
5881 // IE10 throws NoModificationAllowedError if parent is null, #12132.
5882 if ( dest.parentNode ) {
5883 dest.outerHTML = src.outerHTML;
5886 // This path appears unavoidable for IE9. When cloning an object
5887 // element in IE9, the outerHTML strategy above is not sufficient.
5888 // If the src has innerHTML and the destination does not,
5889 // copy the src.innerHTML into the dest.innerHTML. #10324
5890 if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
5891 dest.innerHTML = src.innerHTML;
5894 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5895 // IE6-8 fails to persist the checked state of a cloned checkbox
5896 // or radio button. Worse, IE6-7 fail to give the cloned element
5897 // a checked appearance if the defaultChecked value isn't also set
5899 dest.defaultChecked = dest.checked = src.checked;
5901 // IE6-7 get confused and end up setting the value of a cloned
5902 // checkbox/radio button to an empty string instead of "on"
5903 if ( dest.value !== src.value ) {
5904 dest.value = src.value;
5907 // IE6-8 fails to return the selected option to the default selected
5908 // state when cloning options
5909 } else if ( nodeName === "option" ) {
5910 dest.selected = src.defaultSelected;
5912 // IE6-8 fails to set the defaultValue to the correct value when
5913 // cloning other types of input fields
5914 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5915 dest.defaultValue = src.defaultValue;
5917 // IE blanks contents when cloning scripts
5918 } else if ( nodeName === "script" && dest.text !== src.text ) {
5919 dest.text = src.text;
5922 // Event data gets referenced instead of copied if the expando
5924 dest.removeAttribute( jQuery.expando );
5927 jQuery.buildFragment = function( args, context, scripts ) {
5928 var fragment, cacheable, cachehit,
5931 // Set context from what may come in as undefined or a jQuery collection or a node
5932 context = context || document;
5933 context = (context[0] || context).ownerDocument || context[0] || context;
5935 // Ensure that an attr object doesn't incorrectly stand in as a document object
5936 // Chrome and Firefox seem to allow this to occur and will throw exception
5938 if ( typeof context.createDocumentFragment === "undefined" ) {
5942 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5943 // Cloning options loses the selected state, so don't cache them
5944 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
5945 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5946 // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
5947 if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
5948 first.charAt(0) === "<" && !rnocache.test( first ) &&
5949 (jQuery.support.checkClone || !rchecked.test( first )) &&
5950 (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
5952 // Mark cacheable and look for a hit
5954 fragment = jQuery.fragments[ first ];
5955 cachehit = fragment !== undefined;
5959 fragment = context.createDocumentFragment();
5960 jQuery.clean( args, context, fragment, scripts );
5962 // Update the cache, but only store false
5963 // unless this is a second parsing of the same content
5965 jQuery.fragments[ first ] = cachehit && fragment;
5969 return { fragment: fragment, cacheable: cacheable };
5972 jQuery.fragments = {};
5976 prependTo: "prepend",
5977 insertBefore: "before",
5978 insertAfter: "after",
5979 replaceAll: "replaceWith"
5980 }, function( name, original ) {
5981 jQuery.fn[ name ] = function( selector ) {
5985 insert = jQuery( selector ),
5987 parent = this.length === 1 && this[0].parentNode;
5989 if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
5990 insert[ original ]( this[0] );
5993 for ( ; i < l; i++ ) {
5994 elems = ( i > 0 ? this.clone(true) : this ).get();
5995 jQuery( insert[i] )[ original ]( elems );
5996 ret = ret.concat( elems );
5999 return this.pushStack( ret, name, insert.selector );
6004 function getAll( elem ) {
6005 if ( typeof elem.getElementsByTagName !== "undefined" ) {
6006 return elem.getElementsByTagName( "*" );
6008 } else if ( typeof elem.querySelectorAll !== "undefined" ) {
6009 return elem.querySelectorAll( "*" );
6016 // Used in clean, fixes the defaultChecked property
6017 function fixDefaultChecked( elem ) {
6018 if ( rcheckableType.test( elem.type ) ) {
6019 elem.defaultChecked = elem.checked;
6024 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6030 if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
6031 clone = elem.cloneNode( true );
6033 // IE<=8 does not properly clone detached, unknown element nodes
6035 fragmentDiv.innerHTML = elem.outerHTML;
6036 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
6039 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
6040 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
6041 // IE copies events bound via attachEvent when using cloneNode.
6042 // Calling detachEvent on the clone will also remove the events
6043 // from the original. In order to get around this, we use some
6044 // proprietary methods to clear the events. Thanks to MooTools
6045 // guys for this hotness.
6047 cloneFixAttributes( elem, clone );
6049 // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
6050 srcElements = getAll( elem );
6051 destElements = getAll( clone );
6053 // Weird iteration because IE will replace the length property
6054 // with an element if you are cloning the body and one of the
6055 // elements on the page has a name or id of "length"
6056 for ( i = 0; srcElements[i]; ++i ) {
6057 // Ensure that the destination node is not null; Fixes #9587
6058 if ( destElements[i] ) {
6059 cloneFixAttributes( srcElements[i], destElements[i] );
6064 // Copy the events from the original to the clone
6065 if ( dataAndEvents ) {
6066 cloneCopyEvent( elem, clone );
6068 if ( deepDataAndEvents ) {
6069 srcElements = getAll( elem );
6070 destElements = getAll( clone );
6072 for ( i = 0; srcElements[i]; ++i ) {
6073 cloneCopyEvent( srcElements[i], destElements[i] );
6078 srcElements = destElements = null;
6080 // Return the cloned set
6084 clean: function( elems, context, fragment, scripts ) {
6085 var j, safe, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
6089 // Ensure that context is a document
6090 if ( !context || typeof context.createDocumentFragment === "undefined" ) {
6094 // Use the already-created safe fragment if context permits
6095 for ( safe = context === document && safeFragment; (elem = elems[i]) != null; i++ ) {
6096 if ( typeof elem === "number" ) {
6104 // Convert html string into DOM nodes
6105 if ( typeof elem === "string" ) {
6106 if ( !rhtml.test( elem ) ) {
6107 elem = context.createTextNode( elem );
6109 // Ensure a safe container in which to render the html
6110 safe = safe || createSafeFragment( context );
6111 div = div || safe.appendChild( context.createElement("div") );
6113 // Fix "XHTML"-style tags in all browsers
6114 elem = elem.replace(rxhtmlTag, "<$1></$2>");
6116 // Go to html and back, then peel off extra wrappers
6117 tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
6118 wrap = wrapMap[ tag ] || wrapMap._default;
6120 div.innerHTML = wrap[1] + elem + wrap[2];
6122 // Move to the right depth
6124 div = div.lastChild;
6127 // Remove IE's autoinserted <tbody> from table fragments
6128 if ( !jQuery.support.tbody ) {
6130 // String was a <table>, *may* have spurious <tbody>
6131 hasBody = rtbody.test(elem);
6132 tbody = tag === "table" && !hasBody ?
6133 div.firstChild && div.firstChild.childNodes :
6135 // String was a bare <thead> or <tfoot>
6136 wrap[1] === "<table>" && !hasBody ?
6140 for ( j = tbody.length - 1; j >= 0 ; --j ) {
6141 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
6142 tbody[ j ].parentNode.removeChild( tbody[ j ] );
6147 // IE completely kills leading whitespace when innerHTML is used
6148 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
6149 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
6152 elem = div.childNodes;
6154 // Remember the top-level container for proper cleanup
6155 div = safe.lastChild;
6159 if ( elem.nodeType ) {
6162 ret = jQuery.merge( ret, elem );
6166 // Fix #11356: Clear elements from safeFragment
6168 safe.removeChild( div );
6169 elem = div = safe = null;
6172 // Reset defaultChecked for any radios and checkboxes
6173 // about to be appended to the DOM in IE 6/7 (#8060)
6174 if ( !jQuery.support.appendChecked ) {
6175 for ( i = 0; (elem = ret[i]) != null; i++ ) {
6176 if ( jQuery.nodeName( elem, "input" ) ) {
6177 fixDefaultChecked( elem );
6178 } else if ( typeof elem.getElementsByTagName !== "undefined" ) {
6179 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
6184 // Append elements to a provided document fragment
6186 // Special handling of each script element
6187 handleScript = function( elem ) {
6188 // Check if we consider it executable
6189 if ( !elem.type || rscriptType.test( elem.type ) ) {
6190 // Detach the script and store it in the scripts array (if provided) or the fragment
6191 // Return truthy to indicate that it has been handled
6193 scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
6194 fragment.appendChild( elem );
6198 for ( i = 0; (elem = ret[i]) != null; i++ ) {
6199 // Check if we're done after handling an executable script
6200 if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
6201 // Append to fragment and handle embedded scripts
6202 fragment.appendChild( elem );
6203 if ( typeof elem.getElementsByTagName !== "undefined" ) {
6204 // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
6205 jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
6207 // Splice the scripts into ret after their former ancestor and advance our index beyond them
6208 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
6218 cleanData: function( elems, /* internal */ acceptData ) {
6219 var data, id, elem, type,
6221 internalKey = jQuery.expando,
6222 cache = jQuery.cache,
6223 deleteExpando = jQuery.support.deleteExpando,
6224 special = jQuery.event.special;
6226 for ( ; (elem = elems[i]) != null; i++ ) {
6228 if ( acceptData || jQuery.acceptData( elem ) ) {
6230 id = elem[ internalKey ];
6231 data = id && cache[ id ];
6234 if ( data.events ) {
6235 for ( type in data.events ) {
6236 if ( special[ type ] ) {
6237 jQuery.event.remove( elem, type );
6239 // This is a shortcut to avoid jQuery.event.remove's overhead
6241 jQuery.removeEvent( elem, type, data.handle );
6246 // Remove cache only if it was not already removed by jQuery.event.remove
6247 if ( cache[ id ] ) {
6251 // IE does not allow us to delete expando properties from nodes,
6252 // nor does it have a removeAttribute function on Document nodes;
6253 // we must handle all of these cases
6254 if ( deleteExpando ) {
6255 delete elem[ internalKey ];
6257 } else if ( elem.removeAttribute ) {
6258 elem.removeAttribute( internalKey );
6261 elem[ internalKey ] = null;
6264 jQuery.deletedIds.push( id );
6271 // Limit scope pollution from any deprecated API
6274 var matched, browser;
6276 // Use of jQuery.browser is frowned upon.
6277 // More details: http://api.jquery.com/jQuery.browser
6278 // jQuery.uaMatch maintained for back-compat
6279 jQuery.uaMatch = function( ua ) {
6280 ua = ua.toLowerCase();
6282 var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
6283 /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
6284 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
6285 /(msie) ([\w.]+)/.exec( ua ) ||
6286 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
6290 browser: match[ 1 ] || "",
6291 version: match[ 2 ] || "0"
6295 matched = jQuery.uaMatch( navigator.userAgent );
6298 if ( matched.browser ) {
6299 browser[ matched.browser ] = true;
6300 browser.version = matched.version;
6303 // Deprecated, use jQuery.browser.webkit instead
6304 // Maintained for back-compat only
6305 if ( browser.webkit ) {
6306 browser.safari = true;
6309 jQuery.browser = browser;
6311 jQuery.sub = function() {
6312 function jQuerySub( selector, context ) {
6313 return new jQuerySub.fn.init( selector, context );
6315 jQuery.extend( true, jQuerySub, this );
6316 jQuerySub.superclass = this;
6317 jQuerySub.fn = jQuerySub.prototype = this();
6318 jQuerySub.fn.constructor = jQuerySub;
6319 jQuerySub.sub = this.sub;
6320 jQuerySub.fn.init = function init( selector, context ) {
6321 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
6322 context = jQuerySub( context );
6325 return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
6327 jQuerySub.fn.init.prototype = jQuerySub.fn;
6328 var rootjQuerySub = jQuerySub(document);
6333 var curCSS, iframe, iframeDoc,
6334 ralpha = /alpha\([^)]*\)/i,
6335 ropacity = /opacity=([^)]*)/,
6336 rposition = /^(top|right|bottom|left)$/,
6337 rmargin = /^margin/,
6338 rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
6339 rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
6340 rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
6343 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6344 cssNormalTransform = {
6350 cssExpand = [ "Top", "Right", "Bottom", "Left" ],
6351 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
6353 eventsToggle = jQuery.fn.toggle;
6355 // return a css property mapped to a potentially vendor prefixed property
6356 function vendorPropName( style, name ) {
6358 // shortcut for names that are not vendor prefixed
6359 if ( name in style ) {
6363 // check for vendor prefixed names
6364 var capName = name.charAt(0).toUpperCase() + name.slice(1),
6366 i = cssPrefixes.length;
6369 name = cssPrefixes[ i ] + capName;
6370 if ( name in style ) {
6378 function isHidden( elem, el ) {
6380 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
6383 function showHide( elements, show ) {
6387 length = elements.length;
6389 for ( ; index < length; index++ ) {
6390 elem = elements[ index ];
6391 if ( !elem.style ) {
6394 values[ index ] = jQuery._data( elem, "olddisplay" );
6396 // Reset the inline display of this element to learn if it is
6397 // being hidden by cascaded rules or not
6398 if ( !values[ index ] && elem.style.display === "none" ) {
6399 elem.style.display = "";
6402 // Set elements which have been overridden with display: none
6403 // in a stylesheet to whatever the default browser style is
6404 // for such an element
6405 if ( elem.style.display === "" && isHidden( elem ) ) {
6406 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6409 display = curCSS( elem, "display" );
6411 if ( !values[ index ] && display !== "none" ) {
6412 jQuery._data( elem, "olddisplay", display );
6417 // Set the display of most of the elements in a second loop
6418 // to avoid the constant reflow
6419 for ( index = 0; index < length; index++ ) {
6420 elem = elements[ index ];
6421 if ( !elem.style ) {
6424 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6425 elem.style.display = show ? values[ index ] || "" : "none";
6433 css: function( name, value ) {
6434 return jQuery.access( this, function( elem, name, value ) {
6435 return value !== undefined ?
6436 jQuery.style( elem, name, value ) :
6437 jQuery.css( elem, name );
6438 }, name, value, arguments.length > 1 );
6441 return showHide( this, true );
6444 return showHide( this );
6446 toggle: function( state, fn2 ) {
6447 var bool = typeof state === "boolean";
6449 if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
6450 return eventsToggle.apply( this, arguments );
6453 return this.each(function() {
6454 if ( bool ? state : isHidden( this ) ) {
6455 jQuery( this ).show();
6457 jQuery( this ).hide();
6464 // Add in style property hooks for overriding the default
6465 // behavior of getting and setting a style property
6468 get: function( elem, computed ) {
6470 // We should always get a number back from opacity
6471 var ret = curCSS( elem, "opacity" );
6472 return ret === "" ? "1" : ret;
6479 // Exclude the following css properties to add px
6481 "fillOpacity": true,
6491 // Add in properties whose names you wish to fix before
6492 // setting or getting the value
6494 // normalize float css property
6495 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
6498 // Get and set the style property on a DOM Node
6499 style: function( elem, name, value, extra ) {
6500 // Don't set styles on text and comment nodes
6501 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6505 // Make sure that we're working with the right name
6506 var ret, type, hooks,
6507 origName = jQuery.camelCase( name ),
6510 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6512 // gets hook for the prefixed version
6513 // followed by the unprefixed version
6514 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6516 // Check if we're setting a value
6517 if ( value !== undefined ) {
6518 type = typeof value;
6520 // convert relative number strings (+= or -=) to relative numbers. #7345
6521 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6522 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6527 // Make sure that NaN and null values aren't set. See: #7116
6528 if ( value == null || type === "number" && isNaN( value ) ) {
6532 // If a number was passed in, add 'px' to the (except for certain CSS properties)
6533 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6537 // If a hook was provided, use that value, otherwise just set the specified value
6538 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6539 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
6542 style[ name ] = value;
6547 // If a hook was provided get the non-computed value from there
6548 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6552 // Otherwise just get the value from the style object
6553 return style[ name ];
6557 css: function( elem, name, numeric, extra ) {
6558 var val, num, hooks,
6559 origName = jQuery.camelCase( name );
6561 // Make sure that we're working with the right name
6562 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6564 // gets hook for the prefixed version
6565 // followed by the unprefixed version
6566 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6568 // If a hook was provided get the computed value from there
6569 if ( hooks && "get" in hooks ) {
6570 val = hooks.get( elem, true, extra );
6573 // Otherwise, if a way to get the computed value exists, use that
6574 if ( val === undefined ) {
6575 val = curCSS( elem, name );
6578 //convert "normal" to computed value
6579 if ( val === "normal" && name in cssNormalTransform ) {
6580 val = cssNormalTransform[ name ];
6583 // Return, converting to number if forced or a qualifier was provided and val looks numeric
6584 if ( numeric || extra !== undefined ) {
6585 num = parseFloat( val );
6586 return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
6591 // A method for quickly swapping in/out CSS properties to get correct calculations
6592 swap: function( elem, options, callback ) {
6596 // Remember the old values, and insert the new ones
6597 for ( name in options ) {
6598 old[ name ] = elem.style[ name ];
6599 elem.style[ name ] = options[ name ];
6602 ret = callback.call( elem );
6604 // Revert the old values
6605 for ( name in options ) {
6606 elem.style[ name ] = old[ name ];
6613 // NOTE: To any future maintainer, we've used both window.getComputedStyle
6614 // and getComputedStyle here to produce a better gzip size
6615 if ( window.getComputedStyle ) {
6616 curCSS = function( elem, name ) {
6617 var ret, width, minWidth, maxWidth,
6618 computed = getComputedStyle( elem, null ),
6623 ret = computed[ name ];
6624 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
6625 ret = jQuery.style( elem, name );
6628 // A tribute to the "awesome hack by Dean Edwards"
6629 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
6630 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
6631 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6632 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6633 width = style.width;
6634 minWidth = style.minWidth;
6635 maxWidth = style.maxWidth;
6637 style.minWidth = style.maxWidth = style.width = ret;
6638 ret = computed.width;
6640 style.width = width;
6641 style.minWidth = minWidth;
6642 style.maxWidth = maxWidth;
6648 } else if ( document.documentElement.currentStyle ) {
6649 curCSS = function( elem, name ) {
6651 ret = elem.currentStyle && elem.currentStyle[ name ],
6654 // Avoid setting ret to empty string here
6655 // so we don't default to auto
6656 if ( ret == null && style && style[ name ] ) {
6657 ret = style[ name ];
6660 // From the awesome hack by Dean Edwards
6661 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
6663 // If we're not dealing with a regular pixel number
6664 // but a number that has a weird ending, we need to convert it to pixels
6665 // but not position css attributes, as those are proportional to the parent element instead
6666 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
6667 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
6669 // Remember the original values
6671 rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
6673 // Put in the new values to get a computed value out
6675 elem.runtimeStyle.left = elem.currentStyle.left;
6677 style.left = name === "fontSize" ? "1em" : ret;
6678 ret = style.pixelLeft + "px";
6680 // Revert the changed values
6683 elem.runtimeStyle.left = rsLeft;
6687 return ret === "" ? "auto" : ret;
6691 function setPositiveNumber( elem, value, subtract ) {
6692 var matches = rnumsplit.exec( value );
6694 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
6698 function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
6699 var i = extra === ( isBorderBox ? "border" : "content" ) ?
6700 // If we already have the right measurement, avoid augmentation
6702 // Otherwise initialize for horizontal or vertical properties
6703 name === "width" ? 1 : 0,
6707 for ( ; i < 4; i += 2 ) {
6708 // both box models exclude margin, so add it if we want it
6709 if ( extra === "margin" ) {
6710 // we use jQuery.css instead of curCSS here
6711 // because of the reliableMarginRight CSS hook!
6712 val += jQuery.css( elem, extra + cssExpand[ i ], true );
6715 // From this point on we use curCSS for maximum performance (relevant in animations)
6716 if ( isBorderBox ) {
6717 // border-box includes padding, so remove it if we want content
6718 if ( extra === "content" ) {
6719 val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
6722 // at this point, extra isn't border nor margin, so remove border
6723 if ( extra !== "margin" ) {
6724 val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6727 // at this point, extra isn't content, so add padding
6728 val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
6730 // at this point, extra isn't content nor padding, so add border
6731 if ( extra !== "padding" ) {
6732 val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6740 function getWidthOrHeight( elem, name, extra ) {
6742 // Start with offset property, which is equivalent to the border-box value
6743 var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6744 valueIsBorderBox = true,
6745 isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
6748 // Fall back to computed then uncomputed css if necessary
6749 val = curCSS( elem, name );
6750 if ( val < 0 || val == null ) {
6751 val = elem.style[ name ];
6754 // Computed unit is not pixels. Stop here and return.
6755 if ( rnumnonpx.test(val) ) {
6759 // we need the check for style in case a browser which returns unreliable values
6760 // for getComputedStyle silently falls back to the reliable elem.style
6761 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
6763 // Normalize "", auto, and prepare for extra
6764 val = parseFloat( val ) || 0;
6767 // use the active box-sizing model to add/subtract irrelevant styles
6769 augmentWidthOrHeight(
6772 extra || ( isBorderBox ? "border" : "content" ),
6779 // Try to determine the default display value of an element
6780 function css_defaultDisplay( nodeName ) {
6781 if ( elemdisplay[ nodeName ] ) {
6782 return elemdisplay[ nodeName ];
6785 var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
6786 display = elem.css("display");
6789 // If the simple way fails,
6790 // get element's real default display by attaching it to a temp iframe
6791 if ( display === "none" || display === "" ) {
6792 // Use the already-created iframe if possible
6793 iframe = document.body.appendChild(
6794 iframe || jQuery.extend( document.createElement("iframe"), {
6801 // Create a cacheable copy of the iframe document on first call.
6802 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
6803 // document to it; WebKit & Firefox won't allow reusing the iframe document.
6804 if ( !iframeDoc || !iframe.createElement ) {
6805 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
6806 iframeDoc.write("<!doctype html><html><body>");
6810 elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
6812 display = curCSS( elem, "display" );
6813 document.body.removeChild( iframe );
6816 // Store the correct default display
6817 elemdisplay[ nodeName ] = display;
6822 jQuery.each([ "height", "width" ], function( i, name ) {
6823 jQuery.cssHooks[ name ] = {
6824 get: function( elem, computed, extra ) {
6826 if ( elem.offsetWidth !== 0 || curCSS( elem, "display" ) !== "none" ) {
6827 return getWidthOrHeight( elem, name, extra );
6829 return jQuery.swap( elem, cssShow, function() {
6830 return getWidthOrHeight( elem, name, extra );
6836 set: function( elem, value, extra ) {
6837 return setPositiveNumber( elem, value, extra ?
6838 augmentWidthOrHeight(
6842 jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
6849 if ( !jQuery.support.opacity ) {
6850 jQuery.cssHooks.opacity = {
6851 get: function( elem, computed ) {
6852 // IE uses filters for opacity
6853 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6854 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
6855 computed ? "1" : "";
6858 set: function( elem, value ) {
6859 var style = elem.style,
6860 currentStyle = elem.currentStyle,
6861 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6862 filter = currentStyle && currentStyle.filter || style.filter || "";
6864 // IE has trouble with opacity if it does not have layout
6865 // Force it by setting the zoom level
6868 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6869 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
6870 style.removeAttribute ) {
6872 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6873 // if "filter:" is present at all, clearType is disabled, we want to avoid this
6874 // style.removeAttribute is IE Only, but so apparently is this code path...
6875 style.removeAttribute( "filter" );
6877 // if there there is no filter style applied in a css rule, we are done
6878 if ( currentStyle && !currentStyle.filter ) {
6883 // otherwise, set new filter values
6884 style.filter = ralpha.test( filter ) ?
6885 filter.replace( ralpha, opacity ) :
6886 filter + " " + opacity;
6891 // These hooks cannot be added until DOM ready because the support test
6892 // for it is not run until after DOM ready
6894 if ( !jQuery.support.reliableMarginRight ) {
6895 jQuery.cssHooks.marginRight = {
6896 get: function( elem, computed ) {
6897 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6898 // Work around by temporarily setting element display to inline-block
6899 return jQuery.swap( elem, { "display": "inline-block" }, function() {
6901 return curCSS( elem, "marginRight" );
6908 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
6909 // getComputedStyle returns percent when specified for top/left/bottom/right
6910 // rather than make the css module depend on the offset module, we just check for it here
6911 if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
6912 jQuery.each( [ "top", "left" ], function( i, prop ) {
6913 jQuery.cssHooks[ prop ] = {
6914 get: function( elem, computed ) {
6916 var ret = curCSS( elem, prop );
6917 // if curCSS returns percentage, fallback to offset
6918 return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
6927 if ( jQuery.expr && jQuery.expr.filters ) {
6928 jQuery.expr.filters.hidden = function( elem ) {
6929 return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
6932 jQuery.expr.filters.visible = function( elem ) {
6933 return !jQuery.expr.filters.hidden( elem );
6937 // These hooks are used by animate to expand properties
6942 }, function( prefix, suffix ) {
6943 jQuery.cssHooks[ prefix + suffix ] = {
6944 expand: function( value ) {
6947 // assumes a single number if not a string
6948 parts = typeof value === "string" ? value.split(" ") : [ value ],
6951 for ( i = 0; i < 4; i++ ) {
6952 expanded[ prefix + cssExpand[ i ] + suffix ] =
6953 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6960 if ( !rmargin.test( prefix ) ) {
6961 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6967 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6968 rselectTextarea = /^(?:select|textarea)/i;
6971 serialize: function() {
6972 return jQuery.param( this.serializeArray() );
6974 serializeArray: function() {
6975 return this.map(function(){
6976 return this.elements ? jQuery.makeArray( this.elements ) : this;
6979 return this.name && !this.disabled &&
6980 ( this.checked || rselectTextarea.test( this.nodeName ) ||
6981 rinput.test( this.type ) );
6983 .map(function( i, elem ){
6984 var val = jQuery( this ).val();
6986 return val == null ?
6988 jQuery.isArray( val ) ?
6989 jQuery.map( val, function( val, i ){
6990 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6992 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6997 //Serialize an array of form elements or a set of
6998 //key/values into a query string
6999 jQuery.param = function( a, traditional ) {
7002 add = function( key, value ) {
7003 // If value is a function, invoke it and return its value
7004 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
7005 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
7008 // Set traditional to true for jQuery <= 1.3.2 behavior.
7009 if ( traditional === undefined ) {
7010 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
7013 // If an array was passed in, assume that it is an array of form elements.
7014 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7015 // Serialize the form elements
7016 jQuery.each( a, function() {
7017 add( this.name, this.value );
7021 // If traditional, encode the "old" way (the way 1.3.2 or older
7022 // did it), otherwise encode params recursively.
7023 for ( prefix in a ) {
7024 buildParams( prefix, a[ prefix ], traditional, add );
7028 // Return the resulting serialization
7029 return s.join( "&" ).replace( r20, "+" );
7032 function buildParams( prefix, obj, traditional, add ) {
7035 if ( jQuery.isArray( obj ) ) {
7036 // Serialize array item.
7037 jQuery.each( obj, function( i, v ) {
7038 if ( traditional || rbracket.test( prefix ) ) {
7039 // Treat each array item as a scalar.
7043 // If array item is non-scalar (array or object), encode its
7044 // numeric index to resolve deserialization ambiguity issues.
7045 // Note that rack (as of 1.0.0) can't currently deserialize
7046 // nested arrays properly, and attempting to do so may cause
7047 // a server error. Possible fixes are to modify rack's
7048 // deserialization algorithm or to provide an option or flag
7049 // to force array serialization to be shallow.
7050 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7054 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7055 // Serialize object item.
7056 for ( name in obj ) {
7057 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7061 // Serialize scalar item.
7065 var // Document location
7067 // Document location segments
7071 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
7072 // #7653, #8125, #8152: local protocol detection
7073 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
7074 rnoContent = /^(?:GET|HEAD)$/,
7075 rprotocol = /^\/\//,
7077 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
7078 rts = /([?&])_=[^&]*/,
7079 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
7081 // Keep a copy of the old load method
7082 _load = jQuery.fn.load,
7085 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7086 * 2) These are called:
7087 * - BEFORE asking for a transport
7088 * - AFTER param serialization (s.data is a string if s.processData is true)
7089 * 3) key is the dataType
7090 * 4) the catchall symbol "*" can be used
7091 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7095 /* Transports bindings
7096 * 1) key is the dataType
7097 * 2) the catchall symbol "*" can be used
7098 * 3) selection will start with transport dataType and THEN go to "*" if needed
7102 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7103 allTypes = ["*/"] + ["*"];
7105 // #8138, IE may throw an exception when accessing
7106 // a field from window.location if document.domain has been set
7108 ajaxLocation = location.href;
7110 // Use the href attribute of an A element
7111 // since IE will modify it given document.location
7112 ajaxLocation = document.createElement( "a" );
7113 ajaxLocation.href = "";
7114 ajaxLocation = ajaxLocation.href;
7117 // Segment location into parts
7118 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
7120 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7121 function addToPrefiltersOrTransports( structure ) {
7123 // dataTypeExpression is optional and defaults to "*"
7124 return function( dataTypeExpression, func ) {
7126 if ( typeof dataTypeExpression !== "string" ) {
7127 func = dataTypeExpression;
7128 dataTypeExpression = "*";
7131 var dataType, list, placeBefore,
7132 dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
7134 length = dataTypes.length;
7136 if ( jQuery.isFunction( func ) ) {
7137 // For each dataType in the dataTypeExpression
7138 for ( ; i < length; i++ ) {
7139 dataType = dataTypes[ i ];
7140 // We control if we're asked to add before
7141 // any existing element
7142 placeBefore = /^\+/.test( dataType );
7143 if ( placeBefore ) {
7144 dataType = dataType.substr( 1 ) || "*";
7146 list = structure[ dataType ] = structure[ dataType ] || [];
7147 // then we add to the structure accordingly
7148 list[ placeBefore ? "unshift" : "push" ]( func );
7154 // Base inspection function for prefilters and transports
7155 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
7156 dataType /* internal */, inspected /* internal */ ) {
7158 dataType = dataType || options.dataTypes[ 0 ];
7159 inspected = inspected || {};
7161 inspected[ dataType ] = true;
7164 list = structure[ dataType ],
7166 length = list ? list.length : 0,
7167 executeOnly = ( structure === prefilters );
7169 for ( ; i < length && ( executeOnly || !selection ); i++ ) {
7170 selection = list[ i ]( options, originalOptions, jqXHR );
7171 // If we got redirected to another dataType
7172 // we try there if executing only and not done already
7173 if ( typeof selection === "string" ) {
7174 if ( !executeOnly || inspected[ selection ] ) {
7175 selection = undefined;
7177 options.dataTypes.unshift( selection );
7178 selection = inspectPrefiltersOrTransports(
7179 structure, options, originalOptions, jqXHR, selection, inspected );
7183 // If we're only executing or nothing was selected
7184 // we try the catchall dataType if not done already
7185 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
7186 selection = inspectPrefiltersOrTransports(
7187 structure, options, originalOptions, jqXHR, "*", inspected );
7189 // unnecessary when only executing (prefilters)
7190 // but it'll be ignored by the caller in that case
7194 // A special extend for ajax options
7195 // that takes "flat" options (not to be deep extended)
7197 function ajaxExtend( target, src ) {
7199 flatOptions = jQuery.ajaxSettings.flatOptions || {};
7200 for ( key in src ) {
7201 if ( src[ key ] !== undefined ) {
7202 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
7206 jQuery.extend( true, target, deep );
7210 jQuery.fn.load = function( url, params, callback ) {
7211 if ( typeof url !== "string" && _load ) {
7212 return _load.apply( this, arguments );
7215 // Don't do a request if no elements are being requested
7216 if ( !this.length ) {
7220 var selector, type, response,
7222 off = url.indexOf(" ");
7225 selector = url.slice( off, url.length );
7226 url = url.slice( 0, off );
7229 // If it's a function
7230 if ( jQuery.isFunction( params ) ) {
7232 // We assume that it's the callback
7236 // Otherwise, build a param string
7237 } else if ( typeof params === "object" ) {
7241 // Request the remote document
7245 // if "type" variable is undefined, then "GET" method will be used
7249 complete: function( jqXHR, status ) {
7251 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
7254 }).done(function( responseText ) {
7256 // Save response for use in complete callback
7257 response = arguments;
7259 // See if a selector was specified
7260 self.html( selector ?
7262 // Create a dummy div to hold the results
7265 // inject the contents of the document in, removing the scripts
7266 // to avoid any 'Permission Denied' errors in IE
7267 .append( responseText.replace( rscript, "" ) )
7269 // Locate the specified elements
7272 // If not, just inject the full result
7280 // Attach a bunch of functions for handling common AJAX events
7281 jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
7282 jQuery.fn[ o ] = function( f ){
7283 return this.on( o, f );
7287 jQuery.each( [ "get", "post" ], function( i, method ) {
7288 jQuery[ method ] = function( url, data, callback, type ) {
7289 // shift arguments if data argument was omitted
7290 if ( jQuery.isFunction( data ) ) {
7291 type = type || callback;
7296 return jQuery.ajax({
7308 getScript: function( url, callback ) {
7309 return jQuery.get( url, undefined, callback, "script" );
7312 getJSON: function( url, data, callback ) {
7313 return jQuery.get( url, data, callback, "json" );
7316 // Creates a full fledged settings object into target
7317 // with both ajaxSettings and settings fields.
7318 // If target is omitted, writes into ajaxSettings.
7319 ajaxSetup: function( target, settings ) {
7321 // Building a settings object
7322 ajaxExtend( target, jQuery.ajaxSettings );
7324 // Extending ajaxSettings
7326 target = jQuery.ajaxSettings;
7328 ajaxExtend( target, settings );
7334 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7337 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7353 xml: "application/xml, text/xml",
7356 json: "application/json, text/javascript",
7368 text: "responseText"
7371 // List of data converters
7372 // 1) key format is "source_type destination_type" (a single space in-between)
7373 // 2) the catchall symbol "*" can be used for source_type
7376 // Convert anything to text
7377 "* text": window.String,
7379 // Text to html (true = no transformation)
7382 // Evaluate text as a json expression
7383 "text json": jQuery.parseJSON,
7385 // Parse text as xml
7386 "text xml": jQuery.parseXML
7389 // For options that shouldn't be deep extended:
7390 // you can add your own custom options here if
7391 // and when you create one that shouldn't be
7392 // deep extended (see ajaxExtend)
7399 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
7400 ajaxTransport: addToPrefiltersOrTransports( transports ),
7403 ajax: function( url, options ) {
7405 // If url is an object, simulate pre-1.5 signature
7406 if ( typeof url === "object" ) {
7411 // Force options to be an object
7412 options = options || {};
7414 var // ifModified key
7417 responseHeadersString,
7423 // Cross-domain detection vars
7425 // To know if global events are to be dispatched
7429 // Create the final options object
7430 s = jQuery.ajaxSetup( {}, options ),
7431 // Callbacks context
7432 callbackContext = s.context || s,
7433 // Context for global events
7434 // It's the callbackContext if one was provided in the options
7435 // and if it's a DOM node or a jQuery collection
7436 globalEventContext = callbackContext !== s &&
7437 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
7438 jQuery( callbackContext ) : jQuery.event,
7440 deferred = jQuery.Deferred(),
7441 completeDeferred = jQuery.Callbacks( "once memory" ),
7442 // Status-dependent callbacks
7443 statusCode = s.statusCode || {},
7444 // Headers (they are sent all at once)
7445 requestHeaders = {},
7446 requestHeadersNames = {},
7449 // Default abort message
7450 strAbort = "canceled",
7456 // Caches the header
7457 setRequestHeader: function( name, value ) {
7459 var lname = name.toLowerCase();
7460 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
7461 requestHeaders[ name ] = value;
7467 getAllResponseHeaders: function() {
7468 return state === 2 ? responseHeadersString : null;
7471 // Builds headers hashtable if needed
7472 getResponseHeader: function( key ) {
7474 if ( state === 2 ) {
7475 if ( !responseHeaders ) {
7476 responseHeaders = {};
7477 while( ( match = rheaders.exec( responseHeadersString ) ) ) {
7478 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
7481 match = responseHeaders[ key.toLowerCase() ];
7483 return match === undefined ? null : match;
7486 // Overrides response content-type header
7487 overrideMimeType: function( type ) {
7494 // Cancel the request
7495 abort: function( statusText ) {
7496 statusText = statusText || strAbort;
7498 transport.abort( statusText );
7500 done( 0, statusText );
7505 // Callback for when everything is done
7506 // It is defined here because jslint complains if it is declared
7507 // at the end of the function (which would be more logical and readable)
7508 function done( status, nativeStatusText, responses, headers ) {
7509 var isSuccess, success, error, response, modified,
7510 statusText = nativeStatusText;
7513 if ( state === 2 ) {
7517 // State is "done" now
7520 // Clear timeout if it exists
7521 if ( timeoutTimer ) {
7522 clearTimeout( timeoutTimer );
7525 // Dereference transport for early garbage collection
7526 // (no matter how long the jqXHR object will be used)
7527 transport = undefined;
7529 // Cache response headers
7530 responseHeadersString = headers || "";
7533 jqXHR.readyState = status > 0 ? 4 : 0;
7535 // Get response data
7537 response = ajaxHandleResponses( s, jqXHR, responses );
7540 // If successful, handle type chaining
7541 if ( status >= 200 && status < 300 || status === 304 ) {
7543 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7544 if ( s.ifModified ) {
7546 modified = jqXHR.getResponseHeader("Last-Modified");
7548 jQuery.lastModified[ ifModifiedKey ] = modified;
7550 modified = jqXHR.getResponseHeader("Etag");
7552 jQuery.etag[ ifModifiedKey ] = modified;
7557 if ( status === 304 ) {
7559 statusText = "notmodified";
7565 isSuccess = ajaxConvert( s, response );
7566 statusText = isSuccess.state;
7567 success = isSuccess.data;
7568 error = isSuccess.error;
7572 // We extract error from statusText
7573 // then normalize statusText and status for non-aborts
7575 if ( !statusText || status ) {
7576 statusText = "error";
7583 // Set data for the fake xhr object
7584 jqXHR.status = status;
7585 jqXHR.statusText = "" + ( nativeStatusText || statusText );
7589 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
7591 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
7594 // Status-dependent callbacks
7595 jqXHR.statusCode( statusCode );
7596 statusCode = undefined;
7598 if ( fireGlobals ) {
7599 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
7600 [ jqXHR, s, isSuccess ? success : error ] );
7604 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
7606 if ( fireGlobals ) {
7607 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
7608 // Handle the global AJAX counter
7609 if ( !( --jQuery.active ) ) {
7610 jQuery.event.trigger( "ajaxStop" );
7616 deferred.promise( jqXHR );
7617 jqXHR.success = jqXHR.done;
7618 jqXHR.error = jqXHR.fail;
7619 jqXHR.complete = completeDeferred.add;
7621 // Status-dependent callbacks
7622 jqXHR.statusCode = function( map ) {
7626 for ( tmp in map ) {
7627 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
7630 tmp = map[ jqXHR.status ];
7631 jqXHR.always( tmp );
7637 // Remove hash character (#7531: and string promotion)
7638 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
7639 // We also use the url parameter if available
7640 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
7642 // Extract dataTypes list
7643 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
7645 // Determine if a cross-domain request is in order
7646 if ( s.crossDomain == null ) {
7647 parts = rurl.exec( s.url.toLowerCase() );
7648 s.crossDomain = !!( parts &&
7649 ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
7650 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
7651 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
7655 // Convert data if not already a string
7656 if ( s.data && s.processData && typeof s.data !== "string" ) {
7657 s.data = jQuery.param( s.data, s.traditional );
7661 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
7663 // If request was aborted inside a prefilter, stop there
7664 if ( state === 2 ) {
7668 // We can fire global events as of now if asked to
7669 fireGlobals = s.global;
7671 // Uppercase the type
7672 s.type = s.type.toUpperCase();
7674 // Determine if request has content
7675 s.hasContent = !rnoContent.test( s.type );
7677 // Watch for a new set of requests
7678 if ( fireGlobals && jQuery.active++ === 0 ) {
7679 jQuery.event.trigger( "ajaxStart" );
7682 // More options handling for requests with no content
7683 if ( !s.hasContent ) {
7685 // If data is available, append data to url
7687 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
7688 // #9682: remove data so that it's not used in an eventual retry
7692 // Get ifModifiedKey before adding the anti-cache parameter
7693 ifModifiedKey = s.url;
7695 // Add anti-cache in url if needed
7696 if ( s.cache === false ) {
7698 var ts = jQuery.now(),
7699 // try replacing _= if it is there
7700 ret = s.url.replace( rts, "$1_=" + ts );
7702 // if nothing was replaced, add timestamp to the end
7703 s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
7707 // Set the correct header, if data is being sent
7708 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
7709 jqXHR.setRequestHeader( "Content-Type", s.contentType );
7712 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7713 if ( s.ifModified ) {
7714 ifModifiedKey = ifModifiedKey || s.url;
7715 if ( jQuery.lastModified[ ifModifiedKey ] ) {
7716 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
7718 if ( jQuery.etag[ ifModifiedKey ] ) {
7719 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
7723 // Set the Accepts header for the server, depending on the dataType
7724 jqXHR.setRequestHeader(
7726 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
7727 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
7731 // Check for headers option
7732 for ( i in s.headers ) {
7733 jqXHR.setRequestHeader( i, s.headers[ i ] );
7736 // Allow custom headers/mimetypes and early abort
7737 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
7738 // Abort if not done already and return
7739 return jqXHR.abort();
7743 // aborting is no longer a cancellation
7746 // Install callbacks on deferreds
7747 for ( i in { success: 1, error: 1, complete: 1 } ) {
7748 jqXHR[ i ]( s[ i ] );
7752 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
7754 // If no transport, we auto-abort
7756 done( -1, "No Transport" );
7758 jqXHR.readyState = 1;
7759 // Send global event
7760 if ( fireGlobals ) {
7761 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
7764 if ( s.async && s.timeout > 0 ) {
7765 timeoutTimer = setTimeout( function(){
7766 jqXHR.abort( "timeout" );
7772 transport.send( requestHeaders, done );
7774 // Propagate exception as error if not done
7777 // Simply rethrow otherwise
7787 // Counter for holding the number of active queries
7790 // Last-Modified header cache for next request
7796 /* Handles responses to an ajax request:
7797 * - sets all responseXXX fields accordingly
7798 * - finds the right dataType (mediates between content-type and expected dataType)
7799 * - returns the corresponding response
7801 function ajaxHandleResponses( s, jqXHR, responses ) {
7803 var ct, type, finalDataType, firstDataType,
7804 contents = s.contents,
7805 dataTypes = s.dataTypes,
7806 responseFields = s.responseFields;
7808 // Fill responseXXX fields
7809 for ( type in responseFields ) {
7810 if ( type in responses ) {
7811 jqXHR[ responseFields[type] ] = responses[ type ];
7815 // Remove auto dataType and get content-type in the process
7816 while( dataTypes[ 0 ] === "*" ) {
7818 if ( ct === undefined ) {
7819 ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
7823 // Check if we're dealing with a known content-type
7825 for ( type in contents ) {
7826 if ( contents[ type ] && contents[ type ].test( ct ) ) {
7827 dataTypes.unshift( type );
7833 // Check to see if we have a response for the expected dataType
7834 if ( dataTypes[ 0 ] in responses ) {
7835 finalDataType = dataTypes[ 0 ];
7837 // Try convertible dataTypes
7838 for ( type in responses ) {
7839 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
7840 finalDataType = type;
7843 if ( !firstDataType ) {
7844 firstDataType = type;
7847 // Or just use first one
7848 finalDataType = finalDataType || firstDataType;
7851 // If we found a dataType
7852 // We add the dataType to the list if needed
7853 // and return the corresponding response
7854 if ( finalDataType ) {
7855 if ( finalDataType !== dataTypes[ 0 ] ) {
7856 dataTypes.unshift( finalDataType );
7858 return responses[ finalDataType ];
7862 // Chain conversions given the request and the original response
7863 function ajaxConvert( s, response ) {
7865 var conv, conv2, current, tmp,
7866 // Work with a copy of dataTypes in case we need to modify it for conversion
7867 dataTypes = s.dataTypes.slice(),
7868 prev = dataTypes[ 0 ],
7872 // Apply the dataFilter if provided
7873 if ( s.dataFilter ) {
7874 response = s.dataFilter( response, s.dataType );
7877 // Create converters map with lowercased keys
7878 if ( dataTypes[ 1 ] ) {
7879 for ( conv in s.converters ) {
7880 converters[ conv.toLowerCase() ] = s.converters[ conv ];
7884 // Convert to each sequential dataType, tolerating list modification
7885 for ( ; (current = dataTypes[++i]); ) {
7887 // There's only work to do if current dataType is non-auto
7888 if ( current !== "*" ) {
7890 // Convert response if prev dataType is non-auto and differs from current
7891 if ( prev !== "*" && prev !== current ) {
7893 // Seek a direct converter
7894 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
7896 // If none found, seek a pair
7898 for ( conv2 in converters ) {
7900 // If conv2 outputs current
7901 tmp = conv2.split(" ");
7902 if ( tmp[ 1 ] === current ) {
7904 // If prev can be converted to accepted input
7905 conv = converters[ prev + " " + tmp[ 0 ] ] ||
7906 converters[ "* " + tmp[ 0 ] ];
7908 // Condense equivalence converters
7909 if ( conv === true ) {
7910 conv = converters[ conv2 ];
7912 // Otherwise, insert the intermediate dataType
7913 } else if ( converters[ conv2 ] !== true ) {
7915 dataTypes.splice( i--, 0, current );
7924 // Apply converter (if not an equivalence)
7925 if ( conv !== true ) {
7927 // Unless errors are allowed to bubble, catch and return them
7928 if ( conv && s["throws"] ) {
7929 response = conv( response );
7932 response = conv( response );
7934 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
7940 // Update prev for next iteration
7945 return { state: "success", data: response };
7947 var oldCallbacks = [],
7949 rjsonp = /(=)\?(?=&|$)|\?\?/,
7950 nonce = jQuery.now();
7952 // Default jsonp settings
7955 jsonpCallback: function() {
7956 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
7957 this[ callback ] = true;
7962 // Detect, normalize options and install callbacks for jsonp requests
7963 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7965 var callbackName, overwritten, responseContainer,
7968 hasCallback = s.jsonp !== false,
7969 replaceInUrl = hasCallback && rjsonp.test( url ),
7970 replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
7971 !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
7972 rjsonp.test( data );
7974 // Handle iff the expected data type is "jsonp" or we have a parameter to set
7975 if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
7977 // Get callback name, remembering preexisting value associated with it
7978 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
7981 overwritten = window[ callbackName ];
7983 // Insert callback into url or form data
7984 if ( replaceInUrl ) {
7985 s.url = url.replace( rjsonp, "$1" + callbackName );
7986 } else if ( replaceInData ) {
7987 s.data = data.replace( rjsonp, "$1" + callbackName );
7988 } else if ( hasCallback ) {
7989 s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
7992 // Use data converter to retrieve json after script execution
7993 s.converters["script json"] = function() {
7994 if ( !responseContainer ) {
7995 jQuery.error( callbackName + " was not called" );
7997 return responseContainer[ 0 ];
8000 // force json dataType
8001 s.dataTypes[ 0 ] = "json";
8004 window[ callbackName ] = function() {
8005 responseContainer = arguments;
8008 // Clean-up function (fires after converters)
8009 jqXHR.always(function() {
8010 // Restore preexisting value
8011 window[ callbackName ] = overwritten;
8013 // Save back as free
8014 if ( s[ callbackName ] ) {
8015 // make sure that re-using the options doesn't screw things around
8016 s.jsonpCallback = originalSettings.jsonpCallback;
8018 // save the callback name for future use
8019 oldCallbacks.push( callbackName );
8022 // Call if it was a function and we have a response
8023 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
8024 overwritten( responseContainer[ 0 ] );
8027 responseContainer = overwritten = undefined;
8030 // Delegate to script
8034 // Install script dataType
8037 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
8040 script: /javascript|ecmascript/
8043 "text script": function( text ) {
8044 jQuery.globalEval( text );
8050 // Handle cache's special case and global
8051 jQuery.ajaxPrefilter( "script", function( s ) {
8052 if ( s.cache === undefined ) {
8055 if ( s.crossDomain ) {
8061 // Bind script tag hack transport
8062 jQuery.ajaxTransport( "script", function(s) {
8064 // This transport only deals with cross domain requests
8065 if ( s.crossDomain ) {
8068 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
8072 send: function( _, callback ) {
8074 script = document.createElement( "script" );
8076 script.async = "async";
8078 if ( s.scriptCharset ) {
8079 script.charset = s.scriptCharset;
8084 // Attach handlers for all browsers
8085 script.onload = script.onreadystatechange = function( _, isAbort ) {
8087 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
8089 // Handle memory leak in IE
8090 script.onload = script.onreadystatechange = null;
8092 // Remove the script
8093 if ( head && script.parentNode ) {
8094 head.removeChild( script );
8097 // Dereference the script
8100 // Callback if not abort
8102 callback( 200, "success" );
8106 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
8107 // This arises when a base node is used (#2709 and #4378).
8108 head.insertBefore( script, head.firstChild );
8113 script.onload( 0, 1 );
8120 // #5280: Internet Explorer will keep connections alive if we don't abort on unload
8121 xhrOnUnloadAbort = window.ActiveXObject ? function() {
8122 // Abort all pending requests
8123 for ( var key in xhrCallbacks ) {
8124 xhrCallbacks[ key ]( 0, 1 );
8129 // Functions to create xhrs
8130 function createStandardXHR() {
8132 return new window.XMLHttpRequest();
8136 function createActiveXHR() {
8138 return new window.ActiveXObject( "Microsoft.XMLHTTP" );
8142 // Create the request object
8143 // (This is still attached to ajaxSettings for backward compatibility)
8144 jQuery.ajaxSettings.xhr = window.ActiveXObject ?
8145 /* Microsoft failed to properly
8146 * implement the XMLHttpRequest in IE7 (can't request local files),
8147 * so we use the ActiveXObject when it is available
8148 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
8149 * we need a fallback.
8152 return !this.isLocal && createStandardXHR() || createActiveXHR();
8154 // For all other browsers, use the standard XMLHttpRequest object
8157 // Determine support properties
8159 jQuery.extend( jQuery.support, {
8161 cors: !!xhr && ( "withCredentials" in xhr )
8163 })( jQuery.ajaxSettings.xhr() );
8165 // Create transport if the browser can provide an xhr
8166 if ( jQuery.support.ajax ) {
8168 jQuery.ajaxTransport(function( s ) {
8169 // Cross domain only allowed if supported through XMLHttpRequest
8170 if ( !s.crossDomain || jQuery.support.cors ) {
8175 send: function( headers, complete ) {
8182 // Passing null username, generates a login popup on Opera (#2865)
8184 xhr.open( s.type, s.url, s.async, s.username, s.password );
8186 xhr.open( s.type, s.url, s.async );
8189 // Apply custom fields if provided
8190 if ( s.xhrFields ) {
8191 for ( i in s.xhrFields ) {
8192 xhr[ i ] = s.xhrFields[ i ];
8196 // Override mime type if needed
8197 if ( s.mimeType && xhr.overrideMimeType ) {
8198 xhr.overrideMimeType( s.mimeType );
8201 // X-Requested-With header
8202 // For cross-domain requests, seeing as conditions for a preflight are
8203 // akin to a jigsaw puzzle, we simply never set it to be sure.
8204 // (it can always be set on a per-request basis or even using ajaxSetup)
8205 // For same-domain requests, won't change header if already provided.
8206 if ( !s.crossDomain && !headers["X-Requested-With"] ) {
8207 headers[ "X-Requested-With" ] = "XMLHttpRequest";
8210 // Need an extra try/catch for cross domain requests in Firefox 3
8212 for ( i in headers ) {
8213 xhr.setRequestHeader( i, headers[ i ] );
8217 // Do send the request
8218 // This may raise an exception which is actually
8219 // handled in jQuery.ajax (so no try/catch here)
8220 xhr.send( ( s.hasContent && s.data ) || null );
8223 callback = function( _, isAbort ) {
8231 // Firefox throws exceptions when accessing properties
8232 // of an xhr when a network error occurred
8233 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
8236 // Was never called and is aborted or complete
8237 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
8240 callback = undefined;
8242 // Do not keep as active anymore
8244 xhr.onreadystatechange = jQuery.noop;
8245 if ( xhrOnUnloadAbort ) {
8246 delete xhrCallbacks[ handle ];
8252 // Abort it manually if needed
8253 if ( xhr.readyState !== 4 ) {
8257 status = xhr.status;
8258 responseHeaders = xhr.getAllResponseHeaders();
8260 xml = xhr.responseXML;
8262 // Construct response list
8263 if ( xml && xml.documentElement /* #4958 */ ) {
8264 responses.xml = xml;
8267 // When requesting binary data, IE6-9 will throw an exception
8268 // on any attempt to access responseText (#11426)
8270 responses.text = xhr.responseText;
8274 // Firefox throws an exception when accessing
8275 // statusText for faulty cross-domain requests
8277 statusText = xhr.statusText;
8279 // We normalize with Webkit giving an empty statusText
8283 // Filter status for non standard behaviors
8285 // If the request is local and we have data: assume a success
8286 // (success with no data won't get notified, that's the best we
8287 // can do given current implementations)
8288 if ( !status && s.isLocal && !s.crossDomain ) {
8289 status = responses.text ? 200 : 404;
8290 // IE - #1450: sometimes returns 1223 when it should be 204
8291 } else if ( status === 1223 ) {
8296 } catch( firefoxAccessException ) {
8298 complete( -1, firefoxAccessException );
8302 // Call complete if needed
8304 complete( status, statusText, responses, responseHeaders );
8309 // if we're in sync mode we fire the callback
8311 } else if ( xhr.readyState === 4 ) {
8312 // (IE6 & IE7) if it's in cache and has been
8313 // retrieved directly we need to fire the callback
8314 setTimeout( callback, 0 );
8317 if ( xhrOnUnloadAbort ) {
8318 // Create the active xhrs callbacks list if needed
8319 // and attach the unload handler
8320 if ( !xhrCallbacks ) {
8322 jQuery( window ).unload( xhrOnUnloadAbort );
8324 // Add to list of active xhrs callbacks
8325 xhrCallbacks[ handle ] = callback;
8327 xhr.onreadystatechange = callback;
8341 rfxtypes = /^(?:toggle|show|hide)$/,
8342 rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
8343 rrun = /queueHooks$/,
8344 animationPrefilters = [ defaultPrefilter ],
8346 "*": [function( prop, value ) {
8347 var end, unit, prevScale,
8348 tween = this.createTween( prop, value ),
8349 parts = rfxnum.exec( value ),
8350 target = tween.cur(),
8351 start = +target || 0,
8356 unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8358 // We need to compute starting value
8359 if ( unit !== "px" && start ) {
8360 // Iteratively approximate from a nonzero starting point
8361 // Prefer the current property, because this process will be trivial if it uses the same units
8362 // Fallback to end or a simple constant
8363 start = jQuery.css( tween.elem, prop, true ) || end || 1;
8366 // If previous iteration zeroed out, double until we get *something*
8367 // Use a string for doubling factor so we don't accidentally see scale as unchanged below
8368 prevScale = scale = scale || ".5";
8371 start = start / scale;
8372 jQuery.style( tween.elem, prop, start + unit );
8374 // Update scale, tolerating zeroes from tween.cur()
8375 scale = tween.cur() / target;
8377 // Stop looping if we've hit the mark or scale is unchanged
8378 } while ( scale !== 1 && scale !== prevScale );
8382 tween.start = start;
8383 // If a +=/-= token was provided, we're doing a relative animation
8384 tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
8390 // Animations created synchronously will run synchronously
8391 function createFxNow() {
8392 setTimeout(function() {
8395 return ( fxNow = jQuery.now() );
8398 function createTweens( animation, props ) {
8399 jQuery.each( props, function( prop, value ) {
8400 var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
8402 length = collection.length;
8403 for ( ; index < length; index++ ) {
8404 if ( collection[ index ].call( animation, prop, value ) ) {
8406 // we're done with this property
8413 function Animation( elem, properties, options ) {
8417 length = animationPrefilters.length,
8418 deferred = jQuery.Deferred().always( function() {
8419 // don't match elem in the :animated selector
8423 var currentTime = fxNow || createFxNow(),
8424 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8425 percent = 1 - ( remaining / animation.duration || 0 ),
8427 length = animation.tweens.length;
8429 for ( ; index < length ; index++ ) {
8430 animation.tweens[ index ].run( percent );
8433 deferred.notifyWith( elem, [ animation, percent, remaining ]);
8435 if ( percent < 1 && length ) {
8438 deferred.resolveWith( elem, [ animation ] );
8442 animation = deferred.promise({
8444 props: jQuery.extend( {}, properties ),
8445 opts: jQuery.extend( true, { specialEasing: {} }, options ),
8446 originalProperties: properties,
8447 originalOptions: options,
8448 startTime: fxNow || createFxNow(),
8449 duration: options.duration,
8451 createTween: function( prop, end, easing ) {
8452 var tween = jQuery.Tween( elem, animation.opts, prop, end,
8453 animation.opts.specialEasing[ prop ] || animation.opts.easing );
8454 animation.tweens.push( tween );
8457 stop: function( gotoEnd ) {
8459 // if we are going to the end, we want to run all the tweens
8460 // otherwise we skip this part
8461 length = gotoEnd ? animation.tweens.length : 0;
8463 for ( ; index < length ; index++ ) {
8464 animation.tweens[ index ].run( 1 );
8467 // resolve when we played the last frame
8468 // otherwise, reject
8470 deferred.resolveWith( elem, [ animation, gotoEnd ] );
8472 deferred.rejectWith( elem, [ animation, gotoEnd ] );
8477 props = animation.props;
8479 propFilter( props, animation.opts.specialEasing );
8481 for ( ; index < length ; index++ ) {
8482 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
8488 createTweens( animation, props );
8490 if ( jQuery.isFunction( animation.opts.start ) ) {
8491 animation.opts.start.call( elem, animation );
8495 jQuery.extend( tick, {
8497 queue: animation.opts.queue,
8502 // attach callbacks from options
8503 return animation.progress( animation.opts.progress )
8504 .done( animation.opts.done, animation.opts.complete )
8505 .fail( animation.opts.fail )
8506 .always( animation.opts.always );
8509 function propFilter( props, specialEasing ) {
8510 var index, name, easing, value, hooks;
8512 // camelCase, specialEasing and expand cssHook pass
8513 for ( index in props ) {
8514 name = jQuery.camelCase( index );
8515 easing = specialEasing[ name ];
8516 value = props[ index ];
8517 if ( jQuery.isArray( value ) ) {
8518 easing = value[ 1 ];
8519 value = props[ index ] = value[ 0 ];
8522 if ( index !== name ) {
8523 props[ name ] = value;
8524 delete props[ index ];
8527 hooks = jQuery.cssHooks[ name ];
8528 if ( hooks && "expand" in hooks ) {
8529 value = hooks.expand( value );
8530 delete props[ name ];
8532 // not quite $.extend, this wont overwrite keys already present.
8533 // also - reusing 'index' from above because we have the correct "name"
8534 for ( index in value ) {
8535 if ( !( index in props ) ) {
8536 props[ index ] = value[ index ];
8537 specialEasing[ index ] = easing;
8541 specialEasing[ name ] = easing;
8546 jQuery.Animation = jQuery.extend( Animation, {
8548 tweener: function( props, callback ) {
8549 if ( jQuery.isFunction( props ) ) {
8553 props = props.split(" ");
8558 length = props.length;
8560 for ( ; index < length ; index++ ) {
8561 prop = props[ index ];
8562 tweeners[ prop ] = tweeners[ prop ] || [];
8563 tweeners[ prop ].unshift( callback );
8567 prefilter: function( callback, prepend ) {
8569 animationPrefilters.unshift( callback );
8571 animationPrefilters.push( callback );
8576 function defaultPrefilter( elem, props, opts ) {
8577 var index, prop, value, length, dataShow, tween, hooks, oldfire,
8582 hidden = elem.nodeType && isHidden( elem );
8584 // handle queue: false promises
8585 if ( !opts.queue ) {
8586 hooks = jQuery._queueHooks( elem, "fx" );
8587 if ( hooks.unqueued == null ) {
8589 oldfire = hooks.empty.fire;
8590 hooks.empty.fire = function() {
8591 if ( !hooks.unqueued ) {
8598 anim.always(function() {
8599 // doing this makes sure that the complete handler will be called
8600 // before this completes
8601 anim.always(function() {
8603 if ( !jQuery.queue( elem, "fx" ).length ) {
8610 // height/width overflow pass
8611 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
8612 // Make sure that nothing sneaks out
8613 // Record all 3 overflow attributes because IE does not
8614 // change the overflow attribute when overflowX and
8615 // overflowY are set to the same value
8616 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8618 // Set display property to inline-block for height/width
8619 // animations on inline elements that are having width/height animated
8620 if ( jQuery.css( elem, "display" ) === "inline" &&
8621 jQuery.css( elem, "float" ) === "none" ) {
8623 // inline-level elements accept inline-block;
8624 // block-level elements need to be inline with layout
8625 if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
8626 style.display = "inline-block";
8634 if ( opts.overflow ) {
8635 style.overflow = "hidden";
8636 if ( !jQuery.support.shrinkWrapBlocks ) {
8637 anim.done(function() {
8638 style.overflow = opts.overflow[ 0 ];
8639 style.overflowX = opts.overflow[ 1 ];
8640 style.overflowY = opts.overflow[ 2 ];
8647 for ( index in props ) {
8648 value = props[ index ];
8649 if ( rfxtypes.exec( value ) ) {
8650 delete props[ index ];
8651 if ( value === ( hidden ? "hide" : "show" ) ) {
8654 handled.push( index );
8658 length = handled.length;
8660 dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
8662 jQuery( elem ).show();
8664 anim.done(function() {
8665 jQuery( elem ).hide();
8668 anim.done(function() {
8670 jQuery.removeData( elem, "fxshow", true );
8671 for ( prop in orig ) {
8672 jQuery.style( elem, prop, orig[ prop ] );
8675 for ( index = 0 ; index < length ; index++ ) {
8676 prop = handled[ index ];
8677 tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
8678 orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
8680 if ( !( prop in dataShow ) ) {
8681 dataShow[ prop ] = tween.start;
8683 tween.end = tween.start;
8684 tween.start = prop === "width" || prop === "height" ? 1 : 0;
8691 function Tween( elem, options, prop, end, easing ) {
8692 return new Tween.prototype.init( elem, options, prop, end, easing );
8694 jQuery.Tween = Tween;
8698 init: function( elem, options, prop, end, easing, unit ) {
8701 this.easing = easing || "swing";
8702 this.options = options;
8703 this.start = this.now = this.cur();
8705 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8708 var hooks = Tween.propHooks[ this.prop ];
8710 return hooks && hooks.get ?
8712 Tween.propHooks._default.get( this );
8714 run: function( percent ) {
8716 hooks = Tween.propHooks[ this.prop ];
8718 this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration );
8719 this.now = ( this.end - this.start ) * eased + this.start;
8721 if ( this.options.step ) {
8722 this.options.step.call( this.elem, this.now, this );
8725 if ( hooks && hooks.set ) {
8728 Tween.propHooks._default.set( this );
8734 Tween.prototype.init.prototype = Tween.prototype;
8738 get: function( tween ) {
8741 if ( tween.elem[ tween.prop ] != null &&
8742 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
8743 return tween.elem[ tween.prop ];
8746 // passing any value as a 4th parameter to .css will automatically
8747 // attempt a parseFloat and fallback to a string if the parse fails
8748 // so, simple values such as "10px" are parsed to Float.
8749 // complex values such as "rotate(1rad)" are returned as is.
8750 result = jQuery.css( tween.elem, tween.prop, false, "" );
8751 // Empty strings, null, undefined and "auto" are converted to 0.
8752 return !result || result === "auto" ? 0 : result;
8754 set: function( tween ) {
8755 // use step hook for back compat - use cssHook if its there - use .style if its
8756 // available and use plain properties where available
8757 if ( jQuery.fx.step[ tween.prop ] ) {
8758 jQuery.fx.step[ tween.prop ]( tween );
8759 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
8760 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
8762 tween.elem[ tween.prop ] = tween.now;
8768 // Remove in 2.0 - this supports IE8's panic based approach
8769 // to setting things on disconnected nodes
8771 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
8772 set: function( tween ) {
8773 if ( tween.elem.nodeType && tween.elem.parentNode ) {
8774 tween.elem[ tween.prop ] = tween.now;
8779 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
8780 var cssFn = jQuery.fn[ name ];
8781 jQuery.fn[ name ] = function( speed, easing, callback ) {
8782 return speed == null || typeof speed === "boolean" ||
8783 // special check for .toggle( handler, handler, ... )
8784 ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
8785 cssFn.apply( this, arguments ) :
8786 this.animate( genFx( name, true ), speed, easing, callback );
8791 fadeTo: function( speed, to, easing, callback ) {
8793 // show any hidden elements after setting opacity to 0
8794 return this.filter( isHidden ).css( "opacity", 0 ).show()
8796 // animate to the value specified
8797 .end().animate({ opacity: to }, speed, easing, callback );
8799 animate: function( prop, speed, easing, callback ) {
8800 var empty = jQuery.isEmptyObject( prop ),
8801 optall = jQuery.speed( speed, easing, callback ),
8802 doAnimation = function() {
8803 // Operate on a copy of prop so per-property easing won't be lost
8804 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
8806 // Empty animations resolve immediately
8812 return empty || optall.queue === false ?
8813 this.each( doAnimation ) :
8814 this.queue( optall.queue, doAnimation );
8816 stop: function( type, clearQueue, gotoEnd ) {
8817 var stopQueue = function( hooks ) {
8818 var stop = hooks.stop;
8823 if ( typeof type !== "string" ) {
8824 gotoEnd = clearQueue;
8828 if ( clearQueue && type !== false ) {
8829 this.queue( type || "fx", [] );
8832 return this.each(function() {
8834 index = type != null && type + "queueHooks",
8835 timers = jQuery.timers,
8836 data = jQuery._data( this );
8839 if ( data[ index ] && data[ index ].stop ) {
8840 stopQueue( data[ index ] );
8843 for ( index in data ) {
8844 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
8845 stopQueue( data[ index ] );
8850 for ( index = timers.length; index--; ) {
8851 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
8852 timers[ index ].anim.stop( gotoEnd );
8854 timers.splice( index, 1 );
8858 // start the next in the queue if the last step wasn't forced
8859 // timers currently will call their complete callbacks, which will dequeue
8860 // but only if they were gotoEnd
8861 if ( dequeue || !gotoEnd ) {
8862 jQuery.dequeue( this, type );
8868 // Generate parameters to create a standard animation
8869 function genFx( type, includeWidth ) {
8871 attrs = { height: type },
8874 // if we include width, step value is 1 to do all cssExpand values,
8875 // if we don't include width, step value is 2 to skip over Left and Right
8876 for( ; i < 4 ; i += 2 - includeWidth ) {
8877 which = cssExpand[ i ];
8878 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
8881 if ( includeWidth ) {
8882 attrs.opacity = attrs.width = type;
8888 // Generate shortcuts for custom animations
8890 slideDown: genFx("show"),
8891 slideUp: genFx("hide"),
8892 slideToggle: genFx("toggle"),
8893 fadeIn: { opacity: "show" },
8894 fadeOut: { opacity: "hide" },
8895 fadeToggle: { opacity: "toggle" }
8896 }, function( name, props ) {
8897 jQuery.fn[ name ] = function( speed, easing, callback ) {
8898 return this.animate( props, speed, easing, callback );
8902 jQuery.speed = function( speed, easing, fn ) {
8903 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
8904 complete: fn || !fn && easing ||
8905 jQuery.isFunction( speed ) && speed,
8907 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
8910 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
8911 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
8913 // normalize opt.queue - true/undefined/null -> "fx"
8914 if ( opt.queue == null || opt.queue === true ) {
8919 opt.old = opt.complete;
8921 opt.complete = function() {
8922 if ( jQuery.isFunction( opt.old ) ) {
8923 opt.old.call( this );
8927 jQuery.dequeue( this, opt.queue );
8935 linear: function( p ) {
8938 swing: function( p ) {
8939 return 0.5 - Math.cos( p*Math.PI ) / 2;
8944 jQuery.fx = Tween.prototype.init;
8945 jQuery.fx.tick = function() {
8947 timers = jQuery.timers,
8950 for ( ; i < timers.length; i++ ) {
8951 timer = timers[ i ];
8952 // Checks the timer has not already been removed
8953 if ( !timer() && timers[ i ] === timer ) {
8954 timers.splice( i--, 1 );
8958 if ( !timers.length ) {
8963 jQuery.fx.timer = function( timer ) {
8964 if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
8965 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
8969 jQuery.fx.interval = 13;
8971 jQuery.fx.stop = function() {
8972 clearInterval( timerId );
8976 jQuery.fx.speeds = {
8983 // Back Compat <1.8 extension point
8984 jQuery.fx.step = {};
8986 if ( jQuery.expr && jQuery.expr.filters ) {
8987 jQuery.expr.filters.animated = function( elem ) {
8988 return jQuery.grep(jQuery.timers, function( fn ) {
8989 return elem === fn.elem;
8993 var rroot = /^(?:body|html)$/i;
8995 jQuery.fn.offset = function( options ) {
8996 if ( arguments.length ) {
8997 return options === undefined ?
8999 this.each(function( i ) {
9000 jQuery.offset.setOffset( this, options, i );
9004 var box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
9006 doc = elem && elem.ownerDocument;
9012 if ( (body = doc.body) === elem ) {
9013 return jQuery.offset.bodyOffset( elem );
9016 docElem = doc.documentElement;
9018 // Make sure we're not dealing with a disconnected DOM node
9019 if ( !jQuery.contains( docElem, elem ) ) {
9020 return { top: 0, left: 0 };
9023 box = elem.getBoundingClientRect();
9024 win = getWindow( doc );
9025 clientTop = docElem.clientTop || body.clientTop || 0;
9026 clientLeft = docElem.clientLeft || body.clientLeft || 0;
9027 scrollTop = win.pageYOffset || docElem.scrollTop;
9028 scrollLeft = win.pageXOffset || docElem.scrollLeft;
9029 top = box.top + scrollTop - clientTop;
9030 left = box.left + scrollLeft - clientLeft;
9032 return { top: top, left: left };
9037 bodyOffset: function( body ) {
9038 var top = body.offsetTop,
9039 left = body.offsetLeft;
9041 if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
9042 top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
9043 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
9046 return { top: top, left: left };
9049 setOffset: function( elem, options, i ) {
9050 var position = jQuery.css( elem, "position" );
9052 // set position first, in-case top/left are set even on static elem
9053 if ( position === "static" ) {
9054 elem.style.position = "relative";
9057 var curElem = jQuery( elem ),
9058 curOffset = curElem.offset(),
9059 curCSSTop = jQuery.css( elem, "top" ),
9060 curCSSLeft = jQuery.css( elem, "left" ),
9061 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
9062 props = {}, curPosition = {}, curTop, curLeft;
9064 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
9065 if ( calculatePosition ) {
9066 curPosition = curElem.position();
9067 curTop = curPosition.top;
9068 curLeft = curPosition.left;
9070 curTop = parseFloat( curCSSTop ) || 0;
9071 curLeft = parseFloat( curCSSLeft ) || 0;
9074 if ( jQuery.isFunction( options ) ) {
9075 options = options.call( elem, i, curOffset );
9078 if ( options.top != null ) {
9079 props.top = ( options.top - curOffset.top ) + curTop;
9081 if ( options.left != null ) {
9082 props.left = ( options.left - curOffset.left ) + curLeft;
9085 if ( "using" in options ) {
9086 options.using.call( elem, props );
9088 curElem.css( props );
9096 position: function() {
9103 // Get *real* offsetParent
9104 offsetParent = this.offsetParent(),
9106 // Get correct offsets
9107 offset = this.offset(),
9108 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
9110 // Subtract element margins
9111 // note: when an element has margin: auto the offsetLeft and marginLeft
9112 // are the same in Safari causing offset.left to incorrectly be 0
9113 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
9114 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
9116 // Add offsetParent borders
9117 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
9118 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
9120 // Subtract the two offsets
9122 top: offset.top - parentOffset.top,
9123 left: offset.left - parentOffset.left
9127 offsetParent: function() {
9128 return this.map(function() {
9129 var offsetParent = this.offsetParent || document.body;
9130 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
9131 offsetParent = offsetParent.offsetParent;
9133 return offsetParent || document.body;
9139 // Create scrollLeft and scrollTop methods
9140 jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
9141 var top = /Y/.test( prop );
9143 jQuery.fn[ method ] = function( val ) {
9144 return jQuery.access( this, function( elem, method, val ) {
9145 var win = getWindow( elem );
9147 if ( val === undefined ) {
9148 return win ? (prop in win) ? win[ prop ] :
9149 win.document.documentElement[ method ] :
9155 !top ? val : jQuery( win ).scrollLeft(),
9156 top ? val : jQuery( win ).scrollTop()
9160 elem[ method ] = val;
9162 }, method, val, arguments.length, null );
9166 function getWindow( elem ) {
9167 return jQuery.isWindow( elem ) ?
9169 elem.nodeType === 9 ?
9170 elem.defaultView || elem.parentWindow :
9173 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9174 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9175 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
9176 // margin is only for outerHeight, outerWidth
9177 jQuery.fn[ funcName ] = function( margin, value ) {
9178 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9179 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9181 return jQuery.access( this, function( elem, type, value ) {
9184 if ( jQuery.isWindow( elem ) ) {
9185 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9186 // isn't a whole lot we can do. See pull request at this URL for discussion:
9187 // https://github.com/jquery/jquery/pull/764
9188 return elem.document.documentElement[ "client" + name ];
9191 // Get document width or height
9192 if ( elem.nodeType === 9 ) {
9193 doc = elem.documentElement;
9195 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
9196 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
9198 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9199 elem.body[ "offset" + name ], doc[ "offset" + name ],
9200 doc[ "client" + name ]
9204 return value === undefined ?
9205 // Get width or height on the element, requesting but not forcing parseFloat
9206 jQuery.css( elem, type, value, extra ) :
9208 // Set width or height on the element
9209 jQuery.style( elem, type, value, extra );
9210 }, type, chainable ? margin : undefined, chainable );
9214 // Expose jQuery to the global object
9215 window.jQuery = window.$ = jQuery;
9217 // Expose jQuery as an AMD module, but only for AMD loaders that
9218 // understand the issues with loading multiple versions of jQuery
9219 // in a page that all might call define(). The loader will indicate
9220 // they have special allowances for multiple jQuery versions by
9221 // specifying define.amd.jQuery = true. Register as a named module,
9222 // since jQuery can be concatenated with other files that may use define,
9223 // but not use a proper concatenation script that understands anonymous
9224 // AMD modules. A named AMD is safest and most robust way to register.
9225 // Lowercase jquery is used because AMD module names are derived from
9226 // file names, and jQuery is normally delivered in a lowercase file name.
9227 // Do this after creating the global so that if an AMD module wants to call
9228 // noConflict to hide this version of jQuery, it will work.
9229 if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
9230 define( "jquery", [], function () { return jQuery; } );
9235 $(document).ready(function(){
9237 $('#system h2').addClass('hide');
9238 $('#system table').addClass('hide');
9239 $('#cpuidle h2').addClass('hide');
9240 $('#cpuidle table').addClass('hide');
9241 $('#cpufreq h2').addClass('hide');
9242 $('#cpufreq table').addClass('hide');
9244 // $('#software h2').addClass('hide');
9245 // $('#software table').addClass('hide');
9246 $('#device h2').addClass('hide');
9247 $('#device table').addClass('hide');
9248 $('#device p').addClass('hide');
9250 $('#tuning h2').addClass('hide');
9251 $('#tuning table').addClass('hide');
9253 $('#top').append('<div class="SystemButton" onclick="toggleSystem()">System Info</div>');
9254 $('#top').append('<div class="SummaryButton" onclick="toggleSummary()">Summary</div>');
9255 $('#top').append('<div class="CpuidleButton" onclick="toggleCpuidle()">CPU Idle</div>');
9256 $('#top').append('<div class="CpufreqButton" onclick="toggleCpufreq()">CPU Frequency</div>');
9258 $('#top').append('<div class="SoftwareButton" onclick="toggleSoftware()">Software info</div>');
9259 $('#top').append('<div class="DeviceButton" onclick="toggleDevice()">Device Info</div>');
9260 // $('#top').append('<div class="TuningButton" onclick="toggleTuning()">Tuning</div>');
9261 $('#top').append('<div class="AllButton" onclick="toggleAll()">All</div>');
9262 // $('#top .SummaryButton').toggleClass('pressed');
9263 $('#top .SoftwareButton').toggleClass('pressed');
9267 function toggleDummy() {
9269 $('#system table').toggleClass('hide', true);
9270 $('#system h2').toggleClass('hide', true);
9271 $('#summary table').toggleClass('hide', true);
9272 $('#summary h2').toggleClass('hide', true);
9273 $('#summary p').toggleClass('hide', true);
9274 $('#cpuidle table').toggleClass('hide', true);
9275 $('#cpuidle h2').toggleClass('hide', true);
9276 $('#cpufreq table').toggleClass('hide', true);
9277 $('#cpufreq h2').toggleClass('hide', true);
9279 $('#software table').toggleClass('hide', true);
9280 $('#software h2').toggleClass('hide', true);
9281 $('#device table').toggleClass('hide', true);
9282 $('#device h2').toggleClass('hide', true);
9283 $('#device p').toggleClass('hide', true);
9285 $('#tuning table').toggleClass('hide', true);
9286 $('#tuning h2').toggleClass('hide', true);
9287 $('#top .SystemButton').toggleClass('pressed', false);
9288 $('#top .SummaryButton').toggleClass('pressed', false);
9289 $('#top .CpuidleButton').toggleClass('pressed', false);
9290 $('#top .CpufreqButton').toggleClass('pressed', false);
9292 $('#top .SoftwareButton').toggleClass('pressed', false);
9293 $('#top .DeviceButton').toggleClass('pressed', false);
9294 // $('#top .TuningButton').toggleClass('pressed', false);
9295 $('#top .AllButton').toggleClass('pressed', false);
9298 function toggleSystem() {
9299 $('#system table').toggleClass('hide', false);
9300 $('#system h2').toggleClass('hide', false);
9301 $('#summary table').toggleClass('hide', true);
9302 $('#summary h2').toggleClass('hide', true);
9303 $('#summary p').toggleClass('hide', true);
9304 $('#cpuidle table').toggleClass('hide', true);
9305 $('#cpuidle h2').toggleClass('hide', true);
9306 $('#cpufreq table').toggleClass('hide', true);
9307 $('#cpufreq h2').toggleClass('hide', true);
9308 $('#software table').toggleClass('hide', true);
9309 $('#software h2').toggleClass('hide', true);
9310 $('#device table').toggleClass('hide', true);
9311 $('#device h2').toggleClass('hide', true);
9312 $('#device p').toggleClass('hide', true);
9313 $('#tuning table').toggleClass('hide', true);
9314 $('#tuning h2').toggleClass('hide', true);
9315 $('#top .SystemButton').toggleClass('pressed', true);
9316 $('#top .SummaryButton').toggleClass('pressed', false);
9317 $('#top .CpuidleButton').toggleClass('pressed', false);
9318 $('#top .CpufreqButton').toggleClass('pressed', false);
9319 $('#top .SoftwareButton').toggleClass('pressed', false);
9320 $('#top .DeviceButton').toggleClass('pressed', false);
9321 $('#top .TuningButton').toggleClass('pressed', false);
9322 $('#top .AllButton').toggleClass('pressed', false);
9324 function toggleSummary() {
9325 $('#system table').toggleClass('hide', true);
9326 $('#system h2').toggleClass('hide', true);
9327 $('#summary table').toggleClass('hide', false);
9328 $('#summary h2').toggleClass('hide', false);
9329 $('#summary p').toggleClass('hide', false);
9330 $('#cpuidle table').toggleClass('hide', true);
9331 $('#cpuidle h2').toggleClass('hide', true);
9332 $('#cpufreq table').toggleClass('hide', true);
9333 $('#cpufreq h2').toggleClass('hide', true);
9334 $('#software table').toggleClass('hide', true);
9335 $('#software h2').toggleClass('hide', true);
9336 $('#device table').toggleClass('hide', true);
9337 $('#device h2').toggleClass('hide', true);
9338 $('#device p').toggleClass('hide', true);
9339 $('#tuning table').toggleClass('hide', true);
9340 $('#tuning h2').toggleClass('hide', true);
9341 $('#top .SystemButton').toggleClass('pressed', false);
9342 $('#top .SummaryButton').toggleClass('pressed', true);
9343 $('#top .CpuidleButton').toggleClass('pressed', false);
9344 $('#top .CpufreqButton').toggleClass('pressed', false);
9345 $('#top .SoftwareButton').toggleClass('pressed', false);
9346 $('#top .DeviceButton').toggleClass('pressed', false);
9347 $('#top .TuningButton').toggleClass('pressed', false);
9348 $('#top .AllButton').toggleClass('pressed', false);
9350 function toggleCpuidle() {
9351 $('#system table').toggleClass('hide', true);
9352 $('#system h2').toggleClass('hide', true);
9353 $('#summary table').toggleClass('hide', true);
9354 $('#summary h2').toggleClass('hide', true);
9355 $('#summary p').toggleClass('hide', true);
9356 $('#cpuidle table').toggleClass('hide', false);
9357 $('#cpuidle h2').toggleClass('hide', false);
9358 $('#cpufreq table').toggleClass('hide', true);
9359 $('#cpufreq h2').toggleClass('hide', true);
9360 $('#software table').toggleClass('hide', true);
9361 $('#software h2').toggleClass('hide', true);
9362 $('#device table').toggleClass('hide', true);
9363 $('#device h2').toggleClass('hide', true);
9364 $('#device p').toggleClass('hide', true);
9365 $('#tuning table').toggleClass('hide', true);
9366 $('#tuning h2').toggleClass('hide', true);
9367 $('#top .SystemButton').toggleClass('pressed', false);
9368 $('#top .SummaryButton').toggleClass('pressed', false);
9369 $('#top .CpuidleButton').toggleClass('pressed', true);
9370 $('#top .CpufreqButton').toggleClass('pressed', false);
9371 $('#top .SoftwareButton').toggleClass('pressed', false);
9372 $('#top .DeviceButton').toggleClass('pressed', false);
9373 $('#top .TuningButton').toggleClass('pressed', false);
9374 $('#top .AllButton').toggleClass('pressed', false);
9377 function toggleCpufreq() {
9378 $('#system table').toggleClass('hide', true);
9379 $('#system h2').toggleClass('hide', true);
9380 $('#summary table').toggleClass('hide', true);
9381 $('#summary h2').toggleClass('hide', true);
9382 $('#summary p').toggleClass('hide', true);
9383 $('#cpuidle table').toggleClass('hide', true);
9384 $('#cpuidle h2').toggleClass('hide', true);
9385 $('#cpufreq table').toggleClass('hide', false);
9386 $('#cpufreq h2').toggleClass('hide', false);
9387 $('#software table').toggleClass('hide', true);
9388 $('#software h2').toggleClass('hide', true);
9389 $('#device table').toggleClass('hide', true);
9390 $('#device h2').toggleClass('hide', true);
9391 $('#device p').toggleClass('hide', true);
9392 $('#tuning table').toggleClass('hide', true);
9393 $('#tuning h2').toggleClass('hide', true);
9394 $('#top .SystemButton').toggleClass('pressed', false);
9395 $('#top .SummaryButton').toggleClass('pressed', false);
9396 $('#top .CpuidleButton').toggleClass('pressed', false);
9397 $('#top .CpufreqButton').toggleClass('pressed', true);
9398 $('#top .SoftwareButton').toggleClass('pressed', false);
9399 $('#top .DeviceButton').toggleClass('pressed', false);
9400 $('#top .TuningButton').toggleClass('pressed', false);
9401 $('#top .AllButton').toggleClass('pressed', false);
9404 function toggleSoftware() {
9406 $('#system table').toggleClass('hide', true);
9407 $('#system h2').toggleClass('hide', true);
9408 $('#summary table').toggleClass('hide', true);
9409 $('#summary h2').toggleClass('hide', true);
9410 $('#summary p').toggleClass('hide', true);
9411 $('#cpuidle table').toggleClass('hide', true);
9412 $('#cpuidle h2').toggleClass('hide', true);
9413 $('#cpufreq table').toggleClass('hide', true);
9414 $('#cpufreq h2').toggleClass('hide', true);
9416 $('#software table').toggleClass('hide', false);
9417 $('#software h2').toggleClass('hide', false);
9418 $('#device table').toggleClass('hide', true);
9419 $('#device h2').toggleClass('hide', true);
9420 $('#device p').toggleClass('hide', true);
9422 $('#tuning table').toggleClass('hide', true);
9423 $('#tuning h2').toggleClass('hide', true);
9424 $('#top .SystemButton').toggleClass('pressed', false);
9425 $('#top .SummaryButton').toggleClass('pressed', false);
9426 $('#top .CpuidleButton').toggleClass('pressed', false);
9427 $('#top .CpufreqButton').toggleClass('pressed', false);
9429 $('#top .SoftwareButton').toggleClass('pressed', true);
9430 $('#top .DeviceButton').toggleClass('pressed', false);
9431 // $('#top .TuningButton').toggleClass('pressed', false);
9432 $('#top .AllButton').toggleClass('pressed', false);
9435 function toggleDevice() {
9436 $('#system table').toggleClass('hide', true);
9437 $('#system h2').toggleClass('hide', true);
9438 $('#summary table').toggleClass('hide', true);
9439 $('#summary h2').toggleClass('hide', true);
9440 $('#summary p').toggleClass('hide', true);
9441 $('#cpuidle table').toggleClass('hide', true);
9442 $('#cpuidle h2').toggleClass('hide', true);
9443 $('#cpufreq table').toggleClass('hide', true);
9444 $('#cpufreq h2').toggleClass('hide', true);
9445 $('#software table').toggleClass('hide', true);
9446 $('#software h2').toggleClass('hide', true);
9447 $('#device table').toggleClass('hide', false);
9448 $('#device h2').toggleClass('hide', false);
9449 $('#device p').toggleClass('hide', false);
9450 $('#tuning table').toggleClass('hide', true);
9451 $('#tuning h2').toggleClass('hide', true);
9452 $('#top .SystemButton').toggleClass('pressed', false);
9453 $('#top .SummaryButton').toggleClass('pressed', false);
9454 $('#top .CpuidleButton').toggleClass('pressed', false);
9455 $('#top .CpufreqButton').toggleClass('pressed', false);
9456 $('#top .SoftwareButton').toggleClass('pressed', false);
9457 $('#top .DeviceButton').toggleClass('pressed', true);
9458 $('#top .TuningButton').toggleClass('pressed', false);
9459 $('#top .AllButton').toggleClass('pressed', false);
9462 function toggleTuning() {
9463 $('#system table').toggleClass('hide', true);
9464 $('#system h2').toggleClass('hide', true);
9465 $('#summary table').toggleClass('hide', true);
9466 $('#summary h2').toggleClass('hide', true);
9467 $('#summary p').toggleClass('hide', true);
9468 $('#cpuidle table').toggleClass('hide', true);
9469 $('#cpuidle h2').toggleClass('hide', true);
9470 $('#cpufreq table').toggleClass('hide', true);
9471 $('#cpufreq h2').toggleClass('hide', true);
9472 $('#software table').toggleClass('hide', true);
9473 $('#software h2').toggleClass('hide', true);
9474 $('#device table').toggleClass('hide', true);
9475 $('#device h2').toggleClass('hide', true);
9476 $('#device p').toggleClass('hide', true);
9477 $('#tuning table').toggleClass('hide', false);
9478 $('#tuning h2').toggleClass('hide', false);
9479 $('#top .SystemButton').toggleClass('pressed', false);
9480 $('#top .SummaryButton').toggleClass('pressed', false);
9481 $('#top .CpuidleButton').toggleClass('pressed', false);
9482 $('#top .CpufreqButton').toggleClass('pressed', false);
9483 $('#top .SoftwareButton').toggleClass('pressed', false);
9484 $('#top .DeviceButton').toggleClass('pressed', false);
9485 $('#top .TuningButton').toggleClass('pressed', true);
9486 $('#top .AllButton').toggleClass('pressed', false);
9489 function toggleAll() {
9491 $('#system table').toggleClass('hide', false);
9492 $('#system h2').toggleClass('hide', false);
9493 $('#summary table').toggleClass('hide', false);
9494 $('#summary h2').toggleClass('hide', false);
9495 $('#summary p').toggleClass('hide', false);
9496 $('#cpuidle table').toggleClass('hide', false);
9497 $('#cpuidle h2').toggleClass('hide', false);
9498 $('#cpufreq table').toggleClass('hide', false);
9499 $('#cpufreq h2').toggleClass('hide', false);
9501 $('#software table').toggleClass('hide', false);
9502 $('#software h2').toggleClass('hide', false);
9503 $('#device table').toggleClass('hide', false);
9504 $('#device h2').toggleClass('hide', false);
9505 $('#device p').toggleClass('hide', false);
9507 $('#tuning table').toggleClass('hide', false);
9508 $('#tuning h2').toggleClass('hide', false);
9509 $('#top .SystemButton').toggleClass('pressed', false);
9510 $('#top .SummaryButton').toggleClass('pressed', false);
9511 $('#top .CpuidleButton').toggleClass('pressed', false);
9512 $('#top .CpufreqButton').toggleClass('pressed', false);
9514 $('#top .SoftwareButton').toggleClass('pressed', false);
9515 $('#top .DeviceButton').toggleClass('pressed', false);
9516 // $('#top .TuningButton').toggleClass('pressed', false);
9517 $('#top .AllButton').toggleClass('pressed', true);
9520 <style type="text/css">
9523 background-color: #F8F8F8;
9542 background-color: #E0ffE0;
9548 background-color: #F0ffF0;
9555 background-color: #F0ffF0;
9562 background-color: #E0E0ff;
9569 background-color: #E2E2E2;
9575 background-color: #F4f4F4;
9581 background-color: #E0E0f0;
9588 background-color: #F0f0F0;
9594 background-color: #E0E0ff;
9601 background-color: #F0ffF0;
9608 background-color: #E0E0E0;
9613 background-color: #F0f0F0;
9619 background-color: #E0E0E0;
9624 background-color: #F0f0F0;
9645 background-color: #E0E0E0;
9650 background-color: #F0f0F0;
9656 background-color: #FFE0E0;
9661 background-color: #FFf0F0;
9667 background-color: #E0E0E0;
9672 background-color: #F0f0F0;
9678 background-color: #E0E0E0;
9683 background-color: #F0f0F0;
9688 background-color: #eee; /* Background color */
9689 color: #222; /* Foreground color used for text */
9690 font-family: Helvetica;
9692 margin: 0; /* Amount of negative space around the
9693 outside of the body */
9694 padding: 0; /* Amount of negative space around the
9695 inside of the body */
9702 background-color: #ccc;
9703 border-bottom: 1px solid #666;
9710 text-decoration: none;
9711 text-shadow: 0px 1px 1px #fff;
9712 background-image: -webkit-gradient(linear, left top, left bottom,
9713 from(#ccc), to(#999));
9722 text-shadow: rgba(0,0,0,0.6) 0px -1px 1px;
9724 border-width:0px 8px 0px 8px;
9726 #top div.SystemButton {
9731 #top div.SummaryButton {
9736 #top div.CpuidleButton {
9741 #top div.CpufreqButton {
9746 #top div.SoftwareButton {
9752 #top div.DeviceButton {
9758 #top div.TuningButton {
9763 #top div.AllButton {
9770 background-color: #000000;
9771 border: 1px solid #000000;
9774 border-width:0px 8px 0px 8px;
9775 -webkit-border-top-left-radius: 8px;
9776 -webkit-border-top-right-radius: 8px;
9777 -webkit-border-bottom-left-radius: 8px;
9778 -webkit-border-bottom-right-radius: 8px;
9794 <h1><a href="#top"> </a></h1>