How to use jQuery.find.attr method in Cypress

Best JavaScript code snippet using cypress

jquery-1.10.2.js

Source:jquery-1.10.2.js Github

copy

Full Screen

1/*!2 * jquery javascript library v1.10.23 * http://jquery.com/4 *5 * includes sizzle.js6 * http://sizzlejs.com/7 *8 * copyright 2005, 2013 jquery foundation, inc. and other contributors9 * released under the mit license10 * http://jquery.org/license11 *12 * date: 2013-07-03t13:48z13 */14(function( window, undefined ) {15// can't do this because several apps including asp.net trace16// the stack via arguments.caller.callee and firefox dies if17// you try to trace through "use strict" call chains. (#13335)18// support: firefox 18+19//"use strict";20 var21 // the deferred used on dom ready22 readylist,23 // a central reference to the root jquery(document)24 rootjquery,25 // support: ie<1026 // for `typeof xmlnode.method` instead of `xmlnode.method !== undefined`27 core_strundefined = typeof undefined,28 // use the correct document accordingly with window argument (sandbox)29 location = window.location,30 document = window.document,31 docelem = document.documentelement,32 // map over jquery in case of overwrite33 _jquery = window.jquery,34 // map over the $ in case of overwrite35 _$ = window.$,36 // [[class]] -> type pairs37 class2type = {},38 // list of deleted data cache ids, so we can reuse them39 core_deletedids = [],40 core_version = "1.10.2",41 // save a reference to some core methods42 core_concat = core_deletedids.concat,43 core_push = core_deletedids.push,44 core_slice = core_deletedids.slice,45 core_indexof = core_deletedids.indexof,46 core_tostring = class2type.tostring,47 core_hasown = class2type.hasownproperty,48 core_trim = core_version.trim,49 // define a local copy of jquery50 jquery = function( selector, context ) {51 // the jquery object is actually just the init constructor 'enhanced'52 return new jquery.fn.init( selector, context, rootjquery );53 },54 // used for matching numbers55 core_pnum = /[+-]?(?:\d*\.|)\d+(?:[ee][+-]?\d+|)/.source,56 // used for splitting on whitespace57 core_rnotwhite = /\s+/g,58 // make sure we trim bom and nbsp (here's looking at you, safari 5.0 and ie)59 rtrim = /^[\s\ufeff\xa0]+|[\s\ufeff\xa0]+$/g,60 // a simple way to check for html strings61 // prioritize #id over <tag> to avoid xss via location.hash (#9521)62 // strict html recognition (#11290: must start with <)63 rquickexpr = /^(?:\s*(<[\w\w]+>)[^>]*|#([\w-]*))$/,64 // match a standalone tag65 rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,66 // json regexp67 rvalidchars = /^[\],:{}\s]*$/,68 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,69 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fa-f]{4})/g,70 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[ee][+-]?\d+|)/g,71 // matches dashed string for camelizing72 rmsprefix = /^-ms-/,73 rdashalpha = /-([\da-z])/gi,74 // used by jquery.camelcase as callback to replace()75 fcamelcase = function( all, letter ) {76 return letter.touppercase();77 },78 // the ready event handler79 completed = function( event ) {80 // readystate === "complete" is good enough for us to call the dom ready in oldie81 if ( document.addeventlistener || event.type === "load" || document.readystate === "complete" ) {82 detach();83 jquery.ready();84 }85 },86 // clean-up method for dom ready events87 detach = function() {88 if ( document.addeventlistener ) {89 document.removeeventlistener( "domcontentloaded", completed, false );90 window.removeeventlistener( "load", completed, false );91 } else {92 document.detachevent( "onreadystatechange", completed );93 window.detachevent( "onload", completed );94 }95 };96 jquery.fn = jquery.prototype = {97 // the current version of jquery being used98 jquery: core_version,99 constructor: jquery,100 init: function( selector, context, rootjquery ) {101 var match, elem;102 // handle: $(""), $(null), $(undefined), $(false)103 if ( !selector ) {104 return this;105 }106 // handle html strings107 if ( typeof selector === "string" ) {108 if ( selector.charat(0) === "<" && selector.charat( selector.length - 1 ) === ">" && selector.length >= 3 ) {109 // assume that strings that start and end with <> are html and skip the regex check110 match = [ null, selector, null ];111 } else {112 match = rquickexpr.exec( selector );113 }114 // match html or make sure no context is specified for #id115 if ( match && (match[1] || !context) ) {116 // handle: $(html) -> $(array)117 if ( match[1] ) {118 context = context instanceof jquery ? context[0] : context;119 // scripts is true for back-compat120 jquery.merge( this, jquery.parsehtml(121 match[1],122 context && context.nodetype ? context.ownerdocument || context : document,123 true124 ) );125 // handle: $(html, props)126 if ( rsingletag.test( match[1] ) && jquery.isplainobject( context ) ) {127 for ( match in context ) {128 // properties of context are called as methods if possible129 if ( jquery.isfunction( this[ match ] ) ) {130 this[ match ]( context[ match ] );131 // ...and otherwise set as attributes132 } else {133 this.attr( match, context[ match ] );134 }135 }136 }137 return this;138 // handle: $(#id)139 } else {140 elem = document.getelementbyid( match[2] );141 // check parentnode to catch when blackberry 4.6 returns142 // nodes that are no longer in the document #6963143 if ( elem && elem.parentnode ) {144 // handle the case where ie and opera return items145 // by name instead of id146 if ( elem.id !== match[2] ) {147 return rootjquery.find( selector );148 }149 // otherwise, we inject the element directly into the jquery object150 this.length = 1;151 this[0] = elem;152 }153 this.context = document;154 this.selector = selector;155 return this;156 }157 // handle: $(expr, $(...))158 } else if ( !context || context.jquery ) {159 return ( context || rootjquery ).find( selector );160 // handle: $(expr, context)161 // (which is just equivalent to: $(context).find(expr)162 } else {163 return this.constructor( context ).find( selector );164 }165 // handle: $(domelement)166 } else if ( selector.nodetype ) {167 this.context = this[0] = selector;168 this.length = 1;169 return this;170 // handle: $(function)171 // shortcut for document ready172 } else if ( jquery.isfunction( selector ) ) {173 return rootjquery.ready( selector );174 }175 if ( selector.selector !== undefined ) {176 this.selector = selector.selector;177 this.context = selector.context;178 }179 return jquery.makearray( selector, this );180 },181 // start with an empty selector182 selector: "",183 // the default length of a jquery object is 0184 length: 0,185 toarray: function() {186 return core_slice.call( this );187 },188 // get the nth element in the matched element set or189 // get the whole matched element set as a clean array190 get: function( num ) {191 return num == null ?192 // return a 'clean' array193 this.toarray() :194 // return just the object195 ( num < 0 ? this[ this.length + num ] : this[ num ] );196 },197 // take an array of elements and push it onto the stack198 // (returning the new matched element set)199 pushstack: function( elems ) {200 // build a new jquery matched element set201 var ret = jquery.merge( this.constructor(), elems );202 // add the old object onto the stack (as a reference)203 ret.prevobject = this;204 ret.context = this.context;205 // return the newly-formed element set206 return ret;207 },208 // execute a callback for every element in the matched set.209 // (you can seed the arguments with an array of args, but this is210 // only used internally.)211 each: function( callback, args ) {212 return jquery.each( this, callback, args );213 },214 ready: function( fn ) {215 // add the callback216 jquery.ready.promise().done( fn );217 return this;218 },219 slice: function() {220 return this.pushstack( core_slice.apply( this, arguments ) );221 },222 first: function() {223 return this.eq( 0 );224 },225 last: function() {226 return this.eq( -1 );227 },228 eq: function( i ) {229 var len = this.length,230 j = +i + ( i < 0 ? len : 0 );231 return this.pushstack( j >= 0 && j < len ? [ this[j] ] : [] );232 },233 map: function( callback ) {234 return this.pushstack( jquery.map(this, function( elem, i ) {235 return callback.call( elem, i, elem );236 }));237 },238 end: function() {239 return this.prevobject || this.constructor(null);240 },241 // for internal use only.242 // behaves like an array's method, not like a jquery method.243 push: core_push,244 sort: [].sort,245 splice: [].splice246 };247// give the init function the jquery prototype for later instantiation248 jquery.fn.init.prototype = jquery.fn;249 jquery.extend = jquery.fn.extend = function() {250 var src, copyisarray, copy, name, options, clone,251 target = arguments[0] || {},252 i = 1,253 length = arguments.length,254 deep = false;255 // handle a deep copy situation256 if ( typeof target === "boolean" ) {257 deep = target;258 target = arguments[1] || {};259 // skip the boolean and the target260 i = 2;261 }262 // handle case when target is a string or something (possible in deep copy)263 if ( typeof target !== "object" && !jquery.isfunction(target) ) {264 target = {};265 }266 // extend jquery itself if only one argument is passed267 if ( length === i ) {268 target = this;269 --i;270 }271 for ( ; i < length; i++ ) {272 // only deal with non-null/undefined values273 if ( (options = arguments[ i ]) != null ) {274 // extend the base object275 for ( name in options ) {276 src = target[ name ];277 copy = options[ name ];278 // prevent never-ending loop279 if ( target === copy ) {280 continue;281 }282 // recurse if we're merging plain objects or arrays283 if ( deep && copy && ( jquery.isplainobject(copy) || (copyisarray = jquery.isarray(copy)) ) ) {284 if ( copyisarray ) {285 copyisarray = false;286 clone = src && jquery.isarray(src) ? src : [];287 } else {288 clone = src && jquery.isplainobject(src) ? src : {};289 }290 // never move original objects, clone them291 target[ name ] = jquery.extend( deep, clone, copy );292 // don't bring in undefined values293 } else if ( copy !== undefined ) {294 target[ name ] = copy;295 }296 }297 }298 }299 // return the modified object300 return target;301 };302 jquery.extend({303 // unique for each copy of jquery on the page304 // non-digits removed to match rinlinejquery305 expando: "jquery" + ( core_version + math.random() ).replace( /\d/g, "" ),306 noconflict: function( deep ) {307 if ( window.$ === jquery ) {308 window.$ = _$;309 }310 if ( deep && window.jquery === jquery ) {311 window.jquery = _jquery;312 }313 return jquery;314 },315 // is the dom ready to be used? set to true once it occurs.316 isready: false,317 // a counter to track how many items to wait for before318 // the ready event fires. see #6781319 readywait: 1,320 // hold (or release) the ready event321 holdready: function( hold ) {322 if ( hold ) {323 jquery.readywait++;324 } else {325 jquery.ready( true );326 }327 },328 // handle when the dom is ready329 ready: function( wait ) {330 // abort if there are pending holds or we're already ready331 if ( wait === true ? --jquery.readywait : jquery.isready ) {332 return;333 }334 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).335 if ( !document.body ) {336 return settimeout( jquery.ready );337 }338 // remember that the dom is ready339 jquery.isready = true;340 // if a normal dom ready event fired, decrement, and wait if need be341 if ( wait !== true && --jquery.readywait > 0 ) {342 return;343 }344 // if there are functions bound, to execute345 readylist.resolvewith( document, [ jquery ] );346 // trigger any bound ready events347 if ( jquery.fn.trigger ) {348 jquery( document ).trigger("ready").off("ready");349 }350 },351 // see test/unit/core.js for details concerning isfunction.352 // since version 1.3, dom methods and functions like alert353 // aren't supported. they return false on ie (#2968).354 isfunction: function( obj ) {355 return jquery.type(obj) === "function";356 },357 isarray: array.isarray || function( obj ) {358 return jquery.type(obj) === "array";359 },360 iswindow: function( obj ) {361 /* jshint eqeqeq: false */362 return obj != null && obj == obj.window;363 },364 isnumeric: function( obj ) {365 return !isnan( parsefloat(obj) ) && isfinite( obj );366 },367 type: function( obj ) {368 if ( obj == null ) {369 return string( obj );370 }371 return typeof obj === "object" || typeof obj === "function" ?372 class2type[ core_tostring.call(obj) ] || "object" :373 typeof obj;374 },375 isplainobject: function( obj ) {376 var key;377 // must be an object.378 // because of ie, we also have to check the presence of the constructor property.379 // make sure that dom nodes and window objects don't pass through, as well380 if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) {381 return false;382 }383 try {384 // not own constructor property must be object385 if ( obj.constructor &&386 !core_hasown.call(obj, "constructor") &&387 !core_hasown.call(obj.constructor.prototype, "isprototypeof") ) {388 return false;389 }390 } catch ( e ) {391 // ie8,9 will throw exceptions on certain host objects #9897392 return false;393 }394 // support: ie<9395 // handle iteration over inherited properties before own properties.396 if ( jquery.support.ownlast ) {397 for ( key in obj ) {398 return core_hasown.call( obj, key );399 }400 }401 // own properties are enumerated firstly, so to speed up,402 // if last one is own, then all properties are own.403 for ( key in obj ) {}404 return key === undefined || core_hasown.call( obj, key );405 },406 isemptyobject: function( obj ) {407 var name;408 for ( name in obj ) {409 return false;410 }411 return true;412 },413 error: function( msg ) {414 throw new error( msg );415 },416 // data: string of html417 // context (optional): if specified, the fragment will be created in this context, defaults to document418 // keepscripts (optional): if true, will include scripts passed in the html string419 parsehtml: function( data, context, keepscripts ) {420 if ( !data || typeof data !== "string" ) {421 return null;422 }423 if ( typeof context === "boolean" ) {424 keepscripts = context;425 context = false;426 }427 context = context || document;428 var parsed = rsingletag.exec( data ),429 scripts = !keepscripts && [];430 // single tag431 if ( parsed ) {432 return [ context.createelement( parsed[1] ) ];433 }434 parsed = jquery.buildfragment( [ data ], context, scripts );435 if ( scripts ) {436 jquery( scripts ).remove();437 }438 return jquery.merge( [], parsed.childnodes );439 },440 parsejson: function( data ) {441 // attempt to parse using the native json parser first442 if ( window.json && window.json.parse ) {443 return window.json.parse( data );444 }445 if ( data === null ) {446 return data;447 }448 if ( typeof data === "string" ) {449 // make sure leading/trailing whitespace is removed (ie can't handle it)450 data = jquery.trim( data );451 if ( data ) {452 // make sure the incoming data is actual json453 // logic borrowed from http://json.org/json2.js454 if ( rvalidchars.test( data.replace( rvalidescape, "@" )455 .replace( rvalidtokens, "]" )456 .replace( rvalidbraces, "")) ) {457 return ( new function( "return " + data ) )();458 }459 }460 }461 jquery.error( "invalid json: " + data );462 },463 // cross-browser xml parsing464 parsexml: function( data ) {465 var xml, tmp;466 if ( !data || typeof data !== "string" ) {467 return null;468 }469 try {470 if ( window.domparser ) { // standard471 tmp = new domparser();472 xml = tmp.parsefromstring( data , "text/xml" );473 } else { // ie474 xml = new activexobject( "microsoft.xmldom" );475 xml.async = "false";476 xml.loadxml( data );477 }478 } catch( e ) {479 xml = undefined;480 }481 if ( !xml || !xml.documentelement || xml.getelementsbytagname( "parsererror" ).length ) {482 jquery.error( "invalid xml: " + data );483 }484 return xml;485 },486 noop: function() {},487 // evaluates a script in a global context488 // workarounds based on findings by jim driscoll489 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context490 globaleval: function( data ) {491 if ( data && jquery.trim( data ) ) {492 // we use execscript on internet explorer493 // we use an anonymous function so that context is window494 // rather than jquery in firefox495 ( window.execscript || function( data ) {496 window[ "eval" ].call( window, data );497 } )( data );498 }499 },500 // convert dashed to camelcase; used by the css and data modules501 // microsoft forgot to hump their vendor prefix (#9572)502 camelcase: function( string ) {503 return string.replace( rmsprefix, "ms-" ).replace( rdashalpha, fcamelcase );504 },505 nodename: function( elem, name ) {506 return elem.nodename && elem.nodename.tolowercase() === name.tolowercase();507 },508 // args is for internal usage only509 each: function( obj, callback, args ) {510 var value,511 i = 0,512 length = obj.length,513 isarray = isarraylike( obj );514 if ( args ) {515 if ( isarray ) {516 for ( ; i < length; i++ ) {517 value = callback.apply( obj[ i ], args );518 if ( value === false ) {519 break;520 }521 }522 } else {523 for ( i in obj ) {524 value = callback.apply( obj[ i ], args );525 if ( value === false ) {526 break;527 }528 }529 }530 // a special, fast, case for the most common use of each531 } else {532 if ( isarray ) {533 for ( ; i < length; i++ ) {534 value = callback.call( obj[ i ], i, obj[ i ] );535 if ( value === false ) {536 break;537 }538 }539 } else {540 for ( i in obj ) {541 value = callback.call( obj[ i ], i, obj[ i ] );542 if ( value === false ) {543 break;544 }545 }546 }547 }548 return obj;549 },550 // use native string.trim function wherever possible551 trim: core_trim && !core_trim.call("\ufeff\xa0") ?552 function( text ) {553 return text == null ?554 "" :555 core_trim.call( text );556 } :557 // otherwise use our own trimming functionality558 function( text ) {559 return text == null ?560 "" :561 ( text + "" ).replace( rtrim, "" );562 },563 // results is for internal usage only564 makearray: function( arr, results ) {565 var ret = results || [];566 if ( arr != null ) {567 if ( isarraylike( object(arr) ) ) {568 jquery.merge( ret,569 typeof arr === "string" ?570 [ arr ] : arr571 );572 } else {573 core_push.call( ret, arr );574 }575 }576 return ret;577 },578 inarray: function( elem, arr, i ) {579 var len;580 if ( arr ) {581 if ( core_indexof ) {582 return core_indexof.call( arr, elem, i );583 }584 len = arr.length;585 i = i ? i < 0 ? math.max( 0, len + i ) : i : 0;586 for ( ; i < len; i++ ) {587 // skip accessing in sparse arrays588 if ( i in arr && arr[ i ] === elem ) {589 return i;590 }591 }592 }593 return -1;594 },595 merge: function( first, second ) {596 var l = second.length,597 i = first.length,598 j = 0;599 if ( typeof l === "number" ) {600 for ( ; j < l; j++ ) {601 first[ i++ ] = second[ j ];602 }603 } else {604 while ( second[j] !== undefined ) {605 first[ i++ ] = second[ j++ ];606 }607 }608 first.length = i;609 return first;610 },611 grep: function( elems, callback, inv ) {612 var retval,613 ret = [],614 i = 0,615 length = elems.length;616 inv = !!inv;617 // go through the array, only saving the items618 // that pass the validator function619 for ( ; i < length; i++ ) {620 retval = !!callback( elems[ i ], i );621 if ( inv !== retval ) {622 ret.push( elems[ i ] );623 }624 }625 return ret;626 },627 // arg is for internal usage only628 map: function( elems, callback, arg ) {629 var value,630 i = 0,631 length = elems.length,632 isarray = isarraylike( elems ),633 ret = [];634 // go through the array, translating each of the items to their635 if ( isarray ) {636 for ( ; i < length; i++ ) {637 value = callback( elems[ i ], i, arg );638 if ( value != null ) {639 ret[ ret.length ] = value;640 }641 }642 // go through every key on the object,643 } else {644 for ( i in elems ) {645 value = callback( elems[ i ], i, arg );646 if ( value != null ) {647 ret[ ret.length ] = value;648 }649 }650 }651 // flatten any nested arrays652 return core_concat.apply( [], ret );653 },654 // a global guid counter for objects655 guid: 1,656 // bind a function to a context, optionally partially applying any657 // arguments.658 proxy: function( fn, context ) {659 var args, proxy, tmp;660 if ( typeof context === "string" ) {661 tmp = fn[ context ];662 context = fn;663 fn = tmp;664 }665 // quick check to determine if target is callable, in the spec666 // this throws a typeerror, but we will just return undefined.667 if ( !jquery.isfunction( fn ) ) {668 return undefined;669 }670 // simulated bind671 args = core_slice.call( arguments, 2 );672 proxy = function() {673 return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );674 };675 // set the guid of unique handler to the same of original handler, so it can be removed676 proxy.guid = fn.guid = fn.guid || jquery.guid++;677 return proxy;678 },679 // multifunctional method to get and set values of a collection680 // the value/s can optionally be executed if it's a function681 access: function( elems, fn, key, value, chainable, emptyget, raw ) {682 var i = 0,683 length = elems.length,684 bulk = key == null;685 // sets many values686 if ( jquery.type( key ) === "object" ) {687 chainable = true;688 for ( i in key ) {689 jquery.access( elems, fn, i, key[i], true, emptyget, raw );690 }691 // sets one value692 } else if ( value !== undefined ) {693 chainable = true;694 if ( !jquery.isfunction( value ) ) {695 raw = true;696 }697 if ( bulk ) {698 // bulk operations run against the entire set699 if ( raw ) {700 fn.call( elems, value );701 fn = null;702 // ...except when executing function values703 } else {704 bulk = fn;705 fn = function( elem, key, value ) {706 return bulk.call( jquery( elem ), value );707 };708 }709 }710 if ( fn ) {711 for ( ; i < length; i++ ) {712 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );713 }714 }715 }716 return chainable ?717 elems :718 // gets719 bulk ?720 fn.call( elems ) :721 length ? fn( elems[0], key ) : emptyget;722 },723 now: function() {724 return ( new date() ).gettime();725 },726 // a method for quickly swapping in/out css properties to get correct calculations.727 // note: this method belongs to the css module but it's needed here for the support module.728 // if support gets modularized, this method should be moved back to the css module.729 swap: function( elem, options, callback, args ) {730 var ret, name,731 old = {};732 // remember the old values, and insert the new ones733 for ( name in options ) {734 old[ name ] = elem.style[ name ];735 elem.style[ name ] = options[ name ];736 }737 ret = callback.apply( elem, args || [] );738 // revert the old values739 for ( name in options ) {740 elem.style[ name ] = old[ name ];741 }742 return ret;743 }744 });745 jquery.ready.promise = function( obj ) {746 if ( !readylist ) {747 readylist = jquery.deferred();748 // catch cases where $(document).ready() is called after the browser event has already occurred.749 // we once tried to use readystate "interactive" here, but it caused issues like the one750 // discovered by chriss here: http://bugs.jquery.com/ticket/12282#comment:15751 if ( document.readystate === "complete" ) {752 // handle it asynchronously to allow scripts the opportunity to delay ready753 settimeout( jquery.ready );754 // standards-based browsers support domcontentloaded755 } else if ( document.addeventlistener ) {756 // use the handy event callback757 document.addeventlistener( "domcontentloaded", completed, false );758 // a fallback to window.onload, that will always work759 window.addeventlistener( "load", completed, false );760 // if ie event model is used761 } else {762 // ensure firing before onload, maybe late but safe also for iframes763 document.attachevent( "onreadystatechange", completed );764 // a fallback to window.onload, that will always work765 window.attachevent( "onload", completed );766 // if ie and not a frame767 // continually check to see if the document is ready768 var top = false;769 try {770 top = window.frameelement == null && document.documentelement;771 } catch(e) {}772 if ( top && top.doscroll ) {773 (function doscrollcheck() {774 if ( !jquery.isready ) {775 try {776 // use the trick by diego perini777 // http://javascript.nwbox.com/iecontentloaded/778 top.doscroll("left");779 } catch(e) {780 return settimeout( doscrollcheck, 50 );781 }782 // detach all dom ready events783 detach();784 // and execute any waiting functions785 jquery.ready();786 }787 })();788 }789 }790 }791 return readylist.promise( obj );792 };793// populate the class2type map794 jquery.each("boolean number string function array date regexp object error".split(" "), function(i, name) {795 class2type[ "[object " + name + "]" ] = name.tolowercase();796 });797 function isarraylike( obj ) {798 var length = obj.length,799 type = jquery.type( obj );800 if ( jquery.iswindow( obj ) ) {801 return false;802 }803 if ( obj.nodetype === 1 && length ) {804 return true;805 }806 return type === "array" || type !== "function" &&807 ( length === 0 ||808 typeof length === "number" && length > 0 && ( length - 1 ) in obj );809 }810// all jquery objects should point back to these811 rootjquery = jquery(document);812 /*!813 * sizzle css selector engine v1.10.2814 * http://sizzlejs.com/815 *816 * copyright 2013 jquery foundation, inc. and other contributors817 * released under the mit license818 * http://jquery.org/license819 *820 * date: 2013-07-03821 */822 (function( window, undefined ) {823 var i,824 support,825 cachedruns,826 expr,827 gettext,828 isxml,829 compile,830 outermostcontext,831 sortinput,832 // local document vars833 setdocument,834 document,835 docelem,836 documentishtml,837 rbuggyqsa,838 rbuggymatches,839 matches,840 contains,841 // instance-specific data842 expando = "sizzle" + -(new date()),843 preferreddoc = window.document,844 dirruns = 0,845 done = 0,846 classcache = createcache(),847 tokencache = createcache(),848 compilercache = createcache(),849 hasduplicate = false,850 sortorder = function( a, b ) {851 if ( a === b ) {852 hasduplicate = true;853 return 0;854 }855 return 0;856 },857 // general-purpose constants858 strundefined = typeof undefined,859 max_negative = 1 << 31,860 // instance methods861 hasown = ({}).hasownproperty,862 arr = [],863 pop = arr.pop,864 push_native = arr.push,865 push = arr.push,866 slice = arr.slice,867 // use a stripped-down indexof if we can't use a native one868 indexof = arr.indexof || function( elem ) {869 var i = 0,870 len = this.length;871 for ( ; i < len; i++ ) {872 if ( this[i] === elem ) {873 return i;874 }875 }876 return -1;877 },878 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",879 // regular expressions880 // whitespace characters http://www.w3.org/tr/css3-selectors/#whitespace881 whitespace = "[\\x20\\t\\r\\n\\f]",882 // http://www.w3.org/tr/css3-syntax/#characters883 characterencoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",884 // loosely modeled on css identifier characters885 // an unquoted value should be a css identifier http://www.w3.org/tr/css3-selectors/#attribute-selectors886 // proper syntax: http://www.w3.org/tr/css21/syndata.html#value-def-identifier887 identifier = characterencoding.replace( "w", "w#" ),888 // acceptable operators http://www.w3.org/tr/selectors/#attribute-selectors889 attributes = "\\[" + whitespace + "*(" + characterencoding + ")" + whitespace +890 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",891 // prefer arguments quoted,892 // then not containing pseudos/brackets,893 // then attribute selectors/non-parenthetical expressions,894 // then anything else895 // these preferences are here to reduce the number of selectors896 // needing tokenize in the pseudo prefilter897 pseudos = ":(" + characterencoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",898 // leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter899 rtrim = new regexp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),900 rcomma = new regexp( "^" + whitespace + "*," + whitespace + "*" ),901 rcombinators = new regexp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),902 rsibling = new regexp( whitespace + "*[+~]" ),903 rattributequotes = new regexp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),904 rpseudo = new regexp( pseudos ),905 ridentifier = new regexp( "^" + identifier + "$" ),906 matchexpr = {907 "id": new regexp( "^#(" + characterencoding + ")" ),908 "class": new regexp( "^\\.(" + characterencoding + ")" ),909 "tag": new regexp( "^(" + characterencoding.replace( "w", "w*" ) + ")" ),910 "attr": new regexp( "^" + attributes ),911 "pseudo": new regexp( "^" + pseudos ),912 "child": new regexp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +913 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +914 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),915 "bool": new regexp( "^(?:" + booleans + ")$", "i" ),916 // for use in libraries implementing .is()917 // we use this for pos matching in `select`918 "needscontext": new regexp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +919 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )920 },921 rnative = /^[^{]+\{\s*\[native \w/,922 // easily-parseable/retrievable id or tag or class selectors923 rquickexpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,924 rinputs = /^(?:input|select|textarea|button)$/i,925 rheader = /^h\d$/i,926 rescape = /'|\\/g,927 // css escapes http://www.w3.org/tr/css21/syndata.html#escaped-characters928 runescape = new regexp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),929 funescape = function( _, escaped, escapedwhitespace ) {930 var high = "0x" + escaped - 0x10000;931 // nan means non-codepoint932 // support: firefox933 // workaround erroneous numeric interpretation of +"0x"934 return high !== high || escapedwhitespace ?935 escaped :936 // bmp codepoint937 high < 0 ?938 string.fromcharcode( high + 0x10000 ) :939 // supplemental plane codepoint (surrogate pair)940 string.fromcharcode( high >> 10 | 0xd800, high & 0x3ff | 0xdc00 );941 };942// optimize for push.apply( _, nodelist )943 try {944 push.apply(945 (arr = slice.call( preferreddoc.childnodes )),946 preferreddoc.childnodes947 );948 // support: android<4.0949 // detect silently failing push.apply950 arr[ preferreddoc.childnodes.length ].nodetype;951 } catch ( e ) {952 push = { apply: arr.length ?953 // leverage slice if possible954 function( target, els ) {955 push_native.apply( target, slice.call(els) );956 } :957 // support: ie<9958 // otherwise append directly959 function( target, els ) {960 var j = target.length,961 i = 0;962 // can't trust nodelist.length963 while ( (target[j++] = els[i++]) ) {}964 target.length = j - 1;965 }966 };967 }968 function sizzle( selector, context, results, seed ) {969 var match, elem, m, nodetype,970 // qsa vars971 i, groups, old, nid, newcontext, newselector;972 if ( ( context ? context.ownerdocument || context : preferreddoc ) !== document ) {973 setdocument( context );974 }975 context = context || document;976 results = results || [];977 if ( !selector || typeof selector !== "string" ) {978 return results;979 }980 if ( (nodetype = context.nodetype) !== 1 && nodetype !== 9 ) {981 return [];982 }983 if ( documentishtml && !seed ) {984 // shortcuts985 if ( (match = rquickexpr.exec( selector )) ) {986 // speed-up: sizzle("#id")987 if ( (m = match[1]) ) {988 if ( nodetype === 9 ) {989 elem = context.getelementbyid( m );990 // check parentnode to catch when blackberry 4.6 returns991 // nodes that are no longer in the document #6963992 if ( elem && elem.parentnode ) {993 // handle the case where ie, opera, and webkit return items994 // by name instead of id995 if ( elem.id === m ) {996 results.push( elem );997 return results;998 }999 } else {1000 return results;1001 }1002 } else {1003 // context is not a document1004 if ( context.ownerdocument && (elem = context.ownerdocument.getelementbyid( m )) &&1005 contains( context, elem ) && elem.id === m ) {1006 results.push( elem );1007 return results;1008 }1009 }1010 // speed-up: sizzle("tag")1011 } else if ( match[2] ) {1012 push.apply( results, context.getelementsbytagname( selector ) );1013 return results;1014 // speed-up: sizzle(".class")1015 } else if ( (m = match[3]) && support.getelementsbyclassname && context.getelementsbyclassname ) {1016 push.apply( results, context.getelementsbyclassname( m ) );1017 return results;1018 }1019 }1020 // qsa path1021 if ( support.qsa && (!rbuggyqsa || !rbuggyqsa.test( selector )) ) {1022 nid = old = expando;1023 newcontext = context;1024 newselector = nodetype === 9 && selector;1025 // qsa works strangely on element-rooted queries1026 // we can work around this by specifying an extra id on the root1027 // and working up from there (thanks to andrew dupont for the technique)1028 // ie 8 doesn't work on object elements1029 if ( nodetype === 1 && context.nodename.tolowercase() !== "object" ) {1030 groups = tokenize( selector );1031 if ( (old = context.getattribute("id")) ) {1032 nid = old.replace( rescape, "\\$&" );1033 } else {1034 context.setattribute( "id", nid );1035 }1036 nid = "[id='" + nid + "'] ";1037 i = groups.length;1038 while ( i-- ) {1039 groups[i] = nid + toselector( groups[i] );1040 }1041 newcontext = rsibling.test( selector ) && context.parentnode || context;1042 newselector = groups.join(",");1043 }1044 if ( newselector ) {1045 try {1046 push.apply( results,1047 newcontext.queryselectorall( newselector )1048 );1049 return results;1050 } catch(qsaerror) {1051 } finally {1052 if ( !old ) {1053 context.removeattribute("id");1054 }1055 }1056 }1057 }1058 }1059 // all others1060 return select( selector.replace( rtrim, "$1" ), context, results, seed );1061 }1062 /**1063 * create key-value caches of limited size1064 * @returns {function(string, object)} returns the object data after storing it on itself with1065 * property name the (space-suffixed) string and (if the cache is larger than expr.cachelength)1066 * deleting the oldest entry1067 */1068 function createcache() {1069 var keys = [];1070 function cache( key, value ) {1071 // use (key + " ") to avoid collision with native prototype properties (see issue #157)1072 if ( keys.push( key += " " ) > expr.cachelength ) {1073 // only keep the most recent entries1074 delete cache[ keys.shift() ];1075 }1076 return (cache[ key ] = value);1077 }1078 return cache;1079 }1080 /**1081 * mark a function for special use by sizzle1082 * @param {function} fn the function to mark1083 */1084 function markfunction( fn ) {1085 fn[ expando ] = true;1086 return fn;1087 }1088 /**1089 * support testing using an element1090 * @param {function} fn passed the created div and expects a boolean result1091 */1092 function assert( fn ) {1093 var div = document.createelement("div");1094 try {1095 return !!fn( div );1096 } catch (e) {1097 return false;1098 } finally {1099 // remove from its parent by default1100 if ( div.parentnode ) {1101 div.parentnode.removechild( div );1102 }1103 // release memory in ie1104 div = null;1105 }1106 }1107 /**1108 * adds the same handler for all of the specified attrs1109 * @param {string} attrs pipe-separated list of attributes1110 * @param {function} handler the method that will be applied1111 */1112 function addhandle( attrs, handler ) {1113 var arr = attrs.split("|"),1114 i = attrs.length;1115 while ( i-- ) {1116 expr.attrhandle[ arr[i] ] = handler;1117 }1118 }1119 /**1120 * checks document order of two siblings1121 * @param {element} a1122 * @param {element} b1123 * @returns {number} returns less than 0 if a precedes b, greater than 0 if a follows b1124 */1125 function siblingcheck( a, b ) {1126 var cur = b && a,1127 diff = cur && a.nodetype === 1 && b.nodetype === 1 &&1128 ( ~b.sourceindex || max_negative ) -1129 ( ~a.sourceindex || max_negative );1130 // use ie sourceindex if available on both nodes1131 if ( diff ) {1132 return diff;1133 }1134 // check if b follows a1135 if ( cur ) {1136 while ( (cur = cur.nextsibling) ) {1137 if ( cur === b ) {1138 return -1;1139 }1140 }1141 }1142 return a ? 1 : -1;1143 }1144 /**1145 * returns a function to use in pseudos for input types1146 * @param {string} type1147 */1148 function createinputpseudo( type ) {1149 return function( elem ) {1150 var name = elem.nodename.tolowercase();1151 return name === "input" && elem.type === type;1152 };1153 }1154 /**1155 * returns a function to use in pseudos for buttons1156 * @param {string} type1157 */1158 function createbuttonpseudo( type ) {1159 return function( elem ) {1160 var name = elem.nodename.tolowercase();1161 return (name === "input" || name === "button") && elem.type === type;1162 };1163 }1164 /**1165 * returns a function to use in pseudos for positionals1166 * @param {function} fn1167 */1168 function createpositionalpseudo( fn ) {1169 return markfunction(function( argument ) {1170 argument = +argument;1171 return markfunction(function( seed, matches ) {1172 var j,1173 matchindexes = fn( [], seed.length, argument ),1174 i = matchindexes.length;1175 // match elements found at the specified indexes1176 while ( i-- ) {1177 if ( seed[ (j = matchindexes[i]) ] ) {1178 seed[j] = !(matches[j] = seed[j]);1179 }1180 }1181 });1182 });1183 }1184 /**1185 * detect xml1186 * @param {element|object} elem an element or a document1187 */1188 isxml = sizzle.isxml = function( elem ) {1189 // documentelement is verified for cases where it doesn't yet exist1190 // (such as loading iframes in ie - #4833)1191 var documentelement = elem && (elem.ownerdocument || elem).documentelement;1192 return documentelement ? documentelement.nodename !== "html" : false;1193 };1194// expose support vars for convenience1195 support = sizzle.support = {};1196 /**1197 * sets document-related variables once based on the current document1198 * @param {element|object} [doc] an element or document object to use to set the document1199 * @returns {object} returns the current document1200 */1201 setdocument = sizzle.setdocument = function( node ) {1202 var doc = node ? node.ownerdocument || node : preferreddoc,1203 parent = doc.defaultview;1204 // if no document and documentelement is available, return1205 if ( doc === document || doc.nodetype !== 9 || !doc.documentelement ) {1206 return document;1207 }1208 // set our document1209 document = doc;1210 docelem = doc.documentelement;1211 // support tests1212 documentishtml = !isxml( doc );1213 // support: ie>81214 // if iframe document is assigned to "document" variable and if iframe has been reloaded,1215 // ie will throw "permission denied" error when accessing "document" variable, see jquery #139361216 // ie6-8 do not support the defaultview property so parent will be undefined1217 if ( parent && parent.attachevent && parent !== parent.top ) {1218 parent.attachevent( "onbeforeunload", function() {1219 setdocument();1220 });1221 }1222 /* attributes1223 ---------------------------------------------------------------------- */1224 // support: ie<81225 // verify that getattribute really returns attributes and not properties (excepting ie8 booleans)1226 support.attributes = assert(function( div ) {1227 div.classname = "i";1228 return !div.getattribute("classname");1229 });1230 /* getelement(s)by*1231 ---------------------------------------------------------------------- */1232 // check if getelementsbytagname("*") returns only elements1233 support.getelementsbytagname = assert(function( div ) {1234 div.appendchild( doc.createcomment("") );1235 return !div.getelementsbytagname("*").length;1236 });1237 // check if getelementsbyclassname can be trusted1238 support.getelementsbyclassname = assert(function( div ) {1239 div.innerhtml = "<div class='a'></div><div class='a i'></div>";1240 // support: safari<41241 // catch class over-caching1242 div.firstchild.classname = "i";1243 // support: opera<101244 // catch gebcn failure to find non-leading classes1245 return div.getelementsbyclassname("i").length === 2;1246 });1247 // support: ie<101248 // check if getelementbyid returns elements by name1249 // the broken getelementbyid methods don't pick up programatically-set names,1250 // so use a roundabout getelementsbyname test1251 support.getbyid = assert(function( div ) {1252 docelem.appendchild( div ).id = expando;1253 return !doc.getelementsbyname || !doc.getelementsbyname( expando ).length;1254 });1255 // id find and filter1256 if ( support.getbyid ) {1257 expr.find["id"] = function( id, context ) {1258 if ( typeof context.getelementbyid !== strundefined && documentishtml ) {1259 var m = context.getelementbyid( id );1260 // check parentnode to catch when blackberry 4.6 returns1261 // nodes that are no longer in the document #69631262 return m && m.parentnode ? [m] : [];1263 }1264 };1265 expr.filter["id"] = function( id ) {1266 var attrid = id.replace( runescape, funescape );1267 return function( elem ) {1268 return elem.getattribute("id") === attrid;1269 };1270 };1271 } else {1272 // support: ie6/71273 // getelementbyid is not reliable as a find shortcut1274 delete expr.find["id"];1275 expr.filter["id"] = function( id ) {1276 var attrid = id.replace( runescape, funescape );1277 return function( elem ) {1278 var node = typeof elem.getattributenode !== strundefined && elem.getattributenode("id");1279 return node && node.value === attrid;1280 };1281 };1282 }1283 // tag1284 expr.find["tag"] = support.getelementsbytagname ?1285 function( tag, context ) {1286 if ( typeof context.getelementsbytagname !== strundefined ) {1287 return context.getelementsbytagname( tag );1288 }1289 } :1290 function( tag, context ) {1291 var elem,1292 tmp = [],1293 i = 0,1294 results = context.getelementsbytagname( tag );1295 // filter out possible comments1296 if ( tag === "*" ) {1297 while ( (elem = results[i++]) ) {1298 if ( elem.nodetype === 1 ) {1299 tmp.push( elem );1300 }1301 }1302 return tmp;1303 }1304 return results;1305 };1306 // class1307 expr.find["class"] = support.getelementsbyclassname && function( classname, context ) {1308 if ( typeof context.getelementsbyclassname !== strundefined && documentishtml ) {1309 return context.getelementsbyclassname( classname );1310 }1311 };1312 /* qsa/matchesselector1313 ---------------------------------------------------------------------- */1314 // qsa and matchesselector support1315 // matchesselector(:active) reports false when true (ie9/opera 11.5)1316 rbuggymatches = [];1317 // qsa(:focus) reports false when true (chrome 21)1318 // we allow this because of a bug in ie8/9 that throws an error1319 // whenever `document.activeelement` is accessed on an iframe1320 // so, we allow :focus to pass through qsa all the time to avoid the ie error1321 // see http://bugs.jquery.com/ticket/133781322 rbuggyqsa = [];1323 if ( (support.qsa = rnative.test( doc.queryselectorall )) ) {1324 // build qsa regex1325 // regex strategy adopted from diego perini1326 assert(function( div ) {1327 // select is set to empty string on purpose1328 // this is to test ie's treatment of not explicitly1329 // setting a boolean content attribute,1330 // since its presence should be enough1331 // http://bugs.jquery.com/ticket/123591332 div.innerhtml = "<select><option selected=''></option></select>";1333 // support: ie81334 // boolean attributes and "value" are not treated correctly1335 if ( !div.queryselectorall("[selected]").length ) {1336 rbuggyqsa.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );1337 }1338 // webkit/opera - :checked should return selected option elements1339 // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked1340 // ie8 throws error here and will not see later tests1341 if ( !div.queryselectorall(":checked").length ) {1342 rbuggyqsa.push(":checked");1343 }1344 });1345 assert(function( div ) {1346 // support: opera 10-12/ie81347 // ^= $= *= and empty values1348 // should not select anything1349 // support: windows 8 native apps1350 // the type attribute is restricted during .innerhtml assignment1351 var input = doc.createelement("input");1352 input.setattribute( "type", "hidden" );1353 div.appendchild( input ).setattribute( "t", "" );1354 if ( div.queryselectorall("[t^='']").length ) {1355 rbuggyqsa.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );1356 }1357 // ff 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)1358 // ie8 throws error here and will not see later tests1359 if ( !div.queryselectorall(":enabled").length ) {1360 rbuggyqsa.push( ":enabled", ":disabled" );1361 }1362 // opera 10-11 does not throw on post-comma invalid pseudos1363 div.queryselectorall("*,:x");1364 rbuggyqsa.push(",.*:");1365 });1366 }1367 if ( (support.matchesselector = rnative.test( (matches = docelem.webkitmatchesselector ||1368 docelem.mozmatchesselector ||1369 docelem.omatchesselector ||1370 docelem.msmatchesselector) )) ) {1371 assert(function( div ) {1372 // check to see if it's possible to do matchesselector1373 // on a disconnected node (ie 9)1374 support.disconnectedmatch = matches.call( div, "div" );1375 // this should fail with an exception1376 // gecko does not error, returns false instead1377 matches.call( div, "[s!='']:x" );1378 rbuggymatches.push( "!=", pseudos );1379 });1380 }1381 rbuggyqsa = rbuggyqsa.length && new regexp( rbuggyqsa.join("|") );1382 rbuggymatches = rbuggymatches.length && new regexp( rbuggymatches.join("|") );1383 /* contains1384 ---------------------------------------------------------------------- */1385 // element contains another1386 // purposefully does not implement inclusive descendent1387 // as in, an element does not contain itself1388 contains = rnative.test( docelem.contains ) || docelem.comparedocumentposition ?1389 function( a, b ) {1390 var adown = a.nodetype === 9 ? a.documentelement : a,1391 bup = b && b.parentnode;1392 return a === bup || !!( bup && bup.nodetype === 1 && (1393 adown.contains ?1394 adown.contains( bup ) :1395 a.comparedocumentposition && a.comparedocumentposition( bup ) & 161396 ));1397 } :1398 function( a, b ) {1399 if ( b ) {1400 while ( (b = b.parentnode) ) {1401 if ( b === a ) {1402 return true;1403 }1404 }1405 }1406 return false;1407 };1408 /* sorting1409 ---------------------------------------------------------------------- */1410 // document order sorting1411 sortorder = docelem.comparedocumentposition ?1412 function( a, b ) {1413 // flag for duplicate removal1414 if ( a === b ) {1415 hasduplicate = true;1416 return 0;1417 }1418 var compare = b.comparedocumentposition && a.comparedocumentposition && a.comparedocumentposition( b );1419 if ( compare ) {1420 // disconnected nodes1421 if ( compare & 1 ||1422 (!support.sortdetached && b.comparedocumentposition( a ) === compare) ) {1423 // choose the first element that is related to our preferred document1424 if ( a === doc || contains(preferreddoc, a) ) {1425 return -1;1426 }1427 if ( b === doc || contains(preferreddoc, b) ) {1428 return 1;1429 }1430 // maintain original order1431 return sortinput ?1432 ( indexof.call( sortinput, a ) - indexof.call( sortinput, b ) ) :1433 0;1434 }1435 return compare & 4 ? -1 : 1;1436 }1437 // not directly comparable, sort on existence of method1438 return a.comparedocumentposition ? -1 : 1;1439 } :1440 function( a, b ) {1441 var cur,1442 i = 0,1443 aup = a.parentnode,1444 bup = b.parentnode,1445 ap = [ a ],1446 bp = [ b ];1447 // exit early if the nodes are identical1448 if ( a === b ) {1449 hasduplicate = true;1450 return 0;1451 // parentless nodes are either documents or disconnected1452 } else if ( !aup || !bup ) {1453 return a === doc ? -1 :1454 b === doc ? 1 :1455 aup ? -1 :1456 bup ? 1 :1457 sortinput ?1458 ( indexof.call( sortinput, a ) - indexof.call( sortinput, b ) ) :1459 0;1460 // if the nodes are siblings, we can do a quick check1461 } else if ( aup === bup ) {1462 return siblingcheck( a, b );1463 }1464 // otherwise we need full lists of their ancestors for comparison1465 cur = a;1466 while ( (cur = cur.parentnode) ) {1467 ap.unshift( cur );1468 }1469 cur = b;1470 while ( (cur = cur.parentnode) ) {1471 bp.unshift( cur );1472 }1473 // walk down the tree looking for a discrepancy1474 while ( ap[i] === bp[i] ) {1475 i++;1476 }1477 return i ?1478 // do a sibling check if the nodes have a common ancestor1479 siblingcheck( ap[i], bp[i] ) :1480 // otherwise nodes in our document sort first1481 ap[i] === preferreddoc ? -1 :1482 bp[i] === preferreddoc ? 1 :1483 0;1484 };1485 return doc;1486 };1487 sizzle.matches = function( expr, elements ) {1488 return sizzle( expr, null, null, elements );1489 };1490 sizzle.matchesselector = function( elem, expr ) {1491 // set document vars if needed1492 if ( ( elem.ownerdocument || elem ) !== document ) {1493 setdocument( elem );1494 }1495 // make sure that attribute selectors are quoted1496 expr = expr.replace( rattributequotes, "='$1']" );1497 if ( support.matchesselector && documentishtml &&1498 ( !rbuggymatches || !rbuggymatches.test( expr ) ) &&1499 ( !rbuggyqsa || !rbuggyqsa.test( expr ) ) ) {1500 try {1501 var ret = matches.call( elem, expr );1502 // ie 9's matchesselector returns false on disconnected nodes1503 if ( ret || support.disconnectedmatch ||1504 // as well, disconnected nodes are said to be in a document1505 // fragment in ie 91506 elem.document && elem.document.nodetype !== 11 ) {1507 return ret;1508 }1509 } catch(e) {}1510 }1511 return sizzle( expr, document, null, [elem] ).length > 0;1512 };1513 sizzle.contains = function( context, elem ) {1514 // set document vars if needed1515 if ( ( context.ownerdocument || context ) !== document ) {1516 setdocument( context );1517 }1518 return contains( context, elem );1519 };1520 sizzle.attr = function( elem, name ) {1521 // set document vars if needed1522 if ( ( elem.ownerdocument || elem ) !== document ) {1523 setdocument( elem );1524 }1525 var fn = expr.attrhandle[ name.tolowercase() ],1526 // don't get fooled by object.prototype properties (jquery #13807)1527 val = fn && hasown.call( expr.attrhandle, name.tolowercase() ) ?1528 fn( elem, name, !documentishtml ) :1529 undefined;1530 return val === undefined ?1531 support.attributes || !documentishtml ?1532 elem.getattribute( name ) :1533 (val = elem.getattributenode(name)) && val.specified ?1534 val.value :1535 null :1536 val;1537 };1538 sizzle.error = function( msg ) {1539 throw new error( "syntax error, unrecognized expression: " + msg );1540 };1541 /**1542 * document sorting and removing duplicates1543 * @param {arraylike} results1544 */1545 sizzle.uniquesort = function( results ) {1546 var elem,1547 duplicates = [],1548 j = 0,1549 i = 0;1550 // unless we *know* we can detect duplicates, assume their presence1551 hasduplicate = !support.detectduplicates;1552 sortinput = !support.sortstable && results.slice( 0 );1553 results.sort( sortorder );1554 if ( hasduplicate ) {1555 while ( (elem = results[i++]) ) {1556 if ( elem === results[ i ] ) {1557 j = duplicates.push( i );1558 }1559 }1560 while ( j-- ) {1561 results.splice( duplicates[ j ], 1 );1562 }1563 }1564 return results;1565 };1566 /**1567 * utility function for retrieving the text value of an array of dom nodes1568 * @param {array|element} elem1569 */1570 gettext = sizzle.gettext = function( elem ) {1571 var node,1572 ret = "",1573 i = 0,1574 nodetype = elem.nodetype;1575 if ( !nodetype ) {1576 // if no nodetype, this is expected to be an array1577 for ( ; (node = elem[i]); i++ ) {1578 // do not traverse comment nodes1579 ret += gettext( node );1580 }1581 } else if ( nodetype === 1 || nodetype === 9 || nodetype === 11 ) {1582 // use textcontent for elements1583 // innertext usage removed for consistency of new lines (see #11153)1584 if ( typeof elem.textcontent === "string" ) {1585 return elem.textcontent;1586 } else {1587 // traverse its children1588 for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {1589 ret += gettext( elem );1590 }1591 }1592 } else if ( nodetype === 3 || nodetype === 4 ) {1593 return elem.nodevalue;1594 }1595 // do not include comment or processing instruction nodes1596 return ret;1597 };1598 expr = sizzle.selectors = {1599 // can be adjusted by the user1600 cachelength: 50,1601 createpseudo: markfunction,1602 match: matchexpr,1603 attrhandle: {},1604 find: {},1605 relative: {1606 ">": { dir: "parentnode", first: true },1607 " ": { dir: "parentnode" },1608 "+": { dir: "previoussibling", first: true },1609 "~": { dir: "previoussibling" }1610 },1611 prefilter: {1612 "attr": function( match ) {1613 match[1] = match[1].replace( runescape, funescape );1614 // move the given value to match[3] whether quoted or unquoted1615 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );1616 if ( match[2] === "~=" ) {1617 match[3] = " " + match[3] + " ";1618 }1619 return match.slice( 0, 4 );1620 },1621 "child": function( match ) {1622 /* matches from matchexpr["child"]1623 1 type (only|nth|...)1624 2 what (child|of-type)1625 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)1626 4 xn-component of xn+y argument ([+-]?\d*n|)1627 5 sign of xn-component1628 6 x of xn-component1629 7 sign of y-component1630 8 y of y-component1631 */1632 match[1] = match[1].tolowercase();1633 if ( match[1].slice( 0, 3 ) === "nth" ) {1634 // nth-* requires argument1635 if ( !match[3] ) {1636 sizzle.error( match[0] );1637 }1638 // numeric x and y parameters for expr.filter.child1639 // remember that false/true cast respectively to 0/11640 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );1641 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );1642 // other types prohibit arguments1643 } else if ( match[3] ) {1644 sizzle.error( match[0] );1645 }1646 return match;1647 },1648 "pseudo": function( match ) {1649 var excess,1650 unquoted = !match[5] && match[2];1651 if ( matchexpr["child"].test( match[0] ) ) {1652 return null;1653 }1654 // accept quoted arguments as-is1655 if ( match[3] && match[4] !== undefined ) {1656 match[2] = match[4];1657 // strip excess characters from unquoted arguments1658 } else if ( unquoted && rpseudo.test( unquoted ) &&1659 // get excess from tokenize (recursively)1660 (excess = tokenize( unquoted, true )) &&1661 // advance to the next closing parenthesis1662 (excess = unquoted.indexof( ")", unquoted.length - excess ) - unquoted.length) ) {1663 // excess is a negative index1664 match[0] = match[0].slice( 0, excess );1665 match[2] = unquoted.slice( 0, excess );1666 }1667 // return only captures needed by the pseudo filter method (type and argument)1668 return match.slice( 0, 3 );1669 }1670 },1671 filter: {1672 "tag": function( nodenameselector ) {1673 var nodename = nodenameselector.replace( runescape, funescape ).tolowercase();1674 return nodenameselector === "*" ?1675 function() { return true; } :1676 function( elem ) {1677 return elem.nodename && elem.nodename.tolowercase() === nodename;1678 };1679 },1680 "class": function( classname ) {1681 var pattern = classcache[ classname + " " ];1682 return pattern ||1683 (pattern = new regexp( "(^|" + whitespace + ")" + classname + "(" + whitespace + "|$)" )) &&1684 classcache( classname, function( elem ) {1685 return pattern.test( typeof elem.classname === "string" && elem.classname || typeof elem.getattribute !== strundefined && elem.getattribute("class") || "" );1686 });1687 },1688 "attr": function( name, operator, check ) {1689 return function( elem ) {1690 var result = sizzle.attr( elem, name );1691 if ( result == null ) {1692 return operator === "!=";1693 }1694 if ( !operator ) {1695 return true;1696 }1697 result += "";1698 return operator === "=" ? result === check :1699 operator === "!=" ? result !== check :1700 operator === "^=" ? check && result.indexof( check ) === 0 :1701 operator === "*=" ? check && result.indexof( check ) > -1 :1702 operator === "$=" ? check && result.slice( -check.length ) === check :1703 operator === "~=" ? ( " " + result + " " ).indexof( check ) > -1 :1704 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :1705 false;1706 };1707 },1708 "child": function( type, what, argument, first, last ) {1709 var simple = type.slice( 0, 3 ) !== "nth",1710 forward = type.slice( -4 ) !== "last",1711 oftype = what === "of-type";1712 return first === 1 && last === 0 ?1713 // shortcut for :nth-*(n)1714 function( elem ) {1715 return !!elem.parentnode;1716 } :1717 function( elem, context, xml ) {1718 var cache, outercache, node, diff, nodeindex, start,1719 dir = simple !== forward ? "nextsibling" : "previoussibling",1720 parent = elem.parentnode,1721 name = oftype && elem.nodename.tolowercase(),1722 usecache = !xml && !oftype;1723 if ( parent ) {1724 // :(first|last|only)-(child|of-type)1725 if ( simple ) {1726 while ( dir ) {1727 node = elem;1728 while ( (node = node[ dir ]) ) {1729 if ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) {1730 return false;1731 }1732 }1733 // reverse direction for :only-* (if we haven't yet done so)1734 start = dir = type === "only" && !start && "nextsibling";1735 }1736 return true;1737 }1738 start = [ forward ? parent.firstchild : parent.lastchild ];1739 // non-xml :nth-child(...) stores cache data on `parent`1740 if ( forward && usecache ) {1741 // seek `elem` from a previously-cached index1742 outercache = parent[ expando ] || (parent[ expando ] = {});1743 cache = outercache[ type ] || [];1744 nodeindex = cache[0] === dirruns && cache[1];1745 diff = cache[0] === dirruns && cache[2];1746 node = nodeindex && parent.childnodes[ nodeindex ];1747 while ( (node = ++nodeindex && node && node[ dir ] ||1748 // fallback to seeking `elem` from the start1749 (diff = nodeindex = 0) || start.pop()) ) {1750 // when found, cache indexes on `parent` and break1751 if ( node.nodetype === 1 && ++diff && node === elem ) {1752 outercache[ type ] = [ dirruns, nodeindex, diff ];1753 break;1754 }1755 }1756 // use previously-cached element index if available1757 } else if ( usecache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {1758 diff = cache[1];1759 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)1760 } else {1761 // use the same loop as above to seek `elem` from the start1762 while ( (node = ++nodeindex && node && node[ dir ] ||1763 (diff = nodeindex = 0) || start.pop()) ) {1764 if ( ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) && ++diff ) {1765 // cache the index of each encountered element1766 if ( usecache ) {1767 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];1768 }1769 if ( node === elem ) {1770 break;1771 }1772 }1773 }1774 }1775 // incorporate the offset, then check against cycle size1776 diff -= last;1777 return diff === first || ( diff % first === 0 && diff / first >= 0 );1778 }1779 };1780 },1781 "pseudo": function( pseudo, argument ) {1782 // pseudo-class names are case-insensitive1783 // http://www.w3.org/tr/selectors/#pseudo-classes1784 // prioritize by case sensitivity in case custom pseudos are added with uppercase letters1785 // remember that setfilters inherits from pseudos1786 var args,1787 fn = expr.pseudos[ pseudo ] || expr.setfilters[ pseudo.tolowercase() ] ||1788 sizzle.error( "unsupported pseudo: " + pseudo );1789 // the user may use createpseudo to indicate that1790 // arguments are needed to create the filter function1791 // just as sizzle does1792 if ( fn[ expando ] ) {1793 return fn( argument );1794 }1795 // but maintain support for old signatures1796 if ( fn.length > 1 ) {1797 args = [ pseudo, pseudo, "", argument ];1798 return expr.setfilters.hasownproperty( pseudo.tolowercase() ) ?1799 markfunction(function( seed, matches ) {1800 var idx,1801 matched = fn( seed, argument ),1802 i = matched.length;1803 while ( i-- ) {1804 idx = indexof.call( seed, matched[i] );1805 seed[ idx ] = !( matches[ idx ] = matched[i] );1806 }1807 }) :1808 function( elem ) {1809 return fn( elem, 0, args );1810 };1811 }1812 return fn;1813 }1814 },1815 pseudos: {1816 // potentially complex pseudos1817 "not": markfunction(function( selector ) {1818 // trim the selector passed to compile1819 // to avoid treating leading and trailing1820 // spaces as combinators1821 var input = [],1822 results = [],1823 matcher = compile( selector.replace( rtrim, "$1" ) );1824 return matcher[ expando ] ?1825 markfunction(function( seed, matches, context, xml ) {1826 var elem,1827 unmatched = matcher( seed, null, xml, [] ),1828 i = seed.length;1829 // match elements unmatched by `matcher`1830 while ( i-- ) {1831 if ( (elem = unmatched[i]) ) {1832 seed[i] = !(matches[i] = elem);1833 }1834 }1835 }) :1836 function( elem, context, xml ) {1837 input[0] = elem;1838 matcher( input, null, xml, results );1839 return !results.pop();1840 };1841 }),1842 "has": markfunction(function( selector ) {1843 return function( elem ) {1844 return sizzle( selector, elem ).length > 0;1845 };1846 }),1847 "contains": markfunction(function( text ) {1848 return function( elem ) {1849 return ( elem.textcontent || elem.innertext || gettext( elem ) ).indexof( text ) > -1;1850 };1851 }),1852 // "whether an element is represented by a :lang() selector1853 // is based solely on the element's language value1854 // being equal to the identifier c,1855 // or beginning with the identifier c immediately followed by "-".1856 // the matching of c against the element's language value is performed case-insensitively.1857 // the identifier c does not have to be a valid language name."1858 // http://www.w3.org/tr/selectors/#lang-pseudo1859 "lang": markfunction( function( lang ) {1860 // lang value must be a valid identifier1861 if ( !ridentifier.test(lang || "") ) {1862 sizzle.error( "unsupported lang: " + lang );1863 }1864 lang = lang.replace( runescape, funescape ).tolowercase();1865 return function( elem ) {1866 var elemlang;1867 do {1868 if ( (elemlang = documentishtml ?1869 elem.lang :1870 elem.getattribute("xml:lang") || elem.getattribute("lang")) ) {1871 elemlang = elemlang.tolowercase();1872 return elemlang === lang || elemlang.indexof( lang + "-" ) === 0;1873 }1874 } while ( (elem = elem.parentnode) && elem.nodetype === 1 );1875 return false;1876 };1877 }),1878 // miscellaneous1879 "target": function( elem ) {1880 var hash = window.location && window.location.hash;1881 return hash && hash.slice( 1 ) === elem.id;1882 },1883 "root": function( elem ) {1884 return elem === docelem;1885 },1886 "focus": function( elem ) {1887 return elem === document.activeelement && (!document.hasfocus || document.hasfocus()) && !!(elem.type || elem.href || ~elem.tabindex);1888 },1889 // boolean properties1890 "enabled": function( elem ) {1891 return elem.disabled === false;1892 },1893 "disabled": function( elem ) {1894 return elem.disabled === true;1895 },1896 "checked": function( elem ) {1897 // in css3, :checked should return both checked and selected elements1898 // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked1899 var nodename = elem.nodename.tolowercase();1900 return (nodename === "input" && !!elem.checked) || (nodename === "option" && !!elem.selected);1901 },1902 "selected": function( elem ) {1903 // accessing this property makes selected-by-default1904 // options in safari work properly1905 if ( elem.parentnode ) {1906 elem.parentnode.selectedindex;1907 }1908 return elem.selected === true;1909 },1910 // contents1911 "empty": function( elem ) {1912 // http://www.w3.org/tr/selectors/#empty-pseudo1913 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),1914 // not comment, processing instructions, or others1915 // thanks to diego perini for the nodename shortcut1916 // greater than "@" means alpha characters (specifically not starting with "#" or "?")1917 for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {1918 if ( elem.nodename > "@" || elem.nodetype === 3 || elem.nodetype === 4 ) {1919 return false;1920 }1921 }1922 return true;1923 },1924 "parent": function( elem ) {1925 return !expr.pseudos["empty"]( elem );1926 },1927 // element/input types1928 "header": function( elem ) {1929 return rheader.test( elem.nodename );1930 },1931 "input": function( elem ) {1932 return rinputs.test( elem.nodename );1933 },1934 "button": function( elem ) {1935 var name = elem.nodename.tolowercase();1936 return name === "input" && elem.type === "button" || name === "button";1937 },1938 "text": function( elem ) {1939 var attr;1940 // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc)1941 // use getattribute instead to test this case1942 return elem.nodename.tolowercase() === "input" &&1943 elem.type === "text" &&1944 ( (attr = elem.getattribute("type")) == null || attr.tolowercase() === elem.type );1945 },1946 // position-in-collection1947 "first": createpositionalpseudo(function() {1948 return [ 0 ];1949 }),1950 "last": createpositionalpseudo(function( matchindexes, length ) {1951 return [ length - 1 ];1952 }),1953 "eq": createpositionalpseudo(function( matchindexes, length, argument ) {1954 return [ argument < 0 ? argument + length : argument ];1955 }),1956 "even": createpositionalpseudo(function( matchindexes, length ) {1957 var i = 0;1958 for ( ; i < length; i += 2 ) {1959 matchindexes.push( i );1960 }1961 return matchindexes;1962 }),1963 "odd": createpositionalpseudo(function( matchindexes, length ) {1964 var i = 1;1965 for ( ; i < length; i += 2 ) {1966 matchindexes.push( i );1967 }1968 return matchindexes;1969 }),1970 "lt": createpositionalpseudo(function( matchindexes, length, argument ) {1971 var i = argument < 0 ? argument + length : argument;1972 for ( ; --i >= 0; ) {1973 matchindexes.push( i );1974 }1975 return matchindexes;1976 }),1977 "gt": createpositionalpseudo(function( matchindexes, length, argument ) {1978 var i = argument < 0 ? argument + length : argument;1979 for ( ; ++i < length; ) {1980 matchindexes.push( i );1981 }1982 return matchindexes;1983 })1984 }1985 };1986 expr.pseudos["nth"] = expr.pseudos["eq"];1987// add button/input type pseudos1988 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {1989 expr.pseudos[ i ] = createinputpseudo( i );1990 }1991 for ( i in { submit: true, reset: true } ) {1992 expr.pseudos[ i ] = createbuttonpseudo( i );1993 }1994// easy api for creating new setfilters1995 function setfilters() {}1996 setfilters.prototype = expr.filters = expr.pseudos;1997 expr.setfilters = new setfilters();1998 function tokenize( selector, parseonly ) {1999 var matched, match, tokens, type,2000 sofar, groups, prefilters,2001 cached = tokencache[ selector + " " ];2002 if ( cached ) {2003 return parseonly ? 0 : cached.slice( 0 );2004 }2005 sofar = selector;2006 groups = [];2007 prefilters = expr.prefilter;2008 while ( sofar ) {2009 // comma and first run2010 if ( !matched || (match = rcomma.exec( sofar )) ) {2011 if ( match ) {2012 // don't consume trailing commas as valid2013 sofar = sofar.slice( match[0].length ) || sofar;2014 }2015 groups.push( tokens = [] );2016 }2017 matched = false;2018 // combinators2019 if ( (match = rcombinators.exec( sofar )) ) {2020 matched = match.shift();2021 tokens.push({2022 value: matched,2023 // cast descendant combinators to space2024 type: match[0].replace( rtrim, " " )2025 });2026 sofar = sofar.slice( matched.length );2027 }2028 // filters2029 for ( type in expr.filter ) {2030 if ( (match = matchexpr[ type ].exec( sofar )) && (!prefilters[ type ] ||2031 (match = prefilters[ type ]( match ))) ) {2032 matched = match.shift();2033 tokens.push({2034 value: matched,2035 type: type,2036 matches: match2037 });2038 sofar = sofar.slice( matched.length );2039 }2040 }2041 if ( !matched ) {2042 break;2043 }2044 }2045 // return the length of the invalid excess2046 // if we're just parsing2047 // otherwise, throw an error or return tokens2048 return parseonly ?2049 sofar.length :2050 sofar ?2051 sizzle.error( selector ) :2052 // cache the tokens2053 tokencache( selector, groups ).slice( 0 );2054 }2055 function toselector( tokens ) {2056 var i = 0,2057 len = tokens.length,2058 selector = "";2059 for ( ; i < len; i++ ) {2060 selector += tokens[i].value;2061 }2062 return selector;2063 }2064 function addcombinator( matcher, combinator, base ) {2065 var dir = combinator.dir,2066 checknonelements = base && dir === "parentnode",2067 donename = done++;2068 return combinator.first ?2069 // check against closest ancestor/preceding element2070 function( elem, context, xml ) {2071 while ( (elem = elem[ dir ]) ) {2072 if ( elem.nodetype === 1 || checknonelements ) {2073 return matcher( elem, context, xml );2074 }2075 }2076 } :2077 // check against all ancestor/preceding elements2078 function( elem, context, xml ) {2079 var data, cache, outercache,2080 dirkey = dirruns + " " + donename;2081 // we can't set arbitrary data on xml nodes, so they don't benefit from dir caching2082 if ( xml ) {2083 while ( (elem = elem[ dir ]) ) {2084 if ( elem.nodetype === 1 || checknonelements ) {2085 if ( matcher( elem, context, xml ) ) {2086 return true;2087 }2088 }2089 }2090 } else {2091 while ( (elem = elem[ dir ]) ) {2092 if ( elem.nodetype === 1 || checknonelements ) {2093 outercache = elem[ expando ] || (elem[ expando ] = {});2094 if ( (cache = outercache[ dir ]) && cache[0] === dirkey ) {2095 if ( (data = cache[1]) === true || data === cachedruns ) {2096 return data === true;2097 }2098 } else {2099 cache = outercache[ dir ] = [ dirkey ];2100 cache[1] = matcher( elem, context, xml ) || cachedruns;2101 if ( cache[1] === true ) {2102 return true;2103 }2104 }2105 }2106 }2107 }2108 };2109 }2110 function elementmatcher( matchers ) {2111 return matchers.length > 1 ?2112 function( elem, context, xml ) {2113 var i = matchers.length;2114 while ( i-- ) {2115 if ( !matchers[i]( elem, context, xml ) ) {2116 return false;2117 }2118 }2119 return true;2120 } :2121 matchers[0];2122 }2123 function condense( unmatched, map, filter, context, xml ) {2124 var elem,2125 newunmatched = [],2126 i = 0,2127 len = unmatched.length,2128 mapped = map != null;2129 for ( ; i < len; i++ ) {2130 if ( (elem = unmatched[i]) ) {2131 if ( !filter || filter( elem, context, xml ) ) {2132 newunmatched.push( elem );2133 if ( mapped ) {2134 map.push( i );2135 }2136 }2137 }2138 }2139 return newunmatched;2140 }2141 function setmatcher( prefilter, selector, matcher, postfilter, postfinder, postselector ) {2142 if ( postfilter && !postfilter[ expando ] ) {2143 postfilter = setmatcher( postfilter );2144 }2145 if ( postfinder && !postfinder[ expando ] ) {2146 postfinder = setmatcher( postfinder, postselector );2147 }2148 return markfunction(function( seed, results, context, xml ) {2149 var temp, i, elem,2150 premap = [],2151 postmap = [],2152 preexisting = results.length,2153 // get initial elements from seed or context2154 elems = seed || multiplecontexts( selector || "*", context.nodetype ? [ context ] : context, [] ),2155 // prefilter to get matcher input, preserving a map for seed-results synchronization2156 matcherin = prefilter && ( seed || !selector ) ?2157 condense( elems, premap, prefilter, context, xml ) :2158 elems,2159 matcherout = matcher ?2160 // if we have a postfinder, or filtered seed, or non-seed postfilter or preexisting results,2161 postfinder || ( seed ? prefilter : preexisting || postfilter ) ?2162 // ...intermediate processing is necessary2163 [] :2164 // ...otherwise use results directly2165 results :2166 matcherin;2167 // find primary matches2168 if ( matcher ) {2169 matcher( matcherin, matcherout, context, xml );2170 }2171 // apply postfilter2172 if ( postfilter ) {2173 temp = condense( matcherout, postmap );2174 postfilter( temp, [], context, xml );2175 // un-match failing elements by moving them back to matcherin2176 i = temp.length;2177 while ( i-- ) {2178 if ( (elem = temp[i]) ) {2179 matcherout[ postmap[i] ] = !(matcherin[ postmap[i] ] = elem);2180 }2181 }2182 }2183 if ( seed ) {2184 if ( postfinder || prefilter ) {2185 if ( postfinder ) {2186 // get the final matcherout by condensing this intermediate into postfinder contexts2187 temp = [];2188 i = matcherout.length;2189 while ( i-- ) {2190 if ( (elem = matcherout[i]) ) {2191 // restore matcherin since elem is not yet a final match2192 temp.push( (matcherin[i] = elem) );2193 }2194 }2195 postfinder( null, (matcherout = []), temp, xml );2196 }2197 // move matched elements from seed to results to keep them synchronized2198 i = matcherout.length;2199 while ( i-- ) {2200 if ( (elem = matcherout[i]) &&2201 (temp = postfinder ? indexof.call( seed, elem ) : premap[i]) > -1 ) {2202 seed[temp] = !(results[temp] = elem);2203 }2204 }2205 }2206 // add elements to results, through postfinder if defined2207 } else {2208 matcherout = condense(2209 matcherout === results ?2210 matcherout.splice( preexisting, matcherout.length ) :2211 matcherout2212 );2213 if ( postfinder ) {2214 postfinder( null, results, matcherout, xml );2215 } else {2216 push.apply( results, matcherout );2217 }2218 }2219 });2220 }2221 function matcherfromtokens( tokens ) {2222 var checkcontext, matcher, j,2223 len = tokens.length,2224 leadingrelative = expr.relative[ tokens[0].type ],2225 implicitrelative = leadingrelative || expr.relative[" "],2226 i = leadingrelative ? 1 : 0,2227 // the foundational matcher ensures that elements are reachable from top-level context(s)2228 matchcontext = addcombinator( function( elem ) {2229 return elem === checkcontext;2230 }, implicitrelative, true ),2231 matchanycontext = addcombinator( function( elem ) {2232 return indexof.call( checkcontext, elem ) > -1;2233 }, implicitrelative, true ),2234 matchers = [ function( elem, context, xml ) {2235 return ( !leadingrelative && ( xml || context !== outermostcontext ) ) || (2236 (checkcontext = context).nodetype ?2237 matchcontext( elem, context, xml ) :2238 matchanycontext( elem, context, xml ) );2239 } ];2240 for ( ; i < len; i++ ) {2241 if ( (matcher = expr.relative[ tokens[i].type ]) ) {2242 matchers = [ addcombinator(elementmatcher( matchers ), matcher) ];2243 } else {2244 matcher = expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );2245 // return special upon seeing a positional matcher2246 if ( matcher[ expando ] ) {2247 // find the next relative operator (if any) for proper handling2248 j = ++i;2249 for ( ; j < len; j++ ) {2250 if ( expr.relative[ tokens[j].type ] ) {2251 break;2252 }2253 }2254 return setmatcher(2255 i > 1 && elementmatcher( matchers ),2256 i > 1 && toselector(2257 // if the preceding token was a descendant combinator, insert an implicit any-element `*`2258 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })2259 ).replace( rtrim, "$1" ),2260 matcher,2261 i < j && matcherfromtokens( tokens.slice( i, j ) ),2262 j < len && matcherfromtokens( (tokens = tokens.slice( j )) ),2263 j < len && toselector( tokens )2264 );2265 }2266 matchers.push( matcher );2267 }2268 }2269 return elementmatcher( matchers );2270 }2271 function matcherfromgroupmatchers( elementmatchers, setmatchers ) {2272 // a counter to specify which element is currently being matched2273 var matchercachedruns = 0,2274 byset = setmatchers.length > 0,2275 byelement = elementmatchers.length > 0,2276 supermatcher = function( seed, context, xml, results, expandcontext ) {2277 var elem, j, matcher,2278 setmatched = [],2279 matchedcount = 0,2280 i = "0",2281 unmatched = seed && [],2282 outermost = expandcontext != null,2283 contextbackup = outermostcontext,2284 // we must always have either seed elements or context2285 elems = seed || byelement && expr.find["tag"]( "*", expandcontext && context.parentnode || context ),2286 // use integer dirruns iff this is the outermost matcher2287 dirrunsunique = (dirruns += contextbackup == null ? 1 : math.random() || 0.1);2288 if ( outermost ) {2289 outermostcontext = context !== document && context;2290 cachedruns = matchercachedruns;2291 }2292 // add elements passing elementmatchers directly to results2293 // keep `i` a string if there are no elements so `matchedcount` will be "00" below2294 for ( ; (elem = elems[i]) != null; i++ ) {2295 if ( byelement && elem ) {2296 j = 0;2297 while ( (matcher = elementmatchers[j++]) ) {2298 if ( matcher( elem, context, xml ) ) {2299 results.push( elem );2300 break;2301 }2302 }2303 if ( outermost ) {2304 dirruns = dirrunsunique;2305 cachedruns = ++matchercachedruns;2306 }2307 }2308 // track unmatched elements for set filters2309 if ( byset ) {2310 // they will have gone through all possible matchers2311 if ( (elem = !matcher && elem) ) {2312 matchedcount--;2313 }2314 // lengthen the array for every element, matched or not2315 if ( seed ) {2316 unmatched.push( elem );2317 }2318 }2319 }2320 // apply set filters to unmatched elements2321 matchedcount += i;2322 if ( byset && i !== matchedcount ) {2323 j = 0;2324 while ( (matcher = setmatchers[j++]) ) {2325 matcher( unmatched, setmatched, context, xml );2326 }2327 if ( seed ) {2328 // reintegrate element matches to eliminate the need for sorting2329 if ( matchedcount > 0 ) {2330 while ( i-- ) {2331 if ( !(unmatched[i] || setmatched[i]) ) {2332 setmatched[i] = pop.call( results );2333 }2334 }2335 }2336 // discard index placeholder values to get only actual matches2337 setmatched = condense( setmatched );2338 }2339 // add matches to results2340 push.apply( results, setmatched );2341 // seedless set matches succeeding multiple successful matchers stipulate sorting2342 if ( outermost && !seed && setmatched.length > 0 &&2343 ( matchedcount + setmatchers.length ) > 1 ) {2344 sizzle.uniquesort( results );2345 }2346 }2347 // override manipulation of globals by nested matchers2348 if ( outermost ) {2349 dirruns = dirrunsunique;2350 outermostcontext = contextbackup;2351 }2352 return unmatched;2353 };2354 return byset ?2355 markfunction( supermatcher ) :2356 supermatcher;2357 }2358 compile = sizzle.compile = function( selector, group /* internal use only */ ) {2359 var i,2360 setmatchers = [],2361 elementmatchers = [],2362 cached = compilercache[ selector + " " ];2363 if ( !cached ) {2364 // generate a function of recursive functions that can be used to check each element2365 if ( !group ) {2366 group = tokenize( selector );2367 }2368 i = group.length;2369 while ( i-- ) {2370 cached = matcherfromtokens( group[i] );2371 if ( cached[ expando ] ) {2372 setmatchers.push( cached );2373 } else {2374 elementmatchers.push( cached );2375 }2376 }2377 // cache the compiled function2378 cached = compilercache( selector, matcherfromgroupmatchers( elementmatchers, setmatchers ) );2379 }2380 return cached;2381 };2382 function multiplecontexts( selector, contexts, results ) {2383 var i = 0,2384 len = contexts.length;2385 for ( ; i < len; i++ ) {2386 sizzle( selector, contexts[i], results );2387 }2388 return results;2389 }2390 function select( selector, context, results, seed ) {2391 var i, tokens, token, type, find,2392 match = tokenize( selector );2393 if ( !seed ) {2394 // try to minimize operations if there is only one group2395 if ( match.length === 1 ) {2396 // take a shortcut and set the context if the root selector is an id2397 tokens = match[0] = match[0].slice( 0 );2398 if ( tokens.length > 2 && (token = tokens[0]).type === "id" &&2399 support.getbyid && context.nodetype === 9 && documentishtml &&2400 expr.relative[ tokens[1].type ] ) {2401 context = ( expr.find["id"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];2402 if ( !context ) {2403 return results;2404 }2405 selector = selector.slice( tokens.shift().value.length );2406 }2407 // fetch a seed set for right-to-left matching2408 i = matchexpr["needscontext"].test( selector ) ? 0 : tokens.length;2409 while ( i-- ) {2410 token = tokens[i];2411 // abort if we hit a combinator2412 if ( expr.relative[ (type = token.type) ] ) {2413 break;2414 }2415 if ( (find = expr.find[ type ]) ) {2416 // search, expanding context for leading sibling combinators2417 if ( (seed = find(2418 token.matches[0].replace( runescape, funescape ),2419 rsibling.test( tokens[0].type ) && context.parentnode || context2420 )) ) {2421 // if seed is empty or no tokens remain, we can return early2422 tokens.splice( i, 1 );2423 selector = seed.length && toselector( tokens );2424 if ( !selector ) {2425 push.apply( results, seed );2426 return results;2427 }2428 break;2429 }2430 }2431 }2432 }2433 }2434 // compile and execute a filtering function2435 // provide `match` to avoid retokenization if we modified the selector above2436 compile( selector, match )(2437 seed,2438 context,2439 !documentishtml,2440 results,2441 rsibling.test( selector )2442 );2443 return results;2444 }2445// one-time assignments2446// sort stability2447 support.sortstable = expando.split("").sort( sortorder ).join("") === expando;2448// support: chrome<142449// always assume duplicates if they aren't passed to the comparison function2450 support.detectduplicates = hasduplicate;2451// initialize against the default document2452 setdocument();2453// support: webkit<537.32 - safari 6.0.3/chrome 25 (fixed in chrome 27)2454// detached nodes confoundingly follow *each other*2455 support.sortdetached = assert(function( div1 ) {2456 // should return 1, but returns 4 (following)2457 return div1.comparedocumentposition( document.createelement("div") ) & 1;2458 });2459// support: ie<82460// prevent attribute/property "interpolation"2461// http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx2462 if ( !assert(function( div ) {2463 div.innerhtml = "<a href='#'></a>";2464 return div.firstchild.getattribute("href") === "#" ;2465 }) ) {2466 addhandle( "type|href|height|width", function( elem, name, isxml ) {2467 if ( !isxml ) {2468 return elem.getattribute( name, name.tolowercase() === "type" ? 1 : 2 );2469 }2470 });2471 }2472// support: ie<92473// use defaultvalue in place of getattribute("value")2474 if ( !support.attributes || !assert(function( div ) {2475 div.innerhtml = "<input/>";2476 div.firstchild.setattribute( "value", "" );2477 return div.firstchild.getattribute( "value" ) === "";2478 }) ) {2479 addhandle( "value", function( elem, name, isxml ) {2480 if ( !isxml && elem.nodename.tolowercase() === "input" ) {2481 return elem.defaultvalue;2482 }2483 });2484 }2485// support: ie<92486// use getattributenode to fetch booleans when getattribute lies2487 if ( !assert(function( div ) {2488 return div.getattribute("disabled") == null;2489 }) ) {2490 addhandle( booleans, function( elem, name, isxml ) {2491 var val;2492 if ( !isxml ) {2493 return (val = elem.getattributenode( name )) && val.specified ?2494 val.value :2495 elem[ name ] === true ? name.tolowercase() : null;2496 }2497 });2498 }2499 jquery.find = sizzle;2500 jquery.expr = sizzle.selectors;2501 jquery.expr[":"] = jquery.expr.pseudos;2502 jquery.unique = sizzle.uniquesort;2503 jquery.text = sizzle.gettext;2504 jquery.isxmldoc = sizzle.isxml;2505 jquery.contains = sizzle.contains;2506 })( window );2507// string to object options format cache2508 var optionscache = {};2509// convert string-formatted options into object-formatted ones and store in cache2510 function createoptions( options ) {2511 var object = optionscache[ options ] = {};2512 jquery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {2513 object[ flag ] = true;2514 });2515 return object;2516 }2517 /*2518 * create a callback list using the following parameters:2519 *2520 * options: an optional list of space-separated options that will change how2521 * the callback list behaves or a more traditional option object2522 *2523 * by default a callback list will act like an event callback list and can be2524 * "fired" multiple times.2525 *2526 * possible options:2527 *2528 * once: will ensure the callback list can only be fired once (like a deferred)2529 *2530 * memory: will keep track of previous values and will call any callback added2531 * after the list has been fired right away with the latest "memorized"2532 * values (like a deferred)2533 *2534 * unique: will ensure a callback can only be added once (no duplicate in the list)2535 *2536 * stoponfalse: interrupt callings when a callback returns false2537 *2538 */2539 jquery.callbacks = function( options ) {2540 // convert options from string-formatted to object-formatted if needed2541 // (we check in cache first)2542 options = typeof options === "string" ?2543 ( optionscache[ options ] || createoptions( options ) ) :2544 jquery.extend( {}, options );2545 var // flag to know if list is currently firing2546 firing,2547 // last fire value (for non-forgettable lists)2548 memory,2549 // flag to know if list was already fired2550 fired,2551 // end of the loop when firing2552 firinglength,2553 // index of currently firing callback (modified by remove if needed)2554 firingindex,2555 // first callback to fire (used internally by add and firewith)2556 firingstart,2557 // actual callback list2558 list = [],2559 // stack of fire calls for repeatable lists2560 stack = !options.once && [],2561 // fire callbacks2562 fire = function( data ) {2563 memory = options.memory && data;2564 fired = true;2565 firingindex = firingstart || 0;2566 firingstart = 0;2567 firinglength = list.length;2568 firing = true;2569 for ( ; list && firingindex < firinglength; firingindex++ ) {2570 if ( list[ firingindex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stoponfalse ) {2571 memory = false; // to prevent further calls using add2572 break;2573 }2574 }2575 firing = false;2576 if ( list ) {2577 if ( stack ) {2578 if ( stack.length ) {2579 fire( stack.shift() );2580 }2581 } else if ( memory ) {2582 list = [];2583 } else {2584 self.disable();2585 }2586 }2587 },2588 // actual callbacks object2589 self = {2590 // add a callback or a collection of callbacks to the list2591 add: function() {2592 if ( list ) {2593 // first, we save the current length2594 var start = list.length;2595 (function add( args ) {2596 jquery.each( args, function( _, arg ) {2597 var type = jquery.type( arg );2598 if ( type === "function" ) {2599 if ( !options.unique || !self.has( arg ) ) {2600 list.push( arg );2601 }2602 } else if ( arg && arg.length && type !== "string" ) {2603 // inspect recursively2604 add( arg );2605 }2606 });2607 })( arguments );2608 // do we need to add the callbacks to the2609 // current firing batch?2610 if ( firing ) {2611 firinglength = list.length;2612 // with memory, if we're not firing then2613 // we should call right away2614 } else if ( memory ) {2615 firingstart = start;2616 fire( memory );2617 }2618 }2619 return this;2620 },2621 // remove a callback from the list2622 remove: function() {2623 if ( list ) {2624 jquery.each( arguments, function( _, arg ) {2625 var index;2626 while( ( index = jquery.inarray( arg, list, index ) ) > -1 ) {2627 list.splice( index, 1 );2628 // handle firing indexes2629 if ( firing ) {2630 if ( index <= firinglength ) {2631 firinglength--;2632 }2633 if ( index <= firingindex ) {2634 firingindex--;2635 }2636 }2637 }2638 });2639 }2640 return this;2641 },2642 // check if a given callback is in the list.2643 // if no argument is given, return whether or not list has callbacks attached.2644 has: function( fn ) {2645 return fn ? jquery.inarray( fn, list ) > -1 : !!( list && list.length );2646 },2647 // remove all callbacks from the list2648 empty: function() {2649 list = [];2650 firinglength = 0;2651 return this;2652 },2653 // have the list do nothing anymore2654 disable: function() {2655 list = stack = memory = undefined;2656 return this;2657 },2658 // is it disabled?2659 disabled: function() {2660 return !list;2661 },2662 // lock the list in its current state2663 lock: function() {2664 stack = undefined;2665 if ( !memory ) {2666 self.disable();2667 }2668 return this;2669 },2670 // is it locked?2671 locked: function() {2672 return !stack;2673 },2674 // call all callbacks with the given context and arguments2675 firewith: function( context, args ) {2676 if ( list && ( !fired || stack ) ) {2677 args = args || [];2678 args = [ context, args.slice ? args.slice() : args ];2679 if ( firing ) {2680 stack.push( args );2681 } else {2682 fire( args );2683 }2684 }2685 return this;2686 },2687 // call all the callbacks with the given arguments2688 fire: function() {2689 self.firewith( this, arguments );2690 return this;2691 },2692 // to know if the callbacks have already been called at least once2693 fired: function() {2694 return !!fired;2695 }2696 };2697 return self;2698 };2699 jquery.extend({2700 deferred: function( func ) {2701 var tuples = [2702 // action, add listener, listener list, final state2703 [ "resolve", "done", jquery.callbacks("once memory"), "resolved" ],2704 [ "reject", "fail", jquery.callbacks("once memory"), "rejected" ],2705 [ "notify", "progress", jquery.callbacks("memory") ]2706 ],2707 state = "pending",2708 promise = {2709 state: function() {2710 return state;2711 },2712 always: function() {2713 deferred.done( arguments ).fail( arguments );2714 return this;2715 },2716 then: function( /* fndone, fnfail, fnprogress */ ) {2717 var fns = arguments;2718 return jquery.deferred(function( newdefer ) {2719 jquery.each( tuples, function( i, tuple ) {2720 var action = tuple[ 0 ],2721 fn = jquery.isfunction( fns[ i ] ) && fns[ i ];2722 // deferred[ done | fail | progress ] for forwarding actions to newdefer2723 deferred[ tuple[1] ](function() {2724 var returned = fn && fn.apply( this, arguments );2725 if ( returned && jquery.isfunction( returned.promise ) ) {2726 returned.promise()2727 .done( newdefer.resolve )2728 .fail( newdefer.reject )2729 .progress( newdefer.notify );2730 } else {2731 newdefer[ action + "with" ]( this === promise ? newdefer.promise() : this, fn ? [ returned ] : arguments );2732 }2733 });2734 });2735 fns = null;2736 }).promise();2737 },2738 // get a promise for this deferred2739 // if obj is provided, the promise aspect is added to the object2740 promise: function( obj ) {2741 return obj != null ? jquery.extend( obj, promise ) : promise;2742 }2743 },2744 deferred = {};2745 // keep pipe for back-compat2746 promise.pipe = promise.then;2747 // add list-specific methods2748 jquery.each( tuples, function( i, tuple ) {2749 var list = tuple[ 2 ],2750 statestring = tuple[ 3 ];2751 // promise[ done | fail | progress ] = list.add2752 promise[ tuple[1] ] = list.add;2753 // handle state2754 if ( statestring ) {2755 list.add(function() {2756 // state = [ resolved | rejected ]2757 state = statestring;2758 // [ reject_list | resolve_list ].disable; progress_list.lock2759 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );2760 }2761 // deferred[ resolve | reject | notify ]2762 deferred[ tuple[0] ] = function() {2763 deferred[ tuple[0] + "with" ]( this === deferred ? promise : this, arguments );2764 return this;2765 };2766 deferred[ tuple[0] + "with" ] = list.firewith;2767 });2768 // make the deferred a promise2769 promise.promise( deferred );2770 // call given func if any2771 if ( func ) {2772 func.call( deferred, deferred );2773 }2774 // all done!2775 return deferred;2776 },2777 // deferred helper2778 when: function( subordinate /* , ..., subordinaten */ ) {2779 var i = 0,2780 resolvevalues = core_slice.call( arguments ),2781 length = resolvevalues.length,2782 // the count of uncompleted subordinates2783 remaining = length !== 1 || ( subordinate && jquery.isfunction( subordinate.promise ) ) ? length : 0,2784 // the master deferred. if resolvevalues consist of only a single deferred, just use that.2785 deferred = remaining === 1 ? subordinate : jquery.deferred(),2786 // update function for both resolve and progress values2787 updatefunc = function( i, contexts, values ) {2788 return function( value ) {2789 contexts[ i ] = this;2790 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;2791 if( values === progressvalues ) {2792 deferred.notifywith( contexts, values );2793 } else if ( !( --remaining ) ) {2794 deferred.resolvewith( contexts, values );2795 }2796 };2797 },2798 progressvalues, progresscontexts, resolvecontexts;2799 // add listeners to deferred subordinates; treat others as resolved2800 if ( length > 1 ) {2801 progressvalues = new array( length );2802 progresscontexts = new array( length );2803 resolvecontexts = new array( length );2804 for ( ; i < length; i++ ) {2805 if ( resolvevalues[ i ] && jquery.isfunction( resolvevalues[ i ].promise ) ) {2806 resolvevalues[ i ].promise()2807 .done( updatefunc( i, resolvecontexts, resolvevalues ) )2808 .fail( deferred.reject )2809 .progress( updatefunc( i, progresscontexts, progressvalues ) );2810 } else {2811 --remaining;2812 }2813 }2814 }2815 // if we're not waiting on anything, resolve the master2816 if ( !remaining ) {2817 deferred.resolvewith( resolvecontexts, resolvevalues );2818 }2819 return deferred.promise();2820 }2821 });2822 jquery.support = (function( support ) {2823 var all, a, input, select, fragment, opt, eventname, issupported, i,2824 div = document.createelement("div");2825 // setup2826 div.setattribute( "classname", "t" );2827 div.innerhtml = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";2828 // finish early in limited (non-browser) environments2829 all = div.getelementsbytagname("*") || [];2830 a = div.getelementsbytagname("a")[ 0 ];2831 if ( !a || !a.style || !all.length ) {2832 return support;2833 }2834 // first batch of tests2835 select = document.createelement("select");2836 opt = select.appendchild( document.createelement("option") );2837 input = div.getelementsbytagname("input")[ 0 ];2838 a.style.csstext = "top:1px;float:left;opacity:.5";2839 // test setattribute on camelcase class. if it works, we need attrfixes when doing get/setattribute (ie6/7)2840 support.getsetattribute = div.classname !== "t";2841 // ie strips leading whitespace when .innerhtml is used2842 support.leadingwhitespace = div.firstchild.nodetype === 3;2843 // make sure that tbody elements aren't automatically inserted2844 // ie will insert them into empty tables2845 support.tbody = !div.getelementsbytagname("tbody").length;2846 // make sure that link elements get serialized correctly by innerhtml2847 // this requires a wrapper element in ie2848 support.htmlserialize = !!div.getelementsbytagname("link").length;2849 // get the style information from getattribute2850 // (ie uses .csstext instead)2851 support.style = /top/.test( a.getattribute("style") );2852 // make sure that urls aren't manipulated2853 // (ie normalizes it by default)2854 support.hrefnormalized = a.getattribute("href") === "/a";2855 // make sure that element opacity exists2856 // (ie uses filter instead)2857 // use a regex to work around a webkit issue. see #51452858 support.opacity = /^0.5/.test( a.style.opacity );2859 // verify style float existence2860 // (ie uses stylefloat instead of cssfloat)2861 support.cssfloat = !!a.style.cssfloat;2862 // check the default checkbox/radio value ("" on webkit; "on" elsewhere)2863 support.checkon = !!input.value;2864 // make sure that a selected-by-default option has a working selected property.2865 // (webkit defaults to false instead of true, ie too, if it's in an optgroup)2866 support.optselected = opt.selected;2867 // tests for enctype support on a form (#6743)2868 support.enctype = !!document.createelement("form").enctype;2869 // makes sure cloning an html5 element does not cause problems2870 // where outerhtml is undefined, this still works2871 support.html5clone = document.createelement("nav").clonenode( true ).outerhtml !== "<:nav></:nav>";2872 // will be defined later2873 support.inlineblockneedslayout = false;2874 support.shrinkwrapblocks = false;2875 support.pixelposition = false;2876 support.deleteexpando = true;2877 support.nocloneevent = true;2878 support.reliablemarginright = true;2879 support.boxsizingreliable = true;2880 // make sure checked status is properly cloned2881 input.checked = true;2882 support.noclonechecked = input.clonenode( true ).checked;2883 // make sure that the options inside disabled selects aren't marked as disabled2884 // (webkit marks them as disabled)2885 select.disabled = true;2886 support.optdisabled = !opt.disabled;2887 // support: ie<92888 try {2889 delete div.test;2890 } catch( e ) {2891 support.deleteexpando = false;2892 }2893 // check if we can trust getattribute("value")2894 input = document.createelement("input");2895 input.setattribute( "value", "" );2896 support.input = input.getattribute( "value" ) === "";2897 // check if an input maintains its value after becoming a radio2898 input.value = "t";2899 input.setattribute( "type", "radio" );2900 support.radiovalue = input.value === "t";2901 // #11217 - webkit loses check when the name is after the checked attribute2902 input.setattribute( "checked", "t" );2903 input.setattribute( "name", "t" );2904 fragment = document.createdocumentfragment();2905 fragment.appendchild( input );2906 // check if a disconnected checkbox will retain its checked2907 // value of true after appended to the dom (ie6/7)2908 support.appendchecked = input.checked;2909 // webkit doesn't clone checked state correctly in fragments2910 support.checkclone = fragment.clonenode( true ).clonenode( true ).lastchild.checked;2911 // support: ie<92912 // opera does not clone events (and typeof div.attachevent === undefined).2913 // ie9-10 clones events bound via attachevent, but they don't trigger with .click()2914 if ( div.attachevent ) {2915 div.attachevent( "onclick", function() {2916 support.nocloneevent = false;2917 });2918 div.clonenode( true ).click();2919 }2920 // support: ie<9 (lack submit/change bubble), firefox 17+ (lack focusin event)2921 // beware of csp restrictions (https://developer.mozilla.org/en/security/csp)2922 for ( i in { submit: true, change: true, focusin: true }) {2923 div.setattribute( eventname = "on" + i, "t" );2924 support[ i + "bubbles" ] = eventname in window || div.attributes[ eventname ].expando === false;2925 }2926 div.style.backgroundclip = "content-box";2927 div.clonenode( true ).style.backgroundclip = "";2928 support.clearclonestyle = div.style.backgroundclip === "content-box";2929 // support: ie<92930 // iteration over object's inherited properties before its own.2931 for ( i in jquery( support ) ) {2932 break;2933 }2934 support.ownlast = i !== "0";2935 // run tests that need a body at doc ready2936 jquery(function() {2937 var container, margindiv, tds,2938 divreset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",2939 body = document.getelementsbytagname("body")[0];2940 if ( !body ) {2941 // return for frameset docs that don't have a body2942 return;2943 }2944 container = document.createelement("div");2945 container.style.csstext = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";2946 body.appendchild( container ).appendchild( div );2947 // support: ie82948 // check if table cells still have offsetwidth/height when they are set2949 // to display:none and there are still other visible table cells in a2950 // table row; if so, offsetwidth/height are not reliable for use when2951 // determining if an element has been hidden directly using2952 // display:none (it is still safe to use offsets if a parent element is2953 // hidden; don safety goggles and see bug #4512 for more information).2954 div.innerhtml = "<table><tr><td></td><td>t</td></tr></table>";2955 tds = div.getelementsbytagname("td");2956 tds[ 0 ].style.csstext = "padding:0;margin:0;border:0;display:none";2957 issupported = ( tds[ 0 ].offsetheight === 0 );2958 tds[ 0 ].style.display = "";2959 tds[ 1 ].style.display = "none";2960 // support: ie82961 // check if empty table cells still have offsetwidth/height2962 support.reliablehiddenoffsets = issupported && ( tds[ 0 ].offsetheight === 0 );2963 // check box-sizing and margin behavior.2964 div.innerhtml = "";2965 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%;";2966 // workaround failing boxsizing test due to offsetwidth returning wrong value2967 // with some non-1 values of body zoom, ticket #135432968 jquery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {2969 support.boxsizing = div.offsetwidth === 4;2970 });2971 // use window.getcomputedstyle because jsdom on node.js will break without it.2972 if ( window.getcomputedstyle ) {2973 support.pixelposition = ( window.getcomputedstyle( div, null ) || {} ).top !== "1%";2974 support.boxsizingreliable = ( window.getcomputedstyle( div, null ) || { width: "4px" } ).width === "4px";2975 // check if div with explicit width and no margin-right incorrectly2976 // gets computed margin-right based on width of container. (#3333)2977 // fails in webkit before feb 2011 nightlies2978 // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right2979 margindiv = div.appendchild( document.createelement("div") );2980 margindiv.style.csstext = div.style.csstext = divreset;2981 margindiv.style.marginright = margindiv.style.width = "0";2982 div.style.width = "1px";2983 support.reliablemarginright =2984 !parsefloat( ( window.getcomputedstyle( margindiv, null ) || {} ).marginright );2985 }2986 if ( typeof div.style.zoom !== core_strundefined ) {2987 // support: ie<82988 // check if natively block-level elements act like inline-block2989 // elements when setting their display to 'inline' and giving2990 // them layout2991 div.innerhtml = "";2992 div.style.csstext = divreset + "width:1px;padding:1px;display:inline;zoom:1";2993 support.inlineblockneedslayout = ( div.offsetwidth === 3 );2994 // support: ie62995 // check if elements with layout shrink-wrap their children2996 div.style.display = "block";2997 div.innerhtml = "<div></div>";2998 div.firstchild.style.width = "5px";2999 support.shrinkwrapblocks = ( div.offsetwidth !== 3 );3000 if ( support.inlineblockneedslayout ) {3001 // prevent ie 6 from affecting layout for positioned elements #110483002 // prevent ie from shrinking the body in ie 7 mode #128693003 // support: ie<83004 body.style.zoom = 1;3005 }3006 }3007 body.removechild( container );3008 // null elements to avoid leaks in ie3009 container = div = tds = margindiv = null;3010 });3011 // null elements to avoid leaks in ie3012 all = select = fragment = opt = a = input = null;3013 return support;3014 })({});3015 var rbrace = /(?:\{[\s\s]*\}|\[[\s\s]*\])$/,3016 rmultidash = /([a-z])/g;3017 function internaldata( elem, name, data, pvt /* internal use only */ ){3018 if ( !jquery.acceptdata( elem ) ) {3019 return;3020 }3021 var ret, thiscache,3022 internalkey = jquery.expando,3023 // we have to handle dom nodes and js objects differently because ie6-73024 // can't gc object references properly across the dom-js boundary3025 isnode = elem.nodetype,3026 // only dom nodes need the global jquery cache; js object data is3027 // attached directly to the object so gc can occur automatically3028 cache = isnode ? jquery.cache : elem,3029 // only defining an id for js objects if its cache already exists allows3030 // the code to shortcut on the same path as a dom node with no cache3031 id = isnode ? elem[ internalkey ] : elem[ internalkey ] && internalkey;3032 // avoid doing any more work than we need to when trying to get data on an3033 // object that has no data at all3034 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {3035 return;3036 }3037 if ( !id ) {3038 // only dom nodes need a new unique id for each element since their data3039 // ends up in the global cache3040 if ( isnode ) {3041 id = elem[ internalkey ] = core_deletedids.pop() || jquery.guid++;3042 } else {3043 id = internalkey;3044 }3045 }3046 if ( !cache[ id ] ) {3047 // avoid exposing jquery metadata on plain js objects when the object3048 // is serialized using json.stringify3049 cache[ id ] = isnode ? {} : { tojson: jquery.noop };3050 }3051 // an object can be passed to jquery.data instead of a key/value pair; this gets3052 // shallow copied over onto the existing cache3053 if ( typeof name === "object" || typeof name === "function" ) {3054 if ( pvt ) {3055 cache[ id ] = jquery.extend( cache[ id ], name );3056 } else {3057 cache[ id ].data = jquery.extend( cache[ id ].data, name );3058 }3059 }3060 thiscache = cache[ id ];3061 // jquery data() is stored in a separate object inside the object's internal data3062 // cache in order to avoid key collisions between internal data and user-defined3063 // data.3064 if ( !pvt ) {3065 if ( !thiscache.data ) {3066 thiscache.data = {};3067 }3068 thiscache = thiscache.data;3069 }3070 if ( data !== undefined ) {3071 thiscache[ jquery.camelcase( name ) ] = data;3072 }3073 // check for both converted-to-camel and non-converted data property names3074 // if a data property was specified3075 if ( typeof name === "string" ) {3076 // first try to find as-is property data3077 ret = thiscache[ name ];3078 // test for null|undefined property data3079 if ( ret == null ) {3080 // try to find the camelcased property3081 ret = thiscache[ jquery.camelcase( name ) ];3082 }3083 } else {3084 ret = thiscache;3085 }3086 return ret;3087 }3088 function internalremovedata( elem, name, pvt ) {3089 if ( !jquery.acceptdata( elem ) ) {3090 return;3091 }3092 var thiscache, i,3093 isnode = elem.nodetype,3094 // see jquery.data for more information3095 cache = isnode ? jquery.cache : elem,3096 id = isnode ? elem[ jquery.expando ] : jquery.expando;3097 // if there is already no cache entry for this object, there is no3098 // purpose in continuing3099 if ( !cache[ id ] ) {3100 return;3101 }3102 if ( name ) {3103 thiscache = pvt ? cache[ id ] : cache[ id ].data;3104 if ( thiscache ) {3105 // support array or space separated string names for data keys3106 if ( !jquery.isarray( name ) ) {3107 // try the string as a key before any manipulation3108 if ( name in thiscache ) {3109 name = [ name ];3110 } else {3111 // split the camel cased version by spaces unless a key with the spaces exists3112 name = jquery.camelcase( name );3113 if ( name in thiscache ) {3114 name = [ name ];3115 } else {3116 name = name.split(" ");3117 }3118 }3119 } else {3120 // if "name" is an array of keys...3121 // when data is initially created, via ("key", "val") signature,3122 // keys will be converted to camelcase.3123 // since there is no way to tell _how_ a key was added, remove3124 // both plain key and camelcase key. #127863125 // this will only penalize the array argument path.3126 name = name.concat( jquery.map( name, jquery.camelcase ) );3127 }3128 i = name.length;3129 while ( i-- ) {3130 delete thiscache[ name[i] ];3131 }3132 // if there is no data left in the cache, we want to continue3133 // and let the cache object itself get destroyed3134 if ( pvt ? !isemptydataobject(thiscache) : !jquery.isemptyobject(thiscache) ) {3135 return;3136 }3137 }3138 }3139 // see jquery.data for more information3140 if ( !pvt ) {3141 delete cache[ id ].data;3142 // don't destroy the parent cache unless the internal data object3143 // had been the only thing left in it3144 if ( !isemptydataobject( cache[ id ] ) ) {3145 return;3146 }3147 }3148 // destroy the cache3149 if ( isnode ) {3150 jquery.cleandata( [ elem ], true );3151 // use delete when supported for expandos or `cache` is not a window per iswindow (#10080)3152 /* jshint eqeqeq: false */3153 } else if ( jquery.support.deleteexpando || cache != cache.window ) {3154 /* jshint eqeqeq: true */3155 delete cache[ id ];3156 // when all else fails, null3157 } else {3158 cache[ id ] = null;3159 }3160 }3161 jquery.extend({3162 cache: {},3163 // the following elements throw uncatchable exceptions if you3164 // attempt to add expando properties to them.3165 nodata: {3166 "applet": true,3167 "embed": true,3168 // ban all objects except for flash (which handle expandos)3169 "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"3170 },3171 hasdata: function( elem ) {3172 elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];3173 return !!elem && !isemptydataobject( elem );3174 },3175 data: function( elem, name, data ) {3176 return internaldata( elem, name, data );3177 },3178 removedata: function( elem, name ) {3179 return internalremovedata( elem, name );3180 },3181 // for internal use only.3182 _data: function( elem, name, data ) {3183 return internaldata( elem, name, data, true );3184 },3185 _removedata: function( elem, name ) {3186 return internalremovedata( elem, name, true );3187 },3188 // a method for determining if a dom node can handle the data expando3189 acceptdata: function( elem ) {3190 // do not set data on non-element because it will not be cleared (#8335).3191 if ( elem.nodetype && elem.nodetype !== 1 && elem.nodetype !== 9 ) {3192 return false;3193 }3194 var nodata = elem.nodename && jquery.nodata[ elem.nodename.tolowercase() ];3195 // nodes accept data unless otherwise specified; rejection can be conditional3196 return !nodata || nodata !== true && elem.getattribute("classid") === nodata;3197 }3198 });3199 jquery.fn.extend({3200 data: function( key, value ) {3201 var attrs, name,3202 data = null,3203 i = 0,3204 elem = this[0];3205 // special expections of .data basically thwart jquery.access,3206 // so implement the relevant behavior ourselves3207 // gets all values3208 if ( key === undefined ) {3209 if ( this.length ) {3210 data = jquery.data( elem );3211 if ( elem.nodetype === 1 && !jquery._data( elem, "parsedattrs" ) ) {3212 attrs = elem.attributes;3213 for ( ; i < attrs.length; i++ ) {3214 name = attrs[i].name;3215 if ( name.indexof("data-") === 0 ) {3216 name = jquery.camelcase( name.slice(5) );3217 dataattr( elem, name, data[ name ] );3218 }3219 }3220 jquery._data( elem, "parsedattrs", true );3221 }3222 }3223 return data;3224 }3225 // sets multiple values3226 if ( typeof key === "object" ) {3227 return this.each(function() {3228 jquery.data( this, key );3229 });3230 }3231 return arguments.length > 1 ?3232 // sets one value3233 this.each(function() {3234 jquery.data( this, key, value );3235 }) :3236 // gets one value3237 // try to fetch any internally stored data first3238 elem ? dataattr( elem, key, jquery.data( elem, key ) ) : null;3239 },3240 removedata: function( key ) {3241 return this.each(function() {3242 jquery.removedata( this, key );3243 });3244 }3245 });3246 function dataattr( elem, key, data ) {3247 // if nothing was found internally, try to fetch any3248 // data from the html5 data-* attribute3249 if ( data === undefined && elem.nodetype === 1 ) {3250 var name = "data-" + key.replace( rmultidash, "-$1" ).tolowercase();3251 data = elem.getattribute( name );3252 if ( typeof data === "string" ) {3253 try {3254 data = data === "true" ? true :3255 data === "false" ? false :3256 data === "null" ? null :3257 // only convert to a number if it doesn't change the string3258 +data + "" === data ? +data :3259 rbrace.test( data ) ? jquery.parsejson( data ) :3260 data;3261 } catch( e ) {}3262 // make sure we set the data so it isn't changed later3263 jquery.data( elem, key, data );3264 } else {3265 data = undefined;3266 }3267 }3268 return data;3269 }3270// checks a cache object for emptiness3271 function isemptydataobject( obj ) {3272 var name;3273 for ( name in obj ) {3274 // if the public data object is empty, the private is still empty3275 if ( name === "data" && jquery.isemptyobject( obj[name] ) ) {3276 continue;3277 }3278 if ( name !== "tojson" ) {3279 return false;3280 }3281 }3282 return true;3283 }3284 jquery.extend({3285 queue: function( elem, type, data ) {3286 var queue;3287 if ( elem ) {3288 type = ( type || "fx" ) + "queue";3289 queue = jquery._data( elem, type );3290 // speed up dequeue by getting out quickly if this is just a lookup3291 if ( data ) {3292 if ( !queue || jquery.isarray(data) ) {3293 queue = jquery._data( elem, type, jquery.makearray(data) );3294 } else {3295 queue.push( data );3296 }3297 }3298 return queue || [];3299 }3300 },3301 dequeue: function( elem, type ) {3302 type = type || "fx";3303 var queue = jquery.queue( elem, type ),3304 startlength = queue.length,3305 fn = queue.shift(),3306 hooks = jquery._queuehooks( elem, type ),3307 next = function() {3308 jquery.dequeue( elem, type );3309 };3310 // if the fx queue is dequeued, always remove the progress sentinel3311 if ( fn === "inprogress" ) {3312 fn = queue.shift();3313 startlength--;3314 }3315 if ( fn ) {3316 // add a progress sentinel to prevent the fx queue from being3317 // automatically dequeued3318 if ( type === "fx" ) {3319 queue.unshift( "inprogress" );3320 }3321 // clear up the last queue stop function3322 delete hooks.stop;3323 fn.call( elem, next, hooks );3324 }3325 if ( !startlength && hooks ) {3326 hooks.empty.fire();3327 }3328 },3329 // not intended for public consumption - generates a queuehooks object, or returns the current one3330 _queuehooks: function( elem, type ) {3331 var key = type + "queuehooks";3332 return jquery._data( elem, key ) || jquery._data( elem, key, {3333 empty: jquery.callbacks("once memory").add(function() {3334 jquery._removedata( elem, type + "queue" );3335 jquery._removedata( elem, key );3336 })3337 });3338 }3339 });3340 jquery.fn.extend({3341 queue: function( type, data ) {3342 var setter = 2;3343 if ( typeof type !== "string" ) {3344 data = type;3345 type = "fx";3346 setter--;3347 }3348 if ( arguments.length < setter ) {3349 return jquery.queue( this[0], type );3350 }3351 return data === undefined ?3352 this :3353 this.each(function() {3354 var queue = jquery.queue( this, type, data );3355 // ensure a hooks for this queue3356 jquery._queuehooks( this, type );3357 if ( type === "fx" && queue[0] !== "inprogress" ) {3358 jquery.dequeue( this, type );3359 }3360 });3361 },3362 dequeue: function( type ) {3363 return this.each(function() {3364 jquery.dequeue( this, type );3365 });3366 },3367 // based off of the plugin by clint helfers, with permission.3368 // http://blindsignals.com/index.php/2009/07/jquery-delay/3369 delay: function( time, type ) {3370 time = jquery.fx ? jquery.fx.speeds[ time ] || time : time;3371 type = type || "fx";3372 return this.queue( type, function( next, hooks ) {3373 var timeout = settimeout( next, time );3374 hooks.stop = function() {3375 cleartimeout( timeout );3376 };3377 });3378 },3379 clearqueue: function( type ) {3380 return this.queue( type || "fx", [] );3381 },3382 // get a promise resolved when queues of a certain type3383 // are emptied (fx is the type by default)3384 promise: function( type, obj ) {3385 var tmp,3386 count = 1,3387 defer = jquery.deferred(),3388 elements = this,3389 i = this.length,3390 resolve = function() {3391 if ( !( --count ) ) {3392 defer.resolvewith( elements, [ elements ] );3393 }3394 };3395 if ( typeof type !== "string" ) {3396 obj = type;3397 type = undefined;3398 }3399 type = type || "fx";3400 while( i-- ) {3401 tmp = jquery._data( elements[ i ], type + "queuehooks" );3402 if ( tmp && tmp.empty ) {3403 count++;3404 tmp.empty.add( resolve );3405 }3406 }3407 resolve();3408 return defer.promise( obj );3409 }3410 });3411 var nodehook, boolhook,3412 rclass = /[\t\r\n\f]/g,3413 rreturn = /\r/g,3414 rfocusable = /^(?:input|select|textarea|button|object)$/i,3415 rclickable = /^(?:a|area)$/i,3416 rusedefault = /^(?:checked|selected)$/i,3417 getsetattribute = jquery.support.getsetattribute,3418 getsetinput = jquery.support.input;3419 jquery.fn.extend({3420 attr: function( name, value ) {3421 return jquery.access( this, jquery.attr, name, value, arguments.length > 1 );3422 },3423 removeattr: function( name ) {3424 return this.each(function() {3425 jquery.removeattr( this, name );3426 });3427 },3428 prop: function( name, value ) {3429 return jquery.access( this, jquery.prop, name, value, arguments.length > 1 );3430 },3431 removeprop: function( name ) {3432 name = jquery.propfix[ name ] || name;3433 return this.each(function() {3434 // try/catch handles cases where ie balks (such as removing a property on window)3435 try {3436 this[ name ] = undefined;3437 delete this[ name ];3438 } catch( e ) {}3439 });3440 },3441 addclass: function( value ) {3442 var classes, elem, cur, clazz, j,3443 i = 0,3444 len = this.length,3445 proceed = typeof value === "string" && value;3446 if ( jquery.isfunction( value ) ) {3447 return this.each(function( j ) {3448 jquery( this ).addclass( value.call( this, j, this.classname ) );3449 });3450 }3451 if ( proceed ) {3452 // the disjunction here is for better compressibility (see removeclass)3453 classes = ( value || "" ).match( core_rnotwhite ) || [];3454 for ( ; i < len; i++ ) {3455 elem = this[ i ];3456 cur = elem.nodetype === 1 && ( elem.classname ?3457 ( " " + elem.classname + " " ).replace( rclass, " " ) :3458 " "3459 );3460 if ( cur ) {3461 j = 0;3462 while ( (clazz = classes[j++]) ) {3463 if ( cur.indexof( " " + clazz + " " ) < 0 ) {3464 cur += clazz + " ";3465 }3466 }3467 elem.classname = jquery.trim( cur );3468 }3469 }3470 }3471 return this;3472 },3473 removeclass: function( value ) {3474 var classes, elem, cur, clazz, j,3475 i = 0,3476 len = this.length,3477 proceed = arguments.length === 0 || typeof value === "string" && value;3478 if ( jquery.isfunction( value ) ) {3479 return this.each(function( j ) {3480 jquery( this ).removeclass( value.call( this, j, this.classname ) );3481 });3482 }3483 if ( proceed ) {3484 classes = ( value || "" ).match( core_rnotwhite ) || [];3485 for ( ; i < len; i++ ) {3486 elem = this[ i ];3487 // this expression is here for better compressibility (see addclass)3488 cur = elem.nodetype === 1 && ( elem.classname ?3489 ( " " + elem.classname + " " ).replace( rclass, " " ) :3490 ""3491 );3492 if ( cur ) {3493 j = 0;3494 while ( (clazz = classes[j++]) ) {3495 // remove *all* instances3496 while ( cur.indexof( " " + clazz + " " ) >= 0 ) {3497 cur = cur.replace( " " + clazz + " ", " " );3498 }3499 }3500 elem.classname = value ? jquery.trim( cur ) : "";3501 }3502 }3503 }3504 return this;3505 },3506 toggleclass: function( value, stateval ) {3507 var type = typeof value;3508 if ( typeof stateval === "boolean" && type === "string" ) {3509 return stateval ? this.addclass( value ) : this.removeclass( value );3510 }3511 if ( jquery.isfunction( value ) ) {3512 return this.each(function( i ) {3513 jquery( this ).toggleclass( value.call(this, i, this.classname, stateval), stateval );3514 });3515 }3516 return this.each(function() {3517 if ( type === "string" ) {3518 // toggle individual class names3519 var classname,3520 i = 0,3521 self = jquery( this ),3522 classnames = value.match( core_rnotwhite ) || [];3523 while ( (classname = classnames[ i++ ]) ) {3524 // check each classname given, space separated list3525 if ( self.hasclass( classname ) ) {3526 self.removeclass( classname );3527 } else {3528 self.addclass( classname );3529 }3530 }3531 // toggle whole class name3532 } else if ( type === core_strundefined || type === "boolean" ) {3533 if ( this.classname ) {3534 // store classname if set3535 jquery._data( this, "__classname__", this.classname );3536 }3537 // if the element has a class name or if we're passed "false",3538 // then remove the whole classname (if there was one, the above saved it).3539 // otherwise bring back whatever was previously saved (if anything),3540 // falling back to the empty string if nothing was stored.3541 this.classname = this.classname || value === false ? "" : jquery._data( this, "__classname__" ) || "";3542 }3543 });3544 },3545 hasclass: function( selector ) {3546 var classname = " " + selector + " ",3547 i = 0,3548 l = this.length;3549 for ( ; i < l; i++ ) {3550 if ( this[i].nodetype === 1 && (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) >= 0 ) {3551 return true;3552 }3553 }3554 return false;3555 },3556 val: function( value ) {3557 var ret, hooks, isfunction,3558 elem = this[0];3559 if ( !arguments.length ) {3560 if ( elem ) {3561 hooks = jquery.valhooks[ elem.type ] || jquery.valhooks[ elem.nodename.tolowercase() ];3562 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {3563 return ret;3564 }3565 ret = elem.value;3566 return typeof ret === "string" ?3567 // handle most common string cases3568 ret.replace(rreturn, "") :3569 // handle cases where value is null/undef or number3570 ret == null ? "" : ret;3571 }3572 return;3573 }3574 isfunction = jquery.isfunction( value );3575 return this.each(function( i ) {3576 var val;3577 if ( this.nodetype !== 1 ) {3578 return;3579 }3580 if ( isfunction ) {3581 val = value.call( this, i, jquery( this ).val() );3582 } else {3583 val = value;3584 }3585 // treat null/undefined as ""; convert numbers to string3586 if ( val == null ) {3587 val = "";3588 } else if ( typeof val === "number" ) {3589 val += "";3590 } else if ( jquery.isarray( val ) ) {3591 val = jquery.map(val, function ( value ) {3592 return value == null ? "" : value + "";3593 });3594 }3595 hooks = jquery.valhooks[ this.type ] || jquery.valhooks[ this.nodename.tolowercase() ];3596 // if set returns undefined, fall back to normal setting3597 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {3598 this.value = val;3599 }3600 });3601 }3602 });3603 jquery.extend({3604 valhooks: {3605 option: {3606 get: function( elem ) {3607 // use proper attribute retrieval(#6932, #12072)3608 var val = jquery.find.attr( elem, "value" );3609 return val != null ?3610 val :3611 elem.text;3612 }3613 },3614 select: {3615 get: function( elem ) {3616 var value, option,3617 options = elem.options,3618 index = elem.selectedindex,3619 one = elem.type === "select-one" || index < 0,3620 values = one ? null : [],3621 max = one ? index + 1 : options.length,3622 i = index < 0 ?3623 max :3624 one ? index : 0;3625 // loop through all the selected options3626 for ( ; i < max; i++ ) {3627 option = options[ i ];3628 // oldie doesn't update selected after form reset (#2551)3629 if ( ( option.selected || i === index ) &&3630 // don't return options that are disabled or in a disabled optgroup3631 ( jquery.support.optdisabled ? !option.disabled : option.getattribute("disabled") === null ) &&3632 ( !option.parentnode.disabled || !jquery.nodename( option.parentnode, "optgroup" ) ) ) {3633 // get the specific value for the option3634 value = jquery( option ).val();3635 // we don't need an array for one selects3636 if ( one ) {3637 return value;3638 }3639 // multi-selects return an array3640 values.push( value );3641 }3642 }3643 return values;3644 },3645 set: function( elem, value ) {3646 var optionset, option,3647 options = elem.options,3648 values = jquery.makearray( value ),3649 i = options.length;3650 while ( i-- ) {3651 option = options[ i ];3652 if ( (option.selected = jquery.inarray( jquery(option).val(), values ) >= 0) ) {3653 optionset = true;3654 }3655 }3656 // force browsers to behave consistently when non-matching value is set3657 if ( !optionset ) {3658 elem.selectedindex = -1;3659 }3660 return values;3661 }3662 }3663 },3664 attr: function( elem, name, value ) {3665 var hooks, ret,3666 ntype = elem.nodetype;3667 // don't get/set attributes on text, comment and attribute nodes3668 if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) {3669 return;3670 }3671 // fallback to prop when attributes are not supported3672 if ( typeof elem.getattribute === core_strundefined ) {3673 return jquery.prop( elem, name, value );3674 }3675 // all attributes are lowercase3676 // grab necessary hook if one is defined3677 if ( ntype !== 1 || !jquery.isxmldoc( elem ) ) {3678 name = name.tolowercase();3679 hooks = jquery.attrhooks[ name ] ||3680 ( jquery.expr.match.bool.test( name ) ? boolhook : nodehook );3681 }3682 if ( value !== undefined ) {3683 if ( value === null ) {3684 jquery.removeattr( elem, name );3685 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {3686 return ret;3687 } else {3688 elem.setattribute( name, value + "" );3689 return value;3690 }3691 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {3692 return ret;3693 } else {3694 ret = jquery.find.attr( elem, name );3695 // non-existent attributes return null, we normalize to undefined3696 return ret == null ?3697 undefined :3698 ret;3699 }3700 },3701 removeattr: function( elem, value ) {3702 var name, propname,3703 i = 0,3704 attrnames = value && value.match( core_rnotwhite );3705 if ( attrnames && elem.nodetype === 1 ) {3706 while ( (name = attrnames[i++]) ) {3707 propname = jquery.propfix[ name ] || name;3708 // boolean attributes get special treatment (#10870)3709 if ( jquery.expr.match.bool.test( name ) ) {3710 // set corresponding property to false3711 if ( getsetinput && getsetattribute || !rusedefault.test( name ) ) {3712 elem[ propname ] = false;3713 // support: ie<93714 // also clear defaultchecked/defaultselected (if appropriate)3715 } else {3716 elem[ jquery.camelcase( "default-" + name ) ] =3717 elem[ propname ] = false;3718 }3719 // see #9699 for explanation of this approach (setting first, then removal)3720 } else {3721 jquery.attr( elem, name, "" );3722 }3723 elem.removeattribute( getsetattribute ? name : propname );3724 }3725 }3726 },3727 attrhooks: {3728 type: {3729 set: function( elem, value ) {3730 if ( !jquery.support.radiovalue && value === "radio" && jquery.nodename(elem, "input") ) {3731 // setting the type on a radio button after the value resets the value in ie6-93732 // reset value to default in case type is set after value during creation3733 var val = elem.value;3734 elem.setattribute( "type", value );3735 if ( val ) {3736 elem.value = val;3737 }3738 return value;3739 }3740 }3741 }3742 },3743 propfix: {3744 "for": "htmlfor",3745 "class": "classname"3746 },3747 prop: function( elem, name, value ) {3748 var ret, hooks, notxml,3749 ntype = elem.nodetype;3750 // don't get/set properties on text, comment and attribute nodes3751 if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) {3752 return;3753 }3754 notxml = ntype !== 1 || !jquery.isxmldoc( elem );3755 if ( notxml ) {3756 // fix name and attach hooks3757 name = jquery.propfix[ name ] || name;3758 hooks = jquery.prophooks[ name ];3759 }3760 if ( value !== undefined ) {3761 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?3762 ret :3763 ( elem[ name ] = value );3764 } else {3765 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?3766 ret :3767 elem[ name ];3768 }3769 },3770 prophooks: {3771 tabindex: {3772 get: function( elem ) {3773 // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set3774 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/3775 // use proper attribute retrieval(#12072)3776 var tabindex = jquery.find.attr( elem, "tabindex" );3777 return tabindex ?3778 parseint( tabindex, 10 ) :3779 rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ?3780 0 :3781 -1;3782 }3783 }3784 }3785 });3786// hooks for boolean attributes3787 boolhook = {3788 set: function( elem, value, name ) {3789 if ( value === false ) {3790 // remove boolean attributes when set to false3791 jquery.removeattr( elem, name );3792 } else if ( getsetinput && getsetattribute || !rusedefault.test( name ) ) {3793 // ie<8 needs the *property* name3794 elem.setattribute( !getsetattribute && jquery.propfix[ name ] || name, name );3795 // use defaultchecked and defaultselected for oldie3796 } else {3797 elem[ jquery.camelcase( "default-" + name ) ] = elem[ name ] = true;3798 }3799 return name;3800 }3801 };3802 jquery.each( jquery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {3803 var getter = jquery.expr.attrhandle[ name ] || jquery.find.attr;3804 jquery.expr.attrhandle[ name ] = getsetinput && getsetattribute || !rusedefault.test( name ) ?3805 function( elem, name, isxml ) {3806 var fn = jquery.expr.attrhandle[ name ],3807 ret = isxml ?3808 undefined :3809 /* jshint eqeqeq: false */3810 (jquery.expr.attrhandle[ name ] = undefined) !=3811 getter( elem, name, isxml ) ?3812 name.tolowercase() :3813 null;3814 jquery.expr.attrhandle[ name ] = fn;3815 return ret;3816 } :3817 function( elem, name, isxml ) {3818 return isxml ?3819 undefined :3820 elem[ jquery.camelcase( "default-" + name ) ] ?3821 name.tolowercase() :3822 null;3823 };3824 });3825// fix oldie attroperties3826 if ( !getsetinput || !getsetattribute ) {3827 jquery.attrhooks.value = {3828 set: function( elem, value, name ) {3829 if ( jquery.nodename( elem, "input" ) ) {3830 // does not return so that setattribute is also used3831 elem.defaultvalue = value;3832 } else {3833 // use nodehook if defined (#1954); otherwise setattribute is fine3834 return nodehook && nodehook.set( elem, value, name );3835 }3836 }3837 };3838 }3839// ie6/7 do not support getting/setting some attributes with get/setattribute3840 if ( !getsetattribute ) {3841 // use this for any attribute in ie6/73842 // this fixes almost every ie6/7 issue3843 nodehook = {3844 set: function( elem, value, name ) {3845 // set the existing or create a new attribute node3846 var ret = elem.getattributenode( name );3847 if ( !ret ) {3848 elem.setattributenode(3849 (ret = elem.ownerdocument.createattribute( name ))3850 );3851 }3852 ret.value = value += "";3853 // break association with cloned elements by also using setattribute (#9646)3854 return name === "value" || value === elem.getattribute( name ) ?3855 value :3856 undefined;3857 }3858 };3859 jquery.expr.attrhandle.id = jquery.expr.attrhandle.name = jquery.expr.attrhandle.coords =3860 // some attributes are constructed with empty-string values when not defined3861 function( elem, name, isxml ) {3862 var ret;3863 return isxml ?3864 undefined :3865 (ret = elem.getattributenode( name )) && ret.value !== "" ?3866 ret.value :3867 null;3868 };3869 jquery.valhooks.button = {3870 get: function( elem, name ) {3871 var ret = elem.getattributenode( name );3872 return ret && ret.specified ?3873 ret.value :3874 undefined;3875 },3876 set: nodehook.set3877 };3878 // set contenteditable to false on removals(#10429)3879 // setting to empty string throws an error as an invalid value3880 jquery.attrhooks.contenteditable = {3881 set: function( elem, value, name ) {3882 nodehook.set( elem, value === "" ? false : value, name );3883 }3884 };3885 // set width and height to auto instead of 0 on empty string( bug #8150 )3886 // this is for removals3887 jquery.each([ "width", "height" ], function( i, name ) {3888 jquery.attrhooks[ name ] = {3889 set: function( elem, value ) {3890 if ( value === "" ) {3891 elem.setattribute( name, "auto" );3892 return value;3893 }3894 }3895 };3896 });3897 }3898// some attributes require a special call on ie3899// http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx3900 if ( !jquery.support.hrefnormalized ) {3901 // href/src property should get the full normalized url (#10299/#12915)3902 jquery.each([ "href", "src" ], function( i, name ) {3903 jquery.prophooks[ name ] = {3904 get: function( elem ) {3905 return elem.getattribute( name, 4 );3906 }3907 };3908 });3909 }3910 if ( !jquery.support.style ) {3911 jquery.attrhooks.style = {3912 get: function( elem ) {3913 // return undefined in the case of empty string3914 // note: ie uppercases css property names, but if we were to .tolowercase()3915 // .csstext, that would destroy case senstitivity in url's, like in "background"3916 return elem.style.csstext || undefined;3917 },3918 set: function( elem, value ) {3919 return ( elem.style.csstext = value + "" );3920 }3921 };3922 }3923// safari mis-reports the default selected property of an option3924// accessing the parent's selectedindex property fixes it3925 if ( !jquery.support.optselected ) {3926 jquery.prophooks.selected = {3927 get: function( elem ) {3928 var parent = elem.parentnode;3929 if ( parent ) {3930 parent.selectedindex;3931 // make sure that it also works with optgroups, see #57013932 if ( parent.parentnode ) {3933 parent.parentnode.selectedindex;3934 }3935 }3936 return null;3937 }3938 };3939 }3940 jquery.each([3941 "tabindex",3942 "readonly",3943 "maxlength",3944 "cellspacing",3945 "cellpadding",3946 "rowspan",3947 "colspan",3948 "usemap",3949 "frameborder",3950 "contenteditable"3951 ], function() {3952 jquery.propfix[ this.tolowercase() ] = this;3953 });3954// ie6/7 call enctype encoding3955 if ( !jquery.support.enctype ) {3956 jquery.propfix.enctype = "encoding";3957 }3958// radios and checkboxes getter/setter3959 jquery.each([ "radio", "checkbox" ], function() {3960 jquery.valhooks[ this ] = {3961 set: function( elem, value ) {3962 if ( jquery.isarray( value ) ) {3963 return ( elem.checked = jquery.inarray( jquery(elem).val(), value ) >= 0 );3964 }3965 }3966 };3967 if ( !jquery.support.checkon ) {3968 jquery.valhooks[ this ].get = function( elem ) {3969 // support: webkit3970 // "" is returned instead of "on" if a value isn't specified3971 return elem.getattribute("value") === null ? "on" : elem.value;3972 };3973 }3974 });3975 var rformelems = /^(?:input|select|textarea)$/i,3976 rkeyevent = /^key/,3977 rmouseevent = /^(?:mouse|contextmenu)|click/,3978 rfocusmorph = /^(?:focusinfocus|focusoutblur)$/,3979 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;3980 function returntrue() {3981 return true;3982 }3983 function returnfalse() {3984 return false;3985 }3986 function safeactiveelement() {3987 try {3988 return document.activeelement;3989 } catch ( err ) { }3990 }3991 /*3992 * helper functions for managing events -- not part of the public interface.3993 * props to dean edwards' addevent library for many of the ideas.3994 */3995 jquery.event = {3996 global: {},3997 add: function( elem, types, handler, data, selector ) {3998 var tmp, events, t, handleobjin,3999 special, eventhandle, handleobj,4000 handlers, type, namespaces, origtype,4001 elemdata = jquery._data( elem );4002 // don't attach events to nodata or text/comment nodes (but allow plain objects)4003 if ( !elemdata ) {4004 return;4005 }4006 // caller can pass in an object of custom data in lieu of the handler4007 if ( handler.handler ) {4008 handleobjin = handler;4009 handler = handleobjin.handler;4010 selector = handleobjin.selector;4011 }4012 // make sure that the handler has a unique id, used to find/remove it later4013 if ( !handler.guid ) {4014 handler.guid = jquery.guid++;4015 }4016 // init the element's event structure and main handler, if this is the first4017 if ( !(events = elemdata.events) ) {4018 events = elemdata.events = {};4019 }4020 if ( !(eventhandle = elemdata.handle) ) {4021 eventhandle = elemdata.handle = function( e ) {4022 // discard the second event of a jquery.event.trigger() and4023 // when an event is called after a page has unloaded4024 return typeof jquery !== core_strundefined && (!e || jquery.event.triggered !== e.type) ?4025 jquery.event.dispatch.apply( eventhandle.elem, arguments ) :4026 undefined;4027 };4028 // add elem as a property of the handle fn to prevent a memory leak with ie non-native events4029 eventhandle.elem = elem;4030 }4031 // handle multiple events separated by a space4032 types = ( types || "" ).match( core_rnotwhite ) || [""];4033 t = types.length;4034 while ( t-- ) {4035 tmp = rtypenamespace.exec( types[t] ) || [];4036 type = origtype = tmp[1];4037 namespaces = ( tmp[2] || "" ).split( "." ).sort();4038 // there *must* be a type, no attaching namespace-only handlers4039 if ( !type ) {4040 continue;4041 }4042 // if event changes its type, use the special event handlers for the changed type4043 special = jquery.event.special[ type ] || {};4044 // if selector defined, determine special event api type, otherwise given type4045 type = ( selector ? special.delegatetype : special.bindtype ) || type;4046 // update special based on newly reset type4047 special = jquery.event.special[ type ] || {};4048 // handleobj is passed to all event handlers4049 handleobj = jquery.extend({4050 type: type,4051 origtype: origtype,4052 data: data,4053 handler: handler,4054 guid: handler.guid,4055 selector: selector,4056 needscontext: selector && jquery.expr.match.needscontext.test( selector ),4057 namespace: namespaces.join(".")4058 }, handleobjin );4059 // init the event handler queue if we're the first4060 if ( !(handlers = events[ type ]) ) {4061 handlers = events[ type ] = [];4062 handlers.delegatecount = 0;4063 // only use addeventlistener/attachevent if the special events handler returns false4064 if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) {4065 // bind the global event handler to the element4066 if ( elem.addeventlistener ) {4067 elem.addeventlistener( type, eventhandle, false );4068 } else if ( elem.attachevent ) {4069 elem.attachevent( "on" + type, eventhandle );4070 }4071 }4072 }4073 if ( special.add ) {4074 special.add.call( elem, handleobj );4075 if ( !handleobj.handler.guid ) {4076 handleobj.handler.guid = handler.guid;4077 }4078 }4079 // add to the element's handler list, delegates in front4080 if ( selector ) {4081 handlers.splice( handlers.delegatecount++, 0, handleobj );4082 } else {4083 handlers.push( handleobj );4084 }4085 // keep track of which events have ever been used, for event optimization4086 jquery.event.global[ type ] = true;4087 }4088 // nullify elem to prevent memory leaks in ie4089 elem = null;4090 },4091 // detach an event or set of events from an element4092 remove: function( elem, types, handler, selector, mappedtypes ) {4093 var j, handleobj, tmp,4094 origcount, t, events,4095 special, handlers, type,4096 namespaces, origtype,4097 elemdata = jquery.hasdata( elem ) && jquery._data( elem );4098 if ( !elemdata || !(events = elemdata.events) ) {4099 return;4100 }4101 // once for each type.namespace in types; type may be omitted4102 types = ( types || "" ).match( core_rnotwhite ) || [""];4103 t = types.length;4104 while ( t-- ) {4105 tmp = rtypenamespace.exec( types[t] ) || [];4106 type = origtype = tmp[1];4107 namespaces = ( tmp[2] || "" ).split( "." ).sort();4108 // unbind all events (on this namespace, if provided) for the element4109 if ( !type ) {4110 for ( type in events ) {4111 jquery.event.remove( elem, type + types[ t ], handler, selector, true );4112 }4113 continue;4114 }4115 special = jquery.event.special[ type ] || {};4116 type = ( selector ? special.delegatetype : special.bindtype ) || type;4117 handlers = events[ type ] || [];4118 tmp = tmp[2] && new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );4119 // remove matching events4120 origcount = j = handlers.length;4121 while ( j-- ) {4122 handleobj = handlers[ j ];4123 if ( ( mappedtypes || origtype === handleobj.origtype ) &&4124 ( !handler || handler.guid === handleobj.guid ) &&4125 ( !tmp || tmp.test( handleobj.namespace ) ) &&4126 ( !selector || selector === handleobj.selector || selector === "**" && handleobj.selector ) ) {4127 handlers.splice( j, 1 );4128 if ( handleobj.selector ) {4129 handlers.delegatecount--;4130 }4131 if ( special.remove ) {4132 special.remove.call( elem, handleobj );4133 }4134 }4135 }4136 // remove generic event handler if we removed something and no more handlers exist4137 // (avoids potential for endless recursion during removal of special event handlers)4138 if ( origcount && !handlers.length ) {4139 if ( !special.teardown || special.teardown.call( elem, namespaces, elemdata.handle ) === false ) {4140 jquery.removeevent( elem, type, elemdata.handle );4141 }4142 delete events[ type ];4143 }4144 }4145 // remove the expando if it's no longer used4146 if ( jquery.isemptyobject( events ) ) {4147 delete elemdata.handle;4148 // removedata also checks for emptiness and clears the expando if empty4149 // so use it instead of delete4150 jquery._removedata( elem, "events" );4151 }4152 },4153 trigger: function( event, data, elem, onlyhandlers ) {4154 var handle, ontype, cur,4155 bubbletype, special, tmp, i,4156 eventpath = [ elem || document ],4157 type = core_hasown.call( event, "type" ) ? event.type : event,4158 namespaces = core_hasown.call( event, "namespace" ) ? event.namespace.split(".") : [];4159 cur = tmp = elem = elem || document;4160 // don't do events on text and comment nodes4161 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {4162 return;4163 }4164 // focus/blur morphs to focusin/out; ensure we're not firing them right now4165 if ( rfocusmorph.test( type + jquery.event.triggered ) ) {4166 return;4167 }4168 if ( type.indexof(".") >= 0 ) {4169 // namespaced trigger; create a regexp to match event type in handle()4170 namespaces = type.split(".");4171 type = namespaces.shift();4172 namespaces.sort();4173 }4174 ontype = type.indexof(":") < 0 && "on" + type;4175 // caller can pass in a jquery.event object, object, or just an event type string4176 event = event[ jquery.expando ] ?4177 event :4178 new jquery.event( type, typeof event === "object" && event );4179 // trigger bitmask: & 1 for native handlers; & 2 for jquery (always true)4180 event.istrigger = onlyhandlers ? 2 : 3;4181 event.namespace = namespaces.join(".");4182 event.namespace_re = event.namespace ?4183 new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :4184 null;4185 // clean up the event in case it is being reused4186 event.result = undefined;4187 if ( !event.target ) {4188 event.target = elem;4189 }4190 // clone any incoming data and prepend the event, creating the handler arg list4191 data = data == null ?4192 [ event ] :4193 jquery.makearray( data, [ event ] );4194 // allow special events to draw outside the lines4195 special = jquery.event.special[ type ] || {};4196 if ( !onlyhandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {4197 return;4198 }4199 // determine event propagation path in advance, per w3c events spec (#9951)4200 // bubble up to document, then to window; watch for a global ownerdocument var (#9724)4201 if ( !onlyhandlers && !special.nobubble && !jquery.iswindow( elem ) ) {4202 bubbletype = special.delegatetype || type;4203 if ( !rfocusmorph.test( bubbletype + type ) ) {4204 cur = cur.parentnode;4205 }4206 for ( ; cur; cur = cur.parentnode ) {4207 eventpath.push( cur );4208 tmp = cur;4209 }4210 // only add window if we got to document (e.g., not plain obj or detached dom)4211 if ( tmp === (elem.ownerdocument || document) ) {4212 eventpath.push( tmp.defaultview || tmp.parentwindow || window );4213 }4214 }4215 // fire handlers on the event path4216 i = 0;4217 while ( (cur = eventpath[i++]) && !event.ispropagationstopped() ) {4218 event.type = i > 1 ?4219 bubbletype :4220 special.bindtype || type;4221 // jquery handler4222 handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" );4223 if ( handle ) {4224 handle.apply( cur, data );4225 }4226 // native handler4227 handle = ontype && cur[ ontype ];4228 if ( handle && jquery.acceptdata( cur ) && handle.apply && handle.apply( cur, data ) === false ) {4229 event.preventdefault();4230 }4231 }4232 event.type = type;4233 // if nobody prevented the default action, do it now4234 if ( !onlyhandlers && !event.isdefaultprevented() ) {4235 if ( (!special._default || special._default.apply( eventpath.pop(), data ) === false) &&4236 jquery.acceptdata( elem ) ) {4237 // call a native dom method on the target with the same name name as the event.4238 // can't use an .isfunction() check here because ie6/7 fails that test.4239 // don't do default actions on window, that's where global variables be (#6170)4240 if ( ontype && elem[ type ] && !jquery.iswindow( elem ) ) {4241 // don't re-trigger an onfoo event when we call its foo() method4242 tmp = elem[ ontype ];4243 if ( tmp ) {4244 elem[ ontype ] = null;4245 }4246 // prevent re-triggering of the same event, since we already bubbled it above4247 jquery.event.triggered = type;4248 try {4249 elem[ type ]();4250 } catch ( e ) {4251 // ie<9 dies on focus/blur to hidden element (#1486,#12518)4252 // only reproducible on winxp ie8 native, not ie9 in ie8 mode4253 }4254 jquery.event.triggered = undefined;4255 if ( tmp ) {4256 elem[ ontype ] = tmp;4257 }4258 }4259 }4260 }4261 return event.result;4262 },4263 dispatch: function( event ) {4264 // make a writable jquery.event from the native event object4265 event = jquery.event.fix( event );4266 var i, ret, handleobj, matched, j,4267 handlerqueue = [],4268 args = core_slice.call( arguments ),4269 handlers = ( jquery._data( this, "events" ) || {} )[ event.type ] || [],4270 special = jquery.event.special[ event.type ] || {};4271 // use the fix-ed jquery.event rather than the (read-only) native event4272 args[0] = event;4273 event.delegatetarget = this;4274 // call the predispatch hook for the mapped type, and let it bail if desired4275 if ( special.predispatch && special.predispatch.call( this, event ) === false ) {4276 return;4277 }4278 // determine handlers4279 handlerqueue = jquery.event.handlers.call( this, event, handlers );4280 // run delegates first; they may want to stop propagation beneath us4281 i = 0;4282 while ( (matched = handlerqueue[ i++ ]) && !event.ispropagationstopped() ) {4283 event.currenttarget = matched.elem;4284 j = 0;4285 while ( (handleobj = matched.handlers[ j++ ]) && !event.isimmediatepropagationstopped() ) {4286 // triggered event must either 1) have no namespace, or4287 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).4288 if ( !event.namespace_re || event.namespace_re.test( handleobj.namespace ) ) {4289 event.handleobj = handleobj;4290 event.data = handleobj.data;4291 ret = ( (jquery.event.special[ handleobj.origtype ] || {}).handle || handleobj.handler )4292 .apply( matched.elem, args );4293 if ( ret !== undefined ) {4294 if ( (event.result = ret) === false ) {4295 event.preventdefault();4296 event.stoppropagation();4297 }4298 }4299 }4300 }4301 }4302 // call the postdispatch hook for the mapped type4303 if ( special.postdispatch ) {4304 special.postdispatch.call( this, event );4305 }4306 return event.result;4307 },4308 handlers: function( event, handlers ) {4309 var sel, handleobj, matches, i,4310 handlerqueue = [],4311 delegatecount = handlers.delegatecount,4312 cur = event.target;4313 // find delegate handlers4314 // black-hole svg <use> instance trees (#13180)4315 // avoid non-left-click bubbling in firefox (#3861)4316 if ( delegatecount && cur.nodetype && (!event.button || event.type !== "click") ) {4317 /* jshint eqeqeq: false */4318 for ( ; cur != this; cur = cur.parentnode || this ) {4319 /* jshint eqeqeq: true */4320 // don't check non-elements (#13208)4321 // don't process clicks on disabled elements (#6911, #8165, #11382, #11764)4322 if ( cur.nodetype === 1 && (cur.disabled !== true || event.type !== "click") ) {4323 matches = [];4324 for ( i = 0; i < delegatecount; i++ ) {4325 handleobj = handlers[ i ];4326 // don't conflict with object.prototype properties (#13203)4327 sel = handleobj.selector + " ";4328 if ( matches[ sel ] === undefined ) {4329 matches[ sel ] = handleobj.needscontext ?4330 jquery( sel, this ).index( cur ) >= 0 :4331 jquery.find( sel, this, null, [ cur ] ).length;4332 }4333 if ( matches[ sel ] ) {4334 matches.push( handleobj );4335 }4336 }4337 if ( matches.length ) {4338 handlerqueue.push({ elem: cur, handlers: matches });4339 }4340 }4341 }4342 }4343 // add the remaining (directly-bound) handlers4344 if ( delegatecount < handlers.length ) {4345 handlerqueue.push({ elem: this, handlers: handlers.slice( delegatecount ) });4346 }4347 return handlerqueue;4348 },4349 fix: function( event ) {4350 if ( event[ jquery.expando ] ) {4351 return event;4352 }4353 // create a writable copy of the event object and normalize some properties4354 var i, prop, copy,4355 type = event.type,4356 originalevent = event,4357 fixhook = this.fixhooks[ type ];4358 if ( !fixhook ) {4359 this.fixhooks[ type ] = fixhook =4360 rmouseevent.test( type ) ? this.mousehooks :4361 rkeyevent.test( type ) ? this.keyhooks :4362 {};4363 }4364 copy = fixhook.props ? this.props.concat( fixhook.props ) : this.props;4365 event = new jquery.event( originalevent );4366 i = copy.length;4367 while ( i-- ) {4368 prop = copy[ i ];4369 event[ prop ] = originalevent[ prop ];4370 }4371 // support: ie<94372 // fix target property (#1925)4373 if ( !event.target ) {4374 event.target = originalevent.srcelement || document;4375 }4376 // support: chrome 23+, safari?4377 // target should not be a text node (#504, #13143)4378 if ( event.target.nodetype === 3 ) {4379 event.target = event.target.parentnode;4380 }4381 // support: ie<94382 // for mouse/key events, metakey==false if it's undefined (#3368, #11328)4383 event.metakey = !!event.metakey;4384 return fixhook.filter ? fixhook.filter( event, originalevent ) : event;4385 },4386 // includes some event props shared by keyevent and mouseevent4387 props: "altkey bubbles cancelable ctrlkey currenttarget eventphase metakey relatedtarget shiftkey target timestamp view which".split(" "),4388 fixhooks: {},4389 keyhooks: {4390 props: "char charcode key keycode".split(" "),4391 filter: function( event, original ) {4392 // add which for key events4393 if ( event.which == null ) {4394 event.which = original.charcode != null ? original.charcode : original.keycode;4395 }4396 return event;4397 }4398 },4399 mousehooks: {4400 props: "button buttons clientx clienty fromelement offsetx offsety pagex pagey screenx screeny toelement".split(" "),4401 filter: function( event, original ) {4402 var body, eventdoc, doc,4403 button = original.button,4404 fromelement = original.fromelement;4405 // calculate pagex/y if missing and clientx/y available4406 if ( event.pagex == null && original.clientx != null ) {4407 eventdoc = event.target.ownerdocument || document;4408 doc = eventdoc.documentelement;4409 body = eventdoc.body;4410 event.pagex = original.clientx + ( doc && doc.scrollleft || body && body.scrollleft || 0 ) - ( doc && doc.clientleft || body && body.clientleft || 0 );4411 event.pagey = original.clienty + ( doc && doc.scrolltop || body && body.scrolltop || 0 ) - ( doc && doc.clienttop || body && body.clienttop || 0 );4412 }4413 // add relatedtarget, if necessary4414 if ( !event.relatedtarget && fromelement ) {4415 event.relatedtarget = fromelement === event.target ? original.toelement : fromelement;4416 }4417 // add which for click: 1 === left; 2 === middle; 3 === right4418 // note: button is not normalized, so don't use it4419 if ( !event.which && button !== undefined ) {4420 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );4421 }4422 return event;4423 }4424 },4425 special: {4426 load: {4427 // prevent triggered image.load events from bubbling to window.load4428 nobubble: true4429 },4430 focus: {4431 // fire native event if possible so blur/focus sequence is correct4432 trigger: function() {4433 if ( this !== safeactiveelement() && this.focus ) {4434 try {4435 this.focus();4436 return false;4437 } catch ( e ) {4438 // support: ie<94439 // if we error on focus to hidden element (#1486, #12518),4440 // let .trigger() run the handlers4441 }4442 }4443 },4444 delegatetype: "focusin"4445 },4446 blur: {4447 trigger: function() {4448 if ( this === safeactiveelement() && this.blur ) {4449 this.blur();4450 return false;4451 }4452 },4453 delegatetype: "focusout"4454 },4455 click: {4456 // for checkbox, fire native event so checked state will be right4457 trigger: function() {4458 if ( jquery.nodename( this, "input" ) && this.type === "checkbox" && this.click ) {4459 this.click();4460 return false;4461 }4462 },4463 // for cross-browser consistency, don't fire native .click() on links4464 _default: function( event ) {4465 return jquery.nodename( event.target, "a" );4466 }4467 },4468 beforeunload: {4469 postdispatch: function( event ) {4470 // even when returnvalue equals to undefined firefox will still show alert4471 if ( event.result !== undefined ) {4472 event.originalevent.returnvalue = event.result;4473 }4474 }4475 }4476 },4477 simulate: function( type, elem, event, bubble ) {4478 // piggyback on a donor event to simulate a different one.4479 // fake originalevent to avoid donor's stoppropagation, but if the4480 // simulated event prevents default then we do the same on the donor.4481 var e = jquery.extend(4482 new jquery.event(),4483 event,4484 {4485 type: type,4486 issimulated: true,4487 originalevent: {}4488 }4489 );4490 if ( bubble ) {4491 jquery.event.trigger( e, null, elem );4492 } else {4493 jquery.event.dispatch.call( elem, e );4494 }4495 if ( e.isdefaultprevented() ) {4496 event.preventdefault();4497 }4498 }4499 };4500 jquery.removeevent = document.removeeventlistener ?4501 function( elem, type, handle ) {4502 if ( elem.removeeventlistener ) {4503 elem.removeeventlistener( type, handle, false );4504 }4505 } :4506 function( elem, type, handle ) {4507 var name = "on" + type;4508 if ( elem.detachevent ) {4509 // #8545, #7054, preventing memory leaks for custom events in ie6-84510 // detachevent needed property on element, by name of that event, to properly expose it to gc4511 if ( typeof elem[ name ] === core_strundefined ) {4512 elem[ name ] = null;4513 }4514 elem.detachevent( name, handle );4515 }4516 };4517 jquery.event = function( src, props ) {4518 // allow instantiation without the 'new' keyword4519 if ( !(this instanceof jquery.event) ) {4520 return new jquery.event( src, props );4521 }4522 // event object4523 if ( src && src.type ) {4524 this.originalevent = src;4525 this.type = src.type;4526 // events bubbling up the document may have been marked as prevented4527 // by a handler lower down the tree; reflect the correct value.4528 this.isdefaultprevented = ( src.defaultprevented || src.returnvalue === false ||4529 src.getpreventdefault && src.getpreventdefault() ) ? returntrue : returnfalse;4530 // event type4531 } else {4532 this.type = src;4533 }4534 // put explicitly provided properties onto the event object4535 if ( props ) {4536 jquery.extend( this, props );4537 }4538 // create a timestamp if incoming event doesn't have one4539 this.timestamp = src && src.timestamp || jquery.now();4540 // mark it as fixed4541 this[ jquery.expando ] = true;4542 };4543// jquery.event is based on dom3 events as specified by the ecmascript language binding4544// http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html4545 jquery.event.prototype = {4546 isdefaultprevented: returnfalse,4547 ispropagationstopped: returnfalse,4548 isimmediatepropagationstopped: returnfalse,4549 preventdefault: function() {4550 var e = this.originalevent;4551 this.isdefaultprevented = returntrue;4552 if ( !e ) {4553 return;4554 }4555 // if preventdefault exists, run it on the original event4556 if ( e.preventdefault ) {4557 e.preventdefault();4558 // support: ie4559 // otherwise set the returnvalue property of the original event to false4560 } else {4561 e.returnvalue = false;4562 }4563 },4564 stoppropagation: function() {4565 var e = this.originalevent;4566 this.ispropagationstopped = returntrue;4567 if ( !e ) {4568 return;4569 }4570 // if stoppropagation exists, run it on the original event4571 if ( e.stoppropagation ) {4572 e.stoppropagation();4573 }4574 // support: ie4575 // set the cancelbubble property of the original event to true4576 e.cancelbubble = true;4577 },4578 stopimmediatepropagation: function() {4579 this.isimmediatepropagationstopped = returntrue;4580 this.stoppropagation();4581 }4582 };4583// create mouseenter/leave events using mouseover/out and event-time checks4584 jquery.each({4585 mouseenter: "mouseover",4586 mouseleave: "mouseout"4587 }, function( orig, fix ) {4588 jquery.event.special[ orig ] = {4589 delegatetype: fix,4590 bindtype: fix,4591 handle: function( event ) {4592 var ret,4593 target = this,4594 related = event.relatedtarget,4595 handleobj = event.handleobj;4596 // for mousenter/leave call the handler if related is outside the target.4597 // nb: no relatedtarget if the mouse left/entered the browser window4598 if ( !related || (related !== target && !jquery.contains( target, related )) ) {4599 event.type = handleobj.origtype;4600 ret = handleobj.handler.apply( this, arguments );4601 event.type = fix;4602 }4603 return ret;4604 }4605 };4606 });4607// ie submit delegation4608 if ( !jquery.support.submitbubbles ) {4609 jquery.event.special.submit = {4610 setup: function() {4611 // only need this for delegated form submit events4612 if ( jquery.nodename( this, "form" ) ) {4613 return false;4614 }4615 // lazy-add a submit handler when a descendant form may potentially be submitted4616 jquery.event.add( this, "click._submit keypress._submit", function( e ) {4617 // node name check avoids a vml-related crash in ie (#9807)4618 var elem = e.target,4619 form = jquery.nodename( elem, "input" ) || jquery.nodename( elem, "button" ) ? elem.form : undefined;4620 if ( form && !jquery._data( form, "submitbubbles" ) ) {4621 jquery.event.add( form, "submit._submit", function( event ) {4622 event._submit_bubble = true;4623 });4624 jquery._data( form, "submitbubbles", true );4625 }4626 });4627 // return undefined since we don't need an event listener4628 },4629 postdispatch: function( event ) {4630 // if form was submitted by the user, bubble the event up the tree4631 if ( event._submit_bubble ) {4632 delete event._submit_bubble;4633 if ( this.parentnode && !event.istrigger ) {4634 jquery.event.simulate( "submit", this.parentnode, event, true );4635 }4636 }4637 },4638 teardown: function() {4639 // only need this for delegated form submit events4640 if ( jquery.nodename( this, "form" ) ) {4641 return false;4642 }4643 // remove delegated handlers; cleandata eventually reaps submit handlers attached above4644 jquery.event.remove( this, "._submit" );4645 }4646 };4647 }4648// ie change delegation and checkbox/radio fix4649 if ( !jquery.support.changebubbles ) {4650 jquery.event.special.change = {4651 setup: function() {4652 if ( rformelems.test( this.nodename ) ) {4653 // ie doesn't fire change on a check/radio until blur; trigger it on click4654 // after a propertychange. eat the blur-change in special.change.handle.4655 // this still fires onchange a second time for check/radio after blur.4656 if ( this.type === "checkbox" || this.type === "radio" ) {4657 jquery.event.add( this, "propertychange._change", function( event ) {4658 if ( event.originalevent.propertyname === "checked" ) {4659 this._just_changed = true;4660 }4661 });4662 jquery.event.add( this, "click._change", function( event ) {4663 if ( this._just_changed && !event.istrigger ) {4664 this._just_changed = false;4665 }4666 // allow triggered, simulated change events (#11500)4667 jquery.event.simulate( "change", this, event, true );4668 });4669 }4670 return false;4671 }4672 // delegated event; lazy-add a change handler on descendant inputs4673 jquery.event.add( this, "beforeactivate._change", function( e ) {4674 var elem = e.target;4675 if ( rformelems.test( elem.nodename ) && !jquery._data( elem, "changebubbles" ) ) {4676 jquery.event.add( elem, "change._change", function( event ) {4677 if ( this.parentnode && !event.issimulated && !event.istrigger ) {4678 jquery.event.simulate( "change", this.parentnode, event, true );4679 }4680 });4681 jquery._data( elem, "changebubbles", true );4682 }4683 });4684 },4685 handle: function( event ) {4686 var elem = event.target;4687 // swallow native change events from checkbox/radio, we already triggered them above4688 if ( this !== elem || event.issimulated || event.istrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {4689 return event.handleobj.handler.apply( this, arguments );4690 }4691 },4692 teardown: function() {4693 jquery.event.remove( this, "._change" );4694 return !rformelems.test( this.nodename );4695 }4696 };4697 }4698// create "bubbling" focus and blur events4699 if ( !jquery.support.focusinbubbles ) {4700 jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {4701 // attach a single capturing handler while someone wants focusin/focusout4702 var attaches = 0,4703 handler = function( event ) {4704 jquery.event.simulate( fix, event.target, jquery.event.fix( event ), true );4705 };4706 jquery.event.special[ fix ] = {4707 setup: function() {4708 if ( attaches++ === 0 ) {4709 document.addeventlistener( orig, handler, true );4710 }4711 },4712 teardown: function() {4713 if ( --attaches === 0 ) {4714 document.removeeventlistener( orig, handler, true );4715 }4716 }4717 };4718 });4719 }4720 jquery.fn.extend({4721 on: function( types, selector, data, fn, /*internal*/ one ) {4722 var type, origfn;4723 // types can be a map of types/handlers4724 if ( typeof types === "object" ) {4725 // ( types-object, selector, data )4726 if ( typeof selector !== "string" ) {4727 // ( types-object, data )4728 data = data || selector;4729 selector = undefined;4730 }4731 for ( type in types ) {4732 this.on( type, selector, data, types[ type ], one );4733 }4734 return this;4735 }4736 if ( data == null && fn == null ) {4737 // ( types, fn )4738 fn = selector;4739 data = selector = undefined;4740 } else if ( fn == null ) {4741 if ( typeof selector === "string" ) {4742 // ( types, selector, fn )4743 fn = data;4744 data = undefined;4745 } else {4746 // ( types, data, fn )4747 fn = data;4748 data = selector;4749 selector = undefined;4750 }4751 }4752 if ( fn === false ) {4753 fn = returnfalse;4754 } else if ( !fn ) {4755 return this;4756 }4757 if ( one === 1 ) {4758 origfn = fn;4759 fn = function( event ) {4760 // can use an empty set, since event contains the info4761 jquery().off( event );4762 return origfn.apply( this, arguments );4763 };4764 // use same guid so caller can remove using origfn4765 fn.guid = origfn.guid || ( origfn.guid = jquery.guid++ );4766 }4767 return this.each( function() {4768 jquery.event.add( this, types, fn, data, selector );4769 });4770 },4771 one: function( types, selector, data, fn ) {4772 return this.on( types, selector, data, fn, 1 );4773 },4774 off: function( types, selector, fn ) {4775 var handleobj, type;4776 if ( types && types.preventdefault && types.handleobj ) {4777 // ( event ) dispatched jquery.event4778 handleobj = types.handleobj;4779 jquery( types.delegatetarget ).off(4780 handleobj.namespace ? handleobj.origtype + "." + handleobj.namespace : handleobj.origtype,4781 handleobj.selector,4782 handleobj.handler4783 );4784 return this;4785 }4786 if ( typeof types === "object" ) {4787 // ( types-object [, selector] )4788 for ( type in types ) {4789 this.off( type, selector, types[ type ] );4790 }4791 return this;4792 }4793 if ( selector === false || typeof selector === "function" ) {4794 // ( types [, fn] )4795 fn = selector;4796 selector = undefined;4797 }4798 if ( fn === false ) {4799 fn = returnfalse;4800 }4801 return this.each(function() {4802 jquery.event.remove( this, types, fn, selector );4803 });4804 },4805 trigger: function( type, data ) {4806 return this.each(function() {4807 jquery.event.trigger( type, data, this );4808 });4809 },4810 triggerhandler: function( type, data ) {4811 var elem = this[0];4812 if ( elem ) {4813 return jquery.event.trigger( type, data, elem, true );4814 }4815 }4816 });4817 var issimple = /^.[^:#\[\.,]*$/,4818 rparentsprev = /^(?:parents|prev(?:until|all))/,4819 rneedscontext = jquery.expr.match.needscontext,4820 // methods guaranteed to produce a unique set when starting from a unique set4821 guaranteedunique = {4822 children: true,4823 contents: true,4824 next: true,4825 prev: true4826 };4827 jquery.fn.extend({4828 find: function( selector ) {4829 var i,4830 ret = [],4831 self = this,4832 len = self.length;4833 if ( typeof selector !== "string" ) {4834 return this.pushstack( jquery( selector ).filter(function() {4835 for ( i = 0; i < len; i++ ) {4836 if ( jquery.contains( self[ i ], this ) ) {4837 return true;4838 }4839 }4840 }) );4841 }4842 for ( i = 0; i < len; i++ ) {4843 jquery.find( selector, self[ i ], ret );4844 }4845 // needed because $( selector, context ) becomes $( context ).find( selector )4846 ret = this.pushstack( len > 1 ? jquery.unique( ret ) : ret );4847 ret.selector = this.selector ? this.selector + " " + selector : selector;4848 return ret;4849 },4850 has: function( target ) {4851 var i,4852 targets = jquery( target, this ),4853 len = targets.length;4854 return this.filter(function() {4855 for ( i = 0; i < len; i++ ) {4856 if ( jquery.contains( this, targets[i] ) ) {4857 return true;4858 }4859 }4860 });4861 },4862 not: function( selector ) {4863 return this.pushstack( winnow(this, selector || [], true) );4864 },4865 filter: function( selector ) {4866 return this.pushstack( winnow(this, selector || [], false) );4867 },4868 is: function( selector ) {4869 return !!winnow(4870 this,4871 // if this is a positional/relative selector, check membership in the returned set4872 // so $("p:first").is("p:last") won't return true for a doc with two "p".4873 typeof selector === "string" && rneedscontext.test( selector ) ?4874 jquery( selector ) :4875 selector || [],4876 false4877 ).length;4878 },4879 closest: function( selectors, context ) {4880 var cur,4881 i = 0,4882 l = this.length,4883 ret = [],4884 pos = rneedscontext.test( selectors ) || typeof selectors !== "string" ?4885 jquery( selectors, context || this.context ) :4886 0;4887 for ( ; i < l; i++ ) {4888 for ( cur = this[i]; cur && cur !== context; cur = cur.parentnode ) {4889 // always skip document fragments4890 if ( cur.nodetype < 11 && (pos ?4891 pos.index(cur) > -1 :4892 // don't pass non-elements to sizzle4893 cur.nodetype === 1 &&4894 jquery.find.matchesselector(cur, selectors)) ) {4895 cur = ret.push( cur );4896 break;4897 }4898 }4899 }4900 return this.pushstack( ret.length > 1 ? jquery.unique( ret ) : ret );4901 },4902 // determine the position of an element within4903 // the matched set of elements4904 index: function( elem ) {4905 // no argument, return index in parent4906 if ( !elem ) {4907 return ( this[0] && this[0].parentnode ) ? this.first().prevall().length : -1;4908 }4909 // index in selector4910 if ( typeof elem === "string" ) {4911 return jquery.inarray( this[0], jquery( elem ) );4912 }4913 // locate the position of the desired element4914 return jquery.inarray(4915 // if it receives a jquery object, the first element is used4916 elem.jquery ? elem[0] : elem, this );4917 },4918 add: function( selector, context ) {4919 var set = typeof selector === "string" ?4920 jquery( selector, context ) :4921 jquery.makearray( selector && selector.nodetype ? [ selector ] : selector ),4922 all = jquery.merge( this.get(), set );4923 return this.pushstack( jquery.unique(all) );4924 },4925 addback: function( selector ) {4926 return this.add( selector == null ?4927 this.prevobject : this.prevobject.filter(selector)4928 );4929 }4930 });4931 function sibling( cur, dir ) {4932 do {4933 cur = cur[ dir ];4934 } while ( cur && cur.nodetype !== 1 );4935 return cur;4936 }4937 jquery.each({4938 parent: function( elem ) {4939 var parent = elem.parentnode;4940 return parent && parent.nodetype !== 11 ? parent : null;4941 },4942 parents: function( elem ) {4943 return jquery.dir( elem, "parentnode" );4944 },4945 parentsuntil: function( elem, i, until ) {4946 return jquery.dir( elem, "parentnode", until );4947 },4948 next: function( elem ) {4949 return sibling( elem, "nextsibling" );4950 },4951 prev: function( elem ) {4952 return sibling( elem, "previoussibling" );4953 },4954 nextall: function( elem ) {4955 return jquery.dir( elem, "nextsibling" );4956 },4957 prevall: function( elem ) {4958 return jquery.dir( elem, "previoussibling" );4959 },4960 nextuntil: function( elem, i, until ) {4961 return jquery.dir( elem, "nextsibling", until );4962 },4963 prevuntil: function( elem, i, until ) {4964 return jquery.dir( elem, "previoussibling", until );4965 },4966 siblings: function( elem ) {4967 return jquery.sibling( ( elem.parentnode || {} ).firstchild, elem );4968 },4969 children: function( elem ) {4970 return jquery.sibling( elem.firstchild );4971 },4972 contents: function( elem ) {4973 return jquery.nodename( elem, "iframe" ) ?4974 elem.contentdocument || elem.contentwindow.document :4975 jquery.merge( [], elem.childnodes );4976 }4977 }, function( name, fn ) {4978 jquery.fn[ name ] = function( until, selector ) {4979 var ret = jquery.map( this, fn, until );4980 if ( name.slice( -5 ) !== "until" ) {4981 selector = until;4982 }4983 if ( selector && typeof selector === "string" ) {4984 ret = jquery.filter( selector, ret );4985 }4986 if ( this.length > 1 ) {4987 // remove duplicates4988 if ( !guaranteedunique[ name ] ) {4989 ret = jquery.unique( ret );4990 }4991 // reverse order for parents* and prev-derivatives4992 if ( rparentsprev.test( name ) ) {4993 ret = ret.reverse();4994 }4995 }4996 return this.pushstack( ret );4997 };4998 });4999 jquery.extend({5000 filter: function( expr, elems, not ) {5001 var elem = elems[ 0 ];5002 if ( not ) {5003 expr = ":not(" + expr + ")";5004 }5005 return elems.length === 1 && elem.nodetype === 1 ?5006 jquery.find.matchesselector( elem, expr ) ? [ elem ] : [] :5007 jquery.find.matches( expr, jquery.grep( elems, function( elem ) {5008 return elem.nodetype === 1;5009 }));5010 },5011 dir: function( elem, dir, until ) {5012 var matched = [],5013 cur = elem[ dir ];5014 while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) {5015 if ( cur.nodetype === 1 ) {5016 matched.push( cur );5017 }5018 cur = cur[dir];5019 }5020 return matched;5021 },5022 sibling: function( n, elem ) {5023 var r = [];5024 for ( ; n; n = n.nextsibling ) {5025 if ( n.nodetype === 1 && n !== elem ) {5026 r.push( n );5027 }5028 }5029 return r;5030 }5031 });5032// implement the identical functionality for filter and not5033 function winnow( elements, qualifier, not ) {5034 if ( jquery.isfunction( qualifier ) ) {5035 return jquery.grep( elements, function( elem, i ) {5036 /* jshint -w018 */5037 return !!qualifier.call( elem, i, elem ) !== not;5038 });5039 }5040 if ( qualifier.nodetype ) {5041 return jquery.grep( elements, function( elem ) {5042 return ( elem === qualifier ) !== not;5043 });5044 }5045 if ( typeof qualifier === "string" ) {5046 if ( issimple.test( qualifier ) ) {5047 return jquery.filter( qualifier, elements, not );5048 }5049 qualifier = jquery.filter( qualifier, elements );5050 }5051 return jquery.grep( elements, function( elem ) {5052 return ( jquery.inarray( elem, qualifier ) >= 0 ) !== not;5053 });5054 }5055 function createsafefragment( document ) {5056 var list = nodenames.split( "|" ),5057 safefrag = document.createdocumentfragment();5058 if ( safefrag.createelement ) {5059 while ( list.length ) {5060 safefrag.createelement(5061 list.pop()5062 );5063 }5064 }5065 return safefrag;5066 }5067 var nodenames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +5068 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",5069 rinlinejquery = / jquery\d+="(?:null|\d+)"/g,5070 rnoshimcache = new regexp("<(?:" + nodenames + ")[\\s/>]", "i"),5071 rleadingwhitespace = /^\s+/,5072 rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,5073 rtagname = /<([\w:]+)/,5074 rtbody = /<tbody/i,5075 rhtml = /<|&#?\w+;/,5076 rnoinnerhtml = /<(?:script|style|link)/i,5077 manipulation_rcheckabletype = /^(?:checkbox|radio)$/i,5078 // checked="checked" or checked5079 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,5080 rscripttype = /^$|\/(?:java|ecma)script/i,5081 rscripttypemasked = /^true\/(.*)/,5082 rcleanscript = /^\s*<!(?:\[cdata\[|--)|(?:\]\]|--)>\s*$/g,5083 // we have to close these tags to support xhtml (#13200)5084 wrapmap = {5085 option: [ 1, "<select multiple='multiple'>", "</select>" ],5086 legend: [ 1, "<fieldset>", "</fieldset>" ],5087 area: [ 1, "<map>", "</map>" ],5088 param: [ 1, "<object>", "</object>" ],5089 thead: [ 1, "<table>", "</table>" ],5090 tr: [ 2, "<table><tbody>", "</tbody></table>" ],5091 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],5092 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],5093 // ie6-8 can't serialize link, script, style, or any html5 (noscope) tags,5094 // unless wrapped in a div with non-breaking characters in front of it.5095 _default: jquery.support.htmlserialize ? [ 0, "", "" ] : [ 1, "x<div>", "</div>" ]5096 },5097 safefragment = createsafefragment( document ),5098 fragmentdiv = safefragment.appendchild( document.createelement("div") );5099 wrapmap.optgroup = wrapmap.option;5100 wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead;5101 wrapmap.th = wrapmap.td;5102 jquery.fn.extend({5103 text: function( value ) {5104 return jquery.access( this, function( value ) {5105 return value === undefined ?5106 jquery.text( this ) :5107 this.empty().append( ( this[0] && this[0].ownerdocument || document ).createtextnode( value ) );5108 }, null, value, arguments.length );5109 },5110 append: function() {5111 return this.dommanip( arguments, function( elem ) {5112 if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) {5113 var target = manipulationtarget( this, elem );5114 target.appendchild( elem );5115 }5116 });5117 },5118 prepend: function() {5119 return this.dommanip( arguments, function( elem ) {5120 if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) {5121 var target = manipulationtarget( this, elem );5122 target.insertbefore( elem, target.firstchild );5123 }5124 });5125 },5126 before: function() {5127 return this.dommanip( arguments, function( elem ) {5128 if ( this.parentnode ) {5129 this.parentnode.insertbefore( elem, this );5130 }5131 });5132 },5133 after: function() {5134 return this.dommanip( arguments, function( elem ) {5135 if ( this.parentnode ) {5136 this.parentnode.insertbefore( elem, this.nextsibling );5137 }5138 });5139 },5140 // keepdata is for internal use only--do not document5141 remove: function( selector, keepdata ) {5142 var elem,5143 elems = selector ? jquery.filter( selector, this ) : this,5144 i = 0;5145 for ( ; (elem = elems[i]) != null; i++ ) {5146 if ( !keepdata && elem.nodetype === 1 ) {5147 jquery.cleandata( getall( elem ) );5148 }5149 if ( elem.parentnode ) {5150 if ( keepdata && jquery.contains( elem.ownerdocument, elem ) ) {5151 setglobaleval( getall( elem, "script" ) );5152 }5153 elem.parentnode.removechild( elem );5154 }5155 }5156 return this;5157 },5158 empty: function() {5159 var elem,5160 i = 0;5161 for ( ; (elem = this[i]) != null; i++ ) {5162 // remove element nodes and prevent memory leaks5163 if ( elem.nodetype === 1 ) {5164 jquery.cleandata( getall( elem, false ) );5165 }5166 // remove any remaining nodes5167 while ( elem.firstchild ) {5168 elem.removechild( elem.firstchild );5169 }5170 // if this is a select, ensure that it displays empty (#12336)5171 // support: ie<95172 if ( elem.options && jquery.nodename( elem, "select" ) ) {5173 elem.options.length = 0;5174 }5175 }5176 return this;5177 },5178 clone: function( dataandevents, deepdataandevents ) {5179 dataandevents = dataandevents == null ? false : dataandevents;5180 deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents;5181 return this.map( function () {5182 return jquery.clone( this, dataandevents, deepdataandevents );5183 });5184 },5185 html: function( value ) {5186 return jquery.access( this, function( value ) {5187 var elem = this[0] || {},5188 i = 0,5189 l = this.length;5190 if ( value === undefined ) {5191 return elem.nodetype === 1 ?5192 elem.innerhtml.replace( rinlinejquery, "" ) :5193 undefined;5194 }5195 // see if we can take a shortcut and just use innerhtml5196 if ( typeof value === "string" && !rnoinnerhtml.test( value ) &&5197 ( jquery.support.htmlserialize || !rnoshimcache.test( value ) ) &&5198 ( jquery.support.leadingwhitespace || !rleadingwhitespace.test( value ) ) &&5199 !wrapmap[ ( rtagname.exec( value ) || ["", ""] )[1].tolowercase() ] ) {5200 value = value.replace( rxhtmltag, "<$1></$2>" );5201 try {5202 for (; i < l; i++ ) {5203 // remove element nodes and prevent memory leaks5204 elem = this[i] || {};5205 if ( elem.nodetype === 1 ) {5206 jquery.cleandata( getall( elem, false ) );5207 elem.innerhtml = value;5208 }5209 }5210 elem = 0;5211 // if using innerhtml throws an exception, use the fallback method5212 } catch(e) {}5213 }5214 if ( elem ) {5215 this.empty().append( value );5216 }5217 }, null, value, arguments.length );5218 },5219 replacewith: function() {5220 var5221 // snapshot the dom in case .dommanip sweeps something relevant into its fragment5222 args = jquery.map( this, function( elem ) {5223 return [ elem.nextsibling, elem.parentnode ];5224 }),5225 i = 0;5226 // make the changes, replacing each context element with the new content5227 this.dommanip( arguments, function( elem ) {5228 var next = args[ i++ ],5229 parent = args[ i++ ];5230 if ( parent ) {5231 // don't use the snapshot next if it has moved (#13810)5232 if ( next && next.parentnode !== parent ) {5233 next = this.nextsibling;5234 }5235 jquery( this ).remove();5236 parent.insertbefore( elem, next );5237 }5238 // allow new content to include elements from the context set5239 }, true );5240 // force removal if there was no new content (e.g., from empty arguments)5241 return i ? this : this.remove();5242 },5243 detach: function( selector ) {5244 return this.remove( selector, true );5245 },5246 dommanip: function( args, callback, allowintersection ) {5247 // flatten any nested arrays5248 args = core_concat.apply( [], args );5249 var first, node, hasscripts,5250 scripts, doc, fragment,5251 i = 0,5252 l = this.length,5253 set = this,5254 inoclone = l - 1,5255 value = args[0],5256 isfunction = jquery.isfunction( value );5257 // we can't clonenode fragments that contain checked, in webkit5258 if ( isfunction || !( l <= 1 || typeof value !== "string" || jquery.support.checkclone || !rchecked.test( value ) ) ) {5259 return this.each(function( index ) {5260 var self = set.eq( index );5261 if ( isfunction ) {5262 args[0] = value.call( this, index, self.html() );5263 }5264 self.dommanip( args, callback, allowintersection );5265 });5266 }5267 if ( l ) {5268 fragment = jquery.buildfragment( args, this[ 0 ].ownerdocument, false, !allowintersection && this );5269 first = fragment.firstchild;5270 if ( fragment.childnodes.length === 1 ) {5271 fragment = first;5272 }5273 if ( first ) {5274 scripts = jquery.map( getall( fragment, "script" ), disablescript );5275 hasscripts = scripts.length;5276 // use the original fragment for the last item instead of the first because it can end up5277 // being emptied incorrectly in certain situations (#8070).5278 for ( ; i < l; i++ ) {5279 node = fragment;5280 if ( i !== inoclone ) {5281 node = jquery.clone( node, true, true );5282 // keep references to cloned scripts for later restoration5283 if ( hasscripts ) {5284 jquery.merge( scripts, getall( node, "script" ) );5285 }5286 }5287 callback.call( this[i], node, i );5288 }5289 if ( hasscripts ) {5290 doc = scripts[ scripts.length - 1 ].ownerdocument;5291 // reenable scripts5292 jquery.map( scripts, restorescript );5293 // evaluate executable scripts on first document insertion5294 for ( i = 0; i < hasscripts; i++ ) {5295 node = scripts[ i ];5296 if ( rscripttype.test( node.type || "" ) &&5297 !jquery._data( node, "globaleval" ) && jquery.contains( doc, node ) ) {5298 if ( node.src ) {5299 // hope ajax is available...5300 jquery._evalurl( node.src );5301 } else {5302 jquery.globaleval( ( node.text || node.textcontent || node.innerhtml || "" ).replace( rcleanscript, "" ) );5303 }5304 }5305 }5306 }5307 // fix #11809: avoid leaking memory5308 fragment = first = null;5309 }5310 }5311 return this;5312 }5313 });5314// support: ie<85315// manipulating tables requires a tbody5316 function manipulationtarget( elem, content ) {5317 return jquery.nodename( elem, "table" ) &&5318 jquery.nodename( content.nodetype === 1 ? content : content.firstchild, "tr" ) ?5319 elem.getelementsbytagname("tbody")[0] ||5320 elem.appendchild( elem.ownerdocument.createelement("tbody") ) :5321 elem;5322 }5323// replace/restore the type attribute of script elements for safe dom manipulation5324 function disablescript( elem ) {5325 elem.type = (jquery.find.attr( elem, "type" ) !== null) + "/" + elem.type;5326 return elem;5327 }5328 function restorescript( elem ) {5329 var match = rscripttypemasked.exec( elem.type );5330 if ( match ) {5331 elem.type = match[1];5332 } else {5333 elem.removeattribute("type");5334 }5335 return elem;5336 }5337// mark scripts as having already been evaluated5338 function setglobaleval( elems, refelements ) {5339 var elem,5340 i = 0;5341 for ( ; (elem = elems[i]) != null; i++ ) {5342 jquery._data( elem, "globaleval", !refelements || jquery._data( refelements[i], "globaleval" ) );5343 }5344 }5345 function clonecopyevent( src, dest ) {5346 if ( dest.nodetype !== 1 || !jquery.hasdata( src ) ) {5347 return;5348 }5349 var type, i, l,5350 olddata = jquery._data( src ),5351 curdata = jquery._data( dest, olddata ),5352 events = olddata.events;5353 if ( events ) {5354 delete curdata.handle;5355 curdata.events = {};5356 for ( type in events ) {5357 for ( i = 0, l = events[ type ].length; i < l; i++ ) {5358 jquery.event.add( dest, type, events[ type ][ i ] );5359 }5360 }5361 }5362 // make the cloned public data object a copy from the original5363 if ( curdata.data ) {5364 curdata.data = jquery.extend( {}, curdata.data );5365 }5366 }5367 function fixclonenodeissues( src, dest ) {5368 var nodename, e, data;5369 // we do not need to do anything for non-elements5370 if ( dest.nodetype !== 1 ) {5371 return;5372 }5373 nodename = dest.nodename.tolowercase();5374 // ie6-8 copies events bound via attachevent when using clonenode.5375 if ( !jquery.support.nocloneevent && dest[ jquery.expando ] ) {5376 data = jquery._data( dest );5377 for ( e in data.events ) {5378 jquery.removeevent( dest, e, data.handle );5379 }5380 // event data gets referenced instead of copied if the expando gets copied too5381 dest.removeattribute( jquery.expando );5382 }5383 // ie blanks contents when cloning scripts, and tries to evaluate newly-set text5384 if ( nodename === "script" && dest.text !== src.text ) {5385 disablescript( dest ).text = src.text;5386 restorescript( dest );5387 // ie6-10 improperly clones children of object elements using classid.5388 // ie10 throws nomodificationallowederror if parent is null, #12132.5389 } else if ( nodename === "object" ) {5390 if ( dest.parentnode ) {5391 dest.outerhtml = src.outerhtml;5392 }5393 // this path appears unavoidable for ie9. when cloning an object5394 // element in ie9, the outerhtml strategy above is not sufficient.5395 // if the src has innerhtml and the destination does not,5396 // copy the src.innerhtml into the dest.innerhtml. #103245397 if ( jquery.support.html5clone && ( src.innerhtml && !jquery.trim(dest.innerhtml) ) ) {5398 dest.innerhtml = src.innerhtml;5399 }5400 } else if ( nodename === "input" && manipulation_rcheckabletype.test( src.type ) ) {5401 // ie6-8 fails to persist the checked state of a cloned checkbox5402 // or radio button. worse, ie6-7 fail to give the cloned element5403 // a checked appearance if the defaultchecked value isn't also set5404 dest.defaultchecked = dest.checked = src.checked;5405 // ie6-7 get confused and end up setting the value of a cloned5406 // checkbox/radio button to an empty string instead of "on"5407 if ( dest.value !== src.value ) {5408 dest.value = src.value;5409 }5410 // ie6-8 fails to return the selected option to the default selected5411 // state when cloning options5412 } else if ( nodename === "option" ) {5413 dest.defaultselected = dest.selected = src.defaultselected;5414 // ie6-8 fails to set the defaultvalue to the correct value when5415 // cloning other types of input fields5416 } else if ( nodename === "input" || nodename === "textarea" ) {5417 dest.defaultvalue = src.defaultvalue;5418 }5419 }5420 jquery.each({5421 appendto: "append",5422 prependto: "prepend",5423 insertbefore: "before",5424 insertafter: "after",5425 replaceall: "replacewith"5426 }, function( name, original ) {5427 jquery.fn[ name ] = function( selector ) {5428 var elems,5429 i = 0,5430 ret = [],5431 insert = jquery( selector ),5432 last = insert.length - 1;5433 for ( ; i <= last; i++ ) {5434 elems = i === last ? this : this.clone(true);5435 jquery( insert[i] )[ original ]( elems );5436 // modern browsers can apply jquery collections as arrays, but oldie needs a .get()5437 core_push.apply( ret, elems.get() );5438 }5439 return this.pushstack( ret );5440 };5441 });5442 function getall( context, tag ) {5443 var elems, elem,5444 i = 0,5445 found = typeof context.getelementsbytagname !== core_strundefined ? context.getelementsbytagname( tag || "*" ) :5446 typeof context.queryselectorall !== core_strundefined ? context.queryselectorall( tag || "*" ) :5447 undefined;5448 if ( !found ) {5449 for ( found = [], elems = context.childnodes || context; (elem = elems[i]) != null; i++ ) {5450 if ( !tag || jquery.nodename( elem, tag ) ) {5451 found.push( elem );5452 } else {5453 jquery.merge( found, getall( elem, tag ) );5454 }5455 }5456 }5457 return tag === undefined || tag && jquery.nodename( context, tag ) ?5458 jquery.merge( [ context ], found ) :5459 found;5460 }5461// used in buildfragment, fixes the defaultchecked property5462 function fixdefaultchecked( elem ) {5463 if ( manipulation_rcheckabletype.test( elem.type ) ) {5464 elem.defaultchecked = elem.checked;5465 }5466 }5467 jquery.extend({5468 clone: function( elem, dataandevents, deepdataandevents ) {5469 var destelements, node, clone, i, srcelements,5470 inpage = jquery.contains( elem.ownerdocument, elem );5471 if ( jquery.support.html5clone || jquery.isxmldoc(elem) || !rnoshimcache.test( "<" + elem.nodename + ">" ) ) {5472 clone = elem.clonenode( true );5473 // ie<=8 does not properly clone detached, unknown element nodes5474 } else {5475 fragmentdiv.innerhtml = elem.outerhtml;5476 fragmentdiv.removechild( clone = fragmentdiv.firstchild );5477 }5478 if ( (!jquery.support.nocloneevent || !jquery.support.noclonechecked) &&5479 (elem.nodetype === 1 || elem.nodetype === 11) && !jquery.isxmldoc(elem) ) {5480 // we eschew sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/25481 destelements = getall( clone );5482 srcelements = getall( elem );5483 // fix all ie cloning issues5484 for ( i = 0; (node = srcelements[i]) != null; ++i ) {5485 // ensure that the destination node is not null; fixes #95875486 if ( destelements[i] ) {5487 fixclonenodeissues( node, destelements[i] );5488 }5489 }5490 }5491 // copy the events from the original to the clone5492 if ( dataandevents ) {5493 if ( deepdataandevents ) {5494 srcelements = srcelements || getall( elem );5495 destelements = destelements || getall( clone );5496 for ( i = 0; (node = srcelements[i]) != null; i++ ) {5497 clonecopyevent( node, destelements[i] );5498 }5499 } else {5500 clonecopyevent( elem, clone );5501 }5502 }5503 // preserve script evaluation history5504 destelements = getall( clone, "script" );5505 if ( destelements.length > 0 ) {5506 setglobaleval( destelements, !inpage && getall( elem, "script" ) );5507 }5508 destelements = srcelements = node = null;5509 // return the cloned set5510 return clone;5511 },5512 buildfragment: function( elems, context, scripts, selection ) {5513 var j, elem, contains,5514 tmp, tag, tbody, wrap,5515 l = elems.length,5516 // ensure a safe fragment5517 safe = createsafefragment( context ),5518 nodes = [],5519 i = 0;5520 for ( ; i < l; i++ ) {5521 elem = elems[ i ];5522 if ( elem || elem === 0 ) {5523 // add nodes directly5524 if ( jquery.type( elem ) === "object" ) {5525 jquery.merge( nodes, elem.nodetype ? [ elem ] : elem );5526 // convert non-html into a text node5527 } else if ( !rhtml.test( elem ) ) {5528 nodes.push( context.createtextnode( elem ) );5529 // convert html into dom nodes5530 } else {5531 tmp = tmp || safe.appendchild( context.createelement("div") );5532 // deserialize a standard representation5533 tag = ( rtagname.exec( elem ) || ["", ""] )[1].tolowercase();5534 wrap = wrapmap[ tag ] || wrapmap._default;5535 tmp.innerhtml = wrap[1] + elem.replace( rxhtmltag, "<$1></$2>" ) + wrap[2];5536 // descend through wrappers to the right content5537 j = wrap[0];5538 while ( j-- ) {5539 tmp = tmp.lastchild;5540 }5541 // manually add leading whitespace removed by ie5542 if ( !jquery.support.leadingwhitespace && rleadingwhitespace.test( elem ) ) {5543 nodes.push( context.createtextnode( rleadingwhitespace.exec( elem )[0] ) );5544 }5545 // remove ie's autoinserted <tbody> from table fragments5546 if ( !jquery.support.tbody ) {5547 // string was a <table>, *may* have spurious <tbody>5548 elem = tag === "table" && !rtbody.test( elem ) ?5549 tmp.firstchild :5550 // string was a bare <thead> or <tfoot>5551 wrap[1] === "<table>" && !rtbody.test( elem ) ?5552 tmp :5553 0;5554 j = elem && elem.childnodes.length;5555 while ( j-- ) {5556 if ( jquery.nodename( (tbody = elem.childnodes[j]), "tbody" ) && !tbody.childnodes.length ) {5557 elem.removechild( tbody );5558 }5559 }5560 }5561 jquery.merge( nodes, tmp.childnodes );5562 // fix #12392 for webkit and ie > 95563 tmp.textcontent = "";5564 // fix #12392 for oldie5565 while ( tmp.firstchild ) {5566 tmp.removechild( tmp.firstchild );5567 }5568 // remember the top-level container for proper cleanup5569 tmp = safe.lastchild;5570 }5571 }5572 }5573 // fix #11356: clear elements from fragment5574 if ( tmp ) {5575 safe.removechild( tmp );5576 }5577 // reset defaultchecked for any radios and checkboxes5578 // about to be appended to the dom in ie 6/7 (#8060)5579 if ( !jquery.support.appendchecked ) {5580 jquery.grep( getall( nodes, "input" ), fixdefaultchecked );5581 }5582 i = 0;5583 while ( (elem = nodes[ i++ ]) ) {5584 // #4087 - if origin and destination elements are the same, and this is5585 // that element, do not do anything5586 if ( selection && jquery.inarray( elem, selection ) !== -1 ) {5587 continue;5588 }5589 contains = jquery.contains( elem.ownerdocument, elem );5590 // append to fragment5591 tmp = getall( safe.appendchild( elem ), "script" );5592 // preserve script evaluation history5593 if ( contains ) {5594 setglobaleval( tmp );5595 }5596 // capture executables5597 if ( scripts ) {5598 j = 0;5599 while ( (elem = tmp[ j++ ]) ) {5600 if ( rscripttype.test( elem.type || "" ) ) {5601 scripts.push( elem );5602 }5603 }5604 }5605 }5606 tmp = null;5607 return safe;5608 },5609 cleandata: function( elems, /* internal */ acceptdata ) {5610 var elem, type, id, data,5611 i = 0,5612 internalkey = jquery.expando,5613 cache = jquery.cache,5614 deleteexpando = jquery.support.deleteexpando,5615 special = jquery.event.special;5616 for ( ; (elem = elems[i]) != null; i++ ) {5617 if ( acceptdata || jquery.acceptdata( elem ) ) {5618 id = elem[ internalkey ];5619 data = id && cache[ id ];5620 if ( data ) {5621 if ( data.events ) {5622 for ( type in data.events ) {5623 if ( special[ type ] ) {5624 jquery.event.remove( elem, type );5625 // this is a shortcut to avoid jquery.event.remove's overhead5626 } else {5627 jquery.removeevent( elem, type, data.handle );5628 }5629 }5630 }5631 // remove cache only if it was not already removed by jquery.event.remove5632 if ( cache[ id ] ) {5633 delete cache[ id ];5634 // ie does not allow us to delete expando properties from nodes,5635 // nor does it have a removeattribute function on document nodes;5636 // we must handle all of these cases5637 if ( deleteexpando ) {5638 delete elem[ internalkey ];5639 } else if ( typeof elem.removeattribute !== core_strundefined ) {5640 elem.removeattribute( internalkey );5641 } else {5642 elem[ internalkey ] = null;5643 }5644 core_deletedids.push( id );5645 }5646 }5647 }5648 }5649 },5650 _evalurl: function( url ) {5651 return jquery.ajax({5652 url: url,5653 type: "get",5654 datatype: "script",5655 async: false,5656 global: false,5657 "throws": true5658 });5659 }5660 });5661 jquery.fn.extend({5662 wrapall: function( html ) {5663 if ( jquery.isfunction( html ) ) {5664 return this.each(function(i) {5665 jquery(this).wrapall( html.call(this, i) );5666 });5667 }5668 if ( this[0] ) {5669 // the elements to wrap the target around5670 var wrap = jquery( html, this[0].ownerdocument ).eq(0).clone(true);5671 if ( this[0].parentnode ) {5672 wrap.insertbefore( this[0] );5673 }5674 wrap.map(function() {5675 var elem = this;5676 while ( elem.firstchild && elem.firstchild.nodetype === 1 ) {5677 elem = elem.firstchild;5678 }5679 return elem;5680 }).append( this );5681 }5682 return this;5683 },5684 wrapinner: function( html ) {5685 if ( jquery.isfunction( html ) ) {5686 return this.each(function(i) {5687 jquery(this).wrapinner( html.call(this, i) );5688 });5689 }5690 return this.each(function() {5691 var self = jquery( this ),5692 contents = self.contents();5693 if ( contents.length ) {5694 contents.wrapall( html );5695 } else {5696 self.append( html );5697 }5698 });5699 },5700 wrap: function( html ) {5701 var isfunction = jquery.isfunction( html );5702 return this.each(function(i) {5703 jquery( this ).wrapall( isfunction ? html.call(this, i) : html );5704 });5705 },5706 unwrap: function() {5707 return this.parent().each(function() {5708 if ( !jquery.nodename( this, "body" ) ) {5709 jquery( this ).replacewith( this.childnodes );5710 }5711 }).end();5712 }5713 });5714 var iframe, getstyles, curcss,5715 ralpha = /alpha\([^)]*\)/i,5716 ropacity = /opacity\s*=\s*([^)]*)/,5717 rposition = /^(top|right|bottom|left)$/,5718 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"5719 // see here for display values: https://developer.mozilla.org/en-us/docs/css/display5720 rdisplayswap = /^(none|table(?!-c[ea]).+)/,5721 rmargin = /^margin/,5722 rnumsplit = new regexp( "^(" + core_pnum + ")(.*)$", "i" ),5723 rnumnonpx = new regexp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),5724 rrelnum = new regexp( "^([+-])=(" + core_pnum + ")", "i" ),5725 elemdisplay = { body: "block" },5726 cssshow = { position: "absolute", visibility: "hidden", display: "block" },5727 cssnormaltransform = {5728 letterspacing: 0,5729 fontweight: 4005730 },5731 cssexpand = [ "top", "right", "bottom", "left" ],5732 cssprefixes = [ "webkit", "o", "moz", "ms" ];5733// return a css property mapped to a potentially vendor prefixed property5734 function vendorpropname( style, name ) {5735 // shortcut for names that are not vendor prefixed5736 if ( name in style ) {5737 return name;5738 }5739 // check for vendor prefixed names5740 var capname = name.charat(0).touppercase() + name.slice(1),5741 origname = name,5742 i = cssprefixes.length;5743 while ( i-- ) {5744 name = cssprefixes[ i ] + capname;5745 if ( name in style ) {5746 return name;5747 }5748 }5749 return origname;5750 }5751 function ishidden( elem, el ) {5752 // ishidden might be called from jquery#filter function;5753 // in that case, element will be second argument5754 elem = el || elem;5755 return jquery.css( elem, "display" ) === "none" || !jquery.contains( elem.ownerdocument, elem );5756 }5757 function showhide( elements, show ) {5758 var display, elem, hidden,5759 values = [],5760 index = 0,5761 length = elements.length;5762 for ( ; index < length; index++ ) {5763 elem = elements[ index ];5764 if ( !elem.style ) {5765 continue;5766 }5767 values[ index ] = jquery._data( elem, "olddisplay" );5768 display = elem.style.display;5769 if ( show ) {5770 // reset the inline display of this element to learn if it is5771 // being hidden by cascaded rules or not5772 if ( !values[ index ] && display === "none" ) {5773 elem.style.display = "";5774 }5775 // set elements which have been overridden with display: none5776 // in a stylesheet to whatever the default browser style is5777 // for such an element5778 if ( elem.style.display === "" && ishidden( elem ) ) {5779 values[ index ] = jquery._data( elem, "olddisplay", css_defaultdisplay(elem.nodename) );5780 }5781 } else {5782 if ( !values[ index ] ) {5783 hidden = ishidden( elem );5784 if ( display && display !== "none" || !hidden ) {5785 jquery._data( elem, "olddisplay", hidden ? display : jquery.css( elem, "display" ) );5786 }5787 }5788 }5789 }5790 // set the display of most of the elements in a second loop5791 // to avoid the constant reflow5792 for ( index = 0; index < length; index++ ) {5793 elem = elements[ index ];5794 if ( !elem.style ) {5795 continue;5796 }5797 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {5798 elem.style.display = show ? values[ index ] || "" : "none";5799 }5800 }5801 return elements;5802 }5803 jquery.fn.extend({5804 css: function( name, value ) {5805 return jquery.access( this, function( elem, name, value ) {5806 var len, styles,5807 map = {},5808 i = 0;5809 if ( jquery.isarray( name ) ) {5810 styles = getstyles( elem );5811 len = name.length;5812 for ( ; i < len; i++ ) {5813 map[ name[ i ] ] = jquery.css( elem, name[ i ], false, styles );5814 }5815 return map;5816 }5817 return value !== undefined ?5818 jquery.style( elem, name, value ) :5819 jquery.css( elem, name );5820 }, name, value, arguments.length > 1 );5821 },5822 show: function() {5823 return showhide( this, true );5824 },5825 hide: function() {5826 return showhide( this );5827 },5828 toggle: function( state ) {5829 if ( typeof state === "boolean" ) {5830 return state ? this.show() : this.hide();5831 }5832 return this.each(function() {5833 if ( ishidden( this ) ) {5834 jquery( this ).show();5835 } else {5836 jquery( this ).hide();5837 }5838 });5839 }5840 });5841 jquery.extend({5842 // add in style property hooks for overriding the default5843 // behavior of getting and setting a style property5844 csshooks: {5845 opacity: {5846 get: function( elem, computed ) {5847 if ( computed ) {5848 // we should always get a number back from opacity5849 var ret = curcss( elem, "opacity" );5850 return ret === "" ? "1" : ret;5851 }5852 }5853 }5854 },5855 // don't automatically add "px" to these possibly-unitless properties5856 cssnumber: {5857 "columncount": true,5858 "fillopacity": true,5859 "fontweight": true,5860 "lineheight": true,5861 "opacity": true,5862 "order": true,5863 "orphans": true,5864 "widows": true,5865 "zindex": true,5866 "zoom": true5867 },5868 // add in properties whose names you wish to fix before5869 // setting or getting the value5870 cssprops: {5871 // normalize float css property5872 "float": jquery.support.cssfloat ? "cssfloat" : "stylefloat"5873 },5874 // get and set the style property on a dom node5875 style: function( elem, name, value, extra ) {5876 // don't set styles on text and comment nodes5877 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || !elem.style ) {5878 return;5879 }5880 // make sure that we're working with the right name5881 var ret, type, hooks,5882 origname = jquery.camelcase( name ),5883 style = elem.style;5884 name = jquery.cssprops[ origname ] || ( jquery.cssprops[ origname ] = vendorpropname( style, origname ) );5885 // gets hook for the prefixed version5886 // followed by the unprefixed version5887 hooks = jquery.csshooks[ name ] || jquery.csshooks[ origname ];5888 // check if we're setting a value5889 if ( value !== undefined ) {5890 type = typeof value;5891 // convert relative number strings (+= or -=) to relative numbers. #73455892 if ( type === "string" && (ret = rrelnum.exec( value )) ) {5893 value = ( ret[1] + 1 ) * ret[2] + parsefloat( jquery.css( elem, name ) );5894 // fixes bug #92375895 type = "number";5896 }5897 // make sure that nan and null values aren't set. see: #71165898 if ( value == null || type === "number" && isnan( value ) ) {5899 return;5900 }5901 // if a number was passed in, add 'px' to the (except for certain css properties)5902 if ( type === "number" && !jquery.cssnumber[ origname ] ) {5903 value += "px";5904 }5905 // fixes #8908, it can be done more correctly by specifing setters in csshooks,5906 // but it would mean to define eight (for every problematic property) identical functions5907 if ( !jquery.support.clearclonestyle && value === "" && name.indexof("background") === 0 ) {5908 style[ name ] = "inherit";5909 }5910 // if a hook was provided, use that value, otherwise just set the specified value5911 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {5912 // wrapped to prevent ie from throwing errors when 'invalid' values are provided5913 // fixes bug #55095914 try {5915 style[ name ] = value;5916 } catch(e) {}5917 }5918 } else {5919 // if a hook was provided get the non-computed value from there5920 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {5921 return ret;5922 }5923 // otherwise just get the value from the style object5924 return style[ name ];5925 }5926 },5927 css: function( elem, name, extra, styles ) {5928 var num, val, hooks,5929 origname = jquery.camelcase( name );5930 // make sure that we're working with the right name5931 name = jquery.cssprops[ origname ] || ( jquery.cssprops[ origname ] = vendorpropname( elem.style, origname ) );5932 // gets hook for the prefixed version5933 // followed by the unprefixed version5934 hooks = jquery.csshooks[ name ] || jquery.csshooks[ origname ];5935 // if a hook was provided get the computed value from there5936 if ( hooks && "get" in hooks ) {5937 val = hooks.get( elem, true, extra );5938 }5939 // otherwise, if a way to get the computed value exists, use that5940 if ( val === undefined ) {5941 val = curcss( elem, name, styles );5942 }5943 //convert "normal" to computed value5944 if ( val === "normal" && name in cssnormaltransform ) {5945 val = cssnormaltransform[ name ];5946 }5947 // return, converting to number if forced or a qualifier was provided and val looks numeric5948 if ( extra === "" || extra ) {5949 num = parsefloat( val );5950 return extra === true || jquery.isnumeric( num ) ? num || 0 : val;5951 }5952 return val;5953 }5954 });5955// note: we've included the "window" in window.getcomputedstyle5956// because jsdom on node.js will break without it.5957 if ( window.getcomputedstyle ) {5958 getstyles = function( elem ) {5959 return window.getcomputedstyle( elem, null );5960 };5961 curcss = function( elem, name, _computed ) {5962 var width, minwidth, maxwidth,5963 computed = _computed || getstyles( elem ),5964 // getpropertyvalue is only needed for .css('filter') in ie9, see #125375965 ret = computed ? computed.getpropertyvalue( name ) || computed[ name ] : undefined,5966 style = elem.style;5967 if ( computed ) {5968 if ( ret === "" && !jquery.contains( elem.ownerdocument, elem ) ) {5969 ret = jquery.style( elem, name );5970 }5971 // a tribute to the "awesome hack by dean edwards"5972 // chrome < 17 and safari 5.0 uses "computed value" instead of "used value" for margin-right5973 // safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels5974 // this is against the cssom draft spec: http://dev.w3.org/csswg/cssom/#resolved-values5975 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {5976 // remember the original values5977 width = style.width;5978 minwidth = style.minwidth;5979 maxwidth = style.maxwidth;5980 // put in the new values to get a computed value out5981 style.minwidth = style.maxwidth = style.width = ret;5982 ret = computed.width;5983 // revert the changed values5984 style.width = width;5985 style.minwidth = minwidth;5986 style.maxwidth = maxwidth;5987 }5988 }5989 return ret;5990 };5991 } else if ( document.documentelement.currentstyle ) {5992 getstyles = function( elem ) {5993 return elem.currentstyle;5994 };5995 curcss = function( elem, name, _computed ) {5996 var left, rs, rsleft,5997 computed = _computed || getstyles( elem ),5998 ret = computed ? computed[ name ] : undefined,5999 style = elem.style;6000 // avoid setting ret to empty string here6001 // so we don't default to auto6002 if ( ret == null && style && style[ name ] ) {6003 ret = style[ name ];6004 }6005 // from the awesome hack by dean edwards6006 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022916007 // if we're not dealing with a regular pixel number6008 // but a number that has a weird ending, we need to convert it to pixels6009 // but not position css attributes, as those are proportional to the parent element instead6010 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem6011 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {6012 // remember the original values6013 left = style.left;6014 rs = elem.runtimestyle;6015 rsleft = rs && rs.left;6016 // put in the new values to get a computed value out6017 if ( rsleft ) {6018 rs.left = elem.currentstyle.left;6019 }6020 style.left = name === "fontsize" ? "1em" : ret;6021 ret = style.pixelleft + "px";6022 // revert the changed values6023 style.left = left;6024 if ( rsleft ) {6025 rs.left = rsleft;6026 }6027 }6028 return ret === "" ? "auto" : ret;6029 };6030 }6031 function setpositivenumber( elem, value, subtract ) {6032 var matches = rnumsplit.exec( value );6033 return matches ?6034 // guard against undefined "subtract", e.g., when used as in csshooks6035 math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :6036 value;6037 }6038 function augmentwidthorheight( elem, name, extra, isborderbox, styles ) {6039 var i = extra === ( isborderbox ? "border" : "content" ) ?6040 // if we already have the right measurement, avoid augmentation6041 4 :6042 // otherwise initialize for horizontal or vertical properties6043 name === "width" ? 1 : 0,6044 val = 0;6045 for ( ; i < 4; i += 2 ) {6046 // both box models exclude margin, so add it if we want it6047 if ( extra === "margin" ) {6048 val += jquery.css( elem, extra + cssexpand[ i ], true, styles );6049 }6050 if ( isborderbox ) {6051 // border-box includes padding, so remove it if we want content6052 if ( extra === "content" ) {6053 val -= jquery.css( elem, "padding" + cssexpand[ i ], true, styles );6054 }6055 // at this point, extra isn't border nor margin, so remove border6056 if ( extra !== "margin" ) {6057 val -= jquery.css( elem, "border" + cssexpand[ i ] + "width", true, styles );6058 }6059 } else {6060 // at this point, extra isn't content, so add padding6061 val += jquery.css( elem, "padding" + cssexpand[ i ], true, styles );6062 // at this point, extra isn't content nor padding, so add border6063 if ( extra !== "padding" ) {6064 val += jquery.css( elem, "border" + cssexpand[ i ] + "width", true, styles );6065 }6066 }6067 }6068 return val;6069 }6070 function getwidthorheight( elem, name, extra ) {6071 // start with offset property, which is equivalent to the border-box value6072 var valueisborderbox = true,6073 val = name === "width" ? elem.offsetwidth : elem.offsetheight,6074 styles = getstyles( elem ),6075 isborderbox = jquery.support.boxsizing && jquery.css( elem, "boxsizing", false, styles ) === "border-box";6076 // some non-html elements return undefined for offsetwidth, so check for null/undefined6077 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=6492856078 // mathml - https://bugzilla.mozilla.org/show_bug.cgi?id=4916686079 if ( val <= 0 || val == null ) {6080 // fall back to computed then uncomputed css if necessary6081 val = curcss( elem, name, styles );6082 if ( val < 0 || val == null ) {6083 val = elem.style[ name ];6084 }6085 // computed unit is not pixels. stop here and return.6086 if ( rnumnonpx.test(val) ) {6087 return val;6088 }6089 // we need the check for style in case a browser which returns unreliable values6090 // for getcomputedstyle silently falls back to the reliable elem.style6091 valueisborderbox = isborderbox && ( jquery.support.boxsizingreliable || val === elem.style[ name ] );6092 // normalize "", auto, and prepare for extra6093 val = parsefloat( val ) || 0;6094 }6095 // use the active box-sizing model to add/subtract irrelevant styles6096 return ( val +6097 augmentwidthorheight(6098 elem,6099 name,6100 extra || ( isborderbox ? "border" : "content" ),6101 valueisborderbox,6102 styles6103 )6104 ) + "px";6105 }6106// try to determine the default display value of an element6107 function css_defaultdisplay( nodename ) {6108 var doc = document,6109 display = elemdisplay[ nodename ];6110 if ( !display ) {6111 display = actualdisplay( nodename, doc );6112 // if the simple way fails, read from inside an iframe6113 if ( display === "none" || !display ) {6114 // use the already-created iframe if possible6115 iframe = ( iframe ||6116 jquery("<iframe frameborder='0' width='0' height='0'/>")6117 .css( "csstext", "display:block !important" )6118 ).appendto( doc.documentelement );6119 // always write a new html skeleton so webkit and firefox don't choke on reuse6120 doc = ( iframe[0].contentwindow || iframe[0].contentdocument ).document;6121 doc.write("<!doctype html><html><body>");6122 doc.close();6123 display = actualdisplay( nodename, doc );6124 iframe.detach();6125 }6126 // store the correct default display6127 elemdisplay[ nodename ] = display;6128 }6129 return display;6130 }6131// called only from within css_defaultdisplay6132 function actualdisplay( name, doc ) {6133 var elem = jquery( doc.createelement( name ) ).appendto( doc.body ),6134 display = jquery.css( elem[0], "display" );6135 elem.remove();6136 return display;6137 }6138 jquery.each([ "height", "width" ], function( i, name ) {6139 jquery.csshooks[ name ] = {6140 get: function( elem, computed, extra ) {6141 if ( computed ) {6142 // certain elements can have dimension info if we invisibly show them6143 // however, it must have a current display style that would benefit from this6144 return elem.offsetwidth === 0 && rdisplayswap.test( jquery.css( elem, "display" ) ) ?6145 jquery.swap( elem, cssshow, function() {6146 return getwidthorheight( elem, name, extra );6147 }) :6148 getwidthorheight( elem, name, extra );6149 }6150 },6151 set: function( elem, value, extra ) {6152 var styles = extra && getstyles( elem );6153 return setpositivenumber( elem, value, extra ?6154 augmentwidthorheight(6155 elem,6156 name,6157 extra,6158 jquery.support.boxsizing && jquery.css( elem, "boxsizing", false, styles ) === "border-box",6159 styles6160 ) : 06161 );6162 }6163 };6164 });6165 if ( !jquery.support.opacity ) {6166 jquery.csshooks.opacity = {6167 get: function( elem, computed ) {6168 // ie uses filters for opacity6169 return ropacity.test( (computed && elem.currentstyle ? elem.currentstyle.filter : elem.style.filter) || "" ) ?6170 ( 0.01 * parsefloat( regexp.$1 ) ) + "" :6171 computed ? "1" : "";6172 },6173 set: function( elem, value ) {6174 var style = elem.style,6175 currentstyle = elem.currentstyle,6176 opacity = jquery.isnumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",6177 filter = currentstyle && currentstyle.filter || style.filter || "";6178 // ie has trouble with opacity if it does not have layout6179 // force it by setting the zoom level6180 style.zoom = 1;6181 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #66526182 // if value === "", then remove inline opacity #126856183 if ( ( value >= 1 || value === "" ) &&6184 jquery.trim( filter.replace( ralpha, "" ) ) === "" &&6185 style.removeattribute ) {6186 // setting style.filter to null, "" & " " still leave "filter:" in the csstext6187 // if "filter:" is present at all, cleartype is disabled, we want to avoid this6188 // style.removeattribute is ie only, but so apparently is this code path...6189 style.removeattribute( "filter" );6190 // if there is no filter style applied in a css rule or unset inline opacity, we are done6191 if ( value === "" || currentstyle && !currentstyle.filter ) {6192 return;6193 }6194 }6195 // otherwise, set new filter values6196 style.filter = ralpha.test( filter ) ?6197 filter.replace( ralpha, opacity ) :6198 filter + " " + opacity;6199 }6200 };6201 }6202// these hooks cannot be added until dom ready because the support test6203// for it is not run until after dom ready6204 jquery(function() {6205 if ( !jquery.support.reliablemarginright ) {6206 jquery.csshooks.marginright = {6207 get: function( elem, computed ) {6208 if ( computed ) {6209 // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right6210 // work around by temporarily setting element display to inline-block6211 return jquery.swap( elem, { "display": "inline-block" },6212 curcss, [ elem, "marginright" ] );6213 }6214 }6215 };6216 }6217 // webkit bug: https://bugs.webkit.org/show_bug.cgi?id=290846218 // getcomputedstyle returns percent when specified for top/left/bottom/right6219 // rather than make the css module depend on the offset module, we just check for it here6220 if ( !jquery.support.pixelposition && jquery.fn.position ) {6221 jquery.each( [ "top", "left" ], function( i, prop ) {6222 jquery.csshooks[ prop ] = {6223 get: function( elem, computed ) {6224 if ( computed ) {6225 computed = curcss( elem, prop );6226 // if curcss returns percentage, fallback to offset6227 return rnumnonpx.test( computed ) ?6228 jquery( elem ).position()[ prop ] + "px" :6229 computed;6230 }6231 }6232 };6233 });6234 }6235 });6236 if ( jquery.expr && jquery.expr.filters ) {6237 jquery.expr.filters.hidden = function( elem ) {6238 // support: opera <= 12.126239 // opera reports offsetwidths and offsetheights less than zero on some elements6240 return elem.offsetwidth <= 0 && elem.offsetheight <= 0 ||6241 (!jquery.support.reliablehiddenoffsets && ((elem.style && elem.style.display) || jquery.css( elem, "display" )) === "none");6242 };6243 jquery.expr.filters.visible = function( elem ) {6244 return !jquery.expr.filters.hidden( elem );6245 };6246 }6247// these hooks are used by animate to expand properties6248 jquery.each({6249 margin: "",6250 padding: "",6251 border: "width"6252 }, function( prefix, suffix ) {6253 jquery.csshooks[ prefix + suffix ] = {6254 expand: function( value ) {6255 var i = 0,6256 expanded = {},6257 // assumes a single number if not a string6258 parts = typeof value === "string" ? value.split(" ") : [ value ];6259 for ( ; i < 4; i++ ) {6260 expanded[ prefix + cssexpand[ i ] + suffix ] =6261 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];6262 }6263 return expanded;6264 }6265 };6266 if ( !rmargin.test( prefix ) ) {6267 jquery.csshooks[ prefix + suffix ].set = setpositivenumber;6268 }6269 });6270 var r20 = /%20/g,6271 rbracket = /\[\]$/,6272 rcrlf = /\r?\n/g,6273 rsubmittertypes = /^(?:submit|button|image|reset|file)$/i,6274 rsubmittable = /^(?:input|select|textarea|keygen)/i;6275 jquery.fn.extend({6276 serialize: function() {6277 return jquery.param( this.serializearray() );6278 },6279 serializearray: function() {6280 return this.map(function(){6281 // can add prophook for "elements" to filter or add form elements6282 var elements = jquery.prop( this, "elements" );6283 return elements ? jquery.makearray( elements ) : this;6284 })6285 .filter(function(){6286 var type = this.type;6287 // use .is(":disabled") so that fieldset[disabled] works6288 return this.name && !jquery( this ).is( ":disabled" ) &&6289 rsubmittable.test( this.nodename ) && !rsubmittertypes.test( type ) &&6290 ( this.checked || !manipulation_rcheckabletype.test( type ) );6291 })6292 .map(function( i, elem ){6293 var val = jquery( this ).val();6294 return val == null ?6295 null :6296 jquery.isarray( val ) ?6297 jquery.map( val, function( val ){6298 return { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };6299 }) :6300 { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };6301 }).get();6302 }6303 });6304//serialize an array of form elements or a set of6305//key/values into a query string6306 jquery.param = function( a, traditional ) {6307 var prefix,6308 s = [],6309 add = function( key, value ) {6310 // if value is a function, invoke it and return its value6311 value = jquery.isfunction( value ) ? value() : ( value == null ? "" : value );6312 s[ s.length ] = encodeuricomponent( key ) + "=" + encodeuricomponent( value );6313 };6314 // set traditional to true for jquery <= 1.3.2 behavior.6315 if ( traditional === undefined ) {6316 traditional = jquery.ajaxsettings && jquery.ajaxsettings.traditional;6317 }6318 // if an array was passed in, assume that it is an array of form elements.6319 if ( jquery.isarray( a ) || ( a.jquery && !jquery.isplainobject( a ) ) ) {6320 // serialize the form elements6321 jquery.each( a, function() {6322 add( this.name, this.value );6323 });6324 } else {6325 // if traditional, encode the "old" way (the way 1.3.2 or older6326 // did it), otherwise encode params recursively.6327 for ( prefix in a ) {6328 buildparams( prefix, a[ prefix ], traditional, add );6329 }6330 }6331 // return the resulting serialization6332 return s.join( "&" ).replace( r20, "+" );6333 };6334 function buildparams( prefix, obj, traditional, add ) {6335 var name;6336 if ( jquery.isarray( obj ) ) {6337 // serialize array item.6338 jquery.each( obj, function( i, v ) {6339 if ( traditional || rbracket.test( prefix ) ) {6340 // treat each array item as a scalar.6341 add( prefix, v );6342 } else {6343 // item is non-scalar (array or object), encode its numeric index.6344 buildparams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );6345 }6346 });6347 } else if ( !traditional && jquery.type( obj ) === "object" ) {6348 // serialize object item.6349 for ( name in obj ) {6350 buildparams( prefix + "[" + name + "]", obj[ name ], traditional, add );6351 }6352 } else {6353 // serialize scalar item.6354 add( prefix, obj );6355 }6356 }6357 jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +6358 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +6359 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {6360 // handle event binding6361 jquery.fn[ name ] = function( data, fn ) {6362 return arguments.length > 0 ?6363 this.on( name, null, data, fn ) :6364 this.trigger( name );6365 };6366 });6367 jquery.fn.extend({6368 hover: function( fnover, fnout ) {6369 return this.mouseenter( fnover ).mouseleave( fnout || fnover );6370 },6371 bind: function( types, data, fn ) {6372 return this.on( types, null, data, fn );6373 },6374 unbind: function( types, fn ) {6375 return this.off( types, null, fn );6376 },6377 delegate: function( selector, types, data, fn ) {6378 return this.on( types, selector, data, fn );6379 },6380 undelegate: function( selector, types, fn ) {6381 // ( namespace ) or ( selector, types [, fn] )6382 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );6383 }6384 });6385 var6386 // document location6387 ajaxlocparts,6388 ajaxlocation,6389 ajax_nonce = jquery.now(),6390 ajax_rquery = /\?/,6391 rhash = /#.*$/,6392 rts = /([?&])_=[^&]*/,6393 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // ie leaves an \r character at eol6394 // #7653, #8125, #8152: local protocol detection6395 rlocalprotocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,6396 rnocontent = /^(?:get|head)$/,6397 rprotocol = /^\/\//,6398 rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,6399 // keep a copy of the old load method6400 _load = jquery.fn.load,6401 /* prefilters6402 * 1) they are useful to introduce custom datatypes (see ajax/jsonp.js for an example)6403 * 2) these are called:6404 * - before asking for a transport6405 * - after param serialization (s.data is a string if s.processdata is true)6406 * 3) key is the datatype6407 * 4) the catchall symbol "*" can be used6408 * 5) execution will start with transport datatype and then continue down to "*" if needed6409 */6410 prefilters = {},6411 /* transports bindings6412 * 1) key is the datatype6413 * 2) the catchall symbol "*" can be used6414 * 3) selection will start with transport datatype and then go to "*" if needed6415 */6416 transports = {},6417 // avoid comment-prolog char sequence (#10098); must appease lint and evade compression6418 alltypes = "*/".concat("*");6419// #8138, ie may throw an exception when accessing6420// a field from window.location if document.domain has been set6421 try {6422 ajaxlocation = location.href;6423 } catch( e ) {6424 // use the href attribute of an a element6425 // since ie will modify it given document.location6426 ajaxlocation = document.createelement( "a" );6427 ajaxlocation.href = "";6428 ajaxlocation = ajaxlocation.href;6429 }6430// segment location into parts6431 ajaxlocparts = rurl.exec( ajaxlocation.tolowercase() ) || [];6432// base "constructor" for jquery.ajaxprefilter and jquery.ajaxtransport6433 function addtoprefiltersortransports( structure ) {6434 // datatypeexpression is optional and defaults to "*"6435 return function( datatypeexpression, func ) {6436 if ( typeof datatypeexpression !== "string" ) {6437 func = datatypeexpression;6438 datatypeexpression = "*";6439 }6440 var datatype,6441 i = 0,6442 datatypes = datatypeexpression.tolowercase().match( core_rnotwhite ) || [];6443 if ( jquery.isfunction( func ) ) {6444 // for each datatype in the datatypeexpression6445 while ( (datatype = datatypes[i++]) ) {6446 // prepend if requested6447 if ( datatype[0] === "+" ) {6448 datatype = datatype.slice( 1 ) || "*";6449 (structure[ datatype ] = structure[ datatype ] || []).unshift( func );6450 // otherwise append6451 } else {6452 (structure[ datatype ] = structure[ datatype ] || []).push( func );6453 }6454 }6455 }6456 };6457 }6458// base inspection function for prefilters and transports6459 function inspectprefiltersortransports( structure, options, originaloptions, jqxhr ) {6460 var inspected = {},6461 seekingtransport = ( structure === transports );6462 function inspect( datatype ) {6463 var selected;6464 inspected[ datatype ] = true;6465 jquery.each( structure[ datatype ] || [], function( _, prefilterorfactory ) {6466 var datatypeortransport = prefilterorfactory( options, originaloptions, jqxhr );6467 if( typeof datatypeortransport === "string" && !seekingtransport && !inspected[ datatypeortransport ] ) {6468 options.datatypes.unshift( datatypeortransport );6469 inspect( datatypeortransport );6470 return false;6471 } else if ( seekingtransport ) {6472 return !( selected = datatypeortransport );6473 }6474 });6475 return selected;6476 }6477 return inspect( options.datatypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );6478 }6479// a special extend for ajax options6480// that takes "flat" options (not to be deep extended)6481// fixes #98876482 function ajaxextend( target, src ) {6483 var deep, key,6484 flatoptions = jquery.ajaxsettings.flatoptions || {};6485 for ( key in src ) {6486 if ( src[ key ] !== undefined ) {6487 ( flatoptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];6488 }6489 }6490 if ( deep ) {6491 jquery.extend( true, target, deep );6492 }6493 return target;6494 }6495 jquery.fn.load = function( url, params, callback ) {6496 if ( typeof url !== "string" && _load ) {6497 return _load.apply( this, arguments );6498 }6499 var selector, response, type,6500 self = this,6501 off = url.indexof(" ");6502 if ( off >= 0 ) {6503 selector = url.slice( off, url.length );6504 url = url.slice( 0, off );6505 }6506 // if it's a function6507 if ( jquery.isfunction( params ) ) {6508 // we assume that it's the callback6509 callback = params;6510 params = undefined;6511 // otherwise, build a param string6512 } else if ( params && typeof params === "object" ) {6513 type = "post";6514 }6515 // if we have elements to modify, make the request6516 if ( self.length > 0 ) {6517 jquery.ajax({6518 url: url,6519 // if "type" variable is undefined, then "get" method will be used6520 type: type,6521 datatype: "html",6522 data: params6523 }).done(function( responsetext ) {6524 // save response for use in complete callback6525 response = arguments;6526 self.html( selector ?6527 // if a selector was specified, locate the right elements in a dummy div6528 // exclude scripts to avoid ie 'permission denied' errors6529 jquery("<div>").append( jquery.parsehtml( responsetext ) ).find( selector ) :6530 // otherwise use the full result6531 responsetext );6532 }).complete( callback && function( jqxhr, status ) {6533 self.each( callback, response || [ jqxhr.responsetext, status, jqxhr ] );6534 });6535 }6536 return this;6537 };6538// attach a bunch of functions for handling common ajax events6539 jquery.each( [ "ajaxstart", "ajaxstop", "ajaxcomplete", "ajaxerror", "ajaxsuccess", "ajaxsend" ], function( i, type ){6540 jquery.fn[ type ] = function( fn ){6541 return this.on( type, fn );6542 };6543 });6544 jquery.extend({6545 // counter for holding the number of active queries6546 active: 0,6547 // last-modified header cache for next request6548 lastmodified: {},6549 etag: {},6550 ajaxsettings: {6551 url: ajaxlocation,6552 type: "get",6553 islocal: rlocalprotocol.test( ajaxlocparts[ 1 ] ),6554 global: true,6555 processdata: true,6556 async: true,6557 contenttype: "application/x-www-form-urlencoded; charset=utf-8",6558 /*6559 timeout: 0,6560 data: null,6561 datatype: null,6562 username: null,6563 password: null,6564 cache: null,6565 throws: false,6566 traditional: false,6567 headers: {},6568 */6569 accepts: {6570 "*": alltypes,6571 text: "text/plain",6572 html: "text/html",6573 xml: "application/xml, text/xml",6574 json: "application/json, text/javascript"6575 },6576 contents: {6577 xml: /xml/,6578 html: /html/,6579 json: /json/6580 },6581 responsefields: {6582 xml: "responsexml",6583 text: "responsetext",6584 json: "responsejson"6585 },6586 // data converters6587 // keys separate source (or catchall "*") and destination types with a single space6588 converters: {6589 // convert anything to text6590 "* text": string,6591 // text to html (true = no transformation)6592 "text html": true,6593 // evaluate text as a json expression6594 "text json": jquery.parsejson,6595 // parse text as xml6596 "text xml": jquery.parsexml6597 },6598 // for options that shouldn't be deep extended:6599 // you can add your own custom options here if6600 // and when you create one that shouldn't be6601 // deep extended (see ajaxextend)6602 flatoptions: {6603 url: true,6604 context: true6605 }6606 },6607 // creates a full fledged settings object into target6608 // with both ajaxsettings and settings fields.6609 // if target is omitted, writes into ajaxsettings.6610 ajaxsetup: function( target, settings ) {6611 return settings ?6612 // building a settings object6613 ajaxextend( ajaxextend( target, jquery.ajaxsettings ), settings ) :6614 // extending ajaxsettings6615 ajaxextend( jquery.ajaxsettings, target );6616 },6617 ajaxprefilter: addtoprefiltersortransports( prefilters ),6618 ajaxtransport: addtoprefiltersortransports( transports ),6619 // main method6620 ajax: function( url, options ) {6621 // if url is an object, simulate pre-1.5 signature6622 if ( typeof url === "object" ) {6623 options = url;6624 url = undefined;6625 }6626 // force options to be an object6627 options = options || {};6628 var // cross-domain detection vars6629 parts,6630 // loop variable6631 i,6632 // url without anti-cache param6633 cacheurl,6634 // response headers as string6635 responseheadersstring,6636 // timeout handle6637 timeouttimer,6638 // to know if global events are to be dispatched6639 fireglobals,6640 transport,6641 // response headers6642 responseheaders,6643 // create the final options object6644 s = jquery.ajaxsetup( {}, options ),6645 // callbacks context6646 callbackcontext = s.context || s,6647 // context for global events is callbackcontext if it is a dom node or jquery collection6648 globaleventcontext = s.context && ( callbackcontext.nodetype || callbackcontext.jquery ) ?6649 jquery( callbackcontext ) :6650 jquery.event,6651 // deferreds6652 deferred = jquery.deferred(),6653 completedeferred = jquery.callbacks("once memory"),6654 // status-dependent callbacks6655 statuscode = s.statuscode || {},6656 // headers (they are sent all at once)6657 requestheaders = {},6658 requestheadersnames = {},6659 // the jqxhr state6660 state = 0,6661 // default abort message6662 strabort = "canceled",6663 // fake xhr6664 jqxhr = {6665 readystate: 0,6666 // builds headers hashtable if needed6667 getresponseheader: function( key ) {6668 var match;6669 if ( state === 2 ) {6670 if ( !responseheaders ) {6671 responseheaders = {};6672 while ( (match = rheaders.exec( responseheadersstring )) ) {6673 responseheaders[ match[1].tolowercase() ] = match[ 2 ];6674 }6675 }6676 match = responseheaders[ key.tolowercase() ];6677 }6678 return match == null ? null : match;6679 },6680 // raw string6681 getallresponseheaders: function() {6682 return state === 2 ? responseheadersstring : null;6683 },6684 // caches the header6685 setrequestheader: function( name, value ) {6686 var lname = name.tolowercase();6687 if ( !state ) {6688 name = requestheadersnames[ lname ] = requestheadersnames[ lname ] || name;6689 requestheaders[ name ] = value;6690 }6691 return this;6692 },6693 // overrides response content-type header6694 overridemimetype: function( type ) {6695 if ( !state ) {6696 s.mimetype = type;6697 }6698 return this;6699 },6700 // status-dependent callbacks6701 statuscode: function( map ) {6702 var code;6703 if ( map ) {6704 if ( state < 2 ) {6705 for ( code in map ) {6706 // lazy-add the new callback in a way that preserves old ones6707 statuscode[ code ] = [ statuscode[ code ], map[ code ] ];6708 }6709 } else {6710 // execute the appropriate callbacks6711 jqxhr.always( map[ jqxhr.status ] );6712 }6713 }6714 return this;6715 },6716 // cancel the request6717 abort: function( statustext ) {6718 var finaltext = statustext || strabort;6719 if ( transport ) {6720 transport.abort( finaltext );6721 }6722 done( 0, finaltext );6723 return this;6724 }6725 };6726 // attach deferreds6727 deferred.promise( jqxhr ).complete = completedeferred.add;6728 jqxhr.success = jqxhr.done;6729 jqxhr.error = jqxhr.fail;6730 // remove hash character (#7531: and string promotion)6731 // add protocol if not provided (#5866: ie7 issue with protocol-less urls)6732 // handle falsy url in the settings object (#10093: consistency with old signature)6733 // we also use the url parameter if available6734 s.url = ( ( url || s.url || ajaxlocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxlocparts[ 1 ] + "//" );6735 // alias method option to type as per ticket #120046736 s.type = options.method || options.type || s.method || s.type;6737 // extract datatypes list6738 s.datatypes = jquery.trim( s.datatype || "*" ).tolowercase().match( core_rnotwhite ) || [""];6739 // a cross-domain request is in order when we have a protocol:host:port mismatch6740 if ( s.crossdomain == null ) {6741 parts = rurl.exec( s.url.tolowercase() );6742 s.crossdomain = !!( parts &&6743 ( parts[ 1 ] !== ajaxlocparts[ 1 ] || parts[ 2 ] !== ajaxlocparts[ 2 ] ||6744 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==6745 ( ajaxlocparts[ 3 ] || ( ajaxlocparts[ 1 ] === "http:" ? "80" : "443" ) ) )6746 );6747 }6748 // convert data if not already a string6749 if ( s.data && s.processdata && typeof s.data !== "string" ) {6750 s.data = jquery.param( s.data, s.traditional );6751 }6752 // apply prefilters6753 inspectprefiltersortransports( prefilters, s, options, jqxhr );6754 // if request was aborted inside a prefilter, stop there6755 if ( state === 2 ) {6756 return jqxhr;6757 }6758 // we can fire global events as of now if asked to6759 fireglobals = s.global;6760 // watch for a new set of requests6761 if ( fireglobals && jquery.active++ === 0 ) {6762 jquery.event.trigger("ajaxstart");6763 }6764 // uppercase the type6765 s.type = s.type.touppercase();6766 // determine if request has content6767 s.hascontent = !rnocontent.test( s.type );6768 // save the url in case we're toying with the if-modified-since6769 // and/or if-none-match header later on6770 cacheurl = s.url;6771 // more options handling for requests with no content6772 if ( !s.hascontent ) {6773 // if data is available, append data to url6774 if ( s.data ) {6775 cacheurl = ( s.url += ( ajax_rquery.test( cacheurl ) ? "&" : "?" ) + s.data );6776 // #9682: remove data so that it's not used in an eventual retry6777 delete s.data;6778 }6779 // add anti-cache in url if needed6780 if ( s.cache === false ) {6781 s.url = rts.test( cacheurl ) ?6782 // if there is already a '_' parameter, set its value6783 cacheurl.replace( rts, "$1_=" + ajax_nonce++ ) :6784 // otherwise add one to the end6785 cacheurl + ( ajax_rquery.test( cacheurl ) ? "&" : "?" ) + "_=" + ajax_nonce++;6786 }6787 }6788 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.6789 if ( s.ifmodified ) {6790 if ( jquery.lastmodified[ cacheurl ] ) {6791 jqxhr.setrequestheader( "if-modified-since", jquery.lastmodified[ cacheurl ] );6792 }6793 if ( jquery.etag[ cacheurl ] ) {6794 jqxhr.setrequestheader( "if-none-match", jquery.etag[ cacheurl ] );6795 }6796 }6797 // set the correct header, if data is being sent6798 if ( s.data && s.hascontent && s.contenttype !== false || options.contenttype ) {6799 jqxhr.setrequestheader( "content-type", s.contenttype );6800 }6801 // set the accepts header for the server, depending on the datatype6802 jqxhr.setrequestheader(6803 "accept",6804 s.datatypes[ 0 ] && s.accepts[ s.datatypes[0] ] ?6805 s.accepts[ s.datatypes[0] ] + ( s.datatypes[ 0 ] !== "*" ? ", " + alltypes + "; q=0.01" : "" ) :6806 s.accepts[ "*" ]6807 );6808 // check for headers option6809 for ( i in s.headers ) {6810 jqxhr.setrequestheader( i, s.headers[ i ] );6811 }6812 // allow custom headers/mimetypes and early abort6813 if ( s.beforesend && ( s.beforesend.call( callbackcontext, jqxhr, s ) === false || state === 2 ) ) {6814 // abort if not done already and return6815 return jqxhr.abort();6816 }6817 // aborting is no longer a cancellation6818 strabort = "abort";6819 // install callbacks on deferreds6820 for ( i in { success: 1, error: 1, complete: 1 } ) {6821 jqxhr[ i ]( s[ i ] );6822 }6823 // get transport6824 transport = inspectprefiltersortransports( transports, s, options, jqxhr );6825 // if no transport, we auto-abort6826 if ( !transport ) {6827 done( -1, "no transport" );6828 } else {6829 jqxhr.readystate = 1;6830 // send global event6831 if ( fireglobals ) {6832 globaleventcontext.trigger( "ajaxsend", [ jqxhr, s ] );6833 }6834 // timeout6835 if ( s.async && s.timeout > 0 ) {6836 timeouttimer = settimeout(function() {6837 jqxhr.abort("timeout");6838 }, s.timeout );6839 }6840 try {6841 state = 1;6842 transport.send( requestheaders, done );6843 } catch ( e ) {6844 // propagate exception as error if not done6845 if ( state < 2 ) {6846 done( -1, e );6847 // simply rethrow otherwise6848 } else {6849 throw e;6850 }6851 }6852 }6853 // callback for when everything is done6854 function done( status, nativestatustext, responses, headers ) {6855 var issuccess, success, error, response, modified,6856 statustext = nativestatustext;6857 // called once6858 if ( state === 2 ) {6859 return;6860 }6861 // state is "done" now6862 state = 2;6863 // clear timeout if it exists6864 if ( timeouttimer ) {6865 cleartimeout( timeouttimer );6866 }6867 // dereference transport for early garbage collection6868 // (no matter how long the jqxhr object will be used)6869 transport = undefined;6870 // cache response headers6871 responseheadersstring = headers || "";6872 // set readystate6873 jqxhr.readystate = status > 0 ? 4 : 0;6874 // determine if successful6875 issuccess = status >= 200 && status < 300 || status === 304;6876 // get response data6877 if ( responses ) {6878 response = ajaxhandleresponses( s, jqxhr, responses );6879 }6880 // convert no matter what (that way responsexxx fields are always set)6881 response = ajaxconvert( s, response, jqxhr, issuccess );6882 // if successful, handle type chaining6883 if ( issuccess ) {6884 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.6885 if ( s.ifmodified ) {6886 modified = jqxhr.getresponseheader("last-modified");6887 if ( modified ) {6888 jquery.lastmodified[ cacheurl ] = modified;6889 }6890 modified = jqxhr.getresponseheader("etag");6891 if ( modified ) {6892 jquery.etag[ cacheurl ] = modified;6893 }6894 }6895 // if no content6896 if ( status === 204 || s.type === "head" ) {6897 statustext = "nocontent";6898 // if not modified6899 } else if ( status === 304 ) {6900 statustext = "notmodified";6901 // if we have data, let's convert it6902 } else {6903 statustext = response.state;6904 success = response.data;6905 error = response.error;6906 issuccess = !error;6907 }6908 } else {6909 // we extract error from statustext6910 // then normalize statustext and status for non-aborts6911 error = statustext;6912 if ( status || !statustext ) {6913 statustext = "error";6914 if ( status < 0 ) {6915 status = 0;6916 }6917 }6918 }6919 // set data for the fake xhr object6920 jqxhr.status = status;6921 jqxhr.statustext = ( nativestatustext || statustext ) + "";6922 // success/error6923 if ( issuccess ) {6924 deferred.resolvewith( callbackcontext, [ success, statustext, jqxhr ] );6925 } else {6926 deferred.rejectwith( callbackcontext, [ jqxhr, statustext, error ] );6927 }6928 // status-dependent callbacks6929 jqxhr.statuscode( statuscode );6930 statuscode = undefined;6931 if ( fireglobals ) {6932 globaleventcontext.trigger( issuccess ? "ajaxsuccess" : "ajaxerror",6933 [ jqxhr, s, issuccess ? success : error ] );6934 }6935 // complete6936 completedeferred.firewith( callbackcontext, [ jqxhr, statustext ] );6937 if ( fireglobals ) {6938 globaleventcontext.trigger( "ajaxcomplete", [ jqxhr, s ] );6939 // handle the global ajax counter6940 if ( !( --jquery.active ) ) {6941 jquery.event.trigger("ajaxstop");6942 }6943 }6944 }6945 return jqxhr;6946 },6947 getjson: function( url, data, callback ) {6948 return jquery.get( url, data, callback, "json" );6949 },6950 getscript: function( url, callback ) {6951 return jquery.get( url, undefined, callback, "script" );6952 }6953 });6954 jquery.each( [ "get", "post" ], function( i, method ) {6955 jquery[ method ] = function( url, data, callback, type ) {6956 // shift arguments if data argument was omitted6957 if ( jquery.isfunction( data ) ) {6958 type = type || callback;6959 callback = data;6960 data = undefined;6961 }6962 return jquery.ajax({6963 url: url,6964 type: method,6965 datatype: type,6966 data: data,6967 success: callback6968 });6969 };6970 });6971 /* handles responses to an ajax request:6972 * - finds the right datatype (mediates between content-type and expected datatype)6973 * - returns the corresponding response6974 */6975 function ajaxhandleresponses( s, jqxhr, responses ) {6976 var firstdatatype, ct, finaldatatype, type,6977 contents = s.contents,6978 datatypes = s.datatypes;6979 // remove auto datatype and get content-type in the process6980 while( datatypes[ 0 ] === "*" ) {6981 datatypes.shift();6982 if ( ct === undefined ) {6983 ct = s.mimetype || jqxhr.getresponseheader("content-type");6984 }6985 }6986 // check if we're dealing with a known content-type6987 if ( ct ) {6988 for ( type in contents ) {6989 if ( contents[ type ] && contents[ type ].test( ct ) ) {6990 datatypes.unshift( type );6991 break;6992 }6993 }6994 }6995 // check to see if we have a response for the expected datatype6996 if ( datatypes[ 0 ] in responses ) {6997 finaldatatype = datatypes[ 0 ];6998 } else {6999 // try convertible datatypes7000 for ( type in responses ) {7001 if ( !datatypes[ 0 ] || s.converters[ type + " " + datatypes[0] ] ) {7002 finaldatatype = type;7003 break;7004 }7005 if ( !firstdatatype ) {7006 firstdatatype = type;7007 }7008 }7009 // or just use first one7010 finaldatatype = finaldatatype || firstdatatype;7011 }7012 // if we found a datatype7013 // we add the datatype to the list if needed7014 // and return the corresponding response7015 if ( finaldatatype ) {7016 if ( finaldatatype !== datatypes[ 0 ] ) {7017 datatypes.unshift( finaldatatype );7018 }7019 return responses[ finaldatatype ];7020 }7021 }7022 /* chain conversions given the request and the original response7023 * also sets the responsexxx fields on the jqxhr instance7024 */7025 function ajaxconvert( s, response, jqxhr, issuccess ) {7026 var conv2, current, conv, tmp, prev,7027 converters = {},7028 // work with a copy of datatypes in case we need to modify it for conversion7029 datatypes = s.datatypes.slice();7030 // create converters map with lowercased keys7031 if ( datatypes[ 1 ] ) {7032 for ( conv in s.converters ) {7033 converters[ conv.tolowercase() ] = s.converters[ conv ];7034 }7035 }7036 current = datatypes.shift();7037 // convert to each sequential datatype7038 while ( current ) {7039 if ( s.responsefields[ current ] ) {7040 jqxhr[ s.responsefields[ current ] ] = response;7041 }7042 // apply the datafilter if provided7043 if ( !prev && issuccess && s.datafilter ) {7044 response = s.datafilter( response, s.datatype );7045 }7046 prev = current;7047 current = datatypes.shift();7048 if ( current ) {7049 // there's only work to do if current datatype is non-auto7050 if ( current === "*" ) {7051 current = prev;7052 // convert response if prev datatype is non-auto and differs from current7053 } else if ( prev !== "*" && prev !== current ) {7054 // seek a direct converter7055 conv = converters[ prev + " " + current ] || converters[ "* " + current ];7056 // if none found, seek a pair7057 if ( !conv ) {7058 for ( conv2 in converters ) {7059 // if conv2 outputs current7060 tmp = conv2.split( " " );7061 if ( tmp[ 1 ] === current ) {7062 // if prev can be converted to accepted input7063 conv = converters[ prev + " " + tmp[ 0 ] ] ||7064 converters[ "* " + tmp[ 0 ] ];7065 if ( conv ) {7066 // condense equivalence converters7067 if ( conv === true ) {7068 conv = converters[ conv2 ];7069 // otherwise, insert the intermediate datatype7070 } else if ( converters[ conv2 ] !== true ) {7071 current = tmp[ 0 ];7072 datatypes.unshift( tmp[ 1 ] );7073 }7074 break;7075 }7076 }7077 }7078 }7079 // apply converter (if not an equivalence)7080 if ( conv !== true ) {7081 // unless errors are allowed to bubble, catch and return them7082 if ( conv && s[ "throws" ] ) {7083 response = conv( response );7084 } else {7085 try {7086 response = conv( response );7087 } catch ( e ) {7088 return { state: "parsererror", error: conv ? e : "no conversion from " + prev + " to " + current };7089 }7090 }7091 }7092 }7093 }7094 }7095 return { state: "success", data: response };7096 }7097// install script datatype7098 jquery.ajaxsetup({7099 accepts: {7100 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"7101 },7102 contents: {7103 script: /(?:java|ecma)script/7104 },7105 converters: {7106 "text script": function( text ) {7107 jquery.globaleval( text );7108 return text;7109 }7110 }7111 });7112// handle cache's special case and global7113 jquery.ajaxprefilter( "script", function( s ) {7114 if ( s.cache === undefined ) {7115 s.cache = false;7116 }7117 if ( s.crossdomain ) {7118 s.type = "get";7119 s.global = false;7120 }7121 });7122// bind script tag hack transport7123 jquery.ajaxtransport( "script", function(s) {7124 // this transport only deals with cross domain requests7125 if ( s.crossdomain ) {7126 var script,7127 head = document.head || jquery("head")[0] || document.documentelement;7128 return {7129 send: function( _, callback ) {7130 script = document.createelement("script");7131 script.async = true;7132 if ( s.scriptcharset ) {7133 script.charset = s.scriptcharset;7134 }7135 script.src = s.url;7136 // attach handlers for all browsers7137 script.onload = script.onreadystatechange = function( _, isabort ) {7138 if ( isabort || !script.readystate || /loaded|complete/.test( script.readystate ) ) {7139 // handle memory leak in ie7140 script.onload = script.onreadystatechange = null;7141 // remove the script7142 if ( script.parentnode ) {7143 script.parentnode.removechild( script );7144 }7145 // dereference the script7146 script = null;7147 // callback if not abort7148 if ( !isabort ) {7149 callback( 200, "success" );7150 }7151 }7152 };7153 // circumvent ie6 bugs with base elements (#2709 and #4378) by prepending7154 // use native dom manipulation to avoid our dommanip ajax trickery7155 head.insertbefore( script, head.firstchild );7156 },7157 abort: function() {7158 if ( script ) {7159 script.onload( undefined, true );7160 }7161 }7162 };7163 }7164 });7165 var oldcallbacks = [],7166 rjsonp = /(=)\?(?=&|$)|\?\?/;7167// default jsonp settings7168 jquery.ajaxsetup({7169 jsonp: "callback",7170 jsonpcallback: function() {7171 var callback = oldcallbacks.pop() || ( jquery.expando + "_" + ( ajax_nonce++ ) );7172 this[ callback ] = true;7173 return callback;7174 }7175 });7176// detect, normalize options and install callbacks for jsonp requests7177 jquery.ajaxprefilter( "json jsonp", function( s, originalsettings, jqxhr ) {7178 var callbackname, overwritten, responsecontainer,7179 jsonprop = s.jsonp !== false && ( rjsonp.test( s.url ) ?7180 "url" :7181 typeof s.data === "string" && !( s.contenttype || "" ).indexof("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"7182 );7183 // handle iff the expected data type is "jsonp" or we have a parameter to set7184 if ( jsonprop || s.datatypes[ 0 ] === "jsonp" ) {7185 // get callback name, remembering preexisting value associated with it7186 callbackname = s.jsonpcallback = jquery.isfunction( s.jsonpcallback ) ?7187 s.jsonpcallback() :7188 s.jsonpcallback;7189 // insert callback into url or form data7190 if ( jsonprop ) {7191 s[ jsonprop ] = s[ jsonprop ].replace( rjsonp, "$1" + callbackname );7192 } else if ( s.jsonp !== false ) {7193 s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackname;7194 }7195 // use data converter to retrieve json after script execution7196 s.converters["script json"] = function() {7197 if ( !responsecontainer ) {7198 jquery.error( callbackname + " was not called" );7199 }7200 return responsecontainer[ 0 ];7201 };7202 // force json datatype7203 s.datatypes[ 0 ] = "json";7204 // install callback7205 overwritten = window[ callbackname ];7206 window[ callbackname ] = function() {7207 responsecontainer = arguments;7208 };7209 // clean-up function (fires after converters)7210 jqxhr.always(function() {7211 // restore preexisting value7212 window[ callbackname ] = overwritten;7213 // save back as free7214 if ( s[ callbackname ] ) {7215 // make sure that re-using the options doesn't screw things around7216 s.jsonpcallback = originalsettings.jsonpcallback;7217 // save the callback name for future use7218 oldcallbacks.push( callbackname );7219 }7220 // call if it was a function and we have a response7221 if ( responsecontainer && jquery.isfunction( overwritten ) ) {7222 overwritten( responsecontainer[ 0 ] );7223 }7224 responsecontainer = overwritten = undefined;7225 });7226 // delegate to script7227 return "script";7228 }7229 });7230 var xhrcallbacks, xhrsupported,7231 xhrid = 0,7232 // #5280: internet explorer will keep connections alive if we don't abort on unload7233 xhronunloadabort = window.activexobject && function() {7234 // abort all pending requests7235 var key;7236 for ( key in xhrcallbacks ) {7237 xhrcallbacks[ key ]( undefined, true );7238 }7239 };7240// functions to create xhrs7241 function createstandardxhr() {7242 try {7243 return new window.xmlhttprequest();7244 } catch( e ) {}7245 }7246 function createactivexhr() {7247 try {7248 return new window.activexobject("microsoft.xmlhttp");7249 } catch( e ) {}7250 }7251// create the request object7252// (this is still attached to ajaxsettings for backward compatibility)7253 jquery.ajaxsettings.xhr = window.activexobject ?7254 /* microsoft failed to properly7255 * implement the xmlhttprequest in ie7 (can't request local files),7256 * so we use the activexobject when it is available7257 * additionally xmlhttprequest can be disabled in ie7/ie8 so7258 * we need a fallback.7259 */7260 function() {7261 return !this.islocal && createstandardxhr() || createactivexhr();7262 } :7263 // for all other browsers, use the standard xmlhttprequest object7264 createstandardxhr;7265// determine support properties7266 xhrsupported = jquery.ajaxsettings.xhr();7267 jquery.support.cors = !!xhrsupported && ( "withcredentials" in xhrsupported );7268 xhrsupported = jquery.support.ajax = !!xhrsupported;7269// create transport if the browser can provide an xhr7270 if ( xhrsupported ) {7271 jquery.ajaxtransport(function( s ) {7272 // cross domain only allowed if supported through xmlhttprequest7273 if ( !s.crossdomain || jquery.support.cors ) {7274 var callback;7275 return {7276 send: function( headers, complete ) {7277 // get a new xhr7278 var handle, i,7279 xhr = s.xhr();7280 // open the socket7281 // passing null username, generates a login popup on opera (#2865)7282 if ( s.username ) {7283 xhr.open( s.type, s.url, s.async, s.username, s.password );7284 } else {7285 xhr.open( s.type, s.url, s.async );7286 }7287 // apply custom fields if provided7288 if ( s.xhrfields ) {7289 for ( i in s.xhrfields ) {7290 xhr[ i ] = s.xhrfields[ i ];7291 }7292 }7293 // override mime type if needed7294 if ( s.mimetype && xhr.overridemimetype ) {7295 xhr.overridemimetype( s.mimetype );7296 }7297 // x-requested-with header7298 // for cross-domain requests, seeing as conditions for a preflight are7299 // akin to a jigsaw puzzle, we simply never set it to be sure.7300 // (it can always be set on a per-request basis or even using ajaxsetup)7301 // for same-domain requests, won't change header if already provided.7302 if ( !s.crossdomain && !headers["x-requested-with"] ) {7303 headers["x-requested-with"] = "xmlhttprequest";7304 }7305 // need an extra try/catch for cross domain requests in firefox 37306 try {7307 for ( i in headers ) {7308 xhr.setrequestheader( i, headers[ i ] );7309 }7310 } catch( err ) {}7311 // do send the request7312 // this may raise an exception which is actually7313 // handled in jquery.ajax (so no try/catch here)7314 xhr.send( ( s.hascontent && s.data ) || null );7315 // listener7316 callback = function( _, isabort ) {7317 var status, responseheaders, statustext, responses;7318 // firefox throws exceptions when accessing properties7319 // of an xhr when a network error occurred7320 // http://helpful.knobs-dials.com/index.php/component_returned_failure_code:_0x80040111_(ns_error_not_available)7321 try {7322 // was never called and is aborted or complete7323 if ( callback && ( isabort || xhr.readystate === 4 ) ) {7324 // only called once7325 callback = undefined;7326 // do not keep as active anymore7327 if ( handle ) {7328 xhr.onreadystatechange = jquery.noop;7329 if ( xhronunloadabort ) {7330 delete xhrcallbacks[ handle ];7331 }7332 }7333 // if it's an abort7334 if ( isabort ) {7335 // abort it manually if needed7336 if ( xhr.readystate !== 4 ) {7337 xhr.abort();7338 }7339 } else {7340 responses = {};7341 status = xhr.status;7342 responseheaders = xhr.getallresponseheaders();7343 // when requesting binary data, ie6-9 will throw an exception7344 // on any attempt to access responsetext (#11426)7345 if ( typeof xhr.responsetext === "string" ) {7346 responses.text = xhr.responsetext;7347 }7348 // firefox throws an exception when accessing7349 // statustext for faulty cross-domain requests7350 try {7351 statustext = xhr.statustext;7352 } catch( e ) {7353 // we normalize with webkit giving an empty statustext7354 statustext = "";7355 }7356 // filter status for non standard behaviors7357 // if the request is local and we have data: assume a success7358 // (success with no data won't get notified, that's the best we7359 // can do given current implementations)7360 if ( !status && s.islocal && !s.crossdomain ) {7361 status = responses.text ? 200 : 404;7362 // ie - #1450: sometimes returns 1223 when it should be 2047363 } else if ( status === 1223 ) {7364 status = 204;7365 }7366 }7367 }7368 } catch( firefoxaccessexception ) {7369 if ( !isabort ) {7370 complete( -1, firefoxaccessexception );7371 }7372 }7373 // call complete if needed7374 if ( responses ) {7375 complete( status, statustext, responses, responseheaders );7376 }7377 };7378 if ( !s.async ) {7379 // if we're in sync mode we fire the callback7380 callback();7381 } else if ( xhr.readystate === 4 ) {7382 // (ie6 & ie7) if it's in cache and has been7383 // retrieved directly we need to fire the callback7384 settimeout( callback );7385 } else {7386 handle = ++xhrid;7387 if ( xhronunloadabort ) {7388 // create the active xhrs callbacks list if needed7389 // and attach the unload handler7390 if ( !xhrcallbacks ) {7391 xhrcallbacks = {};7392 jquery( window ).unload( xhronunloadabort );7393 }7394 // add to list of active xhrs callbacks7395 xhrcallbacks[ handle ] = callback;7396 }7397 xhr.onreadystatechange = callback;7398 }7399 },7400 abort: function() {7401 if ( callback ) {7402 callback( undefined, true );7403 }7404 }7405 };7406 }7407 });7408 }7409 var fxnow, timerid,7410 rfxtypes = /^(?:toggle|show|hide)$/,7411 rfxnum = new regexp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),7412 rrun = /queuehooks$/,7413 animationprefilters = [ defaultprefilter ],7414 tweeners = {7415 "*": [function( prop, value ) {7416 var tween = this.createtween( prop, value ),7417 target = tween.cur(),7418 parts = rfxnum.exec( value ),7419 unit = parts && parts[ 3 ] || ( jquery.cssnumber[ prop ] ? "" : "px" ),7420 // starting value computation is required for potential unit mismatches7421 start = ( jquery.cssnumber[ prop ] || unit !== "px" && +target ) &&7422 rfxnum.exec( jquery.css( tween.elem, prop ) ),7423 scale = 1,7424 maxiterations = 20;7425 if ( start && start[ 3 ] !== unit ) {7426 // trust units reported by jquery.css7427 unit = unit || start[ 3 ];7428 // make sure we update the tween properties later on7429 parts = parts || [];7430 // iteratively approximate from a nonzero starting point7431 start = +target || 1;7432 do {7433 // if previous iteration zeroed out, double until we get *something*7434 // use a string for doubling factor so we don't accidentally see scale as unchanged below7435 scale = scale || ".5";7436 // adjust and apply7437 start = start / scale;7438 jquery.style( tween.elem, prop, start + unit );7439 // update scale, tolerating zero or nan from tween.cur()7440 // and breaking the loop if scale is unchanged or perfect, or if we've just had enough7441 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxiterations );7442 }7443 // update tween properties7444 if ( parts ) {7445 start = tween.start = +start || +target || 0;7446 tween.unit = unit;7447 // if a +=/-= token was provided, we're doing a relative animation7448 tween.end = parts[ 1 ] ?7449 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :7450 +parts[ 2 ];7451 }7452 return tween;7453 }]7454 };7455// animations created synchronously will run synchronously7456 function createfxnow() {7457 settimeout(function() {7458 fxnow = undefined;7459 });7460 return ( fxnow = jquery.now() );7461 }7462 function createtween( value, prop, animation ) {7463 var tween,7464 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),7465 index = 0,7466 length = collection.length;7467 for ( ; index < length; index++ ) {7468 if ( (tween = collection[ index ].call( animation, prop, value )) ) {7469 // we're done with this property7470 return tween;7471 }7472 }7473 }7474 function animation( elem, properties, options ) {7475 var result,7476 stopped,7477 index = 0,7478 length = animationprefilters.length,7479 deferred = jquery.deferred().always( function() {7480 // don't match elem in the :animated selector7481 delete tick.elem;7482 }),7483 tick = function() {7484 if ( stopped ) {7485 return false;7486 }7487 var currenttime = fxnow || createfxnow(),7488 remaining = math.max( 0, animation.starttime + animation.duration - currenttime ),7489 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)7490 temp = remaining / animation.duration || 0,7491 percent = 1 - temp,7492 index = 0,7493 length = animation.tweens.length;7494 for ( ; index < length ; index++ ) {7495 animation.tweens[ index ].run( percent );7496 }7497 deferred.notifywith( elem, [ animation, percent, remaining ]);7498 if ( percent < 1 && length ) {7499 return remaining;7500 } else {7501 deferred.resolvewith( elem, [ animation ] );7502 return false;7503 }7504 },7505 animation = deferred.promise({7506 elem: elem,7507 props: jquery.extend( {}, properties ),7508 opts: jquery.extend( true, { specialeasing: {} }, options ),7509 originalproperties: properties,7510 originaloptions: options,7511 starttime: fxnow || createfxnow(),7512 duration: options.duration,7513 tweens: [],7514 createtween: function( prop, end ) {7515 var tween = jquery.tween( elem, animation.opts, prop, end,7516 animation.opts.specialeasing[ prop ] || animation.opts.easing );7517 animation.tweens.push( tween );7518 return tween;7519 },7520 stop: function( gotoend ) {7521 var index = 0,7522 // if we are going to the end, we want to run all the tweens7523 // otherwise we skip this part7524 length = gotoend ? animation.tweens.length : 0;7525 if ( stopped ) {7526 return this;7527 }7528 stopped = true;7529 for ( ; index < length ; index++ ) {7530 animation.tweens[ index ].run( 1 );7531 }7532 // resolve when we played the last frame7533 // otherwise, reject7534 if ( gotoend ) {7535 deferred.resolvewith( elem, [ animation, gotoend ] );7536 } else {7537 deferred.rejectwith( elem, [ animation, gotoend ] );7538 }7539 return this;7540 }7541 }),7542 props = animation.props;7543 propfilter( props, animation.opts.specialeasing );7544 for ( ; index < length ; index++ ) {7545 result = animationprefilters[ index ].call( animation, elem, props, animation.opts );7546 if ( result ) {7547 return result;7548 }7549 }7550 jquery.map( props, createtween, animation );7551 if ( jquery.isfunction( animation.opts.start ) ) {7552 animation.opts.start.call( elem, animation );7553 }7554 jquery.fx.timer(7555 jquery.extend( tick, {7556 elem: elem,7557 anim: animation,7558 queue: animation.opts.queue7559 })7560 );7561 // attach callbacks from options7562 return animation.progress( animation.opts.progress )7563 .done( animation.opts.done, animation.opts.complete )7564 .fail( animation.opts.fail )7565 .always( animation.opts.always );7566 }7567 function propfilter( props, specialeasing ) {7568 var index, name, easing, value, hooks;7569 // camelcase, specialeasing and expand csshook pass7570 for ( index in props ) {7571 name = jquery.camelcase( index );7572 easing = specialeasing[ name ];7573 value = props[ index ];7574 if ( jquery.isarray( value ) ) {7575 easing = value[ 1 ];7576 value = props[ index ] = value[ 0 ];7577 }7578 if ( index !== name ) {7579 props[ name ] = value;7580 delete props[ index ];7581 }7582 hooks = jquery.csshooks[ name ];7583 if ( hooks && "expand" in hooks ) {7584 value = hooks.expand( value );7585 delete props[ name ];7586 // not quite $.extend, this wont overwrite keys already present.7587 // also - reusing 'index' from above because we have the correct "name"7588 for ( index in value ) {7589 if ( !( index in props ) ) {7590 props[ index ] = value[ index ];7591 specialeasing[ index ] = easing;7592 }7593 }7594 } else {7595 specialeasing[ name ] = easing;7596 }7597 }7598 }7599 jquery.animation = jquery.extend( animation, {7600 tweener: function( props, callback ) {7601 if ( jquery.isfunction( props ) ) {7602 callback = props;7603 props = [ "*" ];7604 } else {7605 props = props.split(" ");7606 }7607 var prop,7608 index = 0,7609 length = props.length;7610 for ( ; index < length ; index++ ) {7611 prop = props[ index ];7612 tweeners[ prop ] = tweeners[ prop ] || [];7613 tweeners[ prop ].unshift( callback );7614 }7615 },7616 prefilter: function( callback, prepend ) {7617 if ( prepend ) {7618 animationprefilters.unshift( callback );7619 } else {7620 animationprefilters.push( callback );7621 }7622 }7623 });7624 function defaultprefilter( elem, props, opts ) {7625 /* jshint validthis: true */7626 var prop, value, toggle, tween, hooks, oldfire,7627 anim = this,7628 orig = {},7629 style = elem.style,7630 hidden = elem.nodetype && ishidden( elem ),7631 datashow = jquery._data( elem, "fxshow" );7632 // handle queue: false promises7633 if ( !opts.queue ) {7634 hooks = jquery._queuehooks( elem, "fx" );7635 if ( hooks.unqueued == null ) {7636 hooks.unqueued = 0;7637 oldfire = hooks.empty.fire;7638 hooks.empty.fire = function() {7639 if ( !hooks.unqueued ) {7640 oldfire();7641 }7642 };7643 }7644 hooks.unqueued++;7645 anim.always(function() {7646 // doing this makes sure that the complete handler will be called7647 // before this completes7648 anim.always(function() {7649 hooks.unqueued--;7650 if ( !jquery.queue( elem, "fx" ).length ) {7651 hooks.empty.fire();7652 }7653 });7654 });7655 }7656 // height/width overflow pass7657 if ( elem.nodetype === 1 && ( "height" in props || "width" in props ) ) {7658 // make sure that nothing sneaks out7659 // record all 3 overflow attributes because ie does not7660 // change the overflow attribute when overflowx and7661 // overflowy are set to the same value7662 opts.overflow = [ style.overflow, style.overflowx, style.overflowy ];7663 // set display property to inline-block for height/width7664 // animations on inline elements that are having width/height animated7665 if ( jquery.css( elem, "display" ) === "inline" &&7666 jquery.css( elem, "float" ) === "none" ) {7667 // inline-level elements accept inline-block;7668 // block-level elements need to be inline with layout7669 if ( !jquery.support.inlineblockneedslayout || css_defaultdisplay( elem.nodename ) === "inline" ) {7670 style.display = "inline-block";7671 } else {7672 style.zoom = 1;7673 }7674 }7675 }7676 if ( opts.overflow ) {7677 style.overflow = "hidden";7678 if ( !jquery.support.shrinkwrapblocks ) {7679 anim.always(function() {7680 style.overflow = opts.overflow[ 0 ];7681 style.overflowx = opts.overflow[ 1 ];7682 style.overflowy = opts.overflow[ 2 ];7683 });7684 }7685 }7686 // show/hide pass7687 for ( prop in props ) {7688 value = props[ prop ];7689 if ( rfxtypes.exec( value ) ) {7690 delete props[ prop ];7691 toggle = toggle || value === "toggle";7692 if ( value === ( hidden ? "hide" : "show" ) ) {7693 continue;7694 }7695 orig[ prop ] = datashow && datashow[ prop ] || jquery.style( elem, prop );7696 }7697 }7698 if ( !jquery.isemptyobject( orig ) ) {7699 if ( datashow ) {7700 if ( "hidden" in datashow ) {7701 hidden = datashow.hidden;7702 }7703 } else {7704 datashow = jquery._data( elem, "fxshow", {} );7705 }7706 // store state if its toggle - enables .stop().toggle() to "reverse"7707 if ( toggle ) {7708 datashow.hidden = !hidden;7709 }7710 if ( hidden ) {7711 jquery( elem ).show();7712 } else {7713 anim.done(function() {7714 jquery( elem ).hide();7715 });7716 }7717 anim.done(function() {7718 var prop;7719 jquery._removedata( elem, "fxshow" );7720 for ( prop in orig ) {7721 jquery.style( elem, prop, orig[ prop ] );7722 }7723 });7724 for ( prop in orig ) {7725 tween = createtween( hidden ? datashow[ prop ] : 0, prop, anim );7726 if ( !( prop in datashow ) ) {7727 datashow[ prop ] = tween.start;7728 if ( hidden ) {7729 tween.end = tween.start;7730 tween.start = prop === "width" || prop === "height" ? 1 : 0;7731 }7732 }7733 }7734 }7735 }7736 function tween( elem, options, prop, end, easing ) {7737 return new tween.prototype.init( elem, options, prop, end, easing );7738 }7739 jquery.tween = tween;7740 tween.prototype = {7741 constructor: tween,7742 init: function( elem, options, prop, end, easing, unit ) {7743 this.elem = elem;7744 this.prop = prop;7745 this.easing = easing || "swing";7746 this.options = options;7747 this.start = this.now = this.cur();7748 this.end = end;7749 this.unit = unit || ( jquery.cssnumber[ prop ] ? "" : "px" );7750 },7751 cur: function() {7752 var hooks = tween.prophooks[ this.prop ];7753 return hooks && hooks.get ?7754 hooks.get( this ) :7755 tween.prophooks._default.get( this );7756 },7757 run: function( percent ) {7758 var eased,7759 hooks = tween.prophooks[ this.prop ];7760 if ( this.options.duration ) {7761 this.pos = eased = jquery.easing[ this.easing ](7762 percent, this.options.duration * percent, 0, 1, this.options.duration7763 );7764 } else {7765 this.pos = eased = percent;7766 }7767 this.now = ( this.end - this.start ) * eased + this.start;7768 if ( this.options.step ) {7769 this.options.step.call( this.elem, this.now, this );7770 }7771 if ( hooks && hooks.set ) {7772 hooks.set( this );7773 } else {7774 tween.prophooks._default.set( this );7775 }7776 return this;7777 }7778 };7779 tween.prototype.init.prototype = tween.prototype;7780 tween.prophooks = {7781 _default: {7782 get: function( tween ) {7783 var result;7784 if ( tween.elem[ tween.prop ] != null &&7785 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {7786 return tween.elem[ tween.prop ];7787 }7788 // passing an empty string as a 3rd parameter to .css will automatically7789 // attempt a parsefloat and fallback to a string if the parse fails7790 // so, simple values such as "10px" are parsed to float.7791 // complex values such as "rotate(1rad)" are returned as is.7792 result = jquery.css( tween.elem, tween.prop, "" );7793 // empty strings, null, undefined and "auto" are converted to 0.7794 return !result || result === "auto" ? 0 : result;7795 },7796 set: function( tween ) {7797 // use step hook for back compat - use csshook if its there - use .style if its7798 // available and use plain properties where available7799 if ( jquery.fx.step[ tween.prop ] ) {7800 jquery.fx.step[ tween.prop ]( tween );7801 } else if ( tween.elem.style && ( tween.elem.style[ jquery.cssprops[ tween.prop ] ] != null || jquery.csshooks[ tween.prop ] ) ) {7802 jquery.style( tween.elem, tween.prop, tween.now + tween.unit );7803 } else {7804 tween.elem[ tween.prop ] = tween.now;7805 }7806 }7807 }7808 };7809// support: ie <=97810// panic based approach to setting things on disconnected nodes7811 tween.prophooks.scrolltop = tween.prophooks.scrollleft = {7812 set: function( tween ) {7813 if ( tween.elem.nodetype && tween.elem.parentnode ) {7814 tween.elem[ tween.prop ] = tween.now;7815 }7816 }7817 };7818 jquery.each([ "toggle", "show", "hide" ], function( i, name ) {7819 var cssfn = jquery.fn[ name ];7820 jquery.fn[ name ] = function( speed, easing, callback ) {7821 return speed == null || typeof speed === "boolean" ?7822 cssfn.apply( this, arguments ) :7823 this.animate( genfx( name, true ), speed, easing, callback );7824 };7825 });7826 jquery.fn.extend({7827 fadeto: function( speed, to, easing, callback ) {7828 // show any hidden elements after setting opacity to 07829 return this.filter( ishidden ).css( "opacity", 0 ).show()7830 // animate to the value specified7831 .end().animate({ opacity: to }, speed, easing, callback );7832 },7833 animate: function( prop, speed, easing, callback ) {7834 var empty = jquery.isemptyobject( prop ),7835 optall = jquery.speed( speed, easing, callback ),7836 doanimation = function() {7837 // operate on a copy of prop so per-property easing won't be lost7838 var anim = animation( this, jquery.extend( {}, prop ), optall );7839 // empty animations, or finishing resolves immediately7840 if ( empty || jquery._data( this, "finish" ) ) {7841 anim.stop( true );7842 }7843 };7844 doanimation.finish = doanimation;7845 return empty || optall.queue === false ?7846 this.each( doanimation ) :7847 this.queue( optall.queue, doanimation );7848 },7849 stop: function( type, clearqueue, gotoend ) {7850 var stopqueue = function( hooks ) {7851 var stop = hooks.stop;7852 delete hooks.stop;7853 stop( gotoend );7854 };7855 if ( typeof type !== "string" ) {7856 gotoend = clearqueue;7857 clearqueue = type;7858 type = undefined;7859 }7860 if ( clearqueue && type !== false ) {7861 this.queue( type || "fx", [] );7862 }7863 return this.each(function() {7864 var dequeue = true,7865 index = type != null && type + "queuehooks",7866 timers = jquery.timers,7867 data = jquery._data( this );7868 if ( index ) {7869 if ( data[ index ] && data[ index ].stop ) {7870 stopqueue( data[ index ] );7871 }7872 } else {7873 for ( index in data ) {7874 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {7875 stopqueue( data[ index ] );7876 }7877 }7878 }7879 for ( index = timers.length; index--; ) {7880 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {7881 timers[ index ].anim.stop( gotoend );7882 dequeue = false;7883 timers.splice( index, 1 );7884 }7885 }7886 // start the next in the queue if the last step wasn't forced7887 // timers currently will call their complete callbacks, which will dequeue7888 // but only if they were gotoend7889 if ( dequeue || !gotoend ) {7890 jquery.dequeue( this, type );7891 }7892 });7893 },7894 finish: function( type ) {7895 if ( type !== false ) {7896 type = type || "fx";7897 }7898 return this.each(function() {7899 var index,7900 data = jquery._data( this ),7901 queue = data[ type + "queue" ],7902 hooks = data[ type + "queuehooks" ],7903 timers = jquery.timers,7904 length = queue ? queue.length : 0;7905 // enable finishing flag on private data7906 data.finish = true;7907 // empty the queue first7908 jquery.queue( this, type, [] );7909 if ( hooks && hooks.stop ) {7910 hooks.stop.call( this, true );7911 }7912 // look for any active animations, and finish them7913 for ( index = timers.length; index--; ) {7914 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {7915 timers[ index ].anim.stop( true );7916 timers.splice( index, 1 );7917 }7918 }7919 // look for any animations in the old queue and finish them7920 for ( index = 0; index < length; index++ ) {7921 if ( queue[ index ] && queue[ index ].finish ) {7922 queue[ index ].finish.call( this );7923 }7924 }7925 // turn off finishing flag7926 delete data.finish;7927 });7928 }7929 });7930// generate parameters to create a standard animation7931 function genfx( type, includewidth ) {7932 var which,7933 attrs = { height: type },7934 i = 0;7935 // if we include width, step value is 1 to do all cssexpand values,7936 // if we don't include width, step value is 2 to skip over left and right7937 includewidth = includewidth? 1 : 0;7938 for( ; i < 4 ; i += 2 - includewidth ) {7939 which = cssexpand[ i ];7940 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;7941 }7942 if ( includewidth ) {7943 attrs.opacity = attrs.width = type;7944 }7945 return attrs;7946 }7947// generate shortcuts for custom animations7948 jquery.each({7949 slidedown: genfx("show"),7950 slideup: genfx("hide"),7951 slidetoggle: genfx("toggle"),7952 fadein: { opacity: "show" },7953 fadeout: { opacity: "hide" },7954 fadetoggle: { opacity: "toggle" }7955 }, function( name, props ) {7956 jquery.fn[ name ] = function( speed, easing, callback ) {7957 return this.animate( props, speed, easing, callback );7958 };7959 });7960 jquery.speed = function( speed, easing, fn ) {7961 var opt = speed && typeof speed === "object" ? jquery.extend( {}, speed ) : {7962 complete: fn || !fn && easing ||7963 jquery.isfunction( speed ) && speed,7964 duration: speed,7965 easing: fn && easing || easing && !jquery.isfunction( easing ) && easing7966 };7967 opt.duration = jquery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :7968 opt.duration in jquery.fx.speeds ? jquery.fx.speeds[ opt.duration ] : jquery.fx.speeds._default;7969 // normalize opt.queue - true/undefined/null -> "fx"7970 if ( opt.queue == null || opt.queue === true ) {7971 opt.queue = "fx";7972 }7973 // queueing7974 opt.old = opt.complete;7975 opt.complete = function() {7976 if ( jquery.isfunction( opt.old ) ) {7977 opt.old.call( this );7978 }7979 if ( opt.queue ) {7980 jquery.dequeue( this, opt.queue );7981 }7982 };7983 return opt;7984 };7985 jquery.easing = {7986 linear: function( p ) {7987 return p;7988 },7989 swing: function( p ) {7990 return 0.5 - math.cos( p*math.pi ) / 2;7991 }7992 };7993 jquery.timers = [];7994 jquery.fx = tween.prototype.init;7995 jquery.fx.tick = function() {7996 var timer,7997 timers = jquery.timers,7998 i = 0;7999 fxnow = jquery.now();8000 for ( ; i < timers.length; i++ ) {8001 timer = timers[ i ];8002 // checks the timer has not already been removed8003 if ( !timer() && timers[ i ] === timer ) {8004 timers.splice( i--, 1 );8005 }8006 }8007 if ( !timers.length ) {8008 jquery.fx.stop();8009 }8010 fxnow = undefined;8011 };8012 jquery.fx.timer = function( timer ) {8013 if ( timer() && jquery.timers.push( timer ) ) {8014 jquery.fx.start();8015 }8016 };8017 jquery.fx.interval = 13;8018 jquery.fx.start = function() {8019 if ( !timerid ) {8020 timerid = setinterval( jquery.fx.tick, jquery.fx.interval );8021 }8022 };8023 jquery.fx.stop = function() {8024 clearinterval( timerid );8025 timerid = null;8026 };8027 jquery.fx.speeds = {8028 slow: 600,8029 fast: 200,8030 // default speed8031 _default: 4008032 };8033// back compat <1.8 extension point8034 jquery.fx.step = {};8035 if ( jquery.expr && jquery.expr.filters ) {8036 jquery.expr.filters.animated = function( elem ) {8037 return jquery.grep(jquery.timers, function( fn ) {8038 return elem === fn.elem;8039 }).length;8040 };8041 }8042 jquery.fn.offset = function( options ) {8043 if ( arguments.length ) {8044 return options === undefined ?8045 this :8046 this.each(function( i ) {8047 jquery.offset.setoffset( this, options, i );8048 });8049 }8050 var docelem, win,8051 box = { top: 0, left: 0 },8052 elem = this[ 0 ],8053 doc = elem && elem.ownerdocument;8054 if ( !doc ) {8055 return;8056 }8057 docelem = doc.documentelement;8058 // make sure it's not a disconnected dom node8059 if ( !jquery.contains( docelem, elem ) ) {8060 return box;8061 }8062 // if we don't have gbcr, just use 0,0 rather than error8063 // blackberry 5, ios 3 (original iphone)8064 if ( typeof elem.getboundingclientrect !== core_strundefined ) {8065 box = elem.getboundingclientrect();8066 }8067 win = getwindow( doc );8068 return {8069 top: box.top + ( win.pageyoffset || docelem.scrolltop ) - ( docelem.clienttop || 0 ),8070 left: box.left + ( win.pagexoffset || docelem.scrollleft ) - ( docelem.clientleft || 0 )8071 };8072 };8073 jquery.offset = {8074 setoffset: function( elem, options, i ) {8075 var position = jquery.css( elem, "position" );8076 // set position first, in-case top/left are set even on static elem8077 if ( position === "static" ) {8078 elem.style.position = "relative";8079 }8080 var curelem = jquery( elem ),8081 curoffset = curelem.offset(),8082 curcsstop = jquery.css( elem, "top" ),8083 curcssleft = jquery.css( elem, "left" ),8084 calculateposition = ( position === "absolute" || position === "fixed" ) && jquery.inarray("auto", [curcsstop, curcssleft]) > -1,8085 props = {}, curposition = {}, curtop, curleft;8086 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed8087 if ( calculateposition ) {8088 curposition = curelem.position();8089 curtop = curposition.top;8090 curleft = curposition.left;8091 } else {8092 curtop = parsefloat( curcsstop ) || 0;8093 curleft = parsefloat( curcssleft ) || 0;8094 }8095 if ( jquery.isfunction( options ) ) {8096 options = options.call( elem, i, curoffset );8097 }8098 if ( options.top != null ) {8099 props.top = ( options.top - curoffset.top ) + curtop;8100 }8101 if ( options.left != null ) {8102 props.left = ( options.left - curoffset.left ) + curleft;8103 }8104 if ( "using" in options ) {8105 options.using.call( elem, props );8106 } else {8107 curelem.css( props );8108 }8109 }8110 };8111 jquery.fn.extend({8112 position: function() {8113 if ( !this[ 0 ] ) {8114 return;8115 }8116 var offsetparent, offset,8117 parentoffset = { top: 0, left: 0 },8118 elem = this[ 0 ];8119 // fixed elements are offset from window (parentoffset = {top:0, left: 0}, because it is it's only offset parent8120 if ( jquery.css( elem, "position" ) === "fixed" ) {8121 // we assume that getboundingclientrect is available when computed position is fixed8122 offset = elem.getboundingclientrect();8123 } else {8124 // get *real* offsetparent8125 offsetparent = this.offsetparent();8126 // get correct offsets8127 offset = this.offset();8128 if ( !jquery.nodename( offsetparent[ 0 ], "html" ) ) {8129 parentoffset = offsetparent.offset();8130 }8131 // add offsetparent borders8132 parentoffset.top += jquery.css( offsetparent[ 0 ], "bordertopwidth", true );8133 parentoffset.left += jquery.css( offsetparent[ 0 ], "borderleftwidth", true );8134 }8135 // subtract parent offsets and element margins8136 // note: when an element has margin: auto the offsetleft and marginleft8137 // are the same in safari causing offset.left to incorrectly be 08138 return {8139 top: offset.top - parentoffset.top - jquery.css( elem, "margintop", true ),8140 left: offset.left - parentoffset.left - jquery.css( elem, "marginleft", true)8141 };8142 },8143 offsetparent: function() {8144 return this.map(function() {8145 var offsetparent = this.offsetparent || docelem;8146 while ( offsetparent && ( !jquery.nodename( offsetparent, "html" ) && jquery.css( offsetparent, "position") === "static" ) ) {8147 offsetparent = offsetparent.offsetparent;8148 }8149 return offsetparent || docelem;8150 });8151 }8152 });8153// create scrollleft and scrolltop methods8154 jquery.each( {scrollleft: "pagexoffset", scrolltop: "pageyoffset"}, function( method, prop ) {8155 var top = /y/.test( prop );8156 jquery.fn[ method ] = function( val ) {8157 return jquery.access( this, function( elem, method, val ) {8158 var win = getwindow( elem );8159 if ( val === undefined ) {8160 return win ? (prop in win) ? win[ prop ] :8161 win.document.documentelement[ method ] :8162 elem[ method ];8163 }8164 if ( win ) {8165 win.scrollto(8166 !top ? val : jquery( win ).scrollleft(),8167 top ? val : jquery( win ).scrolltop()8168 );8169 } else {8170 elem[ method ] = val;8171 }8172 }, method, val, arguments.length, null );8173 };8174 });8175 function getwindow( elem ) {8176 return jquery.iswindow( elem ) ?8177 elem :8178 elem.nodetype === 9 ?8179 elem.defaultview || elem.parentwindow :8180 false;8181 }8182// create innerheight, innerwidth, height, width, outerheight and outerwidth methods8183 jquery.each( { height: "height", width: "width" }, function( name, type ) {8184 jquery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultextra, funcname ) {8185 // margin is only for outerheight, outerwidth8186 jquery.fn[ funcname ] = function( margin, value ) {8187 var chainable = arguments.length && ( defaultextra || typeof margin !== "boolean" ),8188 extra = defaultextra || ( margin === true || value === true ? "margin" : "border" );8189 return jquery.access( this, function( elem, type, value ) {8190 var doc;8191 if ( jquery.iswindow( elem ) ) {8192 // as of 5/8/2012 this will yield incorrect results for mobile safari, but there8193 // isn't a whole lot we can do. see pull request at this url for discussion:8194 // https://github.com/jquery/jquery/pull/7648195 return elem.document.documentelement[ "client" + name ];8196 }8197 // get document width or height8198 if ( elem.nodetype === 9 ) {8199 doc = elem.documentelement;8200 // either scroll[width/height] or offset[width/height] or client[width/height], whichever is greatest8201 // unfortunately, this causes bug #3838 in ie6/8 only, but there is currently no good, small way to fix it.8202 return math.max(8203 elem.body[ "scroll" + name ], doc[ "scroll" + name ],8204 elem.body[ "offset" + name ], doc[ "offset" + name ],8205 doc[ "client" + name ]8206 );8207 }8208 return value === undefined ?8209 // get width or height on the element, requesting but not forcing parsefloat8210 jquery.css( elem, type, extra ) :8211 // set width or height on the element8212 jquery.style( elem, type, value, extra );8213 }, type, chainable ? margin : undefined, chainable, null );8214 };8215 });8216 });8217// limit scope pollution from any deprecated api8218// (function() {8219// the number of elements contained in the matched element set8220 jquery.fn.size = function() {8221 return this.length;8222 };8223 jquery.fn.andself = jquery.fn.addback;8224// })();8225 if ( typeof module === "object" && module && typeof module.exports === "object" ) {8226 // expose jquery as module.exports in loaders that implement the node8227 // module pattern (including browserify). do not create the global, since8228 // the user will be storing it themselves locally, and globals are frowned8229 // upon in the node module world.8230 module.exports = jquery;8231 } else {8232 // otherwise expose jquery to the global object as usual8233 window.jquery = window.$ = jquery;8234 // register as a named amd module, since jquery can be concatenated with other8235 // files that may use define, but not via a proper concatenation script that8236 // understands anonymous amd modules. a named amd is safest and most robust8237 // way to register. lowercase jquery is used because amd module names are8238 // derived from file names, and jquery is normally delivered in a lowercase8239 // file name. do this after creating the global so that if an amd module wants8240 // to call noconflict to hide this version of jquery, it will work.8241 if ( typeof define === "function" && define.amd ) {8242 define( "jquery", [], function () { return jquery; } );8243 }8244 }...

Full Screen

Full Screen

jquery.js

Source:jquery.js Github

copy

Full Screen

1/*!2 * jquery JavaScript Library v1.11.03 * http://jquery.com/4 *5 * Includes Sizzle.js6 * http://sizzlejs.com/7 *8 * Copyright 2005, 2014 jquery Foundation, Inc. and other contributors9 * Released under the MIT license10 * http://jquery.org/license11 *12 * Date: 2014-01-23T21:02Z13 */14(function( global, factory ) {15 if ( typeof module === "object" && typeof module.exports === "object" ) {16 // For CommonJS and CommonJS-like environments where a proper window is present,17 // execute the factory and get jquery18 // For environments that do not inherently posses a window with a document19 // (such as Node.js), expose a jquery-making factory as module.exports20 // This accentuates the need for the creation of a real window21 // e.g. var jquery = require("jquery")(window);22 // See ticket #14549 for more info23 module.exports = global.document ?24 factory( global, true ) :25 function( w ) {26 if ( !w.document ) {27 throw new Error( "jquery requires a window with a document" );28 }29 return factory( w );30 };31 } else {32 factory( global );33 }34// Pass this if window is not defined yet35}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {36// Can't do this because several apps including ASP.NET trace37// the stack via arguments.caller.callee and Firefox dies if38// you try to trace through "use strict" call chains. (#13335)39// Support: Firefox 18+40//41var deletedIds = [];42var slice = deletedIds.slice;43var concat = deletedIds.concat;44var push = deletedIds.push;45var indexOf = deletedIds.indexOf;46var class2type = {};47var toString = class2type.toString;48var hasOwn = class2type.hasOwnProperty;49var trim = "".trim;50var support = {};51var52 version = "1.11.0",53 // Define a local copy of jquery54 jquery = function( selector, context ) {55 // The jquery object is actually just the init constructor 'enhanced'56 // Need init if jquery is called (just allow error to be thrown if not included)57 return new jquery.fn.init( selector, context );58 },59 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)60 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,61 // Matches dashed string for camelizing62 rmsPrefix = /^-ms-/,63 rdashAlpha = /-([\da-z])/gi,64 // Used by jquery.camelCase as callback to replace()65 fcamelCase = function( all, letter ) {66 return letter.toUpperCase();67 };68jquery.fn = jquery.prototype = {69 // The current version of jquery being used70 jquery: version,71 constructor: jquery,72 // Start with an empty selector73 selector: "",74 // The default length of a jquery object is 075 length: 0,76 toArray: function() {77 return slice.call( this );78 },79 // Get the Nth element in the matched element set OR80 // Get the whole matched element set as a clean array81 get: function( num ) {82 return num != null ?83 // Return a 'clean' array84 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :85 // Return just the object86 slice.call( this );87 },88 // Take an array of elements and push it onto the stack89 // (returning the new matched element set)90 pushStack: function( elems ) {91 // Build a new jquery matched element set92 var ret = jquery.merge( this.constructor(), elems );93 // Add the old object onto the stack (as a reference)94 ret.prevObject = this;95 ret.context = this.context;96 // Return the newly-formed element set97 return ret;98 },99 // Execute a callback for every element in the matched set.100 // (You can seed the arguments with an array of args, but this is101 // only used internally.)102 each: function( callback, args ) {103 return jquery.each( this, callback, args );104 },105 map: function( callback ) {106 return this.pushStack( jquery.map(this, function( elem, i ) {107 return callback.call( elem, i, elem );108 }));109 },110 slice: function() {111 return this.pushStack( slice.apply( this, arguments ) );112 },113 first: function() {114 return this.eq( 0 );115 },116 last: function() {117 return this.eq( -1 );118 },119 eq: function( i ) {120 var len = this.length,121 j = +i + ( i < 0 ? len : 0 );122 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );123 },124 end: function() {125 return this.prevObject || this.constructor(null);126 },127 // For internal use only.128 // Behaves like an Array's method, not like a jquery method.129 push: push,130 sort: deletedIds.sort,131 splice: deletedIds.splice132};133jquery.extend = jquery.fn.extend = function() {134 var src, copyIsArray, copy, name, options, clone,135 target = arguments[0] || {},136 i = 1,137 length = arguments.length,138 deep = false;139 // Handle a deep copy situation140 if ( typeof target === "boolean" ) {141 deep = target;142 // skip the boolean and the target143 target = arguments[ i ] || {};144 i++;145 }146 // Handle case when target is a string or something (possible in deep copy)147 if ( typeof target !== "object" && !jquery.isFunction(target) ) {148 target = {};149 }150 // extend jquery itself if only one argument is passed151 if ( i === length ) {152 target = this;153 i--;154 }155 for ( ; i < length; i++ ) {156 // Only deal with non-null/undefined values157 if ( (options = arguments[ i ]) != null ) {158 // Extend the base object159 for ( name in options ) {160 src = target[ name ];161 copy = options[ name ];162 // Prevent never-ending loop163 if ( target === copy ) {164 continue;165 }166 // Recurse if we're merging plain objects or arrays167 if ( deep && copy && ( jquery.isPlainObject(copy) || (copyIsArray = jquery.isArray(copy)) ) ) {168 if ( copyIsArray ) {169 copyIsArray = false;170 clone = src && jquery.isArray(src) ? src : [];171 } else {172 clone = src && jquery.isPlainObject(src) ? src : {};173 }174 // Never move original objects, clone them175 target[ name ] = jquery.extend( deep, clone, copy );176 // Don't bring in undefined values177 } else if ( copy !== undefined ) {178 target[ name ] = copy;179 }180 }181 }182 }183 // Return the modified object184 return target;185};186jquery.extend({187 // Unique for each copy of jquery on the page188 expando: "jquery" + ( version + Math.random() ).replace( /\D/g, "" ),189 // Assume jquery is ready without the ready module190 isReady: true,191 error: function( msg ) {192 throw new Error( msg );193 },194 noop: function() {},195 // See test/unit/core.js for details concerning isFunction.196 // Since version 1.3, DOM methods and functions like alert197 // aren't supported. They return false on IE (#2968).198 isFunction: function( obj ) {199 return jquery.type(obj) === "function";200 },201 isArray: Array.isArray || function( obj ) {202 return jquery.type(obj) === "array";203 },204 isWindow: function( obj ) {205 /* jshint eqeqeq: false */206 return obj != null && obj == obj.window;207 },208 isNumeric: function( obj ) {209 // parseFloat NaNs numeric-cast false positives (null|true|false|"")210 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")211 // subtraction forces infinities to NaN212 return obj - parseFloat( obj ) >= 0;213 },214 isEmptyObject: function( obj ) {215 var name;216 for ( name in obj ) {217 return false;218 }219 return true;220 },221 isPlainObject: function( obj ) {222 var key;223 // Must be an Object.224 // Because of IE, we also have to check the presence of the constructor property.225 // Make sure that DOM nodes and window objects don't pass through, as well226 if ( !obj || jquery.type(obj) !== "object" || obj.nodeType || jquery.isWindow( obj ) ) {227 return false;228 }229 try {230 // Not own constructor property must be Object231 if ( obj.constructor &&232 !hasOwn.call(obj, "constructor") &&233 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {234 return false;235 }236 } catch ( e ) {237 // IE8,9 Will throw exceptions on certain host objects #9897238 return false;239 }240 // Support: IE<9241 // Handle iteration over inherited properties before own properties.242 if ( support.ownLast ) {243 for ( key in obj ) {244 return hasOwn.call( obj, key );245 }246 }247 // Own properties are enumerated firstly, so to speed up,248 // if last one is own, then all properties are own.249 for ( key in obj ) {}250 return key === undefined || hasOwn.call( obj, key );251 },252 type: function( obj ) {253 if ( obj == null ) {254 return obj + "";255 }256 return typeof obj === "object" || typeof obj === "function" ?257 class2type[ toString.call(obj) ] || "object" :258 typeof obj;259 },260 // Evaluates a script in a global context261 // Workarounds based on findings by Jim Driscoll262 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context263 globalEval: function( data ) {264 if ( data && jquery.trim( data ) ) {265 // We use execScript on Internet Explorer266 // We use an anonymous function so that context is window267 // rather than jquery in Firefox268 ( window.execScript || function( data ) {269 window[ "eval" ].call( window, data );270 } )( data );271 }272 },273 // Convert dashed to camelCase; used by the css and data modules274 // Microsoft forgot to hump their vendor prefix (#9572)275 camelCase: function( string ) {276 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );277 },278 nodeName: function( elem, name ) {279 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();280 },281 // args is for internal usage only282 each: function( obj, callback, args ) {283 var value,284 i = 0,285 length = obj.length,286 isArray = isArraylike( obj );287 if ( args ) {288 if ( isArray ) {289 for ( ; i < length; i++ ) {290 value = callback.apply( obj[ i ], args );291 if ( value === false ) {292 break;293 }294 }295 } else {296 for ( i in obj ) {297 value = callback.apply( obj[ i ], args );298 if ( value === false ) {299 break;300 }301 }302 }303 // A special, fast, case for the most common use of each304 } else {305 if ( isArray ) {306 for ( ; i < length; i++ ) {307 value = callback.call( obj[ i ], i, obj[ i ] );308 if ( value === false ) {309 break;310 }311 }312 } else {313 for ( i in obj ) {314 value = callback.call( obj[ i ], i, obj[ i ] );315 if ( value === false ) {316 break;317 }318 }319 }320 }321 return obj;322 },323 // Use native String.trim function wherever possible324 trim: trim && !trim.call("\uFEFF\xA0") ?325 function( text ) {326 return text == null ?327 "" :328 trim.call( text );329 } :330 // Otherwise use our own trimming functionality331 function( text ) {332 return text == null ?333 "" :334 ( text + "" ).replace( rtrim, "" );335 },336 // results is for internal usage only337 makeArray: function( arr, results ) {338 var ret = results || [];339 if ( arr != null ) {340 if ( isArraylike( Object(arr) ) ) {341 jquery.merge( ret,342 typeof arr === "string" ?343 [ arr ] : arr344 );345 } else {346 push.call( ret, arr );347 }348 }349 return ret;350 },351 inArray: function( elem, arr, i ) {352 var len;353 if ( arr ) {354 if ( indexOf ) {355 return indexOf.call( arr, elem, i );356 }357 len = arr.length;358 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;359 for ( ; i < len; i++ ) {360 // Skip accessing in sparse arrays361 if ( i in arr && arr[ i ] === elem ) {362 return i;363 }364 }365 }366 return -1;367 },368 merge: function( first, second ) {369 var len = +second.length,370 j = 0,371 i = first.length;372 while ( j < len ) {373 first[ i++ ] = second[ j++ ];374 }375 // Support: IE<9376 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)377 if ( len !== len ) {378 while ( second[j] !== undefined ) {379 first[ i++ ] = second[ j++ ];380 }381 }382 first.length = i;383 return first;384 },385 grep: function( elems, callback, invert ) {386 var callbackInverse,387 matches = [],388 i = 0,389 length = elems.length,390 callbackExpect = !invert;391 // Go through the array, only saving the items392 // that pass the validator function393 for ( ; i < length; i++ ) {394 callbackInverse = !callback( elems[ i ], i );395 if ( callbackInverse !== callbackExpect ) {396 matches.push( elems[ i ] );397 }398 }399 return matches;400 },401 // arg is for internal usage only402 map: function( elems, callback, arg ) {403 var value,404 i = 0,405 length = elems.length,406 isArray = isArraylike( elems ),407 ret = [];408 // Go through the array, translating each of the items to their new values409 if ( isArray ) {410 for ( ; i < length; i++ ) {411 value = callback( elems[ i ], i, arg );412 if ( value != null ) {413 ret.push( value );414 }415 }416 // Go through every key on the object,417 } else {418 for ( i in elems ) {419 value = callback( elems[ i ], i, arg );420 if ( value != null ) {421 ret.push( value );422 }423 }424 }425 // Flatten any nested arrays426 return concat.apply( [], ret );427 },428 // A global GUID counter for objects429 guid: 1,430 // Bind a function to a context, optionally partially applying any431 // arguments.432 proxy: function( fn, context ) {433 var args, proxy, tmp;434 if ( typeof context === "string" ) {435 tmp = fn[ context ];436 context = fn;437 fn = tmp;438 }439 // Quick check to determine if target is callable, in the spec440 // this throws a TypeError, but we will just return undefined.441 if ( !jquery.isFunction( fn ) ) {442 return undefined;443 }444 // Simulated bind445 args = slice.call( arguments, 2 );446 proxy = function() {447 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );448 };449 // Set the guid of unique handler to the same of original handler, so it can be removed450 proxy.guid = fn.guid = fn.guid || jquery.guid++;451 return proxy;452 },453 now: function() {454 return +( new Date() );455 },456 // jquery.support is not used in Core but other projects attach their457 // properties to it so it needs to exist.458 support: support459});460// Populate the class2type map461jquery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {462 class2type[ "[object " + name + "]" ] = name.toLowerCase();463});464function isArraylike( obj ) {465 var length = obj.length,466 type = jquery.type( obj );467 if ( type === "function" || jquery.isWindow( obj ) ) {468 return false;469 }470 if ( obj.nodeType === 1 && length ) {471 return true;472 }473 return type === "array" || length === 0 ||474 typeof length === "number" && length > 0 && ( length - 1 ) in obj;475}476var Sizzle =477/*!478 * Sizzle CSS Selector Engine v1.10.16479 * http://sizzlejs.com/480 *481 * Copyright 2013 jquery Foundation, Inc. and other contributors482 * Released under the MIT license483 * http://jquery.org/license484 *485 * Date: 2014-01-13486 */487(function( window ) {488var i,489 support,490 Expr,491 getText,492 isXML,493 compile,494 outermostContext,495 sortInput,496 hasDuplicate,497 // Local document vars498 setDocument,499 document,500 docElem,501 documentIsHTML,502 rbuggyQSA,503 rbuggyMatches,504 matches,505 contains,506 // Instance-specific data507 expando = "sizzle" + -(new Date()),508 preferredDoc = window.document,509 dirruns = 0,510 done = 0,511 classCache = createCache(),512 tokenCache = createCache(),513 compilerCache = createCache(),514 sortOrder = function( a, b ) {515 if ( a === b ) {516 hasDuplicate = true;517 }518 return 0;519 },520 // General-purpose constants521 strundefined = typeof undefined,522 MAX_NEGATIVE = 1 << 31,523 // Instance methods524 hasOwn = ({}).hasOwnProperty,525 arr = [],526 pop = arr.pop,527 push_native = arr.push,528 push = arr.push,529 slice = arr.slice,530 // Use a stripped-down indexOf if we can't use a native one531 indexOf = arr.indexOf || function( elem ) {532 var i = 0,533 len = this.length;534 for ( ; i < len; i++ ) {535 if ( this[i] === elem ) {536 return i;537 }538 }539 return -1;540 },541 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",542 // Regular expressions543 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace544 whitespace = "[\\x20\\t\\r\\n\\f]",545 // http://www.w3.org/TR/css3-syntax/#characters546 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",547 // Loosely modeled on CSS identifier characters548 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors549 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier550 identifier = characterEncoding.replace( "w", "w#" ),551 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors552 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +553 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",554 // Prefer arguments quoted,555 // then not containing pseudos/brackets,556 // then attribute selectors/non-parenthetical expressions,557 // then anything else558 // These preferences are here to reduce the number of selectors559 // needing tokenize in the PSEUDO preFilter560 pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",561 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter562 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),563 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),564 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),565 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),566 rpseudo = new RegExp( pseudos ),567 ridentifier = new RegExp( "^" + identifier + "$" ),568 matchExpr = {569 "ID": new RegExp( "^#(" + characterEncoding + ")" ),570 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),571 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),572 "ATTR": new RegExp( "^" + attributes ),573 "PSEUDO": new RegExp( "^" + pseudos ),574 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +575 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +576 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),577 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),578 // For use in libraries implementing .is()579 // We use this for POS matching in `select`580 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +581 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )582 },583 rinputs = /^(?:input|select|textarea|button)$/i,584 rheader = /^h\d$/i,585 rnative = /^[^{]+\{\s*\[native \w/,586 // Easily-parseable/retrievable ID or TAG or CLASS selectors587 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,588 rsibling = /[+~]/,589 rescape = /'|\\/g,590 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters591 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),592 funescape = function( _, escaped, escapedWhitespace ) {593 var high = "0x" + escaped - 0x10000;594 // NaN means non-codepoint595 // Support: Firefox596 // Workaround erroneous numeric interpretation of +"0x"597 return high !== high || escapedWhitespace ?598 escaped :599 high < 0 ?600 // BMP codepoint601 String.fromCharCode( high + 0x10000 ) :602 // Supplemental Plane codepoint (surrogate pair)603 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );604 };605// Optimize for push.apply( _, NodeList )606try {607 push.apply(608 (arr = slice.call( preferredDoc.childNodes )),609 preferredDoc.childNodes610 );611 // Support: Android<4.0612 // Detect silently failing push.apply613 arr[ preferredDoc.childNodes.length ].nodeType;614} catch ( e ) {615 push = { apply: arr.length ?616 // Leverage slice if possible617 function( target, els ) {618 push_native.apply( target, slice.call(els) );619 } :620 // Support: IE<9621 // Otherwise append directly622 function( target, els ) {623 var j = target.length,624 i = 0;625 // Can't trust NodeList.length626 while ( (target[j++] = els[i++]) ) {}627 target.length = j - 1;628 }629 };630}631function Sizzle( selector, context, results, seed ) {632 var match, elem, m, nodeType,633 // QSA vars634 i, groups, old, nid, newContext, newSelector;635 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {636 setDocument( context );637 }638 context = context || document;639 results = results || [];640 if ( !selector || typeof selector !== "string" ) {641 return results;642 }643 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {644 return [];645 }646 if ( documentIsHTML && !seed ) {647 // Shortcuts648 if ( (match = rquickExpr.exec( selector )) ) {649 // Speed-up: Sizzle("#ID")650 if ( (m = match[1]) ) {651 if ( nodeType === 9 ) {652 elem = context.getElementById( m );653 // Check parentNode to catch when Blackberry 4.6 returns654 // nodes that are no longer in the document (jquery #6963)655 if ( elem && elem.parentNode ) {656 // Handle the case where IE, Opera, and Webkit return items657 // by name instead of ID658 if ( elem.id === m ) {659 results.push( elem );660 return results;661 }662 } else {663 return results;664 }665 } else {666 // Context is not a document667 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&668 contains( context, elem ) && elem.id === m ) {669 results.push( elem );670 return results;671 }672 }673 // Speed-up: Sizzle("TAG")674 } else if ( match[2] ) {675 push.apply( results, context.getElementsByTagName( selector ) );676 return results;677 // Speed-up: Sizzle(".CLASS")678 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {679 push.apply( results, context.getElementsByClassName( m ) );680 return results;681 }682 }683 // QSA path684 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {685 nid = old = expando;686 newContext = context;687 newSelector = nodeType === 9 && selector;688 // qSA works strangely on Element-rooted queries689 // We can work around this by specifying an extra ID on the root690 // and working up from there (Thanks to Andrew Dupont for the technique)691 // IE 8 doesn't work on object elements692 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {693 groups = tokenize( selector );694 if ( (old = context.getAttribute("id")) ) {695 nid = old.replace( rescape, "\\$&" );696 } else {697 context.setAttribute( "id", nid );698 }699 nid = "[id='" + nid + "'] ";700 i = groups.length;701 while ( i-- ) {702 groups[i] = nid + toSelector( groups[i] );703 }704 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;705 newSelector = groups.join(",");706 }707 if ( newSelector ) {708 try {709 push.apply( results,710 newContext.querySelectorAll( newSelector )711 );712 return results;713 } catch(qsaError) {714 } finally {715 if ( !old ) {716 context.removeAttribute("id");717 }718 }719 }720 }721 }722 // All others723 return select( selector.replace( rtrim, "$1" ), context, results, seed );724}725/**726 * Create key-value caches of limited size727 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with728 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)729 * deleting the oldest entry730 */731function createCache() {732 var keys = [];733 function cache( key, value ) {734 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)735 if ( keys.push( key + " " ) > Expr.cacheLength ) {736 // Only keep the most recent entries737 delete cache[ keys.shift() ];738 }739 return (cache[ key + " " ] = value);740 }741 return cache;742}743/**744 * Mark a function for special use by Sizzle745 * @param {Function} fn The function to mark746 */747function markFunction( fn ) {748 fn[ expando ] = true;749 return fn;750}751/**752 * Support testing using an element753 * @param {Function} fn Passed the created div and expects a boolean result754 */755function assert( fn ) {756 var div = document.createElement("div");757 try {758 return !!fn( div );759 } catch (e) {760 return false;761 } finally {762 // Remove from its parent by default763 if ( div.parentNode ) {764 div.parentNode.removeChild( div );765 }766 // release memory in IE767 div = null;768 }769}770/**771 * Adds the same handler for all of the specified attrs772 * @param {String} attrs Pipe-separated list of attributes773 * @param {Function} handler The method that will be applied774 */775function addHandle( attrs, handler ) {776 var arr = attrs.split("|"),777 i = attrs.length;778 while ( i-- ) {779 Expr.attrHandle[ arr[i] ] = handler;780 }781}782/**783 * Checks document order of two siblings784 * @param {Element} a785 * @param {Element} b786 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b787 */788function siblingCheck( a, b ) {789 var cur = b && a,790 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&791 ( ~b.sourceIndex || MAX_NEGATIVE ) -792 ( ~a.sourceIndex || MAX_NEGATIVE );793 // Use IE sourceIndex if available on both nodes794 if ( diff ) {795 return diff;796 }797 // Check if b follows a798 if ( cur ) {799 while ( (cur = cur.nextSibling) ) {800 if ( cur === b ) {801 return -1;802 }803 }804 }805 return a ? 1 : -1;806}807/**808 * Returns a function to use in pseudos for input types809 * @param {String} type810 */811function createInputPseudo( type ) {812 return function( elem ) {813 var name = elem.nodeName.toLowerCase();814 return name === "input" && elem.type === type;815 };816}817/**818 * Returns a function to use in pseudos for buttons819 * @param {String} type820 */821function createButtonPseudo( type ) {822 return function( elem ) {823 var name = elem.nodeName.toLowerCase();824 return (name === "input" || name === "button") && elem.type === type;825 };826}827/**828 * Returns a function to use in pseudos for positionals829 * @param {Function} fn830 */831function createPositionalPseudo( fn ) {832 return markFunction(function( argument ) {833 argument = +argument;834 return markFunction(function( seed, matches ) {835 var j,836 matchIndexes = fn( [], seed.length, argument ),837 i = matchIndexes.length;838 // Match elements found at the specified indexes839 while ( i-- ) {840 if ( seed[ (j = matchIndexes[i]) ] ) {841 seed[j] = !(matches[j] = seed[j]);842 }843 }844 });845 });846}847/**848 * Checks a node for validity as a Sizzle context849 * @param {Element|Object=} context850 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value851 */852function testContext( context ) {853 return context && typeof context.getElementsByTagName !== strundefined && context;854}855// Expose support vars for convenience856support = Sizzle.support = {};857/**858 * Detects XML nodes859 * @param {Element|Object} elem An element or a document860 * @returns {Boolean} True iff elem is a non-HTML XML node861 */862isXML = Sizzle.isXML = function( elem ) {863 // documentElement is verified for cases where it doesn't yet exist864 // (such as loading iframes in IE - #4833)865 var documentElement = elem && (elem.ownerDocument || elem).documentElement;866 return documentElement ? documentElement.nodeName !== "HTML" : false;867};868/**869 * Sets document-related variables once based on the current document870 * @param {Element|Object} [doc] An element or document object to use to set the document871 * @returns {Object} Returns the current document872 */873setDocument = Sizzle.setDocument = function( node ) {874 var hasCompare,875 doc = node ? node.ownerDocument || node : preferredDoc,876 parent = doc.defaultView;877 // If no document and documentElement is available, return878 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {879 return document;880 }881 // Set our document882 document = doc;883 docElem = doc.documentElement;884 // Support tests885 documentIsHTML = !isXML( doc );886 // Support: IE>8887 // If iframe document is assigned to "document" variable and if iframe has been reloaded,888 // IE will throw "permission denied" error when accessing "document" variable, see jquery #13936889 // IE6-8 do not support the defaultView property so parent will be undefined890 if ( parent && parent !== parent.top ) {891 // IE11 does not have attachEvent, so all must suffer892 if ( parent.addEventListener ) {893 parent.addEventListener( "unload", function() {894 setDocument();895 }, false );896 } else if ( parent.attachEvent ) {897 parent.attachEvent( "onunload", function() {898 setDocument();899 });900 }901 }902 /* Attributes903 ---------------------------------------------------------------------- */904 // Support: IE<8905 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)906 support.attributes = assert(function( div ) {907 div.className = "i";908 return !div.getAttribute("className");909 });910 /* getElement(s)By*911 ---------------------------------------------------------------------- */912 // Check if getElementsByTagName("*") returns only elements913 support.getElementsByTagName = assert(function( div ) {914 div.appendChild( doc.createComment("") );915 return !div.getElementsByTagName("*").length;916 });917 // Check if getElementsByClassName can be trusted918 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {919 div.innerHTML = "<div class='a'></div><div class='a i'></div>";920 // Support: Safari<4921 // Catch class over-caching922 div.firstChild.className = "i";923 // Support: Opera<10924 // Catch gEBCN failure to find non-leading classes925 return div.getElementsByClassName("i").length === 2;926 });927 // Support: IE<10928 // Check if getElementById returns elements by name929 // The broken getElementById methods don't pick up programatically-set names,930 // so use a roundabout getElementsByName test931 support.getById = assert(function( div ) {932 docElem.appendChild( div ).id = expando;933 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;934 });935 // ID find and filter936 if ( support.getById ) {937 Expr.find["ID"] = function( id, context ) {938 if ( typeof context.getElementById !== strundefined && documentIsHTML ) {939 var m = context.getElementById( id );940 // Check parentNode to catch when Blackberry 4.6 returns941 // nodes that are no longer in the document #6963942 return m && m.parentNode ? [m] : [];943 }944 };945 Expr.filter["ID"] = function( id ) {946 var attrId = id.replace( runescape, funescape );947 return function( elem ) {948 return elem.getAttribute("id") === attrId;949 };950 };951 } else {952 // Support: IE6/7953 // getElementById is not reliable as a find shortcut954 delete Expr.find["ID"];955 Expr.filter["ID"] = function( id ) {956 var attrId = id.replace( runescape, funescape );957 return function( elem ) {958 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");959 return node && node.value === attrId;960 };961 };962 }963 // Tag964 Expr.find["TAG"] = support.getElementsByTagName ?965 function( tag, context ) {966 if ( typeof context.getElementsByTagName !== strundefined ) {967 return context.getElementsByTagName( tag );968 }969 } :970 function( tag, context ) {971 var elem,972 tmp = [],973 i = 0,974 results = context.getElementsByTagName( tag );975 // Filter out possible comments976 if ( tag === "*" ) {977 while ( (elem = results[i++]) ) {978 if ( elem.nodeType === 1 ) {979 tmp.push( elem );980 }981 }982 return tmp;983 }984 return results;985 };986 // Class987 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {988 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {989 return context.getElementsByClassName( className );990 }991 };992 /* QSA/matchesSelector993 ---------------------------------------------------------------------- */994 // QSA and matchesSelector support995 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)996 rbuggyMatches = [];997 // qSa(:focus) reports false when true (Chrome 21)998 // We allow this because of a bug in IE8/9 that throws an error999 // whenever `document.activeElement` is accessed on an iframe1000 // So, we allow :focus to pass through QSA all the time to avoid the IE error1001 // See http://bugs.jquery.com/ticket/133781002 rbuggyQSA = [];1003 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {1004 // Build QSA regex1005 // Regex strategy adopted from Diego Perini1006 assert(function( div ) {1007 // Select is set to empty string on purpose1008 // This is to test IE's treatment of not explicitly1009 // setting a boolean content attribute,1010 // since its presence should be enough1011 // http://bugs.jquery.com/ticket/123591012 div.innerHTML = "<select t=''><option selected=''></option></select>";1013 // Support: IE8, Opera 10-121014 // Nothing should be selected when empty strings follow ^= or $= or *=1015 if ( div.querySelectorAll("[t^='']").length ) {1016 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );1017 }1018 // Support: IE81019 // Boolean attributes and "value" are not treated correctly1020 if ( !div.querySelectorAll("[selected]").length ) {1021 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );1022 }1023 // Webkit/Opera - :checked should return selected option elements1024 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1025 // IE8 throws error here and will not see later tests1026 if ( !div.querySelectorAll(":checked").length ) {1027 rbuggyQSA.push(":checked");1028 }1029 });1030 assert(function( div ) {1031 // Support: Windows 8 Native Apps1032 // The type and name attributes are restricted during .innerHTML assignment1033 var input = doc.createElement("input");1034 input.setAttribute( "type", "hidden" );1035 div.appendChild( input ).setAttribute( "name", "D" );1036 // Support: IE81037 // Enforce case-sensitivity of name attribute1038 if ( div.querySelectorAll("[name=d]").length ) {1039 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );1040 }1041 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)1042 // IE8 throws error here and will not see later tests1043 if ( !div.querySelectorAll(":enabled").length ) {1044 rbuggyQSA.push( ":enabled", ":disabled" );1045 }1046 // Opera 10-11 does not throw on post-comma invalid pseudos1047 div.querySelectorAll("*,:x");1048 rbuggyQSA.push(",.*:");1049 });1050 }1051 if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||1052 docElem.mozMatchesSelector ||1053 docElem.oMatchesSelector ||1054 docElem.msMatchesSelector) )) ) {1055 assert(function( div ) {1056 // Check to see if it's possible to do matchesSelector1057 // on a disconnected node (IE 9)1058 support.disconnectedMatch = matches.call( div, "div" );1059 // This should fail with an exception1060 // Gecko does not error, returns false instead1061 matches.call( div, "[s!='']:x" );1062 rbuggyMatches.push( "!=", pseudos );1063 });1064 }1065 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );1066 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );1067 /* Contains1068 ---------------------------------------------------------------------- */1069 hasCompare = rnative.test( docElem.compareDocumentPosition );1070 // Element contains another1071 // Purposefully does not implement inclusive descendent1072 // As in, an element does not contain itself1073 contains = hasCompare || rnative.test( docElem.contains ) ?1074 function( a, b ) {1075 var adown = a.nodeType === 9 ? a.documentElement : a,1076 bup = b && b.parentNode;1077 return a === bup || !!( bup && bup.nodeType === 1 && (1078 adown.contains ?1079 adown.contains( bup ) :1080 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 161081 ));1082 } :1083 function( a, b ) {1084 if ( b ) {1085 while ( (b = b.parentNode) ) {1086 if ( b === a ) {1087 return true;1088 }1089 }1090 }1091 return false;1092 };1093 /* Sorting1094 ---------------------------------------------------------------------- */1095 // Document order sorting1096 sortOrder = hasCompare ?1097 function( a, b ) {1098 // Flag for duplicate removal1099 if ( a === b ) {1100 hasDuplicate = true;1101 return 0;1102 }1103 // Sort on method existence if only one input has compareDocumentPosition1104 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;1105 if ( compare ) {1106 return compare;1107 }1108 // Calculate position if both inputs belong to the same document1109 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?1110 a.compareDocumentPosition( b ) :1111 // Otherwise we know they are disconnected1112 1;1113 // Disconnected nodes1114 if ( compare & 1 ||1115 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {1116 // Choose the first element that is related to our preferred document1117 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {1118 return -1;1119 }1120 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {1121 return 1;1122 }1123 // Maintain original order1124 return sortInput ?1125 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1126 0;1127 }1128 return compare & 4 ? -1 : 1;1129 } :1130 function( a, b ) {1131 // Exit early if the nodes are identical1132 if ( a === b ) {1133 hasDuplicate = true;1134 return 0;1135 }1136 var cur,1137 i = 0,1138 aup = a.parentNode,1139 bup = b.parentNode,1140 ap = [ a ],1141 bp = [ b ];1142 // Parentless nodes are either documents or disconnected1143 if ( !aup || !bup ) {1144 return a === doc ? -1 :1145 b === doc ? 1 :1146 aup ? -1 :1147 bup ? 1 :1148 sortInput ?1149 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1150 0;1151 // If the nodes are siblings, we can do a quick check1152 } else if ( aup === bup ) {1153 return siblingCheck( a, b );1154 }1155 // Otherwise we need full lists of their ancestors for comparison1156 cur = a;1157 while ( (cur = cur.parentNode) ) {1158 ap.unshift( cur );1159 }1160 cur = b;1161 while ( (cur = cur.parentNode) ) {1162 bp.unshift( cur );1163 }1164 // Walk down the tree looking for a discrepancy1165 while ( ap[i] === bp[i] ) {1166 i++;1167 }1168 return i ?1169 // Do a sibling check if the nodes have a common ancestor1170 siblingCheck( ap[i], bp[i] ) :1171 // Otherwise nodes in our document sort first1172 ap[i] === preferredDoc ? -1 :1173 bp[i] === preferredDoc ? 1 :1174 0;1175 };1176 return doc;1177};1178Sizzle.matches = function( expr, elements ) {1179 return Sizzle( expr, null, null, elements );1180};1181Sizzle.matchesSelector = function( elem, expr ) {1182 // Set document vars if needed1183 if ( ( elem.ownerDocument || elem ) !== document ) {1184 setDocument( elem );1185 }1186 // Make sure that attribute selectors are quoted1187 expr = expr.replace( rattributeQuotes, "='$1']" );1188 if ( support.matchesSelector && documentIsHTML &&1189 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&1190 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {1191 try {1192 var ret = matches.call( elem, expr );1193 // IE 9's matchesSelector returns false on disconnected nodes1194 if ( ret || support.disconnectedMatch ||1195 // As well, disconnected nodes are said to be in a document1196 // fragment in IE 91197 elem.document && elem.document.nodeType !== 11 ) {1198 return ret;1199 }1200 } catch(e) {}1201 }1202 return Sizzle( expr, document, null, [elem] ).length > 0;1203};1204Sizzle.contains = function( context, elem ) {1205 // Set document vars if needed1206 if ( ( context.ownerDocument || context ) !== document ) {1207 setDocument( context );1208 }1209 return contains( context, elem );1210};1211Sizzle.attr = function( elem, name ) {1212 // Set document vars if needed1213 if ( ( elem.ownerDocument || elem ) !== document ) {1214 setDocument( elem );1215 }1216 var fn = Expr.attrHandle[ name.toLowerCase() ],1217 // Don't get fooled by Object.prototype properties (jquery #13807)1218 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?1219 fn( elem, name, !documentIsHTML ) :1220 undefined;1221 return val !== undefined ?1222 val :1223 support.attributes || !documentIsHTML ?1224 elem.getAttribute( name ) :1225 (val = elem.getAttributeNode(name)) && val.specified ?1226 val.value :1227 null;1228};1229Sizzle.error = function( msg ) {1230 throw new Error( "Syntax error, unrecognized expression: " + msg );1231};1232/**1233 * Document sorting and removing duplicates1234 * @param {ArrayLike} results1235 */1236Sizzle.uniqueSort = function( results ) {1237 var elem,1238 duplicates = [],1239 j = 0,1240 i = 0;1241 // Unless we *know* we can detect duplicates, assume their presence1242 hasDuplicate = !support.detectDuplicates;1243 sortInput = !support.sortStable && results.slice( 0 );1244 results.sort( sortOrder );1245 if ( hasDuplicate ) {1246 while ( (elem = results[i++]) ) {1247 if ( elem === results[ i ] ) {1248 j = duplicates.push( i );1249 }1250 }1251 while ( j-- ) {1252 results.splice( duplicates[ j ], 1 );1253 }1254 }1255 // Clear input after sorting to release objects1256 // See https://github.com/jquery/sizzle/pull/2251257 sortInput = null;1258 return results;1259};1260/**1261 * Utility function for retrieving the text value of an array of DOM nodes1262 * @param {Array|Element} elem1263 */1264getText = Sizzle.getText = function( elem ) {1265 var node,1266 ret = "",1267 i = 0,1268 nodeType = elem.nodeType;1269 if ( !nodeType ) {1270 // If no nodeType, this is expected to be an array1271 while ( (node = elem[i++]) ) {1272 // Do not traverse comment nodes1273 ret += getText( node );1274 }1275 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {1276 // Use textContent for elements1277 // innerText usage removed for consistency of new lines (jquery #11153)1278 if ( typeof elem.textContent === "string" ) {1279 return elem.textContent;1280 } else {1281 // Traverse its children1282 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1283 ret += getText( elem );1284 }1285 }1286 } else if ( nodeType === 3 || nodeType === 4 ) {1287 return elem.nodeValue;1288 }1289 // Do not include comment or processing instruction nodes1290 return ret;1291};1292Expr = Sizzle.selectors = {1293 // Can be adjusted by the user1294 cacheLength: 50,1295 createPseudo: markFunction,1296 match: matchExpr,1297 attrHandle: {},1298 find: {},1299 relative: {1300 ">": { dir: "parentNode", first: true },1301 " ": { dir: "parentNode" },1302 "+": { dir: "previousSibling", first: true },1303 "~": { dir: "previousSibling" }1304 },1305 preFilter: {1306 "ATTR": function( match ) {1307 match[1] = match[1].replace( runescape, funescape );1308 // Move the given value to match[3] whether quoted or unquoted1309 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );1310 if ( match[2] === "~=" ) {1311 match[3] = " " + match[3] + " ";1312 }1313 return match.slice( 0, 4 );1314 },1315 "CHILD": function( match ) {1316 /* matches from matchExpr["CHILD"]1317 1 type (only|nth|...)1318 2 what (child|of-type)1319 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)1320 4 xn-component of xn+y argument ([+-]?\d*n|)1321 5 sign of xn-component1322 6 x of xn-component1323 7 sign of y-component1324 8 y of y-component1325 */1326 match[1] = match[1].toLowerCase();1327 if ( match[1].slice( 0, 3 ) === "nth" ) {1328 // nth-* requires argument1329 if ( !match[3] ) {1330 Sizzle.error( match[0] );1331 }1332 // numeric x and y parameters for Expr.filter.CHILD1333 // remember that false/true cast respectively to 0/11334 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );1335 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );1336 // other types prohibit arguments1337 } else if ( match[3] ) {1338 Sizzle.error( match[0] );1339 }1340 return match;1341 },1342 "PSEUDO": function( match ) {1343 var excess,1344 unquoted = !match[5] && match[2];1345 if ( matchExpr["CHILD"].test( match[0] ) ) {1346 return null;1347 }1348 // Accept quoted arguments as-is1349 if ( match[3] && match[4] !== undefined ) {1350 match[2] = match[4];1351 // Strip excess characters from unquoted arguments1352 } else if ( unquoted && rpseudo.test( unquoted ) &&1353 // Get excess from tokenize (recursively)1354 (excess = tokenize( unquoted, true )) &&1355 // advance to the next closing parenthesis1356 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {1357 // excess is a negative index1358 match[0] = match[0].slice( 0, excess );1359 match[2] = unquoted.slice( 0, excess );1360 }1361 // Return only captures needed by the pseudo filter method (type and argument)1362 return match.slice( 0, 3 );1363 }1364 },1365 filter: {1366 "TAG": function( nodeNameSelector ) {1367 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();1368 return nodeNameSelector === "*" ?1369 function() { return true; } :1370 function( elem ) {1371 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;1372 };1373 },1374 "CLASS": function( className ) {1375 var pattern = classCache[ className + " " ];1376 return pattern ||1377 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&1378 classCache( className, function( elem ) {1379 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );1380 });1381 },1382 "ATTR": function( name, operator, check ) {1383 return function( elem ) {1384 var result = Sizzle.attr( elem, name );1385 if ( result == null ) {1386 return operator === "!=";1387 }1388 if ( !operator ) {1389 return true;1390 }1391 result += "";1392 return operator === "=" ? result === check :1393 operator === "!=" ? result !== check :1394 operator === "^=" ? check && result.indexOf( check ) === 0 :1395 operator === "*=" ? check && result.indexOf( check ) > -1 :1396 operator === "$=" ? check && result.slice( -check.length ) === check :1397 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :1398 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :1399 false;1400 };1401 },1402 "CHILD": function( type, what, argument, first, last ) {1403 var simple = type.slice( 0, 3 ) !== "nth",1404 forward = type.slice( -4 ) !== "last",1405 ofType = what === "of-type";1406 return first === 1 && last === 0 ?1407 // Shortcut for :nth-*(n)1408 function( elem ) {1409 return !!elem.parentNode;1410 } :1411 function( elem, context, xml ) {1412 var cache, outerCache, node, diff, nodeIndex, start,1413 dir = simple !== forward ? "nextSibling" : "previousSibling",1414 parent = elem.parentNode,1415 name = ofType && elem.nodeName.toLowerCase(),1416 useCache = !xml && !ofType;1417 if ( parent ) {1418 // :(first|last|only)-(child|of-type)1419 if ( simple ) {1420 while ( dir ) {1421 node = elem;1422 while ( (node = node[ dir ]) ) {1423 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {1424 return false;1425 }1426 }1427 // Reverse direction for :only-* (if we haven't yet done so)1428 start = dir = type === "only" && !start && "nextSibling";1429 }1430 return true;1431 }1432 start = [ forward ? parent.firstChild : parent.lastChild ];1433 // non-xml :nth-child(...) stores cache data on `parent`1434 if ( forward && useCache ) {1435 // Seek `elem` from a previously-cached index1436 outerCache = parent[ expando ] || (parent[ expando ] = {});1437 cache = outerCache[ type ] || [];1438 nodeIndex = cache[0] === dirruns && cache[1];1439 diff = cache[0] === dirruns && cache[2];1440 node = nodeIndex && parent.childNodes[ nodeIndex ];1441 while ( (node = ++nodeIndex && node && node[ dir ] ||1442 // Fallback to seeking `elem` from the start1443 (diff = nodeIndex = 0) || start.pop()) ) {1444 // When found, cache indexes on `parent` and break1445 if ( node.nodeType === 1 && ++diff && node === elem ) {1446 outerCache[ type ] = [ dirruns, nodeIndex, diff ];1447 break;1448 }1449 }1450 // Use previously-cached element index if available1451 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {1452 diff = cache[1];1453 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)1454 } else {1455 // Use the same loop as above to seek `elem` from the start1456 while ( (node = ++nodeIndex && node && node[ dir ] ||1457 (diff = nodeIndex = 0) || start.pop()) ) {1458 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {1459 // Cache the index of each encountered element1460 if ( useCache ) {1461 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];1462 }1463 if ( node === elem ) {1464 break;1465 }1466 }1467 }1468 }1469 // Incorporate the offset, then check against cycle size1470 diff -= last;1471 return diff === first || ( diff % first === 0 && diff / first >= 0 );1472 }1473 };1474 },1475 "PSEUDO": function( pseudo, argument ) {1476 // pseudo-class names are case-insensitive1477 // http://www.w3.org/TR/selectors/#pseudo-classes1478 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters1479 // Remember that setFilters inherits from pseudos1480 var args,1481 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||1482 Sizzle.error( "unsupported pseudo: " + pseudo );1483 // The user may use createPseudo to indicate that1484 // arguments are needed to create the filter function1485 // just as Sizzle does1486 if ( fn[ expando ] ) {1487 return fn( argument );1488 }1489 // But maintain support for old signatures1490 if ( fn.length > 1 ) {1491 args = [ pseudo, pseudo, "", argument ];1492 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?1493 markFunction(function( seed, matches ) {1494 var idx,1495 matched = fn( seed, argument ),1496 i = matched.length;1497 while ( i-- ) {1498 idx = indexOf.call( seed, matched[i] );1499 seed[ idx ] = !( matches[ idx ] = matched[i] );1500 }1501 }) :1502 function( elem ) {1503 return fn( elem, 0, args );1504 };1505 }1506 return fn;1507 }1508 },1509 pseudos: {1510 // Potentially complex pseudos1511 "not": markFunction(function( selector ) {1512 // Trim the selector passed to compile1513 // to avoid treating leading and trailing1514 // spaces as combinators1515 var input = [],1516 results = [],1517 matcher = compile( selector.replace( rtrim, "$1" ) );1518 return matcher[ expando ] ?1519 markFunction(function( seed, matches, context, xml ) {1520 var elem,1521 unmatched = matcher( seed, null, xml, [] ),1522 i = seed.length;1523 // Match elements unmatched by `matcher`1524 while ( i-- ) {1525 if ( (elem = unmatched[i]) ) {1526 seed[i] = !(matches[i] = elem);1527 }1528 }1529 }) :1530 function( elem, context, xml ) {1531 input[0] = elem;1532 matcher( input, null, xml, results );1533 return !results.pop();1534 };1535 }),1536 "has": markFunction(function( selector ) {1537 return function( elem ) {1538 return Sizzle( selector, elem ).length > 0;1539 };1540 }),1541 "contains": markFunction(function( text ) {1542 return function( elem ) {1543 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;1544 };1545 }),1546 // "Whether an element is represented by a :lang() selector1547 // is based solely on the element's language value1548 // being equal to the identifier C,1549 // or beginning with the identifier C immediately followed by "-".1550 // The matching of C against the element's language value is performed case-insensitively.1551 // The identifier C does not have to be a valid language name."1552 // http://www.w3.org/TR/selectors/#lang-pseudo1553 "lang": markFunction( function( lang ) {1554 // lang value must be a valid identifier1555 if ( !ridentifier.test(lang || "") ) {1556 Sizzle.error( "unsupported lang: " + lang );1557 }1558 lang = lang.replace( runescape, funescape ).toLowerCase();1559 return function( elem ) {1560 var elemLang;1561 do {1562 if ( (elemLang = documentIsHTML ?1563 elem.lang :1564 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {1565 elemLang = elemLang.toLowerCase();1566 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;1567 }1568 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );1569 return false;1570 };1571 }),1572 // Miscellaneous1573 "target": function( elem ) {1574 var hash = window.location && window.location.hash;1575 return hash && hash.slice( 1 ) === elem.id;1576 },1577 "root": function( elem ) {1578 return elem === docElem;1579 },1580 "focus": function( elem ) {1581 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);1582 },1583 // Boolean properties1584 "enabled": function( elem ) {1585 return elem.disabled === false;1586 },1587 "disabled": function( elem ) {1588 return elem.disabled === true;1589 },1590 "checked": function( elem ) {1591 // In CSS3, :checked should return both checked and selected elements1592 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1593 var nodeName = elem.nodeName.toLowerCase();1594 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);1595 },1596 "selected": function( elem ) {1597 // Accessing this property makes selected-by-default1598 // options in Safari work properly1599 if ( elem.parentNode ) {1600 elem.parentNode.selectedIndex;1601 }1602 return elem.selected === true;1603 },1604 // Contents1605 "empty": function( elem ) {1606 // http://www.w3.org/TR/selectors/#empty-pseudo1607 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),1608 // but not by others (comment: 8; processing instruction: 7; etc.)1609 // nodeType < 6 works because attributes (2) do not appear as children1610 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1611 if ( elem.nodeType < 6 ) {1612 return false;1613 }1614 }1615 return true;1616 },1617 "parent": function( elem ) {1618 return !Expr.pseudos["empty"]( elem );1619 },1620 // Element/input types1621 "header": function( elem ) {1622 return rheader.test( elem.nodeName );1623 },1624 "input": function( elem ) {1625 return rinputs.test( elem.nodeName );1626 },1627 "button": function( elem ) {1628 var name = elem.nodeName.toLowerCase();1629 return name === "input" && elem.type === "button" || name === "button";1630 },1631 "text": function( elem ) {1632 var attr;1633 return elem.nodeName.toLowerCase() === "input" &&1634 elem.type === "text" &&1635 // Support: IE<81636 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"1637 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );1638 },1639 // Position-in-collection1640 "first": createPositionalPseudo(function() {1641 return [ 0 ];1642 }),1643 "last": createPositionalPseudo(function( matchIndexes, length ) {1644 return [ length - 1 ];1645 }),1646 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {1647 return [ argument < 0 ? argument + length : argument ];1648 }),1649 "even": createPositionalPseudo(function( matchIndexes, length ) {1650 var i = 0;1651 for ( ; i < length; i += 2 ) {1652 matchIndexes.push( i );1653 }1654 return matchIndexes;1655 }),1656 "odd": createPositionalPseudo(function( matchIndexes, length ) {1657 var i = 1;1658 for ( ; i < length; i += 2 ) {1659 matchIndexes.push( i );1660 }1661 return matchIndexes;1662 }),1663 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {1664 var i = argument < 0 ? argument + length : argument;1665 for ( ; --i >= 0; ) {1666 matchIndexes.push( i );1667 }1668 return matchIndexes;1669 }),1670 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {1671 var i = argument < 0 ? argument + length : argument;1672 for ( ; ++i < length; ) {1673 matchIndexes.push( i );1674 }1675 return matchIndexes;1676 })1677 }1678};1679Expr.pseudos["nth"] = Expr.pseudos["eq"];1680// Add button/input type pseudos1681for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {1682 Expr.pseudos[ i ] = createInputPseudo( i );1683}1684for ( i in { submit: true, reset: true } ) {1685 Expr.pseudos[ i ] = createButtonPseudo( i );1686}1687// Easy API for creating new setFilters1688function setFilters() {}1689setFilters.prototype = Expr.filters = Expr.pseudos;1690Expr.setFilters = new setFilters();1691function tokenize( selector, parseOnly ) {1692 var matched, match, tokens, type,1693 soFar, groups, preFilters,1694 cached = tokenCache[ selector + " " ];1695 if ( cached ) {1696 return parseOnly ? 0 : cached.slice( 0 );1697 }1698 soFar = selector;1699 groups = [];1700 preFilters = Expr.preFilter;1701 while ( soFar ) {1702 // Comma and first run1703 if ( !matched || (match = rcomma.exec( soFar )) ) {1704 if ( match ) {1705 // Don't consume trailing commas as valid1706 soFar = soFar.slice( match[0].length ) || soFar;1707 }1708 groups.push( (tokens = []) );1709 }1710 matched = false;1711 // Combinators1712 if ( (match = rcombinators.exec( soFar )) ) {1713 matched = match.shift();1714 tokens.push({1715 value: matched,1716 // Cast descendant combinators to space1717 type: match[0].replace( rtrim, " " )1718 });1719 soFar = soFar.slice( matched.length );1720 }1721 // Filters1722 for ( type in Expr.filter ) {1723 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||1724 (match = preFilters[ type ]( match ))) ) {1725 matched = match.shift();1726 tokens.push({1727 value: matched,1728 type: type,1729 matches: match1730 });1731 soFar = soFar.slice( matched.length );1732 }1733 }1734 if ( !matched ) {1735 break;1736 }1737 }1738 // Return the length of the invalid excess1739 // if we're just parsing1740 // Otherwise, throw an error or return tokens1741 return parseOnly ?1742 soFar.length :1743 soFar ?1744 Sizzle.error( selector ) :1745 // Cache the tokens1746 tokenCache( selector, groups ).slice( 0 );1747}1748function toSelector( tokens ) {1749 var i = 0,1750 len = tokens.length,1751 selector = "";1752 for ( ; i < len; i++ ) {1753 selector += tokens[i].value;1754 }1755 return selector;1756}1757function addCombinator( matcher, combinator, base ) {1758 var dir = combinator.dir,1759 checkNonElements = base && dir === "parentNode",1760 doneName = done++;1761 return combinator.first ?1762 // Check against closest ancestor/preceding element1763 function( elem, context, xml ) {1764 while ( (elem = elem[ dir ]) ) {1765 if ( elem.nodeType === 1 || checkNonElements ) {1766 return matcher( elem, context, xml );1767 }1768 }1769 } :1770 // Check against all ancestor/preceding elements1771 function( elem, context, xml ) {1772 var oldCache, outerCache,1773 newCache = [ dirruns, doneName ];1774 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching1775 if ( xml ) {1776 while ( (elem = elem[ dir ]) ) {1777 if ( elem.nodeType === 1 || checkNonElements ) {1778 if ( matcher( elem, context, xml ) ) {1779 return true;1780 }1781 }1782 }1783 } else {1784 while ( (elem = elem[ dir ]) ) {1785 if ( elem.nodeType === 1 || checkNonElements ) {1786 outerCache = elem[ expando ] || (elem[ expando ] = {});1787 if ( (oldCache = outerCache[ dir ]) &&1788 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {1789 // Assign to newCache so results back-propagate to previous elements1790 return (newCache[ 2 ] = oldCache[ 2 ]);1791 } else {1792 // Reuse newcache so results back-propagate to previous elements1793 outerCache[ dir ] = newCache;1794 // A match means we're done; a fail means we have to keep checking1795 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {1796 return true;1797 }1798 }1799 }1800 }1801 }1802 };1803}1804function elementMatcher( matchers ) {1805 return matchers.length > 1 ?1806 function( elem, context, xml ) {1807 var i = matchers.length;1808 while ( i-- ) {1809 if ( !matchers[i]( elem, context, xml ) ) {1810 return false;1811 }1812 }1813 return true;1814 } :1815 matchers[0];1816}1817function condense( unmatched, map, filter, context, xml ) {1818 var elem,1819 newUnmatched = [],1820 i = 0,1821 len = unmatched.length,1822 mapped = map != null;1823 for ( ; i < len; i++ ) {1824 if ( (elem = unmatched[i]) ) {1825 if ( !filter || filter( elem, context, xml ) ) {1826 newUnmatched.push( elem );1827 if ( mapped ) {1828 map.push( i );1829 }1830 }1831 }1832 }1833 return newUnmatched;1834}1835function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {1836 if ( postFilter && !postFilter[ expando ] ) {1837 postFilter = setMatcher( postFilter );1838 }1839 if ( postFinder && !postFinder[ expando ] ) {1840 postFinder = setMatcher( postFinder, postSelector );1841 }1842 return markFunction(function( seed, results, context, xml ) {1843 var temp, i, elem,1844 preMap = [],1845 postMap = [],1846 preexisting = results.length,1847 // Get initial elements from seed or context1848 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),1849 // Prefilter to get matcher input, preserving a map for seed-results synchronization1850 matcherIn = preFilter && ( seed || !selector ) ?1851 condense( elems, preMap, preFilter, context, xml ) :1852 elems,1853 matcherOut = matcher ?1854 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,1855 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?1856 // ...intermediate processing is necessary1857 [] :1858 // ...otherwise use results directly1859 results :1860 matcherIn;1861 // Find primary matches1862 if ( matcher ) {1863 matcher( matcherIn, matcherOut, context, xml );1864 }1865 // Apply postFilter1866 if ( postFilter ) {1867 temp = condense( matcherOut, postMap );1868 postFilter( temp, [], context, xml );1869 // Un-match failing elements by moving them back to matcherIn1870 i = temp.length;1871 while ( i-- ) {1872 if ( (elem = temp[i]) ) {1873 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);1874 }1875 }1876 }1877 if ( seed ) {1878 if ( postFinder || preFilter ) {1879 if ( postFinder ) {1880 // Get the final matcherOut by condensing this intermediate into postFinder contexts1881 temp = [];1882 i = matcherOut.length;1883 while ( i-- ) {1884 if ( (elem = matcherOut[i]) ) {1885 // Restore matcherIn since elem is not yet a final match1886 temp.push( (matcherIn[i] = elem) );1887 }1888 }1889 postFinder( null, (matcherOut = []), temp, xml );1890 }1891 // Move matched elements from seed to results to keep them synchronized1892 i = matcherOut.length;1893 while ( i-- ) {1894 if ( (elem = matcherOut[i]) &&1895 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {1896 seed[temp] = !(results[temp] = elem);1897 }1898 }1899 }1900 // Add elements to results, through postFinder if defined1901 } else {1902 matcherOut = condense(1903 matcherOut === results ?1904 matcherOut.splice( preexisting, matcherOut.length ) :1905 matcherOut1906 );1907 if ( postFinder ) {1908 postFinder( null, results, matcherOut, xml );1909 } else {1910 push.apply( results, matcherOut );1911 }1912 }1913 });1914}1915function matcherFromTokens( tokens ) {1916 var checkContext, matcher, j,1917 len = tokens.length,1918 leadingRelative = Expr.relative[ tokens[0].type ],1919 implicitRelative = leadingRelative || Expr.relative[" "],1920 i = leadingRelative ? 1 : 0,1921 // The foundational matcher ensures that elements are reachable from top-level context(s)1922 matchContext = addCombinator( function( elem ) {1923 return elem === checkContext;1924 }, implicitRelative, true ),1925 matchAnyContext = addCombinator( function( elem ) {1926 return indexOf.call( checkContext, elem ) > -1;1927 }, implicitRelative, true ),1928 matchers = [ function( elem, context, xml ) {1929 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (1930 (checkContext = context).nodeType ?1931 matchContext( elem, context, xml ) :1932 matchAnyContext( elem, context, xml ) );1933 } ];1934 for ( ; i < len; i++ ) {1935 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {1936 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];1937 } else {1938 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );1939 // Return special upon seeing a positional matcher1940 if ( matcher[ expando ] ) {1941 // Find the next relative operator (if any) for proper handling1942 j = ++i;1943 for ( ; j < len; j++ ) {1944 if ( Expr.relative[ tokens[j].type ] ) {1945 break;1946 }1947 }1948 return setMatcher(1949 i > 1 && elementMatcher( matchers ),1950 i > 1 && toSelector(1951 // If the preceding token was a descendant combinator, insert an implicit any-element `*`1952 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })1953 ).replace( rtrim, "$1" ),1954 matcher,1955 i < j && matcherFromTokens( tokens.slice( i, j ) ),1956 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),1957 j < len && toSelector( tokens )1958 );1959 }1960 matchers.push( matcher );1961 }1962 }1963 return elementMatcher( matchers );1964}1965function matcherFromGroupMatchers( elementMatchers, setMatchers ) {1966 var bySet = setMatchers.length > 0,1967 byElement = elementMatchers.length > 0,1968 superMatcher = function( seed, context, xml, results, outermost ) {1969 var elem, j, matcher,1970 matchedCount = 0,1971 i = "0",1972 unmatched = seed && [],1973 setMatched = [],1974 contextBackup = outermostContext,1975 // We must always have either seed elements or outermost context1976 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),1977 // Use integer dirruns iff this is the outermost matcher1978 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),1979 len = elems.length;1980 if ( outermost ) {1981 outermostContext = context !== document && context;1982 }1983 // Add elements passing elementMatchers directly to results1984 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below1985 // Support: IE<9, Safari1986 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id1987 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {1988 if ( byElement && elem ) {1989 j = 0;1990 while ( (matcher = elementMatchers[j++]) ) {1991 if ( matcher( elem, context, xml ) ) {1992 results.push( elem );1993 break;1994 }1995 }1996 if ( outermost ) {1997 dirruns = dirrunsUnique;1998 }1999 }2000 // Track unmatched elements for set filters2001 if ( bySet ) {2002 // They will have gone through all possible matchers2003 if ( (elem = !matcher && elem) ) {2004 matchedCount--;2005 }2006 // Lengthen the array for every element, matched or not2007 if ( seed ) {2008 unmatched.push( elem );2009 }2010 }2011 }2012 // Apply set filters to unmatched elements2013 matchedCount += i;2014 if ( bySet && i !== matchedCount ) {2015 j = 0;2016 while ( (matcher = setMatchers[j++]) ) {2017 matcher( unmatched, setMatched, context, xml );2018 }2019 if ( seed ) {2020 // Reintegrate element matches to eliminate the need for sorting2021 if ( matchedCount > 0 ) {2022 while ( i-- ) {2023 if ( !(unmatched[i] || setMatched[i]) ) {2024 setMatched[i] = pop.call( results );2025 }2026 }2027 }2028 // Discard index placeholder values to get only actual matches2029 setMatched = condense( setMatched );2030 }2031 // Add matches to results2032 push.apply( results, setMatched );2033 // Seedless set matches succeeding multiple successful matchers stipulate sorting2034 if ( outermost && !seed && setMatched.length > 0 &&2035 ( matchedCount + setMatchers.length ) > 1 ) {2036 Sizzle.uniqueSort( results );2037 }2038 }2039 // Override manipulation of globals by nested matchers2040 if ( outermost ) {2041 dirruns = dirrunsUnique;2042 outermostContext = contextBackup;2043 }2044 return unmatched;2045 };2046 return bySet ?2047 markFunction( superMatcher ) :2048 superMatcher;2049}2050compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {2051 var i,2052 setMatchers = [],2053 elementMatchers = [],2054 cached = compilerCache[ selector + " " ];2055 if ( !cached ) {2056 // Generate a function of recursive functions that can be used to check each element2057 if ( !group ) {2058 group = tokenize( selector );2059 }2060 i = group.length;2061 while ( i-- ) {2062 cached = matcherFromTokens( group[i] );2063 if ( cached[ expando ] ) {2064 setMatchers.push( cached );2065 } else {2066 elementMatchers.push( cached );2067 }2068 }2069 // Cache the compiled function2070 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );2071 }2072 return cached;2073};2074function multipleContexts( selector, contexts, results ) {2075 var i = 0,2076 len = contexts.length;2077 for ( ; i < len; i++ ) {2078 Sizzle( selector, contexts[i], results );2079 }2080 return results;2081}2082function select( selector, context, results, seed ) {2083 var i, tokens, token, type, find,2084 match = tokenize( selector );2085 if ( !seed ) {2086 // Try to minimize operations if there is only one group2087 if ( match.length === 1 ) {2088 // Take a shortcut and set the context if the root selector is an ID2089 tokens = match[0] = match[0].slice( 0 );2090 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&2091 support.getById && context.nodeType === 9 && documentIsHTML &&2092 Expr.relative[ tokens[1].type ] ) {2093 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];2094 if ( !context ) {2095 return results;2096 }2097 selector = selector.slice( tokens.shift().value.length );2098 }2099 // Fetch a seed set for right-to-left matching2100 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;2101 while ( i-- ) {2102 token = tokens[i];2103 // Abort if we hit a combinator2104 if ( Expr.relative[ (type = token.type) ] ) {2105 break;2106 }2107 if ( (find = Expr.find[ type ]) ) {2108 // Search, expanding context for leading sibling combinators2109 if ( (seed = find(2110 token.matches[0].replace( runescape, funescape ),2111 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context2112 )) ) {2113 // If seed is empty or no tokens remain, we can return early2114 tokens.splice( i, 1 );2115 selector = seed.length && toSelector( tokens );2116 if ( !selector ) {2117 push.apply( results, seed );2118 return results;2119 }2120 break;2121 }2122 }2123 }2124 }2125 }2126 // Compile and execute a filtering function2127 // Provide `match` to avoid retokenization if we modified the selector above2128 compile( selector, match )(2129 seed,2130 context,2131 !documentIsHTML,2132 results,2133 rsibling.test( selector ) && testContext( context.parentNode ) || context2134 );2135 return results;2136}2137// One-time assignments2138// Sort stability2139support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;2140// Support: Chrome<142141// Always assume duplicates if they aren't passed to the comparison function2142support.detectDuplicates = !!hasDuplicate;2143// Initialize against the default document2144setDocument();2145// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)2146// Detached nodes confoundingly follow *each other*2147support.sortDetached = assert(function( div1 ) {2148 // Should return 1, but returns 4 (following)2149 return div1.compareDocumentPosition( document.createElement("div") ) & 1;2150});2151// Support: IE<82152// Prevent attribute/property "interpolation"2153// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx2154if ( !assert(function( div ) {2155 div.innerHTML = "<a href='#'></a>";2156 return div.firstChild.getAttribute("href") === "#" ;2157}) ) {2158 addHandle( "type|href|height|width", function( elem, name, isXML ) {2159 if ( !isXML ) {2160 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );2161 }2162 });2163}2164// Support: IE<92165// Use defaultValue in place of getAttribute("value")2166if ( !support.attributes || !assert(function( div ) {2167 div.innerHTML = "<input/>";2168 div.firstChild.setAttribute( "value", "" );2169 return div.firstChild.getAttribute( "value" ) === "";2170}) ) {2171 addHandle( "value", function( elem, name, isXML ) {2172 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {2173 return elem.defaultValue;2174 }2175 });2176}2177// Support: IE<92178// Use getAttributeNode to fetch booleans when getAttribute lies2179if ( !assert(function( div ) {2180 return div.getAttribute("disabled") == null;2181}) ) {2182 addHandle( booleans, function( elem, name, isXML ) {2183 var val;2184 if ( !isXML ) {2185 return elem[ name ] === true ? name.toLowerCase() :2186 (val = elem.getAttributeNode( name )) && val.specified ?2187 val.value :2188 null;2189 }2190 });2191}2192return Sizzle;2193})( window );2194jquery.find = Sizzle;2195jquery.expr = Sizzle.selectors;2196jquery.expr[":"] = jquery.expr.pseudos;2197jquery.unique = Sizzle.uniqueSort;2198jquery.text = Sizzle.getText;2199jquery.isXMLDoc = Sizzle.isXML;2200jquery.contains = Sizzle.contains;2201var rneedsContext = jquery.expr.match.needsContext;2202var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);2203var risSimple = /^.[^:#\[\.,]*$/;2204// Implement the identical functionality for filter and not2205function winnow( elements, qualifier, not ) {2206 if ( jquery.isFunction( qualifier ) ) {2207 return jquery.grep( elements, function( elem, i ) {2208 /* jshint -W018 */2209 return !!qualifier.call( elem, i, elem ) !== not;2210 });2211 }2212 if ( qualifier.nodeType ) {2213 return jquery.grep( elements, function( elem ) {2214 return ( elem === qualifier ) !== not;2215 });2216 }2217 if ( typeof qualifier === "string" ) {2218 if ( risSimple.test( qualifier ) ) {2219 return jquery.filter( qualifier, elements, not );2220 }2221 qualifier = jquery.filter( qualifier, elements );2222 }2223 return jquery.grep( elements, function( elem ) {2224 return ( jquery.inArray( elem, qualifier ) >= 0 ) !== not;2225 });2226}2227jquery.filter = function( expr, elems, not ) {2228 var elem = elems[ 0 ];2229 if ( not ) {2230 expr = ":not(" + expr + ")";2231 }2232 return elems.length === 1 && elem.nodeType === 1 ?2233 jquery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :2234 jquery.find.matches( expr, jquery.grep( elems, function( elem ) {2235 return elem.nodeType === 1;2236 }));2237};2238jquery.fn.extend({2239 find: function( selector ) {2240 var i,2241 ret = [],2242 self = this,2243 len = self.length;2244 if ( typeof selector !== "string" ) {2245 return this.pushStack( jquery( selector ).filter(function() {2246 for ( i = 0; i < len; i++ ) {2247 if ( jquery.contains( self[ i ], this ) ) {2248 return true;2249 }2250 }2251 }) );2252 }2253 for ( i = 0; i < len; i++ ) {2254 jquery.find( selector, self[ i ], ret );2255 }2256 // Needed because $( selector, context ) becomes $( context ).find( selector )2257 ret = this.pushStack( len > 1 ? jquery.unique( ret ) : ret );2258 ret.selector = this.selector ? this.selector + " " + selector : selector;2259 return ret;2260 },2261 filter: function( selector ) {2262 return this.pushStack( winnow(this, selector || [], false) );2263 },2264 not: function( selector ) {2265 return this.pushStack( winnow(this, selector || [], true) );2266 },2267 is: function( selector ) {2268 return !!winnow(2269 this,2270 // If this is a positional/relative selector, check membership in the returned set2271 // so $("p:first").is("p:last") won't return true for a doc with two "p".2272 typeof selector === "string" && rneedsContext.test( selector ) ?2273 jquery( selector ) :2274 selector || [],2275 false2276 ).length;2277 }2278});2279// Initialize a jquery object2280// A central reference to the root jquery(document)2281var rootjquery,2282 // Use the correct document accordingly with window argument (sandbox)2283 document = window.document,2284 // A simple way to check for HTML strings2285 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)2286 // Strict HTML recognition (#11290: must start with <)2287 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,2288 init = jquery.fn.init = function( selector, context ) {2289 var match, elem;2290 // HANDLE: $(""), $(null), $(undefined), $(false)2291 if ( !selector ) {2292 return this;2293 }2294 // Handle HTML strings2295 if ( typeof selector === "string" ) {2296 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {2297 // Assume that strings that start and end with <> are HTML and skip the regex check2298 match = [ null, selector, null ];2299 } else {2300 match = rquickExpr.exec( selector );2301 }2302 // Match html or make sure no context is specified for #id2303 if ( match && (match[1] || !context) ) {2304 // HANDLE: $(html) -> $(array)2305 if ( match[1] ) {2306 context = context instanceof jquery ? context[0] : context;2307 // scripts is true for back-compat2308 // Intentionally let the error be thrown if parseHTML is not present2309 jquery.merge( this, jquery.parseHTML(2310 match[1],2311 context && context.nodeType ? context.ownerDocument || context : document,2312 true2313 ) );2314 // HANDLE: $(html, props)2315 if ( rsingleTag.test( match[1] ) && jquery.isPlainObject( context ) ) {2316 for ( match in context ) {2317 // Properties of context are called as methods if possible2318 if ( jquery.isFunction( this[ match ] ) ) {2319 this[ match ]( context[ match ] );2320 // ...and otherwise set as attributes2321 } else {2322 this.attr( match, context[ match ] );2323 }2324 }2325 }2326 return this;2327 // HANDLE: $(#id)2328 } else {2329 elem = document.getElementById( match[2] );2330 // Check parentNode to catch when Blackberry 4.6 returns2331 // nodes that are no longer in the document #69632332 if ( elem && elem.parentNode ) {2333 // Handle the case where IE and Opera return items2334 // by name instead of ID2335 if ( elem.id !== match[2] ) {2336 return rootjquery.find( selector );2337 }2338 // Otherwise, we inject the element directly into the jquery object2339 this.length = 1;2340 this[0] = elem;2341 }2342 this.context = document;2343 this.selector = selector;2344 return this;2345 }2346 // HANDLE: $(expr, $(...))2347 } else if ( !context || context.jquery ) {2348 return ( context || rootjquery ).find( selector );2349 // HANDLE: $(expr, context)2350 // (which is just equivalent to: $(context).find(expr)2351 } else {2352 return this.constructor( context ).find( selector );2353 }2354 // HANDLE: $(DOMElement)2355 } else if ( selector.nodeType ) {2356 this.context = this[0] = selector;2357 this.length = 1;2358 return this;2359 // HANDLE: $(function)2360 // Shortcut for document ready2361 } else if ( jquery.isFunction( selector ) ) {2362 return typeof rootjquery.ready !== "undefined" ?2363 rootjquery.ready( selector ) :2364 // Execute immediately if ready is not present2365 selector( jquery );2366 }2367 if ( selector.selector !== undefined ) {2368 this.selector = selector.selector;2369 this.context = selector.context;2370 }2371 return jquery.makeArray( selector, this );2372 };2373// Give the init function the jquery prototype for later instantiation2374init.prototype = jquery.fn;2375// Initialize central reference2376rootjquery = jquery( document );2377var rparentsprev = /^(?:parents|prev(?:Until|All))/,2378 // methods guaranteed to produce a unique set when starting from a unique set2379 guaranteedUnique = {2380 children: true,2381 contents: true,2382 next: true,2383 prev: true2384 };2385jquery.extend({2386 dir: function( elem, dir, until ) {2387 var matched = [],2388 cur = elem[ dir ];2389 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jquery( cur ).is( until )) ) {2390 if ( cur.nodeType === 1 ) {2391 matched.push( cur );2392 }2393 cur = cur[dir];2394 }2395 return matched;2396 },2397 sibling: function( n, elem ) {2398 var r = [];2399 for ( ; n; n = n.nextSibling ) {2400 if ( n.nodeType === 1 && n !== elem ) {2401 r.push( n );2402 }2403 }2404 return r;2405 }2406});2407jquery.fn.extend({2408 has: function( target ) {2409 var i,2410 targets = jquery( target, this ),2411 len = targets.length;2412 return this.filter(function() {2413 for ( i = 0; i < len; i++ ) {2414 if ( jquery.contains( this, targets[i] ) ) {2415 return true;2416 }2417 }2418 });2419 },2420 closest: function( selectors, context ) {2421 var cur,2422 i = 0,2423 l = this.length,2424 matched = [],2425 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?2426 jquery( selectors, context || this.context ) :2427 0;2428 for ( ; i < l; i++ ) {2429 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {2430 // Always skip document fragments2431 if ( cur.nodeType < 11 && (pos ?2432 pos.index(cur) > -1 :2433 // Don't pass non-elements to Sizzle2434 cur.nodeType === 1 &&2435 jquery.find.matchesSelector(cur, selectors)) ) {2436 matched.push( cur );2437 break;2438 }2439 }2440 }2441 return this.pushStack( matched.length > 1 ? jquery.unique( matched ) : matched );2442 },2443 // Determine the position of an element within2444 // the matched set of elements2445 index: function( elem ) {2446 // No argument, return index in parent2447 if ( !elem ) {2448 return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;2449 }2450 // index in selector2451 if ( typeof elem === "string" ) {2452 return jquery.inArray( this[0], jquery( elem ) );2453 }2454 // Locate the position of the desired element2455 return jquery.inArray(2456 // If it receives a jquery object, the first element is used2457 elem.jquery ? elem[0] : elem, this );2458 },2459 add: function( selector, context ) {2460 return this.pushStack(2461 jquery.unique(2462 jquery.merge( this.get(), jquery( selector, context ) )2463 )2464 );2465 },2466 addBack: function( selector ) {2467 return this.add( selector == null ?2468 this.prevObject : this.prevObject.filter(selector)2469 );2470 }2471});2472function sibling( cur, dir ) {2473 do {2474 cur = cur[ dir ];2475 } while ( cur && cur.nodeType !== 1 );2476 return cur;2477}2478jquery.each({2479 parent: function( elem ) {2480 var parent = elem.parentNode;2481 return parent && parent.nodeType !== 11 ? parent : null;2482 },2483 parents: function( elem ) {2484 return jquery.dir( elem, "parentNode" );2485 },2486 parentsUntil: function( elem, i, until ) {2487 return jquery.dir( elem, "parentNode", until );2488 },2489 next: function( elem ) {2490 return sibling( elem, "nextSibling" );2491 },2492 prev: function( elem ) {2493 return sibling( elem, "previousSibling" );2494 },2495 nextAll: function( elem ) {2496 return jquery.dir( elem, "nextSibling" );2497 },2498 prevAll: function( elem ) {2499 return jquery.dir( elem, "previousSibling" );2500 },2501 nextUntil: function( elem, i, until ) {2502 return jquery.dir( elem, "nextSibling", until );2503 },2504 prevUntil: function( elem, i, until ) {2505 return jquery.dir( elem, "previousSibling", until );2506 },2507 siblings: function( elem ) {2508 return jquery.sibling( ( elem.parentNode || {} ).firstChild, elem );2509 },2510 children: function( elem ) {2511 return jquery.sibling( elem.firstChild );2512 },2513 contents: function( elem ) {2514 return jquery.nodeName( elem, "iframe" ) ?2515 elem.contentDocument || elem.contentWindow.document :2516 jquery.merge( [], elem.childNodes );2517 }2518}, function( name, fn ) {2519 jquery.fn[ name ] = function( until, selector ) {2520 var ret = jquery.map( this, fn, until );2521 if ( name.slice( -5 ) !== "Until" ) {2522 selector = until;2523 }2524 if ( selector && typeof selector === "string" ) {2525 ret = jquery.filter( selector, ret );2526 }2527 if ( this.length > 1 ) {2528 // Remove duplicates2529 if ( !guaranteedUnique[ name ] ) {2530 ret = jquery.unique( ret );2531 }2532 // Reverse order for parents* and prev-derivatives2533 if ( rparentsprev.test( name ) ) {2534 ret = ret.reverse();2535 }2536 }2537 return this.pushStack( ret );2538 };2539});2540var rnotwhite = (/\S+/g);2541// String to Object options format cache2542var optionsCache = {};2543// Convert String-formatted options into Object-formatted ones and store in cache2544function createOptions( options ) {2545 var object = optionsCache[ options ] = {};2546 jquery.each( options.match( rnotwhite ) || [], function( _, flag ) {2547 object[ flag ] = true;2548 });2549 return object;2550}2551/*2552 * Create a callback list using the following parameters:2553 *2554 * options: an optional list of space-separated options that will change how2555 * the callback list behaves or a more traditional option object2556 *2557 * By default a callback list will act like an event callback list and can be2558 * "fired" multiple times.2559 *2560 * Possible options:2561 *2562 * once: will ensure the callback list can only be fired once (like a Deferred)2563 *2564 * memory: will keep track of previous values and will call any callback added2565 * after the list has been fired right away with the latest "memorized"2566 * values (like a Deferred)2567 *2568 * unique: will ensure a callback can only be added once (no duplicate in the list)2569 *2570 * stopOnFalse: interrupt callings when a callback returns false2571 *2572 */2573jquery.Callbacks = function( options ) {2574 // Convert options from String-formatted to Object-formatted if needed2575 // (we check in cache first)2576 options = typeof options === "string" ?2577 ( optionsCache[ options ] || createOptions( options ) ) :2578 jquery.extend( {}, options );2579 var // Flag to know if list is currently firing2580 firing,2581 // Last fire value (for non-forgettable lists)2582 memory,2583 // Flag to know if list was already fired2584 fired,2585 // End of the loop when firing2586 firingLength,2587 // Index of currently firing callback (modified by remove if needed)2588 firingIndex,2589 // First callback to fire (used internally by add and fireWith)2590 firingStart,2591 // Actual callback list2592 list = [],2593 // Stack of fire calls for repeatable lists2594 stack = !options.once && [],2595 // Fire callbacks2596 fire = function( data ) {2597 memory = options.memory && data;2598 fired = true;2599 firingIndex = firingStart || 0;2600 firingStart = 0;2601 firingLength = list.length;2602 firing = true;2603 for ( ; list && firingIndex < firingLength; firingIndex++ ) {2604 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {2605 memory = false; // To prevent further calls using add2606 break;2607 }2608 }2609 firing = false;2610 if ( list ) {2611 if ( stack ) {2612 if ( stack.length ) {2613 fire( stack.shift() );2614 }2615 } else if ( memory ) {2616 list = [];2617 } else {2618 self.disable();2619 }2620 }2621 },2622 // Actual Callbacks object2623 self = {2624 // Add a callback or a collection of callbacks to the list2625 add: function() {2626 if ( list ) {2627 // First, we save the current length2628 var start = list.length;2629 (function add( args ) {2630 jquery.each( args, function( _, arg ) {2631 var type = jquery.type( arg );2632 if ( type === "function" ) {2633 if ( !options.unique || !self.has( arg ) ) {2634 list.push( arg );2635 }2636 } else if ( arg && arg.length && type !== "string" ) {2637 // Inspect recursively2638 add( arg );2639 }2640 });2641 })( arguments );2642 // Do we need to add the callbacks to the2643 // current firing batch?2644 if ( firing ) {2645 firingLength = list.length;2646 // With memory, if we're not firing then2647 // we should call right away2648 } else if ( memory ) {2649 firingStart = start;2650 fire( memory );2651 }2652 }2653 return this;2654 },2655 // Remove a callback from the list2656 remove: function() {2657 if ( list ) {2658 jquery.each( arguments, function( _, arg ) {2659 var index;2660 while ( ( index = jquery.inArray( arg, list, index ) ) > -1 ) {2661 list.splice( index, 1 );2662 // Handle firing indexes2663 if ( firing ) {2664 if ( index <= firingLength ) {2665 firingLength--;2666 }2667 if ( index <= firingIndex ) {2668 firingIndex--;2669 }2670 }2671 }2672 });2673 }2674 return this;2675 },2676 // Check if a given callback is in the list.2677 // If no argument is given, return whether or not list has callbacks attached.2678 has: function( fn ) {2679 return fn ? jquery.inArray( fn, list ) > -1 : !!( list && list.length );2680 },2681 // Remove all callbacks from the list2682 empty: function() {2683 list = [];2684 firingLength = 0;2685 return this;2686 },2687 // Have the list do nothing anymore2688 disable: function() {2689 list = stack = memory = undefined;2690 return this;2691 },2692 // Is it disabled?2693 disabled: function() {2694 return !list;2695 },2696 // Lock the list in its current state2697 lock: function() {2698 stack = undefined;2699 if ( !memory ) {2700 self.disable();2701 }2702 return this;2703 },2704 // Is it locked?2705 locked: function() {2706 return !stack;2707 },2708 // Call all callbacks with the given context and arguments2709 fireWith: function( context, args ) {2710 if ( list && ( !fired || stack ) ) {2711 args = args || [];2712 args = [ context, args.slice ? args.slice() : args ];2713 if ( firing ) {2714 stack.push( args );2715 } else {2716 fire( args );2717 }2718 }2719 return this;2720 },2721 // Call all the callbacks with the given arguments2722 fire: function() {2723 self.fireWith( this, arguments );2724 return this;2725 },2726 // To know if the callbacks have already been called at least once2727 fired: function() {2728 return !!fired;2729 }2730 };2731 return self;2732};2733jquery.extend({2734 Deferred: function( func ) {2735 var tuples = [2736 // action, add listener, listener list, final state2737 [ "resolve", "done", jquery.Callbacks("once memory"), "resolved" ],2738 [ "reject", "fail", jquery.Callbacks("once memory"), "rejected" ],2739 [ "notify", "progress", jquery.Callbacks("memory") ]2740 ],2741 state = "pending",2742 promise = {2743 state: function() {2744 return state;2745 },2746 always: function() {2747 deferred.done( arguments ).fail( arguments );2748 return this;2749 },2750 then: function( /* fnDone, fnFail, fnProgress */ ) {2751 var fns = arguments;2752 return jquery.Deferred(function( newDefer ) {2753 jquery.each( tuples, function( i, tuple ) {2754 var fn = jquery.isFunction( fns[ i ] ) && fns[ i ];2755 // deferred[ done | fail | progress ] for forwarding actions to newDefer2756 deferred[ tuple[1] ](function() {2757 var returned = fn && fn.apply( this, arguments );2758 if ( returned && jquery.isFunction( returned.promise ) ) {2759 returned.promise()2760 .done( newDefer.resolve )2761 .fail( newDefer.reject )2762 .progress( newDefer.notify );2763 } else {2764 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );2765 }2766 });2767 });2768 fns = null;2769 }).promise();2770 },2771 // Get a promise for this deferred2772 // If obj is provided, the promise aspect is added to the object2773 promise: function( obj ) {2774 return obj != null ? jquery.extend( obj, promise ) : promise;2775 }2776 },2777 deferred = {};2778 // Keep pipe for back-compat2779 promise.pipe = promise.then;2780 // Add list-specific methods2781 jquery.each( tuples, function( i, tuple ) {2782 var list = tuple[ 2 ],2783 stateString = tuple[ 3 ];2784 // promise[ done | fail | progress ] = list.add2785 promise[ tuple[1] ] = list.add;2786 // Handle state2787 if ( stateString ) {2788 list.add(function() {2789 // state = [ resolved | rejected ]2790 state = stateString;2791 // [ reject_list | resolve_list ].disable; progress_list.lock2792 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );2793 }2794 // deferred[ resolve | reject | notify ]2795 deferred[ tuple[0] ] = function() {2796 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );2797 return this;2798 };2799 deferred[ tuple[0] + "With" ] = list.fireWith;2800 });2801 // Make the deferred a promise2802 promise.promise( deferred );2803 // Call given func if any2804 if ( func ) {2805 func.call( deferred, deferred );2806 }2807 // All done!2808 return deferred;2809 },2810 // Deferred helper2811 when: function( subordinate /* , ..., subordinateN */ ) {2812 var i = 0,2813 resolveValues = slice.call( arguments ),2814 length = resolveValues.length,2815 // the count of uncompleted subordinates2816 remaining = length !== 1 || ( subordinate && jquery.isFunction( subordinate.promise ) ) ? length : 0,2817 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.2818 deferred = remaining === 1 ? subordinate : jquery.Deferred(),2819 // Update function for both resolve and progress values2820 updateFunc = function( i, contexts, values ) {2821 return function( value ) {2822 contexts[ i ] = this;2823 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;2824 if ( values === progressValues ) {2825 deferred.notifyWith( contexts, values );2826 } else if ( !(--remaining) ) {2827 deferred.resolveWith( contexts, values );2828 }2829 };2830 },2831 progressValues, progressContexts, resolveContexts;2832 // add listeners to Deferred subordinates; treat others as resolved2833 if ( length > 1 ) {2834 progressValues = new Array( length );2835 progressContexts = new Array( length );2836 resolveContexts = new Array( length );2837 for ( ; i < length; i++ ) {2838 if ( resolveValues[ i ] && jquery.isFunction( resolveValues[ i ].promise ) ) {2839 resolveValues[ i ].promise()2840 .done( updateFunc( i, resolveContexts, resolveValues ) )2841 .fail( deferred.reject )2842 .progress( updateFunc( i, progressContexts, progressValues ) );2843 } else {2844 --remaining;2845 }2846 }2847 }2848 // if we're not waiting on anything, resolve the master2849 if ( !remaining ) {2850 deferred.resolveWith( resolveContexts, resolveValues );2851 }2852 return deferred.promise();2853 }2854});2855// The deferred used on DOM ready2856var readyList;2857jquery.fn.ready = function( fn ) {2858 // Add the callback2859 jquery.ready.promise().done( fn );2860 return this;2861};2862jquery.extend({2863 // Is the DOM ready to be used? Set to true once it occurs.2864 isReady: false,2865 // A counter to track how many items to wait for before2866 // the ready event fires. See #67812867 readyWait: 1,2868 // Hold (or release) the ready event2869 holdReady: function( hold ) {2870 if ( hold ) {2871 jquery.readyWait++;2872 } else {2873 jquery.ready( true );2874 }2875 },2876 // Handle when the DOM is ready2877 ready: function( wait ) {2878 // Abort if there are pending holds or we're already ready2879 if ( wait === true ? --jquery.readyWait : jquery.isReady ) {2880 return;2881 }2882 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).2883 if ( !document.body ) {2884 return setTimeout( jquery.ready );2885 }2886 // Remember that the DOM is ready2887 jquery.isReady = true;2888 // If a normal DOM Ready event fired, decrement, and wait if need be2889 if ( wait !== true && --jquery.readyWait > 0 ) {2890 return;2891 }2892 // If there are functions bound, to execute2893 readyList.resolveWith( document, [ jquery ] );2894 // Trigger any bound ready events2895 if ( jquery.fn.trigger ) {2896 jquery( document ).trigger("ready").off("ready");2897 }2898 }2899});2900/**2901 * Clean-up method for dom ready events2902 */2903function detach() {2904 if ( document.addEventListener ) {2905 document.removeEventListener( "DOMContentLoaded", completed, false );2906 window.removeEventListener( "load", completed, false );2907 } else {2908 document.detachEvent( "onreadystatechange", completed );2909 window.detachEvent( "onload", completed );2910 }2911}2912/**2913 * The ready event handler and self cleanup method2914 */2915function completed() {2916 // readyState === "complete" is good enough for us to call the dom ready in oldIE2917 if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {2918 detach();2919 jquery.ready();2920 }2921}2922jquery.ready.promise = function( obj ) {2923 if ( !readyList ) {2924 readyList = jquery.Deferred();2925 // Catch cases where $(document).ready() is called after the browser event has already occurred.2926 // we once tried to use readyState "interactive" here, but it caused issues like the one2927 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:152928 if ( document.readyState === "complete" ) {2929 // Handle it asynchronously to allow scripts the opportunity to delay ready2930 setTimeout( jquery.ready );2931 // Standards-based browsers support DOMContentLoaded2932 } else if ( document.addEventListener ) {2933 // Use the handy event callback2934 document.addEventListener( "DOMContentLoaded", completed, false );2935 // A fallback to window.onload, that will always work2936 window.addEventListener( "load", completed, false );2937 // If IE event model is used2938 } else {2939 // Ensure firing before onload, maybe late but safe also for iframes2940 document.attachEvent( "onreadystatechange", completed );2941 // A fallback to window.onload, that will always work2942 window.attachEvent( "onload", completed );2943 // If IE and not a frame2944 // continually check to see if the document is ready2945 var top = false;2946 try {2947 top = window.frameElement == null && document.documentElement;2948 } catch(e) {}2949 if ( top && top.doScroll ) {2950 (function doScrollCheck() {2951 if ( !jquery.isReady ) {2952 try {2953 // Use the trick by Diego Perini2954 // http://javascript.nwbox.com/IEContentLoaded/2955 top.doScroll("left");2956 } catch(e) {2957 return setTimeout( doScrollCheck, 50 );2958 }2959 // detach all dom ready events2960 detach();2961 // and execute any waiting functions2962 jquery.ready();2963 }2964 })();2965 }2966 }2967 }2968 return readyList.promise( obj );2969};2970var strundefined = typeof undefined;2971// Support: IE<92972// Iteration over object's inherited properties before its own2973var i;2974for ( i in jquery( support ) ) {2975 break;2976}2977support.ownLast = i !== "0";2978// Note: most support tests are defined in their respective modules.2979// false until the test is run2980support.inlineBlockNeedsLayout = false;2981jquery(function() {2982 // We need to execute this one support test ASAP because we need to know2983 // if body.style.zoom needs to be set.2984 var container, div,2985 body = document.getElementsByTagName("body")[0];2986 if ( !body ) {2987 // Return for frameset docs that don't have a body2988 return;2989 }2990 // Setup2991 container = document.createElement( "div" );2992 container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";2993 div = document.createElement( "div" );2994 body.appendChild( container ).appendChild( div );2995 if ( typeof div.style.zoom !== strundefined ) {2996 // Support: IE<82997 // Check if natively block-level elements act like inline-block2998 // elements when setting their display to 'inline' and giving2999 // them layout3000 div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1";3001 if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) {3002 // Prevent IE 6 from affecting layout for positioned elements #110483003 // Prevent IE from shrinking the body in IE 7 mode #128693004 // Support: IE<83005 body.style.zoom = 1;3006 }3007 }3008 body.removeChild( container );3009 // Null elements to avoid leaks in IE3010 container = div = null;3011});3012(function() {3013 var div = document.createElement( "div" );3014 // Execute the test only if not already executed in another module.3015 if (support.deleteExpando == null) {3016 // Support: IE<93017 support.deleteExpando = true;3018 try {3019 delete div.test;3020 } catch( e ) {3021 support.deleteExpando = false;3022 }3023 }3024 // Null elements to avoid leaks in IE.3025 div = null;3026})();3027/**3028 * Determines whether an object can have data3029 */3030jquery.acceptData = function( elem ) {3031 var noData = jquery.noData[ (elem.nodeName + " ").toLowerCase() ],3032 nodeType = +elem.nodeType || 1;3033 // Do not set data on non-element DOM nodes because it will not be cleared (#8335).3034 return nodeType !== 1 && nodeType !== 9 ?3035 false :3036 // Nodes accept data unless otherwise specified; rejection can be conditional3037 !noData || noData !== true && elem.getAttribute("classid") === noData;3038};3039var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,3040 rmultiDash = /([A-Z])/g;3041function dataAttr( elem, key, data ) {3042 // If nothing was found internally, try to fetch any3043 // data from the HTML5 data-* attribute3044 if ( data === undefined && elem.nodeType === 1 ) {3045 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();3046 data = elem.getAttribute( name );3047 if ( typeof data === "string" ) {3048 try {3049 data = data === "true" ? true :3050 data === "false" ? false :3051 data === "null" ? null :3052 // Only convert to a number if it doesn't change the string3053 +data + "" === data ? +data :3054 rbrace.test( data ) ? jquery.parseJSON( data ) :3055 data;3056 } catch( e ) {}3057 // Make sure we set the data so it isn't changed later3058 jquery.data( elem, key, data );3059 } else {3060 data = undefined;3061 }3062 }3063 return data;3064}3065// checks a cache object for emptiness3066function isEmptyDataObject( obj ) {3067 var name;3068 for ( name in obj ) {3069 // if the public data object is empty, the private is still empty3070 if ( name === "data" && jquery.isEmptyObject( obj[name] ) ) {3071 continue;3072 }3073 if ( name !== "toJSON" ) {3074 return false;3075 }3076 }3077 return true;3078}3079function internalData( elem, name, data, pvt /* Internal Use Only */ ) {3080 if ( !jquery.acceptData( elem ) ) {3081 return;3082 }3083 var ret, thisCache,3084 internalKey = jquery.expando,3085 // We have to handle DOM nodes and JS objects differently because IE6-73086 // can't GC object references properly across the DOM-JS boundary3087 isNode = elem.nodeType,3088 // Only DOM nodes need the global jquery cache; JS object data is3089 // attached directly to the object so GC can occur automatically3090 cache = isNode ? jquery.cache : elem,3091 // Only defining an ID for JS objects if its cache already exists allows3092 // the code to shortcut on the same path as a DOM node with no cache3093 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;3094 // Avoid doing any more work than we need to when trying to get data on an3095 // object that has no data at all3096 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {3097 return;3098 }3099 if ( !id ) {3100 // Only DOM nodes need a new unique ID for each element since their data3101 // ends up in the global cache3102 if ( isNode ) {3103 id = elem[ internalKey ] = deletedIds.pop() || jquery.guid++;3104 } else {3105 id = internalKey;3106 }3107 }3108 if ( !cache[ id ] ) {3109 // Avoid exposing jquery metadata on plain JS objects when the object3110 // is serialized using JSON.stringify3111 cache[ id ] = isNode ? {} : { toJSON: jquery.noop };3112 }3113 // An object can be passed to jquery.data instead of a key/value pair; this gets3114 // shallow copied over onto the existing cache3115 if ( typeof name === "object" || typeof name === "function" ) {3116 if ( pvt ) {3117 cache[ id ] = jquery.extend( cache[ id ], name );3118 } else {3119 cache[ id ].data = jquery.extend( cache[ id ].data, name );3120 }3121 }3122 thisCache = cache[ id ];3123 // jquery data() is stored in a separate object inside the object's internal data3124 // cache in order to avoid key collisions between internal data and user-defined3125 // data.3126 if ( !pvt ) {3127 if ( !thisCache.data ) {3128 thisCache.data = {};3129 }3130 thisCache = thisCache.data;3131 }3132 if ( data !== undefined ) {3133 thisCache[ jquery.camelCase( name ) ] = data;3134 }3135 // Check for both converted-to-camel and non-converted data property names3136 // If a data property was specified3137 if ( typeof name === "string" ) {3138 // First Try to find as-is property data3139 ret = thisCache[ name ];3140 // Test for null|undefined property data3141 if ( ret == null ) {3142 // Try to find the camelCased property3143 ret = thisCache[ jquery.camelCase( name ) ];3144 }3145 } else {3146 ret = thisCache;3147 }3148 return ret;3149}3150function internalRemoveData( elem, name, pvt ) {3151 if ( !jquery.acceptData( elem ) ) {3152 return;3153 }3154 var thisCache, i,3155 isNode = elem.nodeType,3156 // See jquery.data for more information3157 cache = isNode ? jquery.cache : elem,3158 id = isNode ? elem[ jquery.expando ] : jquery.expando;3159 // If there is already no cache entry for this object, there is no3160 // purpose in continuing3161 if ( !cache[ id ] ) {3162 return;3163 }3164 if ( name ) {3165 thisCache = pvt ? cache[ id ] : cache[ id ].data;3166 if ( thisCache ) {3167 // Support array or space separated string names for data keys3168 if ( !jquery.isArray( name ) ) {3169 // try the string as a key before any manipulation3170 if ( name in thisCache ) {3171 name = [ name ];3172 } else {3173 // split the camel cased version by spaces unless a key with the spaces exists3174 name = jquery.camelCase( name );3175 if ( name in thisCache ) {3176 name = [ name ];3177 } else {3178 name = name.split(" ");3179 }3180 }3181 } else {3182 // If "name" is an array of keys...3183 // When data is initially created, via ("key", "val") signature,3184 // keys will be converted to camelCase.3185 // Since there is no way to tell _how_ a key was added, remove3186 // both plain key and camelCase key. #127863187 // This will only penalize the array argument path.3188 name = name.concat( jquery.map( name, jquery.camelCase ) );3189 }3190 i = name.length;3191 while ( i-- ) {3192 delete thisCache[ name[i] ];3193 }3194 // If there is no data left in the cache, we want to continue3195 // and let the cache object itself get destroyed3196 if ( pvt ? !isEmptyDataObject(thisCache) : !jquery.isEmptyObject(thisCache) ) {3197 return;3198 }3199 }3200 }3201 // See jquery.data for more information3202 if ( !pvt ) {3203 delete cache[ id ].data;3204 // Don't destroy the parent cache unless the internal data object3205 // had been the only thing left in it3206 if ( !isEmptyDataObject( cache[ id ] ) ) {3207 return;3208 }3209 }3210 // Destroy the cache3211 if ( isNode ) {3212 jquery.cleanData( [ elem ], true );3213 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)3214 /* jshint eqeqeq: false */3215 } else if ( support.deleteExpando || cache != cache.window ) {3216 /* jshint eqeqeq: true */3217 delete cache[ id ];3218 // When all else fails, null3219 } else {3220 cache[ id ] = null;3221 }3222}3223jquery.extend({3224 cache: {},3225 // The following elements (space-suffixed to avoid Object.prototype collisions)3226 // throw uncatchable exceptions if you attempt to set expando properties3227 noData: {3228 "applet ": true,3229 "embed ": true,3230 // ...but Flash objects (which have this classid) *can* handle expandos3231 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"3232 },3233 hasData: function( elem ) {3234 elem = elem.nodeType ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];3235 return !!elem && !isEmptyDataObject( elem );3236 },3237 data: function( elem, name, data ) {3238 return internalData( elem, name, data );3239 },3240 removeData: function( elem, name ) {3241 return internalRemoveData( elem, name );3242 },3243 // For internal use only.3244 _data: function( elem, name, data ) {3245 return internalData( elem, name, data, true );3246 },3247 _removeData: function( elem, name ) {3248 return internalRemoveData( elem, name, true );3249 }3250});3251jquery.fn.extend({3252 data: function( key, value ) {3253 var i, name, data,3254 elem = this[0],3255 attrs = elem && elem.attributes;3256 // Special expections of .data basically thwart jquery.access,3257 // so implement the relevant behavior ourselves3258 // Gets all values3259 if ( key === undefined ) {3260 if ( this.length ) {3261 data = jquery.data( elem );3262 if ( elem.nodeType === 1 && !jquery._data( elem, "parsedAttrs" ) ) {3263 i = attrs.length;3264 while ( i-- ) {3265 name = attrs[i].name;3266 if ( name.indexOf("data-") === 0 ) {3267 name = jquery.camelCase( name.slice(5) );3268 dataAttr( elem, name, data[ name ] );3269 }3270 }3271 jquery._data( elem, "parsedAttrs", true );3272 }3273 }3274 return data;3275 }3276 // Sets multiple values3277 if ( typeof key === "object" ) {3278 return this.each(function() {3279 jquery.data( this, key );3280 });3281 }3282 return arguments.length > 1 ?3283 // Sets one value3284 this.each(function() {3285 jquery.data( this, key, value );3286 }) :3287 // Gets one value3288 // Try to fetch any internally stored data first3289 elem ? dataAttr( elem, key, jquery.data( elem, key ) ) : undefined;3290 },3291 removeData: function( key ) {3292 return this.each(function() {3293 jquery.removeData( this, key );3294 });3295 }3296});3297jquery.extend({3298 queue: function( elem, type, data ) {3299 var queue;3300 if ( elem ) {3301 type = ( type || "fx" ) + "queue";3302 queue = jquery._data( elem, type );3303 // Speed up dequeue by getting out quickly if this is just a lookup3304 if ( data ) {3305 if ( !queue || jquery.isArray(data) ) {3306 queue = jquery._data( elem, type, jquery.makeArray(data) );3307 } else {3308 queue.push( data );3309 }3310 }3311 return queue || [];3312 }3313 },3314 dequeue: function( elem, type ) {3315 type = type || "fx";3316 var queue = jquery.queue( elem, type ),3317 startLength = queue.length,3318 fn = queue.shift(),3319 hooks = jquery._queueHooks( elem, type ),3320 next = function() {3321 jquery.dequeue( elem, type );3322 };3323 // If the fx queue is dequeued, always remove the progress sentinel3324 if ( fn === "inprogress" ) {3325 fn = queue.shift();3326 startLength--;3327 }3328 if ( fn ) {3329 // Add a progress sentinel to prevent the fx queue from being3330 // automatically dequeued3331 if ( type === "fx" ) {3332 queue.unshift( "inprogress" );3333 }3334 // clear up the last queue stop function3335 delete hooks.stop;3336 fn.call( elem, next, hooks );3337 }3338 if ( !startLength && hooks ) {3339 hooks.empty.fire();3340 }3341 },3342 // not intended for public consumption - generates a queueHooks object, or returns the current one3343 _queueHooks: function( elem, type ) {3344 var key = type + "queueHooks";3345 return jquery._data( elem, key ) || jquery._data( elem, key, {3346 empty: jquery.Callbacks("once memory").add(function() {3347 jquery._removeData( elem, type + "queue" );3348 jquery._removeData( elem, key );3349 })3350 });3351 }3352});3353jquery.fn.extend({3354 queue: function( type, data ) {3355 var setter = 2;3356 if ( typeof type !== "string" ) {3357 data = type;3358 type = "fx";3359 setter--;3360 }3361 if ( arguments.length < setter ) {3362 return jquery.queue( this[0], type );3363 }3364 return data === undefined ?3365 this :3366 this.each(function() {3367 var queue = jquery.queue( this, type, data );3368 // ensure a hooks for this queue3369 jquery._queueHooks( this, type );3370 if ( type === "fx" && queue[0] !== "inprogress" ) {3371 jquery.dequeue( this, type );3372 }3373 });3374 },3375 dequeue: function( type ) {3376 return this.each(function() {3377 jquery.dequeue( this, type );3378 });3379 },3380 clearQueue: function( type ) {3381 return this.queue( type || "fx", [] );3382 },3383 // Get a promise resolved when queues of a certain type3384 // are emptied (fx is the type by default)3385 promise: function( type, obj ) {3386 var tmp,3387 count = 1,3388 defer = jquery.Deferred(),3389 elements = this,3390 i = this.length,3391 resolve = function() {3392 if ( !( --count ) ) {3393 defer.resolveWith( elements, [ elements ] );3394 }3395 };3396 if ( typeof type !== "string" ) {3397 obj = type;3398 type = undefined;3399 }3400 type = type || "fx";3401 while ( i-- ) {3402 tmp = jquery._data( elements[ i ], type + "queueHooks" );3403 if ( tmp && tmp.empty ) {3404 count++;3405 tmp.empty.add( resolve );3406 }3407 }3408 resolve();3409 return defer.promise( obj );3410 }3411});3412var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;3413var cssExpand = [ "Top", "Right", "Bottom", "Left" ];3414var isHidden = function( elem, el ) {3415 // isHidden might be called from jquery#filter function;3416 // in that case, element will be second argument3417 elem = el || elem;3418 return jquery.css( elem, "display" ) === "none" || !jquery.contains( elem.ownerDocument, elem );3419 };3420// Multifunctional method to get and set values of a collection3421// The value/s can optionally be executed if it's a function3422var access = jquery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {3423 var i = 0,3424 length = elems.length,3425 bulk = key == null;3426 // Sets many values3427 if ( jquery.type( key ) === "object" ) {3428 chainable = true;3429 for ( i in key ) {3430 jquery.access( elems, fn, i, key[i], true, emptyGet, raw );3431 }3432 // Sets one value3433 } else if ( value !== undefined ) {3434 chainable = true;3435 if ( !jquery.isFunction( value ) ) {3436 raw = true;3437 }3438 if ( bulk ) {3439 // Bulk operations run against the entire set3440 if ( raw ) {3441 fn.call( elems, value );3442 fn = null;3443 // ...except when executing function values3444 } else {3445 bulk = fn;3446 fn = function( elem, key, value ) {3447 return bulk.call( jquery( elem ), value );3448 };3449 }3450 }3451 if ( fn ) {3452 for ( ; i < length; i++ ) {3453 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );3454 }3455 }3456 }3457 return chainable ?3458 elems :3459 // Gets3460 bulk ?3461 fn.call( elems ) :3462 length ? fn( elems[0], key ) : emptyGet;3463};3464var rcheckableType = (/^(?:checkbox|radio)$/i);3465(function() {3466 var fragment = document.createDocumentFragment(),3467 div = document.createElement("div"),3468 input = document.createElement("input");3469 // Setup3470 div.setAttribute( "className", "t" );3471 div.innerHTML = " <link/><table></table><a href='/a'>a</a>";3472 // IE strips leading whitespace when .innerHTML is used3473 support.leadingWhitespace = div.firstChild.nodeType === 3;3474 // Make sure that tbody elements aren't automatically inserted3475 // IE will insert them into empty tables3476 support.tbody = !div.getElementsByTagName( "tbody" ).length;3477 // Make sure that link elements get serialized correctly by innerHTML3478 // This requires a wrapper element in IE3479 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;3480 // Makes sure cloning an html5 element does not cause problems3481 // Where outerHTML is undefined, this still works3482 support.html5Clone =3483 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";3484 // Check if a disconnected checkbox will retain its checked3485 // value of true after appended to the DOM (IE6/7)3486 input.type = "checkbox";3487 input.checked = true;3488 fragment.appendChild( input );3489 support.appendChecked = input.checked;3490 // Make sure textarea (and checkbox) defaultValue is properly cloned3491 // Support: IE6-IE11+3492 div.innerHTML = "<textarea>x</textarea>";3493 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;3494 // #11217 - WebKit loses check when the name is after the checked attribute3495 fragment.appendChild( div );3496 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";3497 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.33498 // old WebKit doesn't clone checked state correctly in fragments3499 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;3500 // Support: IE<93501 // Opera does not clone events (and typeof div.attachEvent === undefined).3502 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()3503 support.noCloneEvent = true;3504 if ( div.attachEvent ) {3505 div.attachEvent( "onclick", function() {3506 support.noCloneEvent = false;3507 });3508 div.cloneNode( true ).click();3509 }3510 // Execute the test only if not already executed in another module.3511 if (support.deleteExpando == null) {3512 // Support: IE<93513 support.deleteExpando = true;3514 try {3515 delete div.test;3516 } catch( e ) {3517 support.deleteExpando = false;3518 }3519 }3520 // Null elements to avoid leaks in IE.3521 fragment = div = input = null;3522})();3523(function() {3524 var i, eventName,3525 div = document.createElement( "div" );3526 // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)3527 for ( i in { submit: true, change: true, focusin: true }) {3528 eventName = "on" + i;3529 if ( !(support[ i + "Bubbles" ] = eventName in window) ) {3530 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)3531 div.setAttribute( eventName, "t" );3532 support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false;3533 }3534 }3535 // Null elements to avoid leaks in IE.3536 div = null;3537})();3538var rformElems = /^(?:input|select|textarea)$/i,3539 rkeyEvent = /^key/,3540 rmouseEvent = /^(?:mouse|contextmenu)|click/,3541 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,3542 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;3543function returnTrue() {3544 return true;3545}3546function returnFalse() {3547 return false;3548}3549function safeActiveElement() {3550 try {3551 return document.activeElement;3552 } catch ( err ) { }3553}3554/*3555 * Helper functions for managing events -- not part of the public interface.3556 * Props to Dean Edwards' addEvent library for many of the ideas.3557 */3558jquery.event = {3559 global: {},3560 add: function( elem, types, handler, data, selector ) {3561 var tmp, events, t, handleObjIn,3562 special, eventHandle, handleObj,3563 handlers, type, namespaces, origType,3564 elemData = jquery._data( elem );3565 // Don't attach events to noData or text/comment nodes (but allow plain objects)3566 if ( !elemData ) {3567 return;3568 }3569 // Caller can pass in an object of custom data in lieu of the handler3570 if ( handler.handler ) {3571 handleObjIn = handler;3572 handler = handleObjIn.handler;3573 selector = handleObjIn.selector;3574 }3575 // Make sure that the handler has a unique ID, used to find/remove it later3576 if ( !handler.guid ) {3577 handler.guid = jquery.guid++;3578 }3579 // Init the element's event structure and main handler, if this is the first3580 if ( !(events = elemData.events) ) {3581 events = elemData.events = {};3582 }3583 if ( !(eventHandle = elemData.handle) ) {3584 eventHandle = elemData.handle = function( e ) {3585 // Discard the second event of a jquery.event.trigger() and3586 // when an event is called after a page has unloaded3587 return typeof jquery !== strundefined && (!e || jquery.event.triggered !== e.type) ?3588 jquery.event.dispatch.apply( eventHandle.elem, arguments ) :3589 undefined;3590 };3591 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events3592 eventHandle.elem = elem;3593 }3594 // Handle multiple events separated by a space3595 types = ( types || "" ).match( rnotwhite ) || [ "" ];3596 t = types.length;3597 while ( t-- ) {3598 tmp = rtypenamespace.exec( types[t] ) || [];3599 type = origType = tmp[1];3600 namespaces = ( tmp[2] || "" ).split( "." ).sort();3601 // There *must* be a type, no attaching namespace-only handlers3602 if ( !type ) {3603 continue;3604 }3605 // If event changes its type, use the special event handlers for the changed type3606 special = jquery.event.special[ type ] || {};3607 // If selector defined, determine special event api type, otherwise given type3608 type = ( selector ? special.delegateType : special.bindType ) || type;3609 // Update special based on newly reset type3610 special = jquery.event.special[ type ] || {};3611 // handleObj is passed to all event handlers3612 handleObj = jquery.extend({3613 type: type,3614 origType: origType,3615 data: data,3616 handler: handler,3617 guid: handler.guid,3618 selector: selector,3619 needsContext: selector && jquery.expr.match.needsContext.test( selector ),3620 namespace: namespaces.join(".")3621 }, handleObjIn );3622 // Init the event handler queue if we're the first3623 if ( !(handlers = events[ type ]) ) {3624 handlers = events[ type ] = [];3625 handlers.delegateCount = 0;3626 // Only use addEventListener/attachEvent if the special events handler returns false3627 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {3628 // Bind the global event handler to the element3629 if ( elem.addEventListener ) {3630 elem.addEventListener( type, eventHandle, false );3631 } else if ( elem.attachEvent ) {3632 elem.attachEvent( "on" + type, eventHandle );3633 }3634 }3635 }3636 if ( special.add ) {3637 special.add.call( elem, handleObj );3638 if ( !handleObj.handler.guid ) {3639 handleObj.handler.guid = handler.guid;3640 }3641 }3642 // Add to the element's handler list, delegates in front3643 if ( selector ) {3644 handlers.splice( handlers.delegateCount++, 0, handleObj );3645 } else {3646 handlers.push( handleObj );3647 }3648 // Keep track of which events have ever been used, for event optimization3649 jquery.event.global[ type ] = true;3650 }3651 // Nullify elem to prevent memory leaks in IE3652 elem = null;3653 },3654 // Detach an event or set of events from an element3655 remove: function( elem, types, handler, selector, mappedTypes ) {3656 var j, handleObj, tmp,3657 origCount, t, events,3658 special, handlers, type,3659 namespaces, origType,3660 elemData = jquery.hasData( elem ) && jquery._data( elem );3661 if ( !elemData || !(events = elemData.events) ) {3662 return;3663 }3664 // Once for each type.namespace in types; type may be omitted3665 types = ( types || "" ).match( rnotwhite ) || [ "" ];3666 t = types.length;3667 while ( t-- ) {3668 tmp = rtypenamespace.exec( types[t] ) || [];3669 type = origType = tmp[1];3670 namespaces = ( tmp[2] || "" ).split( "." ).sort();3671 // Unbind all events (on this namespace, if provided) for the element3672 if ( !type ) {3673 for ( type in events ) {3674 jquery.event.remove( elem, type + types[ t ], handler, selector, true );3675 }3676 continue;3677 }3678 special = jquery.event.special[ type ] || {};3679 type = ( selector ? special.delegateType : special.bindType ) || type;3680 handlers = events[ type ] || [];3681 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );3682 // Remove matching events3683 origCount = j = handlers.length;3684 while ( j-- ) {3685 handleObj = handlers[ j ];3686 if ( ( mappedTypes || origType === handleObj.origType ) &&3687 ( !handler || handler.guid === handleObj.guid ) &&3688 ( !tmp || tmp.test( handleObj.namespace ) ) &&3689 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {3690 handlers.splice( j, 1 );3691 if ( handleObj.selector ) {3692 handlers.delegateCount--;3693 }3694 if ( special.remove ) {3695 special.remove.call( elem, handleObj );3696 }3697 }3698 }3699 // Remove generic event handler if we removed something and no more handlers exist3700 // (avoids potential for endless recursion during removal of special event handlers)3701 if ( origCount && !handlers.length ) {3702 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {3703 jquery.removeEvent( elem, type, elemData.handle );3704 }3705 delete events[ type ];3706 }3707 }3708 // Remove the expando if it's no longer used3709 if ( jquery.isEmptyObject( events ) ) {3710 delete elemData.handle;3711 // removeData also checks for emptiness and clears the expando if empty3712 // so use it instead of delete3713 jquery._removeData( elem, "events" );3714 }3715 },3716 trigger: function( event, data, elem, onlyHandlers ) {3717 var handle, ontype, cur,3718 bubbleType, special, tmp, i,3719 eventPath = [ elem || document ],3720 type = hasOwn.call( event, "type" ) ? event.type : event,3721 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];3722 cur = tmp = elem = elem || document;3723 // Don't do events on text and comment nodes3724 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {3725 return;3726 }3727 // focus/blur morphs to focusin/out; ensure we're not firing them right now3728 if ( rfocusMorph.test( type + jquery.event.triggered ) ) {3729 return;3730 }3731 if ( type.indexOf(".") >= 0 ) {3732 // Namespaced trigger; create a regexp to match event type in handle()3733 namespaces = type.split(".");3734 type = namespaces.shift();3735 namespaces.sort();3736 }3737 ontype = type.indexOf(":") < 0 && "on" + type;3738 // Caller can pass in a jquery.Event object, Object, or just an event type string3739 event = event[ jquery.expando ] ?3740 event :3741 new jquery.Event( type, typeof event === "object" && event );3742 // Trigger bitmask: & 1 for native handlers; & 2 for jquery (always true)3743 event.isTrigger = onlyHandlers ? 2 : 3;3744 event.namespace = namespaces.join(".");3745 event.namespace_re = event.namespace ?3746 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :3747 null;3748 // Clean up the event in case it is being reused3749 event.result = undefined;3750 if ( !event.target ) {3751 event.target = elem;3752 }3753 // Clone any incoming data and prepend the event, creating the handler arg list3754 data = data == null ?3755 [ event ] :3756 jquery.makeArray( data, [ event ] );3757 // Allow special events to draw outside the lines3758 special = jquery.event.special[ type ] || {};3759 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {3760 return;3761 }3762 // Determine event propagation path in advance, per W3C events spec (#9951)3763 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)3764 if ( !onlyHandlers && !special.noBubble && !jquery.isWindow( elem ) ) {3765 bubbleType = special.delegateType || type;3766 if ( !rfocusMorph.test( bubbleType + type ) ) {3767 cur = cur.parentNode;3768 }3769 for ( ; cur; cur = cur.parentNode ) {3770 eventPath.push( cur );3771 tmp = cur;3772 }3773 // Only add window if we got to document (e.g., not plain obj or detached DOM)3774 if ( tmp === (elem.ownerDocument || document) ) {3775 eventPath.push( tmp.defaultView || tmp.parentWindow || window );3776 }3777 }3778 // Fire handlers on the event path3779 i = 0;3780 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {3781 event.type = i > 1 ?3782 bubbleType :3783 special.bindType || type;3784 // jquery handler3785 handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" );3786 if ( handle ) {3787 handle.apply( cur, data );3788 }3789 // Native handler3790 handle = ontype && cur[ ontype ];3791 if ( handle && handle.apply && jquery.acceptData( cur ) ) {3792 event.result = handle.apply( cur, data );3793 if ( event.result === false ) {3794 event.preventDefault();3795 }3796 }3797 }3798 event.type = type;3799 // If nobody prevented the default action, do it now3800 if ( !onlyHandlers && !event.isDefaultPrevented() ) {3801 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&3802 jquery.acceptData( elem ) ) {3803 // Call a native DOM method on the target with the same name name as the event.3804 // Can't use an .isFunction() check here because IE6/7 fails that test.3805 // Don't do default actions on window, that's where global variables be (#6170)3806 if ( ontype && elem[ type ] && !jquery.isWindow( elem ) ) {3807 // Don't re-trigger an onFOO event when we call its FOO() method3808 tmp = elem[ ontype ];3809 if ( tmp ) {3810 elem[ ontype ] = null;3811 }3812 // Prevent re-triggering of the same event, since we already bubbled it above3813 jquery.event.triggered = type;3814 try {3815 elem[ type ]();3816 } catch ( e ) {3817 // IE<9 dies on focus/blur to hidden element (#1486,#12518)3818 // only reproducible on winXP IE8 native, not IE9 in IE8 mode3819 }3820 jquery.event.triggered = undefined;3821 if ( tmp ) {3822 elem[ ontype ] = tmp;3823 }3824 }3825 }3826 }3827 return event.result;3828 },3829 dispatch: function( event ) {3830 // Make a writable jquery.Event from the native event object3831 event = jquery.event.fix( event );3832 var i, ret, handleObj, matched, j,3833 handlerQueue = [],3834 args = slice.call( arguments ),3835 handlers = ( jquery._data( this, "events" ) || {} )[ event.type ] || [],3836 special = jquery.event.special[ event.type ] || {};3837 // Use the fix-ed jquery.Event rather than the (read-only) native event3838 args[0] = event;3839 event.delegateTarget = this;3840 // Call the preDispatch hook for the mapped type, and let it bail if desired3841 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {3842 return;3843 }3844 // Determine handlers3845 handlerQueue = jquery.event.handlers.call( this, event, handlers );3846 // Run delegates first; they may want to stop propagation beneath us3847 i = 0;3848 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {3849 event.currentTarget = matched.elem;3850 j = 0;3851 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {3852 // Triggered event must either 1) have no namespace, or3853 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).3854 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {3855 event.handleObj = handleObj;3856 event.data = handleObj.data;3857 ret = ( (jquery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )3858 .apply( matched.elem, args );3859 if ( ret !== undefined ) {3860 if ( (event.result = ret) === false ) {3861 event.preventDefault();3862 event.stopPropagation();3863 }3864 }3865 }3866 }3867 }3868 // Call the postDispatch hook for the mapped type3869 if ( special.postDispatch ) {3870 special.postDispatch.call( this, event );3871 }3872 return event.result;3873 },3874 handlers: function( event, handlers ) {3875 var sel, handleObj, matches, i,3876 handlerQueue = [],3877 delegateCount = handlers.delegateCount,3878 cur = event.target;3879 // Find delegate handlers3880 // Black-hole SVG <use> instance trees (#13180)3881 // Avoid non-left-click bubbling in Firefox (#3861)3882 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {3883 /* jshint eqeqeq: false */3884 for ( ; cur != this; cur = cur.parentNode || this ) {3885 /* jshint eqeqeq: true */3886 // Don't check non-elements (#13208)3887 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)3888 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {3889 matches = [];3890 for ( i = 0; i < delegateCount; i++ ) {3891 handleObj = handlers[ i ];3892 // Don't conflict with Object.prototype properties (#13203)3893 sel = handleObj.selector + " ";3894 if ( matches[ sel ] === undefined ) {3895 matches[ sel ] = handleObj.needsContext ?3896 jquery( sel, this ).index( cur ) >= 0 :3897 jquery.find( sel, this, null, [ cur ] ).length;3898 }3899 if ( matches[ sel ] ) {3900 matches.push( handleObj );3901 }3902 }3903 if ( matches.length ) {3904 handlerQueue.push({ elem: cur, handlers: matches });3905 }3906 }3907 }3908 }3909 // Add the remaining (directly-bound) handlers3910 if ( delegateCount < handlers.length ) {3911 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });3912 }3913 return handlerQueue;3914 },3915 fix: function( event ) {3916 if ( event[ jquery.expando ] ) {3917 return event;3918 }3919 // Create a writable copy of the event object and normalize some properties3920 var i, prop, copy,3921 type = event.type,3922 originalEvent = event,3923 fixHook = this.fixHooks[ type ];3924 if ( !fixHook ) {3925 this.fixHooks[ type ] = fixHook =3926 rmouseEvent.test( type ) ? this.mouseHooks :3927 rkeyEvent.test( type ) ? this.keyHooks :3928 {};3929 }3930 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;3931 event = new jquery.Event( originalEvent );3932 i = copy.length;3933 while ( i-- ) {3934 prop = copy[ i ];3935 event[ prop ] = originalEvent[ prop ];3936 }3937 // Support: IE<93938 // Fix target property (#1925)3939 if ( !event.target ) {3940 event.target = originalEvent.srcElement || document;3941 }3942 // Support: Chrome 23+, Safari?3943 // Target should not be a text node (#504, #13143)3944 if ( event.target.nodeType === 3 ) {3945 event.target = event.target.parentNode;3946 }3947 // Support: IE<93948 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)3949 event.metaKey = !!event.metaKey;3950 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;3951 },3952 // Includes some event props shared by KeyEvent and MouseEvent3953 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),3954 fixHooks: {},3955 keyHooks: {3956 props: "char charCode key keyCode".split(" "),3957 filter: function( event, original ) {3958 // Add which for key events3959 if ( event.which == null ) {3960 event.which = original.charCode != null ? original.charCode : original.keyCode;3961 }3962 return event;3963 }3964 },3965 mouseHooks: {3966 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),3967 filter: function( event, original ) {3968 var body, eventDoc, doc,3969 button = original.button,3970 fromElement = original.fromElement;3971 // Calculate pageX/Y if missing and clientX/Y available3972 if ( event.pageX == null && original.clientX != null ) {3973 eventDoc = event.target.ownerDocument || document;3974 doc = eventDoc.documentElement;3975 body = eventDoc.body;3976 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );3977 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );3978 }3979 // Add relatedTarget, if necessary3980 if ( !event.relatedTarget && fromElement ) {3981 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;3982 }3983 // Add which for click: 1 === left; 2 === middle; 3 === right3984 // Note: button is not normalized, so don't use it3985 if ( !event.which && button !== undefined ) {3986 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );3987 }3988 return event;3989 }3990 },3991 special: {3992 load: {3993 // Prevent triggered image.load events from bubbling to window.load3994 noBubble: true3995 },3996 focus: {3997 // Fire native event if possible so blur/focus sequence is correct3998 trigger: function() {3999 if ( this !== safeActiveElement() && this.focus ) {4000 try {4001 this.focus();4002 return false;4003 } catch ( e ) {4004 // Support: IE<94005 // If we error on focus to hidden element (#1486, #12518),4006 // let .trigger() run the handlers4007 }4008 }4009 },4010 delegateType: "focusin"4011 },4012 blur: {4013 trigger: function() {4014 if ( this === safeActiveElement() && this.blur ) {4015 this.blur();4016 return false;4017 }4018 },4019 delegateType: "focusout"4020 },4021 click: {4022 // For checkbox, fire native event so checked state will be right4023 trigger: function() {4024 if ( jquery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {4025 this.click();4026 return false;4027 }4028 },4029 // For cross-browser consistency, don't fire native .click() on links4030 _default: function( event ) {4031 return jquery.nodeName( event.target, "a" );4032 }4033 },4034 beforeunload: {4035 postDispatch: function( event ) {4036 // Even when returnValue equals to undefined Firefox will still show alert4037 if ( event.result !== undefined ) {4038 event.originalEvent.returnValue = event.result;4039 }4040 }4041 }4042 },4043 simulate: function( type, elem, event, bubble ) {4044 // Piggyback on a donor event to simulate a different one.4045 // Fake originalEvent to avoid donor's stopPropagation, but if the4046 // simulated event prevents default then we do the same on the donor.4047 var e = jquery.extend(4048 new jquery.Event(),4049 event,4050 {4051 type: type,4052 isSimulated: true,4053 originalEvent: {}4054 }4055 );4056 if ( bubble ) {4057 jquery.event.trigger( e, null, elem );4058 } else {4059 jquery.event.dispatch.call( elem, e );4060 }4061 if ( e.isDefaultPrevented() ) {4062 event.preventDefault();4063 }4064 }4065};4066jquery.removeEvent = document.removeEventListener ?4067 function( elem, type, handle ) {4068 if ( elem.removeEventListener ) {4069 elem.removeEventListener( type, handle, false );4070 }4071 } :4072 function( elem, type, handle ) {4073 var name = "on" + type;4074 if ( elem.detachEvent ) {4075 // #8545, #7054, preventing memory leaks for custom events in IE6-84076 // detachEvent needed property on element, by name of that event, to properly expose it to GC4077 if ( typeof elem[ name ] === strundefined ) {4078 elem[ name ] = null;4079 }4080 elem.detachEvent( name, handle );4081 }4082 };4083jquery.Event = function( src, props ) {4084 // Allow instantiation without the 'new' keyword4085 if ( !(this instanceof jquery.Event) ) {4086 return new jquery.Event( src, props );4087 }4088 // Event object4089 if ( src && src.type ) {4090 this.originalEvent = src;4091 this.type = src.type;4092 // Events bubbling up the document may have been marked as prevented4093 // by a handler lower down the tree; reflect the correct value.4094 this.isDefaultPrevented = src.defaultPrevented ||4095 src.defaultPrevented === undefined && (4096 // Support: IE < 94097 src.returnValue === false ||4098 // Support: Android < 4.04099 src.getPreventDefault && src.getPreventDefault() ) ?4100 returnTrue :4101 returnFalse;4102 // Event type4103 } else {4104 this.type = src;4105 }4106 // Put explicitly provided properties onto the event object4107 if ( props ) {4108 jquery.extend( this, props );4109 }4110 // Create a timestamp if incoming event doesn't have one4111 this.timeStamp = src && src.timeStamp || jquery.now();4112 // Mark it as fixed4113 this[ jquery.expando ] = true;4114};4115// jquery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding4116// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html4117jquery.Event.prototype = {4118 isDefaultPrevented: returnFalse,4119 isPropagationStopped: returnFalse,4120 isImmediatePropagationStopped: returnFalse,4121 preventDefault: function() {4122 var e = this.originalEvent;4123 this.isDefaultPrevented = returnTrue;4124 if ( !e ) {4125 return;4126 }4127 // If preventDefault exists, run it on the original event4128 if ( e.preventDefault ) {4129 e.preventDefault();4130 // Support: IE4131 // Otherwise set the returnValue property of the original event to false4132 } else {4133 e.returnValue = false;4134 }4135 },4136 stopPropagation: function() {4137 var e = this.originalEvent;4138 this.isPropagationStopped = returnTrue;4139 if ( !e ) {4140 return;4141 }4142 // If stopPropagation exists, run it on the original event4143 if ( e.stopPropagation ) {4144 e.stopPropagation();4145 }4146 // Support: IE4147 // Set the cancelBubble property of the original event to true4148 e.cancelBubble = true;4149 },4150 stopImmediatePropagation: function() {4151 this.isImmediatePropagationStopped = returnTrue;4152 this.stopPropagation();4153 }4154};4155// Create mouseenter/leave events using mouseover/out and event-time checks4156jquery.each({4157 mouseenter: "mouseover",4158 mouseleave: "mouseout"4159}, function( orig, fix ) {4160 jquery.event.special[ orig ] = {4161 delegateType: fix,4162 bindType: fix,4163 handle: function( event ) {4164 var ret,4165 target = this,4166 related = event.relatedTarget,4167 handleObj = event.handleObj;4168 // For mousenter/leave call the handler if related is outside the target.4169 // NB: No relatedTarget if the mouse left/entered the browser window4170 if ( !related || (related !== target && !jquery.contains( target, related )) ) {4171 event.type = handleObj.origType;4172 ret = handleObj.handler.apply( this, arguments );4173 event.type = fix;4174 }4175 return ret;4176 }4177 };4178});4179// IE submit delegation4180if ( !support.submitBubbles ) {4181 jquery.event.special.submit = {4182 setup: function() {4183 // Only need this for delegated form submit events4184 if ( jquery.nodeName( this, "form" ) ) {4185 return false;4186 }4187 // Lazy-add a submit handler when a descendant form may potentially be submitted4188 jquery.event.add( this, "click._submit keypress._submit", function( e ) {4189 // Node name check avoids a VML-related crash in IE (#9807)4190 var elem = e.target,4191 form = jquery.nodeName( elem, "input" ) || jquery.nodeName( elem, "button" ) ? elem.form : undefined;4192 if ( form && !jquery._data( form, "submitBubbles" ) ) {4193 jquery.event.add( form, "submit._submit", function( event ) {4194 event._submit_bubble = true;4195 });4196 jquery._data( form, "submitBubbles", true );4197 }4198 });4199 // return undefined since we don't need an event listener4200 },4201 postDispatch: function( event ) {4202 // If form was submitted by the user, bubble the event up the tree4203 if ( event._submit_bubble ) {4204 delete event._submit_bubble;4205 if ( this.parentNode && !event.isTrigger ) {4206 jquery.event.simulate( "submit", this.parentNode, event, true );4207 }4208 }4209 },4210 teardown: function() {4211 // Only need this for delegated form submit events4212 if ( jquery.nodeName( this, "form" ) ) {4213 return false;4214 }4215 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above4216 jquery.event.remove( this, "._submit" );4217 }4218 };4219}4220// IE change delegation and checkbox/radio fix4221if ( !support.changeBubbles ) {4222 jquery.event.special.change = {4223 setup: function() {4224 if ( rformElems.test( this.nodeName ) ) {4225 // IE doesn't fire change on a check/radio until blur; trigger it on click4226 // after a propertychange. Eat the blur-change in special.change.handle.4227 // This still fires onchange a second time for check/radio after blur.4228 if ( this.type === "checkbox" || this.type === "radio" ) {4229 jquery.event.add( this, "propertychange._change", function( event ) {4230 if ( event.originalEvent.propertyName === "checked" ) {4231 this._just_changed = true;4232 }4233 });4234 jquery.event.add( this, "click._change", function( event ) {4235 if ( this._just_changed && !event.isTrigger ) {4236 this._just_changed = false;4237 }4238 // Allow triggered, simulated change events (#11500)4239 jquery.event.simulate( "change", this, event, true );4240 });4241 }4242 return false;4243 }4244 // Delegated event; lazy-add a change handler on descendant inputs4245 jquery.event.add( this, "beforeactivate._change", function( e ) {4246 var elem = e.target;4247 if ( rformElems.test( elem.nodeName ) && !jquery._data( elem, "changeBubbles" ) ) {4248 jquery.event.add( elem, "change._change", function( event ) {4249 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {4250 jquery.event.simulate( "change", this.parentNode, event, true );4251 }4252 });4253 jquery._data( elem, "changeBubbles", true );4254 }4255 });4256 },4257 handle: function( event ) {4258 var elem = event.target;4259 // Swallow native change events from checkbox/radio, we already triggered them above4260 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {4261 return event.handleObj.handler.apply( this, arguments );4262 }4263 },4264 teardown: function() {4265 jquery.event.remove( this, "._change" );4266 return !rformElems.test( this.nodeName );4267 }4268 };4269}4270// Create "bubbling" focus and blur events4271if ( !support.focusinBubbles ) {4272 jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {4273 // Attach a single capturing handler on the document while someone wants focusin/focusout4274 var handler = function( event ) {4275 jquery.event.simulate( fix, event.target, jquery.event.fix( event ), true );4276 };4277 jquery.event.special[ fix ] = {4278 setup: function() {4279 var doc = this.ownerDocument || this,4280 attaches = jquery._data( doc, fix );4281 if ( !attaches ) {4282 doc.addEventListener( orig, handler, true );4283 }4284 jquery._data( doc, fix, ( attaches || 0 ) + 1 );4285 },4286 teardown: function() {4287 var doc = this.ownerDocument || this,4288 attaches = jquery._data( doc, fix ) - 1;4289 if ( !attaches ) {4290 doc.removeEventListener( orig, handler, true );4291 jquery._removeData( doc, fix );4292 } else {4293 jquery._data( doc, fix, attaches );4294 }4295 }4296 };4297 });4298}4299jquery.fn.extend({4300 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {4301 var type, origFn;4302 // Types can be a map of types/handlers4303 if ( typeof types === "object" ) {4304 // ( types-Object, selector, data )4305 if ( typeof selector !== "string" ) {4306 // ( types-Object, data )4307 data = data || selector;4308 selector = undefined;4309 }4310 for ( type in types ) {4311 this.on( type, selector, data, types[ type ], one );4312 }4313 return this;4314 }4315 if ( data == null && fn == null ) {4316 // ( types, fn )4317 fn = selector;4318 data = selector = undefined;4319 } else if ( fn == null ) {4320 if ( typeof selector === "string" ) {4321 // ( types, selector, fn )4322 fn = data;4323 data = undefined;4324 } else {4325 // ( types, data, fn )4326 fn = data;4327 data = selector;4328 selector = undefined;4329 }4330 }4331 if ( fn === false ) {4332 fn = returnFalse;4333 } else if ( !fn ) {4334 return this;4335 }4336 if ( one === 1 ) {4337 origFn = fn;4338 fn = function( event ) {4339 // Can use an empty set, since event contains the info4340 jquery().off( event );4341 return origFn.apply( this, arguments );4342 };4343 // Use same guid so caller can remove using origFn4344 fn.guid = origFn.guid || ( origFn.guid = jquery.guid++ );4345 }4346 return this.each( function() {4347 jquery.event.add( this, types, fn, data, selector );4348 });4349 },4350 one: function( types, selector, data, fn ) {4351 return this.on( types, selector, data, fn, 1 );4352 },4353 off: function( types, selector, fn ) {4354 var handleObj, type;4355 if ( types && types.preventDefault && types.handleObj ) {4356 // ( event ) dispatched jquery.Event4357 handleObj = types.handleObj;4358 jquery( types.delegateTarget ).off(4359 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,4360 handleObj.selector,4361 handleObj.handler4362 );4363 return this;4364 }4365 if ( typeof types === "object" ) {4366 // ( types-object [, selector] )4367 for ( type in types ) {4368 this.off( type, selector, types[ type ] );4369 }4370 return this;4371 }4372 if ( selector === false || typeof selector === "function" ) {4373 // ( types [, fn] )4374 fn = selector;4375 selector = undefined;4376 }4377 if ( fn === false ) {4378 fn = returnFalse;4379 }4380 return this.each(function() {4381 jquery.event.remove( this, types, fn, selector );4382 });4383 },4384 trigger: function( type, data ) {4385 return this.each(function() {4386 jquery.event.trigger( type, data, this );4387 });4388 },4389 triggerHandler: function( type, data ) {4390 var elem = this[0];4391 if ( elem ) {4392 return jquery.event.trigger( type, data, elem, true );4393 }4394 }4395});4396function createSafeFragment( document ) {4397 var list = nodeNames.split( "|" ),4398 safeFrag = document.createDocumentFragment();4399 if ( safeFrag.createElement ) {4400 while ( list.length ) {4401 safeFrag.createElement(4402 list.pop()4403 );4404 }4405 }4406 return safeFrag;4407}4408var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +4409 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",4410 rinlinejquery = / jquery\d+="(?:null|\d+)"/g,4411 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),4412 rleadingWhitespace = /^\s+/,4413 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,4414 rtagName = /<([\w:]+)/,4415 rtbody = /<tbody/i,4416 rhtml = /<|&#?\w+;/,4417 rnoInnerhtml = /<(?:script|style|link)/i,4418 // checked="checked" or checked4419 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,4420 rscriptType = /^$|\/(?:java|ecma)script/i,4421 rscriptTypeMasked = /^true\/(.*)/,4422 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,4423 // We have to close these tags to support XHTML (#13200)4424 wrapMap = {4425 option: [ 1, "<select multiple='multiple'>", "</select>" ],4426 legend: [ 1, "<fieldset>", "</fieldset>" ],4427 area: [ 1, "<map>", "</map>" ],4428 param: [ 1, "<object>", "</object>" ],4429 thead: [ 1, "<table>", "</table>" ],4430 tr: [ 2, "<table><tbody>", "</tbody></table>" ],4431 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],4432 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],4433 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,4434 // unless wrapped in a div with non-breaking characters in front of it.4435 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]4436 },4437 safeFragment = createSafeFragment( document ),4438 fragmentDiv = safeFragment.appendChild( document.createElement("div") );4439wrapMap.optgroup = wrapMap.option;4440wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;4441wrapMap.th = wrapMap.td;4442function getAll( context, tag ) {4443 var elems, elem,4444 i = 0,4445 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) :4446 typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) :4447 undefined;4448 if ( !found ) {4449 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {4450 if ( !tag || jquery.nodeName( elem, tag ) ) {4451 found.push( elem );4452 } else {4453 jquery.merge( found, getAll( elem, tag ) );4454 }4455 }4456 }4457 return tag === undefined || tag && jquery.nodeName( context, tag ) ?4458 jquery.merge( [ context ], found ) :4459 found;4460}4461// Used in buildFragment, fixes the defaultChecked property4462function fixDefaultChecked( elem ) {4463 if ( rcheckableType.test( elem.type ) ) {4464 elem.defaultChecked = elem.checked;4465 }4466}4467// Support: IE<84468// Manipulating tables requires a tbody4469function manipulationTarget( elem, content ) {4470 return jquery.nodeName( elem, "table" ) &&4471 jquery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?4472 elem.getElementsByTagName("tbody")[0] ||4473 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :4474 elem;4475}4476// Replace/restore the type attribute of script elements for safe DOM manipulation4477function disableScript( elem ) {4478 elem.type = (jquery.find.attr( elem, "type" ) !== null) + "/" + elem.type;4479 return elem;4480}4481function restoreScript( elem ) {4482 var match = rscriptTypeMasked.exec( elem.type );4483 if ( match ) {4484 elem.type = match[1];4485 } else {4486 elem.removeAttribute("type");4487 }4488 return elem;4489}4490// Mark scripts as having already been evaluated4491function setGlobalEval( elems, refElements ) {4492 var elem,4493 i = 0;4494 for ( ; (elem = elems[i]) != null; i++ ) {4495 jquery._data( elem, "globalEval", !refElements || jquery._data( refElements[i], "globalEval" ) );4496 }4497}4498function cloneCopyEvent( src, dest ) {4499 if ( dest.nodeType !== 1 || !jquery.hasData( src ) ) {4500 return;4501 }4502 var type, i, l,4503 oldData = jquery._data( src ),4504 curData = jquery._data( dest, oldData ),4505 events = oldData.events;4506 if ( events ) {4507 delete curData.handle;4508 curData.events = {};4509 for ( type in events ) {4510 for ( i = 0, l = events[ type ].length; i < l; i++ ) {4511 jquery.event.add( dest, type, events[ type ][ i ] );4512 }4513 }4514 }4515 // make the cloned public data object a copy from the original4516 if ( curData.data ) {4517 curData.data = jquery.extend( {}, curData.data );4518 }4519}4520function fixCloneNodeIssues( src, dest ) {4521 var nodeName, e, data;4522 // We do not need to do anything for non-Elements4523 if ( dest.nodeType !== 1 ) {4524 return;4525 }4526 nodeName = dest.nodeName.toLowerCase();4527 // IE6-8 copies events bound via attachEvent when using cloneNode.4528 if ( !support.noCloneEvent && dest[ jquery.expando ] ) {4529 data = jquery._data( dest );4530 for ( e in data.events ) {4531 jquery.removeEvent( dest, e, data.handle );4532 }4533 // Event data gets referenced instead of copied if the expando gets copied too4534 dest.removeAttribute( jquery.expando );4535 }4536 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text4537 if ( nodeName === "script" && dest.text !== src.text ) {4538 disableScript( dest ).text = src.text;4539 restoreScript( dest );4540 // IE6-10 improperly clones children of object elements using classid.4541 // IE10 throws NoModificationAllowedError if parent is null, #12132.4542 } else if ( nodeName === "object" ) {4543 if ( dest.parentNode ) {4544 dest.outerHTML = src.outerHTML;4545 }4546 // This path appears unavoidable for IE9. When cloning an object4547 // element in IE9, the outerHTML strategy above is not sufficient.4548 // If the src has innerHTML and the destination does not,4549 // copy the src.innerHTML into the dest.innerHTML. #103244550 if ( support.html5Clone && ( src.innerHTML && !jquery.trim(dest.innerHTML) ) ) {4551 dest.innerHTML = src.innerHTML;4552 }4553 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {4554 // IE6-8 fails to persist the checked state of a cloned checkbox4555 // or radio button. Worse, IE6-7 fail to give the cloned element4556 // a checked appearance if the defaultChecked value isn't also set4557 dest.defaultChecked = dest.checked = src.checked;4558 // IE6-7 get confused and end up setting the value of a cloned4559 // checkbox/radio button to an empty string instead of "on"4560 if ( dest.value !== src.value ) {4561 dest.value = src.value;4562 }4563 // IE6-8 fails to return the selected option to the default selected4564 // state when cloning options4565 } else if ( nodeName === "option" ) {4566 dest.defaultSelected = dest.selected = src.defaultSelected;4567 // IE6-8 fails to set the defaultValue to the correct value when4568 // cloning other types of input fields4569 } else if ( nodeName === "input" || nodeName === "textarea" ) {4570 dest.defaultValue = src.defaultValue;4571 }4572}4573jquery.extend({4574 clone: function( elem, dataAndEvents, deepDataAndEvents ) {4575 var destElements, node, clone, i, srcElements,4576 inPage = jquery.contains( elem.ownerDocument, elem );4577 if ( support.html5Clone || jquery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {4578 clone = elem.cloneNode( true );4579 // IE<=8 does not properly clone detached, unknown element nodes4580 } else {4581 fragmentDiv.innerHTML = elem.outerHTML;4582 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );4583 }4584 if ( (!support.noCloneEvent || !support.noCloneChecked) &&4585 (elem.nodeType === 1 || elem.nodeType === 11) && !jquery.isXMLDoc(elem) ) {4586 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/24587 destElements = getAll( clone );4588 srcElements = getAll( elem );4589 // Fix all IE cloning issues4590 for ( i = 0; (node = srcElements[i]) != null; ++i ) {4591 // Ensure that the destination node is not null; Fixes #95874592 if ( destElements[i] ) {4593 fixCloneNodeIssues( node, destElements[i] );4594 }4595 }4596 }4597 // Copy the events from the original to the clone4598 if ( dataAndEvents ) {4599 if ( deepDataAndEvents ) {4600 srcElements = srcElements || getAll( elem );4601 destElements = destElements || getAll( clone );4602 for ( i = 0; (node = srcElements[i]) != null; i++ ) {4603 cloneCopyEvent( node, destElements[i] );4604 }4605 } else {4606 cloneCopyEvent( elem, clone );4607 }4608 }4609 // Preserve script evaluation history4610 destElements = getAll( clone, "script" );4611 if ( destElements.length > 0 ) {4612 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );4613 }4614 destElements = srcElements = node = null;4615 // Return the cloned set4616 return clone;4617 },4618 buildFragment: function( elems, context, scripts, selection ) {4619 var j, elem, contains,4620 tmp, tag, tbody, wrap,4621 l = elems.length,4622 // Ensure a safe fragment4623 safe = createSafeFragment( context ),4624 nodes = [],4625 i = 0;4626 for ( ; i < l; i++ ) {4627 elem = elems[ i ];4628 if ( elem || elem === 0 ) {4629 // Add nodes directly4630 if ( jquery.type( elem ) === "object" ) {4631 jquery.merge( nodes, elem.nodeType ? [ elem ] : elem );4632 // Convert non-html into a text node4633 } else if ( !rhtml.test( elem ) ) {4634 nodes.push( context.createTextNode( elem ) );4635 // Convert html into DOM nodes4636 } else {4637 tmp = tmp || safe.appendChild( context.createElement("div") );4638 // Deserialize a standard representation4639 tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase();4640 wrap = wrapMap[ tag ] || wrapMap._default;4641 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];4642 // Descend through wrappers to the right content4643 j = wrap[0];4644 while ( j-- ) {4645 tmp = tmp.lastChild;4646 }4647 // Manually add leading whitespace removed by IE4648 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {4649 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );4650 }4651 // Remove IE's autoinserted <tbody> from table fragments4652 if ( !support.tbody ) {4653 // String was a <table>, *may* have spurious <tbody>4654 elem = tag === "table" && !rtbody.test( elem ) ?4655 tmp.firstChild :4656 // String was a bare <thead> or <tfoot>4657 wrap[1] === "<table>" && !rtbody.test( elem ) ?4658 tmp :4659 0;4660 j = elem && elem.childNodes.length;4661 while ( j-- ) {4662 if ( jquery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {4663 elem.removeChild( tbody );4664 }4665 }4666 }4667 jquery.merge( nodes, tmp.childNodes );4668 // Fix #12392 for WebKit and IE > 94669 tmp.textContent = "";4670 // Fix #12392 for oldIE4671 while ( tmp.firstChild ) {4672 tmp.removeChild( tmp.firstChild );4673 }4674 // Remember the top-level container for proper cleanup4675 tmp = safe.lastChild;4676 }4677 }4678 }4679 // Fix #11356: Clear elements from fragment4680 if ( tmp ) {4681 safe.removeChild( tmp );4682 }4683 // Reset defaultChecked for any radios and checkboxes4684 // about to be appended to the DOM in IE 6/7 (#8060)4685 if ( !support.appendChecked ) {4686 jquery.grep( getAll( nodes, "input" ), fixDefaultChecked );4687 }4688 i = 0;4689 while ( (elem = nodes[ i++ ]) ) {4690 // #4087 - If origin and destination elements are the same, and this is4691 // that element, do not do anything4692 if ( selection && jquery.inArray( elem, selection ) !== -1 ) {4693 continue;4694 }4695 contains = jquery.contains( elem.ownerDocument, elem );4696 // Append to fragment4697 tmp = getAll( safe.appendChild( elem ), "script" );4698 // Preserve script evaluation history4699 if ( contains ) {4700 setGlobalEval( tmp );4701 }4702 // Capture executables4703 if ( scripts ) {4704 j = 0;4705 while ( (elem = tmp[ j++ ]) ) {4706 if ( rscriptType.test( elem.type || "" ) ) {4707 scripts.push( elem );4708 }4709 }4710 }4711 }4712 tmp = null;4713 return safe;4714 },4715 cleanData: function( elems, /* internal */ acceptData ) {4716 var elem, type, id, data,4717 i = 0,4718 internalKey = jquery.expando,4719 cache = jquery.cache,4720 deleteExpando = support.deleteExpando,4721 special = jquery.event.special;4722 for ( ; (elem = elems[i]) != null; i++ ) {4723 if ( acceptData || jquery.acceptData( elem ) ) {4724 id = elem[ internalKey ];4725 data = id && cache[ id ];4726 if ( data ) {4727 if ( data.events ) {4728 for ( type in data.events ) {4729 if ( special[ type ] ) {4730 jquery.event.remove( elem, type );4731 // This is a shortcut to avoid jquery.event.remove's overhead4732 } else {4733 jquery.removeEvent( elem, type, data.handle );4734 }4735 }4736 }4737 // Remove cache only if it was not already removed by jquery.event.remove4738 if ( cache[ id ] ) {4739 delete cache[ id ];4740 // IE does not allow us to delete expando properties from nodes,4741 // nor does it have a removeAttribute function on Document nodes;4742 // we must handle all of these cases4743 if ( deleteExpando ) {4744 delete elem[ internalKey ];4745 } else if ( typeof elem.removeAttribute !== strundefined ) {4746 elem.removeAttribute( internalKey );4747 } else {4748 elem[ internalKey ] = null;4749 }4750 deletedIds.push( id );4751 }4752 }4753 }4754 }4755 }4756});4757jquery.fn.extend({4758 text: function( value ) {4759 return access( this, function( value ) {4760 return value === undefined ?4761 jquery.text( this ) :4762 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );4763 }, null, value, arguments.length );4764 },4765 append: function() {4766 return this.domManip( arguments, function( elem ) {4767 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {4768 var target = manipulationTarget( this, elem );4769 target.appendChild( elem );4770 }4771 });4772 },4773 prepend: function() {4774 return this.domManip( arguments, function( elem ) {4775 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {4776 var target = manipulationTarget( this, elem );4777 target.insertBefore( elem, target.firstChild );4778 }4779 });4780 },4781 before: function() {4782 return this.domManip( arguments, function( elem ) {4783 if ( this.parentNode ) {4784 this.parentNode.insertBefore( elem, this );4785 }4786 });4787 },4788 after: function() {4789 return this.domManip( arguments, function( elem ) {4790 if ( this.parentNode ) {4791 this.parentNode.insertBefore( elem, this.nextSibling );4792 }4793 });4794 },4795 remove: function( selector, keepData /* Internal Use Only */ ) {4796 var elem,4797 elems = selector ? jquery.filter( selector, this ) : this,4798 i = 0;4799 for ( ; (elem = elems[i]) != null; i++ ) {4800 if ( !keepData && elem.nodeType === 1 ) {4801 jquery.cleanData( getAll( elem ) );4802 }4803 if ( elem.parentNode ) {4804 if ( keepData && jquery.contains( elem.ownerDocument, elem ) ) {4805 setGlobalEval( getAll( elem, "script" ) );4806 }4807 elem.parentNode.removeChild( elem );4808 }4809 }4810 return this;4811 },4812 empty: function() {4813 var elem,4814 i = 0;4815 for ( ; (elem = this[i]) != null; i++ ) {4816 // Remove element nodes and prevent memory leaks4817 if ( elem.nodeType === 1 ) {4818 jquery.cleanData( getAll( elem, false ) );4819 }4820 // Remove any remaining nodes4821 while ( elem.firstChild ) {4822 elem.removeChild( elem.firstChild );4823 }4824 // If this is a select, ensure that it displays empty (#12336)4825 // Support: IE<94826 if ( elem.options && jquery.nodeName( elem, "select" ) ) {4827 elem.options.length = 0;4828 }4829 }4830 return this;4831 },4832 clone: function( dataAndEvents, deepDataAndEvents ) {4833 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;4834 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;4835 return this.map(function() {4836 return jquery.clone( this, dataAndEvents, deepDataAndEvents );4837 });4838 },4839 html: function( value ) {4840 return access( this, function( value ) {4841 var elem = this[ 0 ] || {},4842 i = 0,4843 l = this.length;4844 if ( value === undefined ) {4845 return elem.nodeType === 1 ?4846 elem.innerHTML.replace( rinlinejquery, "" ) :4847 undefined;4848 }4849 // See if we can take a shortcut and just use innerHTML4850 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&4851 ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&4852 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&4853 !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) {4854 value = value.replace( rxhtmlTag, "<$1></$2>" );4855 try {4856 for (; i < l; i++ ) {4857 // Remove element nodes and prevent memory leaks4858 elem = this[i] || {};4859 if ( elem.nodeType === 1 ) {4860 jquery.cleanData( getAll( elem, false ) );4861 elem.innerHTML = value;4862 }4863 }4864 elem = 0;4865 // If using innerHTML throws an exception, use the fallback method4866 } catch(e) {}4867 }4868 if ( elem ) {4869 this.empty().append( value );4870 }4871 }, null, value, arguments.length );4872 },4873 replaceWith: function() {4874 var arg = arguments[ 0 ];4875 // Make the changes, replacing each context element with the new content4876 this.domManip( arguments, function( elem ) {4877 arg = this.parentNode;4878 jquery.cleanData( getAll( this ) );4879 if ( arg ) {4880 arg.replaceChild( elem, this );4881 }4882 });4883 // Force removal if there was no new content (e.g., from empty arguments)4884 return arg && (arg.length || arg.nodeType) ? this : this.remove();4885 },4886 detach: function( selector ) {4887 return this.remove( selector, true );4888 },4889 domManip: function( args, callback ) {4890 // Flatten any nested arrays4891 args = concat.apply( [], args );4892 var first, node, hasScripts,4893 scripts, doc, fragment,4894 i = 0,4895 l = this.length,4896 set = this,4897 iNoClone = l - 1,4898 value = args[0],4899 isFunction = jquery.isFunction( value );4900 // We can't cloneNode fragments that contain checked, in WebKit4901 if ( isFunction ||4902 ( l > 1 && typeof value === "string" &&4903 !support.checkClone && rchecked.test( value ) ) ) {4904 return this.each(function( index ) {4905 var self = set.eq( index );4906 if ( isFunction ) {4907 args[0] = value.call( this, index, self.html() );4908 }4909 self.domManip( args, callback );4910 });4911 }4912 if ( l ) {4913 fragment = jquery.buildFragment( args, this[ 0 ].ownerDocument, false, this );4914 first = fragment.firstChild;4915 if ( fragment.childNodes.length === 1 ) {4916 fragment = first;4917 }4918 if ( first ) {4919 scripts = jquery.map( getAll( fragment, "script" ), disableScript );4920 hasScripts = scripts.length;4921 // Use the original fragment for the last item instead of the first because it can end up4922 // being emptied incorrectly in certain situations (#8070).4923 for ( ; i < l; i++ ) {4924 node = fragment;4925 if ( i !== iNoClone ) {4926 node = jquery.clone( node, true, true );4927 // Keep references to cloned scripts for later restoration4928 if ( hasScripts ) {4929 jquery.merge( scripts, getAll( node, "script" ) );4930 }4931 }4932 callback.call( this[i], node, i );4933 }4934 if ( hasScripts ) {4935 doc = scripts[ scripts.length - 1 ].ownerDocument;4936 // Reenable scripts4937 jquery.map( scripts, restoreScript );4938 // Evaluate executable scripts on first document insertion4939 for ( i = 0; i < hasScripts; i++ ) {4940 node = scripts[ i ];4941 if ( rscriptType.test( node.type || "" ) &&4942 !jquery._data( node, "globalEval" ) && jquery.contains( doc, node ) ) {4943 if ( node.src ) {4944 // Optional AJAX dependency, but won't run scripts if not present4945 if ( jquery._evalUrl ) {4946 jquery._evalUrl( node.src );4947 }4948 } else {4949 jquery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );4950 }4951 }4952 }4953 }4954 // Fix #11809: Avoid leaking memory4955 fragment = first = null;4956 }4957 }4958 return this;4959 }4960});4961jquery.each({4962 appendTo: "append",4963 prependTo: "prepend",4964 insertBefore: "before",4965 insertAfter: "after",4966 replaceAll: "replaceWith"4967}, function( name, original ) {4968 jquery.fn[ name ] = function( selector ) {4969 var elems,4970 i = 0,4971 ret = [],4972 insert = jquery( selector ),4973 last = insert.length - 1;4974 for ( ; i <= last; i++ ) {4975 elems = i === last ? this : this.clone(true);4976 jquery( insert[i] )[ original ]( elems );4977 // Modern browsers can apply jquery collections as arrays, but oldIE needs a .get()4978 push.apply( ret, elems.get() );4979 }4980 return this.pushStack( ret );4981 };4982});4983var iframe,4984 elemdisplay = {};4985/**4986 * Retrieve the actual display of a element4987 * @param {String} name nodeName of the element4988 * @param {Object} doc Document object4989 */4990// Called only from within defaultDisplay4991function actualDisplay( name, doc ) {4992 var elem = jquery( doc.createElement( name ) ).appendTo( doc.body ),4993 // getDefaultComputedStyle might be reliably used only on attached element4994 display = window.getDefaultComputedStyle ?4995 // Use of this method is a temporary fix (more like optmization) until something better comes along,4996 // since it was removed from specification and supported only in FF4997 window.getDefaultComputedStyle( elem[ 0 ] ).display : jquery.css( elem[ 0 ], "display" );4998 // We don't have any data stored on the element,4999 // so use "detach" method as fast way to get rid of the element5000 elem.detach();5001 return display;5002}5003/**5004 * Try to determine the default display value of an element5005 * @param {String} nodeName5006 */5007function defaultDisplay( nodeName ) {5008 var doc = document,5009 display = elemdisplay[ nodeName ];5010 if ( !display ) {5011 display = actualDisplay( nodeName, doc );5012 // If the simple way fails, read from inside an iframe5013 if ( display === "none" || !display ) {5014 // Use the already-created iframe if possible5015 iframe = (iframe || jquery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );5016 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse5017 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;5018 // Support: IE5019 doc.write();5020 doc.close();5021 display = actualDisplay( nodeName, doc );5022 iframe.detach();5023 }5024 // Store the correct default display5025 elemdisplay[ nodeName ] = display;5026 }5027 return display;5028}5029(function() {5030 var a, shrinkWrapBlocksVal,5031 div = document.createElement( "div" ),5032 divReset =5033 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +5034 "display:block;padding:0;margin:0;border:0";5035 // Setup5036 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5037 a = div.getElementsByTagName( "a" )[ 0 ];5038 a.style.cssText = "float:left;opacity:.5";5039 // Make sure that element opacity exists5040 // (IE uses filter instead)5041 // Use a regex to work around a WebKit issue. See #51455042 support.opacity = /^0.5/.test( a.style.opacity );5043 // Verify style float existence5044 // (IE uses styleFloat instead of cssFloat)5045 support.cssFloat = !!a.style.cssFloat;5046 div.style.backgroundClip = "content-box";5047 div.cloneNode( true ).style.backgroundClip = "";5048 support.clearCloneStyle = div.style.backgroundClip === "content-box";5049 // Null elements to avoid leaks in IE.5050 a = div = null;5051 support.shrinkWrapBlocks = function() {5052 var body, container, div, containerStyles;5053 if ( shrinkWrapBlocksVal == null ) {5054 body = document.getElementsByTagName( "body" )[ 0 ];5055 if ( !body ) {5056 // Test fired too early or in an unsupported environment, exit.5057 return;5058 }5059 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px";5060 container = document.createElement( "div" );5061 div = document.createElement( "div" );5062 body.appendChild( container ).appendChild( div );5063 // Will be changed later if needed.5064 shrinkWrapBlocksVal = false;5065 if ( typeof div.style.zoom !== strundefined ) {5066 // Support: IE65067 // Check if elements with layout shrink-wrap their children5068 div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1";5069 div.innerHTML = "<div></div>";5070 div.firstChild.style.width = "5px";5071 shrinkWrapBlocksVal = div.offsetWidth !== 3;5072 }5073 body.removeChild( container );5074 // Null elements to avoid leaks in IE.5075 body = container = div = null;5076 }5077 return shrinkWrapBlocksVal;5078 };5079})();5080var rmargin = (/^margin/);5081var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );5082var getStyles, curCSS,5083 rposition = /^(top|right|bottom|left)$/;5084if ( window.getComputedStyle ) {5085 getStyles = function( elem ) {5086 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );5087 };5088 curCSS = function( elem, name, computed ) {5089 var width, minWidth, maxWidth, ret,5090 style = elem.style;5091 computed = computed || getStyles( elem );5092 // getPropertyValue is only needed for .css('filter') in IE9, see #125375093 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;5094 if ( computed ) {5095 if ( ret === "" && !jquery.contains( elem.ownerDocument, elem ) ) {5096 ret = jquery.style( elem, name );5097 }5098 // A tribute to the "awesome hack by Dean Edwards"5099 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right5100 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels5101 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values5102 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {5103 // Remember the original values5104 width = style.width;5105 minWidth = style.minWidth;5106 maxWidth = style.maxWidth;5107 // Put in the new values to get a computed value out5108 style.minWidth = style.maxWidth = style.width = ret;5109 ret = computed.width;5110 // Revert the changed values5111 style.width = width;5112 style.minWidth = minWidth;5113 style.maxWidth = maxWidth;5114 }5115 }5116 // Support: IE5117 // IE returns zIndex value as an integer.5118 return ret === undefined ?5119 ret :5120 ret + "";5121 };5122} else if ( document.documentElement.currentStyle ) {5123 getStyles = function( elem ) {5124 return elem.currentStyle;5125 };5126 curCSS = function( elem, name, computed ) {5127 var left, rs, rsLeft, ret,5128 style = elem.style;5129 computed = computed || getStyles( elem );5130 ret = computed ? computed[ name ] : undefined;5131 // Avoid setting ret to empty string here5132 // so we don't default to auto5133 if ( ret == null && style && style[ name ] ) {5134 ret = style[ name ];5135 }5136 // From the awesome hack by Dean Edwards5137 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022915138 // If we're not dealing with a regular pixel number5139 // but a number that has a weird ending, we need to convert it to pixels5140 // but not position css attributes, as those are proportional to the parent element instead5141 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem5142 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {5143 // Remember the original values5144 left = style.left;5145 rs = elem.runtimeStyle;5146 rsLeft = rs && rs.left;5147 // Put in the new values to get a computed value out5148 if ( rsLeft ) {5149 rs.left = elem.currentStyle.left;5150 }5151 style.left = name === "fontSize" ? "1em" : ret;5152 ret = style.pixelLeft + "px";5153 // Revert the changed values5154 style.left = left;5155 if ( rsLeft ) {5156 rs.left = rsLeft;5157 }5158 }5159 // Support: IE5160 // IE returns zIndex value as an integer.5161 return ret === undefined ?5162 ret :5163 ret + "" || "auto";5164 };5165}5166function addGetHookIf( conditionFn, hookFn ) {5167 // Define the hook, we'll check on the first run if it's really needed.5168 return {5169 get: function() {5170 var condition = conditionFn();5171 if ( condition == null ) {5172 // The test was not ready at this point; screw the hook this time5173 // but check again when needed next time.5174 return;5175 }5176 if ( condition ) {5177 // Hook not needed (or it's not possible to use it due to missing dependency),5178 // remove it.5179 // Since there are no other hooks for marginRight, remove the whole object.5180 delete this.get;5181 return;5182 }5183 // Hook needed; redefine it so that the support test is not executed again.5184 return (this.get = hookFn).apply( this, arguments );5185 }5186 };5187}5188(function() {5189 var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal,5190 pixelPositionVal, reliableMarginRightVal,5191 div = document.createElement( "div" ),5192 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px",5193 divReset =5194 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +5195 "display:block;padding:0;margin:0;border:0";5196 // Setup5197 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5198 a = div.getElementsByTagName( "a" )[ 0 ];5199 a.style.cssText = "float:left;opacity:.5";5200 // Make sure that element opacity exists5201 // (IE uses filter instead)5202 // Use a regex to work around a WebKit issue. See #51455203 support.opacity = /^0.5/.test( a.style.opacity );5204 // Verify style float existence5205 // (IE uses styleFloat instead of cssFloat)5206 support.cssFloat = !!a.style.cssFloat;5207 div.style.backgroundClip = "content-box";5208 div.cloneNode( true ).style.backgroundClip = "";5209 support.clearCloneStyle = div.style.backgroundClip === "content-box";5210 // Null elements to avoid leaks in IE.5211 a = div = null;5212 jquery.extend(support, {5213 reliableHiddenOffsets: function() {5214 if ( reliableHiddenOffsetsVal != null ) {5215 return reliableHiddenOffsetsVal;5216 }5217 var container, tds, isSupported,5218 div = document.createElement( "div" ),5219 body = document.getElementsByTagName( "body" )[ 0 ];5220 if ( !body ) {5221 // Return for frameset docs that don't have a body5222 return;5223 }5224 // Setup5225 div.setAttribute( "className", "t" );5226 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5227 container = document.createElement( "div" );5228 container.style.cssText = containerStyles;5229 body.appendChild( container ).appendChild( div );5230 // Support: IE85231 // Check if table cells still have offsetWidth/Height when they are set5232 // to display:none and there are still other visible table cells in a5233 // table row; if so, offsetWidth/Height are not reliable for use when5234 // determining if an element has been hidden directly using5235 // display:none (it is still safe to use offsets if a parent element is5236 // hidden; don safety goggles and see bug #4512 for more information).5237 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";5238 tds = div.getElementsByTagName( "td" );5239 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";5240 isSupported = ( tds[ 0 ].offsetHeight === 0 );5241 tds[ 0 ].style.display = "";5242 tds[ 1 ].style.display = "none";5243 // Support: IE85244 // Check if empty table cells still have offsetWidth/Height5245 reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 );5246 body.removeChild( container );5247 // Null elements to avoid leaks in IE.5248 div = body = null;5249 return reliableHiddenOffsetsVal;5250 },5251 boxSizing: function() {5252 if ( boxSizingVal == null ) {5253 computeStyleTests();5254 }5255 return boxSizingVal;5256 },5257 boxSizingReliable: function() {5258 if ( boxSizingReliableVal == null ) {5259 computeStyleTests();5260 }5261 return boxSizingReliableVal;5262 },5263 pixelPosition: function() {5264 if ( pixelPositionVal == null ) {5265 computeStyleTests();5266 }5267 return pixelPositionVal;5268 },5269 reliableMarginRight: function() {5270 var body, container, div, marginDiv;5271 // Use window.getComputedStyle because jsdom on node.js will break without it.5272 if ( reliableMarginRightVal == null && window.getComputedStyle ) {5273 body = document.getElementsByTagName( "body" )[ 0 ];5274 if ( !body ) {5275 // Test fired too early or in an unsupported environment, exit.5276 return;5277 }5278 container = document.createElement( "div" );5279 div = document.createElement( "div" );5280 container.style.cssText = containerStyles;5281 body.appendChild( container ).appendChild( div );5282 // Check if div with explicit width and no margin-right incorrectly5283 // gets computed margin-right based on width of container. (#3333)5284 // Fails in WebKit before Feb 2011 nightlies5285 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right5286 marginDiv = div.appendChild( document.createElement( "div" ) );5287 marginDiv.style.cssText = div.style.cssText = divReset;5288 marginDiv.style.marginRight = marginDiv.style.width = "0";5289 div.style.width = "1px";5290 reliableMarginRightVal =5291 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );5292 body.removeChild( container );5293 }5294 return reliableMarginRightVal;5295 }5296 });5297 function computeStyleTests() {5298 var container, div,5299 body = document.getElementsByTagName( "body" )[ 0 ];5300 if ( !body ) {5301 // Test fired too early or in an unsupported environment, exit.5302 return;5303 }5304 container = document.createElement( "div" );5305 div = document.createElement( "div" );5306 container.style.cssText = containerStyles;5307 body.appendChild( container ).appendChild( div );5308 div.style.cssText =5309 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +5310 "position:absolute;display:block;padding:1px;border:1px;width:4px;" +5311 "margin-top:1%;top:1%";5312 // Workaround failing boxSizing test due to offsetWidth returning wrong value5313 // with some non-1 values of body zoom, ticket #135435314 jquery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {5315 boxSizingVal = div.offsetWidth === 4;5316 });5317 // Will be changed later if needed.5318 boxSizingReliableVal = true;5319 pixelPositionVal = false;5320 reliableMarginRightVal = true;5321 // Use window.getComputedStyle because jsdom on node.js will break without it.5322 if ( window.getComputedStyle ) {5323 pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";5324 boxSizingReliableVal =5325 ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";5326 }5327 body.removeChild( container );5328 // Null elements to avoid leaks in IE.5329 div = body = null;5330 }5331})();5332// A method for quickly swapping in/out CSS properties to get correct calculations.5333jquery.swap = function( elem, options, callback, args ) {5334 var ret, name,5335 old = {};5336 // Remember the old values, and insert the new ones5337 for ( name in options ) {5338 old[ name ] = elem.style[ name ];5339 elem.style[ name ] = options[ name ];5340 }5341 ret = callback.apply( elem, args || [] );5342 // Revert the old values5343 for ( name in options ) {5344 elem.style[ name ] = old[ name ];5345 }5346 return ret;5347};5348var5349 ralpha = /alpha\([^)]*\)/i,5350 ropacity = /opacity\s*=\s*([^)]*)/,5351 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"5352 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display5353 rdisplayswap = /^(none|table(?!-c[ea]).+)/,5354 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),5355 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),5356 cssShow = { position: "absolute", visibility: "hidden", display: "block" },5357 cssNormalTransform = {5358 letterSpacing: 0,5359 fontWeight: 4005360 },5361 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];5362// return a css property mapped to a potentially vendor prefixed property5363function vendorPropName( style, name ) {5364 // shortcut for names that are not vendor prefixed5365 if ( name in style ) {5366 return name;5367 }5368 // check for vendor prefixed names5369 var capName = name.charAt(0).toUpperCase() + name.slice(1),5370 origName = name,5371 i = cssPrefixes.length;5372 while ( i-- ) {5373 name = cssPrefixes[ i ] + capName;5374 if ( name in style ) {5375 return name;5376 }5377 }5378 return origName;5379}5380function showHide( elements, show ) {5381 var display, elem, hidden,5382 values = [],5383 index = 0,5384 length = elements.length;5385 for ( ; index < length; index++ ) {5386 elem = elements[ index ];5387 if ( !elem.style ) {5388 continue;5389 }5390 values[ index ] = jquery._data( elem, "olddisplay" );5391 display = elem.style.display;5392 if ( show ) {5393 // Reset the inline display of this element to learn if it is5394 // being hidden by cascaded rules or not5395 if ( !values[ index ] && display === "none" ) {5396 elem.style.display = "";5397 }5398 // Set elements which have been overridden with display: none5399 // in a stylesheet to whatever the default browser style is5400 // for such an element5401 if ( elem.style.display === "" && isHidden( elem ) ) {5402 values[ index ] = jquery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );5403 }5404 } else {5405 if ( !values[ index ] ) {5406 hidden = isHidden( elem );5407 if ( display && display !== "none" || !hidden ) {5408 jquery._data( elem, "olddisplay", hidden ? display : jquery.css( elem, "display" ) );5409 }5410 }5411 }5412 }5413 // Set the display of most of the elements in a second loop5414 // to avoid the constant reflow5415 for ( index = 0; index < length; index++ ) {5416 elem = elements[ index ];5417 if ( !elem.style ) {5418 continue;5419 }5420 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {5421 elem.style.display = show ? values[ index ] || "" : "none";5422 }5423 }5424 return elements;5425}5426function setPositiveNumber( elem, value, subtract ) {5427 var matches = rnumsplit.exec( value );5428 return matches ?5429 // Guard against undefined "subtract", e.g., when used as in cssHooks5430 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :5431 value;5432}5433function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {5434 var i = extra === ( isBorderBox ? "border" : "content" ) ?5435 // If we already have the right measurement, avoid augmentation5436 4 :5437 // Otherwise initialize for horizontal or vertical properties5438 name === "width" ? 1 : 0,5439 val = 0;5440 for ( ; i < 4; i += 2 ) {5441 // both box models exclude margin, so add it if we want it5442 if ( extra === "margin" ) {5443 val += jquery.css( elem, extra + cssExpand[ i ], true, styles );5444 }5445 if ( isBorderBox ) {5446 // border-box includes padding, so remove it if we want content5447 if ( extra === "content" ) {5448 val -= jquery.css( elem, "padding" + cssExpand[ i ], true, styles );5449 }5450 // at this point, extra isn't border nor margin, so remove border5451 if ( extra !== "margin" ) {5452 val -= jquery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );5453 }5454 } else {5455 // at this point, extra isn't content, so add padding5456 val += jquery.css( elem, "padding" + cssExpand[ i ], true, styles );5457 // at this point, extra isn't content nor padding, so add border5458 if ( extra !== "padding" ) {5459 val += jquery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );5460 }5461 }5462 }5463 return val;5464}5465function getWidthOrHeight( elem, name, extra ) {5466 // Start with offset property, which is equivalent to the border-box value5467 var valueIsBorderBox = true,5468 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,5469 styles = getStyles( elem ),5470 isBorderBox = support.boxSizing() && jquery.css( elem, "boxSizing", false, styles ) === "border-box";5471 // some non-html elements return undefined for offsetWidth, so check for null/undefined5472 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=6492855473 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=4916685474 if ( val <= 0 || val == null ) {5475 // Fall back to computed then uncomputed css if necessary5476 val = curCSS( elem, name, styles );5477 if ( val < 0 || val == null ) {5478 val = elem.style[ name ];5479 }5480 // Computed unit is not pixels. Stop here and return.5481 if ( rnumnonpx.test(val) ) {5482 return val;5483 }5484 // we need the check for style in case a browser which returns unreliable values5485 // for getComputedStyle silently falls back to the reliable elem.style5486 valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );5487 // Normalize "", auto, and prepare for extra5488 val = parseFloat( val ) || 0;5489 }5490 // use the active box-sizing model to add/subtract irrelevant styles5491 return ( val +5492 augmentWidthOrHeight(5493 elem,5494 name,5495 extra || ( isBorderBox ? "border" : "content" ),5496 valueIsBorderBox,5497 styles5498 )5499 ) + "px";5500}5501jquery.extend({5502 // Add in style property hooks for overriding the default5503 // behavior of getting and setting a style property5504 cssHooks: {5505 opacity: {5506 get: function( elem, computed ) {5507 if ( computed ) {5508 // We should always get a number back from opacity5509 var ret = curCSS( elem, "opacity" );5510 return ret === "" ? "1" : ret;5511 }5512 }5513 }5514 },5515 // Don't automatically add "px" to these possibly-unitless properties5516 cssNumber: {5517 "columnCount": true,5518 "fillOpacity": true,5519 "fontWeight": true,5520 "lineHeight": true,5521 "opacity": true,5522 "order": true,5523 "orphans": true,5524 "widows": true,5525 "zIndex": true,5526 "zoom": true5527 },5528 // Add in properties whose names you wish to fix before5529 // setting or getting the value5530 cssProps: {5531 // normalize float css property5532 "float": support.cssFloat ? "cssFloat" : "styleFloat"5533 },5534 // Get and set the style property on a DOM Node5535 style: function( elem, name, value, extra ) {5536 // Don't set styles on text and comment nodes5537 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {5538 return;5539 }5540 // Make sure that we're working with the right name5541 var ret, type, hooks,5542 origName = jquery.camelCase( name ),5543 style = elem.style;5544 name = jquery.cssProps[ origName ] || ( jquery.cssProps[ origName ] = vendorPropName( style, origName ) );5545 // gets hook for the prefixed version5546 // followed by the unprefixed version5547 hooks = jquery.cssHooks[ name ] || jquery.cssHooks[ origName ];5548 // Check if we're setting a value5549 if ( value !== undefined ) {5550 type = typeof value;5551 // convert relative number strings (+= or -=) to relative numbers. #73455552 if ( type === "string" && (ret = rrelNum.exec( value )) ) {5553 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jquery.css( elem, name ) );5554 // Fixes bug #92375555 type = "number";5556 }5557 // Make sure that null and NaN values aren't set. See: #71165558 if ( value == null || value !== value ) {5559 return;5560 }5561 // If a number was passed in, add 'px' to the (except for certain CSS properties)5562 if ( type === "number" && !jquery.cssNumber[ origName ] ) {5563 value += "px";5564 }5565 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,5566 // but it would mean to define eight (for every problematic property) identical functions5567 if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {5568 style[ name ] = "inherit";5569 }5570 // If a hook was provided, use that value, otherwise just set the specified value5571 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {5572 // Support: IE5573 // Swallow errors from 'invalid' CSS values (#5509)5574 try {5575 // Support: Chrome, Safari5576 // Setting style to blank string required to delete "style: x !important;"5577 style[ name ] = "";5578 style[ name ] = value;5579 } catch(e) {}5580 }5581 } else {5582 // If a hook was provided get the non-computed value from there5583 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {5584 return ret;5585 }5586 // Otherwise just get the value from the style object5587 return style[ name ];5588 }5589 },5590 css: function( elem, name, extra, styles ) {5591 var num, val, hooks,5592 origName = jquery.camelCase( name );5593 // Make sure that we're working with the right name5594 name = jquery.cssProps[ origName ] || ( jquery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );5595 // gets hook for the prefixed version5596 // followed by the unprefixed version5597 hooks = jquery.cssHooks[ name ] || jquery.cssHooks[ origName ];5598 // If a hook was provided get the computed value from there5599 if ( hooks && "get" in hooks ) {5600 val = hooks.get( elem, true, extra );5601 }5602 // Otherwise, if a way to get the computed value exists, use that5603 if ( val === undefined ) {5604 val = curCSS( elem, name, styles );5605 }5606 //convert "normal" to computed value5607 if ( val === "normal" && name in cssNormalTransform ) {5608 val = cssNormalTransform[ name ];5609 }5610 // Return, converting to number if forced or a qualifier was provided and val looks numeric5611 if ( extra === "" || extra ) {5612 num = parseFloat( val );5613 return extra === true || jquery.isNumeric( num ) ? num || 0 : val;5614 }5615 return val;5616 }5617});5618jquery.each([ "height", "width" ], function( i, name ) {5619 jquery.cssHooks[ name ] = {5620 get: function( elem, computed, extra ) {5621 if ( computed ) {5622 // certain elements can have dimension info if we invisibly show them5623 // however, it must have a current display style that would benefit from this5624 return elem.offsetWidth === 0 && rdisplayswap.test( jquery.css( elem, "display" ) ) ?5625 jquery.swap( elem, cssShow, function() {5626 return getWidthOrHeight( elem, name, extra );5627 }) :5628 getWidthOrHeight( elem, name, extra );5629 }5630 },5631 set: function( elem, value, extra ) {5632 var styles = extra && getStyles( elem );5633 return setPositiveNumber( elem, value, extra ?5634 augmentWidthOrHeight(5635 elem,5636 name,5637 extra,5638 support.boxSizing() && jquery.css( elem, "boxSizing", false, styles ) === "border-box",5639 styles5640 ) : 05641 );5642 }5643 };5644});5645if ( !support.opacity ) {5646 jquery.cssHooks.opacity = {5647 get: function( elem, computed ) {5648 // IE uses filters for opacity5649 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?5650 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :5651 computed ? "1" : "";5652 },5653 set: function( elem, value ) {5654 var style = elem.style,5655 currentStyle = elem.currentStyle,5656 opacity = jquery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",5657 filter = currentStyle && currentStyle.filter || style.filter || "";5658 // IE has trouble with opacity if it does not have layout5659 // Force it by setting the zoom level5660 style.zoom = 1;5661 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #66525662 // if value === "", then remove inline opacity #126855663 if ( ( value >= 1 || value === "" ) &&5664 jquery.trim( filter.replace( ralpha, "" ) ) === "" &&5665 style.removeAttribute ) {5666 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText5667 // if "filter:" is present at all, clearType is disabled, we want to avoid this5668 // style.removeAttribute is IE Only, but so apparently is this code path...5669 style.removeAttribute( "filter" );5670 // if there is no filter style applied in a css rule or unset inline opacity, we are done5671 if ( value === "" || currentStyle && !currentStyle.filter ) {5672 return;5673 }5674 }5675 // otherwise, set new filter values5676 style.filter = ralpha.test( filter ) ?5677 filter.replace( ralpha, opacity ) :5678 filter + " " + opacity;5679 }5680 };5681}5682jquery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,5683 function( elem, computed ) {5684 if ( computed ) {5685 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right5686 // Work around by temporarily setting element display to inline-block5687 return jquery.swap( elem, { "display": "inline-block" },5688 curCSS, [ elem, "marginRight" ] );5689 }5690 }5691);5692// These hooks are used by animate to expand properties5693jquery.each({5694 margin: "",5695 padding: "",5696 border: "Width"5697}, function( prefix, suffix ) {5698 jquery.cssHooks[ prefix + suffix ] = {5699 expand: function( value ) {5700 var i = 0,5701 expanded = {},5702 // assumes a single number if not a string5703 parts = typeof value === "string" ? value.split(" ") : [ value ];5704 for ( ; i < 4; i++ ) {5705 expanded[ prefix + cssExpand[ i ] + suffix ] =5706 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];5707 }5708 return expanded;5709 }5710 };5711 if ( !rmargin.test( prefix ) ) {5712 jquery.cssHooks[ prefix + suffix ].set = setPositiveNumber;5713 }5714});5715jquery.fn.extend({5716 css: function( name, value ) {5717 return access( this, function( elem, name, value ) {5718 var styles, len,5719 map = {},5720 i = 0;5721 if ( jquery.isArray( name ) ) {5722 styles = getStyles( elem );5723 len = name.length;5724 for ( ; i < len; i++ ) {5725 map[ name[ i ] ] = jquery.css( elem, name[ i ], false, styles );5726 }5727 return map;5728 }5729 return value !== undefined ?5730 jquery.style( elem, name, value ) :5731 jquery.css( elem, name );5732 }, name, value, arguments.length > 1 );5733 },5734 show: function() {5735 return showHide( this, true );5736 },5737 hide: function() {5738 return showHide( this );5739 },5740 toggle: function( state ) {5741 if ( typeof state === "boolean" ) {5742 return state ? this.show() : this.hide();5743 }5744 return this.each(function() {5745 if ( isHidden( this ) ) {5746 jquery( this ).show();5747 } else {5748 jquery( this ).hide();5749 }5750 });5751 }5752});5753function Tween( elem, options, prop, end, easing ) {5754 return new Tween.prototype.init( elem, options, prop, end, easing );5755}5756jquery.Tween = Tween;5757Tween.prototype = {5758 constructor: Tween,5759 init: function( elem, options, prop, end, easing, unit ) {5760 this.elem = elem;5761 this.prop = prop;5762 this.easing = easing || "swing";5763 this.options = options;5764 this.start = this.now = this.cur();5765 this.end = end;5766 this.unit = unit || ( jquery.cssNumber[ prop ] ? "" : "px" );5767 },5768 cur: function() {5769 var hooks = Tween.propHooks[ this.prop ];5770 return hooks && hooks.get ?5771 hooks.get( this ) :5772 Tween.propHooks._default.get( this );5773 },5774 run: function( percent ) {5775 var eased,5776 hooks = Tween.propHooks[ this.prop ];5777 if ( this.options.duration ) {5778 this.pos = eased = jquery.easing[ this.easing ](5779 percent, this.options.duration * percent, 0, 1, this.options.duration5780 );5781 } else {5782 this.pos = eased = percent;5783 }5784 this.now = ( this.end - this.start ) * eased + this.start;5785 if ( this.options.step ) {5786 this.options.step.call( this.elem, this.now, this );5787 }5788 if ( hooks && hooks.set ) {5789 hooks.set( this );5790 } else {5791 Tween.propHooks._default.set( this );5792 }5793 return this;5794 }5795};5796Tween.prototype.init.prototype = Tween.prototype;5797Tween.propHooks = {5798 _default: {5799 get: function( tween ) {5800 var result;5801 if ( tween.elem[ tween.prop ] != null &&5802 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {5803 return tween.elem[ tween.prop ];5804 }5805 // passing an empty string as a 3rd parameter to .css will automatically5806 // attempt a parseFloat and fallback to a string if the parse fails5807 // so, simple values such as "10px" are parsed to Float.5808 // complex values such as "rotate(1rad)" are returned as is.5809 result = jquery.css( tween.elem, tween.prop, "" );5810 // Empty strings, null, undefined and "auto" are converted to 0.5811 return !result || result === "auto" ? 0 : result;5812 },5813 set: function( tween ) {5814 // use step hook for back compat - use cssHook if its there - use .style if its5815 // available and use plain properties where available5816 if ( jquery.fx.step[ tween.prop ] ) {5817 jquery.fx.step[ tween.prop ]( tween );5818 } else if ( tween.elem.style && ( tween.elem.style[ jquery.cssProps[ tween.prop ] ] != null || jquery.cssHooks[ tween.prop ] ) ) {5819 jquery.style( tween.elem, tween.prop, tween.now + tween.unit );5820 } else {5821 tween.elem[ tween.prop ] = tween.now;5822 }5823 }5824 }5825};5826// Support: IE <=95827// Panic based approach to setting things on disconnected nodes5828Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {5829 set: function( tween ) {5830 if ( tween.elem.nodeType && tween.elem.parentNode ) {5831 tween.elem[ tween.prop ] = tween.now;5832 }5833 }5834};5835jquery.easing = {5836 linear: function( p ) {5837 return p;5838 },5839 swing: function( p ) {5840 return 0.5 - Math.cos( p * Math.PI ) / 2;5841 }5842};5843jquery.fx = Tween.prototype.init;5844// Back Compat <1.8 extension point5845jquery.fx.step = {};5846var5847 fxNow, timerId,5848 rfxtypes = /^(?:toggle|show|hide)$/,5849 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),5850 rrun = /queueHooks$/,5851 animationPrefilters = [ defaultPrefilter ],5852 tweeners = {5853 "*": [ function( prop, value ) {5854 var tween = this.createTween( prop, value ),5855 target = tween.cur(),5856 parts = rfxnum.exec( value ),5857 unit = parts && parts[ 3 ] || ( jquery.cssNumber[ prop ] ? "" : "px" ),5858 // Starting value computation is required for potential unit mismatches5859 start = ( jquery.cssNumber[ prop ] || unit !== "px" && +target ) &&5860 rfxnum.exec( jquery.css( tween.elem, prop ) ),5861 scale = 1,5862 maxIterations = 20;5863 if ( start && start[ 3 ] !== unit ) {5864 // Trust units reported by jquery.css5865 unit = unit || start[ 3 ];5866 // Make sure we update the tween properties later on5867 parts = parts || [];5868 // Iteratively approximate from a nonzero starting point5869 start = +target || 1;5870 do {5871 // If previous iteration zeroed out, double until we get *something*5872 // Use a string for doubling factor so we don't accidentally see scale as unchanged below5873 scale = scale || ".5";5874 // Adjust and apply5875 start = start / scale;5876 jquery.style( tween.elem, prop, start + unit );5877 // Update scale, tolerating zero or NaN from tween.cur()5878 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough5879 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );5880 }5881 // Update tween properties5882 if ( parts ) {5883 start = tween.start = +start || +target || 0;5884 tween.unit = unit;5885 // If a +=/-= token was provided, we're doing a relative animation5886 tween.end = parts[ 1 ] ?5887 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :5888 +parts[ 2 ];5889 }5890 return tween;5891 } ]5892 };5893// Animations created synchronously will run synchronously5894function createFxNow() {5895 setTimeout(function() {5896 fxNow = undefined;5897 });5898 return ( fxNow = jquery.now() );5899}5900// Generate parameters to create a standard animation5901function genFx( type, includeWidth ) {5902 var which,5903 attrs = { height: type },5904 i = 0;5905 // if we include width, step value is 1 to do all cssExpand values,5906 // if we don't include width, step value is 2 to skip over Left and Right5907 includeWidth = includeWidth ? 1 : 0;5908 for ( ; i < 4 ; i += 2 - includeWidth ) {5909 which = cssExpand[ i ];5910 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;5911 }5912 if ( includeWidth ) {5913 attrs.opacity = attrs.width = type;5914 }5915 return attrs;5916}5917function createTween( value, prop, animation ) {5918 var tween,5919 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),5920 index = 0,5921 length = collection.length;5922 for ( ; index < length; index++ ) {5923 if ( (tween = collection[ index ].call( animation, prop, value )) ) {5924 // we're done with this property5925 return tween;5926 }5927 }5928}5929function defaultPrefilter( elem, props, opts ) {5930 /* jshint validthis: true */5931 var prop, value, toggle, tween, hooks, oldfire, display, dDisplay,5932 anim = this,5933 orig = {},5934 style = elem.style,5935 hidden = elem.nodeType && isHidden( elem ),5936 dataShow = jquery._data( elem, "fxshow" );5937 // handle queue: false promises5938 if ( !opts.queue ) {5939 hooks = jquery._queueHooks( elem, "fx" );5940 if ( hooks.unqueued == null ) {5941 hooks.unqueued = 0;5942 oldfire = hooks.empty.fire;5943 hooks.empty.fire = function() {5944 if ( !hooks.unqueued ) {5945 oldfire();5946 }5947 };5948 }5949 hooks.unqueued++;5950 anim.always(function() {5951 // doing this makes sure that the complete handler will be called5952 // before this completes5953 anim.always(function() {5954 hooks.unqueued--;5955 if ( !jquery.queue( elem, "fx" ).length ) {5956 hooks.empty.fire();5957 }5958 });5959 });5960 }5961 // height/width overflow pass5962 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {5963 // Make sure that nothing sneaks out5964 // Record all 3 overflow attributes because IE does not5965 // change the overflow attribute when overflowX and5966 // overflowY are set to the same value5967 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];5968 // Set display property to inline-block for height/width5969 // animations on inline elements that are having width/height animated5970 display = jquery.css( elem, "display" );5971 dDisplay = defaultDisplay( elem.nodeName );5972 if ( display === "none" ) {5973 display = dDisplay;5974 }5975 if ( display === "inline" &&5976 jquery.css( elem, "float" ) === "none" ) {5977 // inline-level elements accept inline-block;5978 // block-level elements need to be inline with layout5979 if ( !support.inlineBlockNeedsLayout || dDisplay === "inline" ) {5980 style.display = "inline-block";5981 } else {5982 style.zoom = 1;5983 }5984 }5985 }5986 if ( opts.overflow ) {5987 style.overflow = "hidden";5988 if ( !support.shrinkWrapBlocks() ) {5989 anim.always(function() {5990 style.overflow = opts.overflow[ 0 ];5991 style.overflowX = opts.overflow[ 1 ];5992 style.overflowY = opts.overflow[ 2 ];5993 });5994 }5995 }5996 // show/hide pass5997 for ( prop in props ) {5998 value = props[ prop ];5999 if ( rfxtypes.exec( value ) ) {6000 delete props[ prop ];6001 toggle = toggle || value === "toggle";6002 if ( value === ( hidden ? "hide" : "show" ) ) {6003 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden6004 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {6005 hidden = true;6006 } else {6007 continue;6008 }6009 }6010 orig[ prop ] = dataShow && dataShow[ prop ] || jquery.style( elem, prop );6011 }6012 }6013 if ( !jquery.isEmptyObject( orig ) ) {6014 if ( dataShow ) {6015 if ( "hidden" in dataShow ) {6016 hidden = dataShow.hidden;6017 }6018 } else {6019 dataShow = jquery._data( elem, "fxshow", {} );6020 }6021 // store state if its toggle - enables .stop().toggle() to "reverse"6022 if ( toggle ) {6023 dataShow.hidden = !hidden;6024 }6025 if ( hidden ) {6026 jquery( elem ).show();6027 } else {6028 anim.done(function() {6029 jquery( elem ).hide();6030 });6031 }6032 anim.done(function() {6033 var prop;6034 jquery._removeData( elem, "fxshow" );6035 for ( prop in orig ) {6036 jquery.style( elem, prop, orig[ prop ] );6037 }6038 });6039 for ( prop in orig ) {6040 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );6041 if ( !( prop in dataShow ) ) {6042 dataShow[ prop ] = tween.start;6043 if ( hidden ) {6044 tween.end = tween.start;6045 tween.start = prop === "width" || prop === "height" ? 1 : 0;6046 }6047 }6048 }6049 }6050}6051function propFilter( props, specialEasing ) {6052 var index, name, easing, value, hooks;6053 // camelCase, specialEasing and expand cssHook pass6054 for ( index in props ) {6055 name = jquery.camelCase( index );6056 easing = specialEasing[ name ];6057 value = props[ index ];6058 if ( jquery.isArray( value ) ) {6059 easing = value[ 1 ];6060 value = props[ index ] = value[ 0 ];6061 }6062 if ( index !== name ) {6063 props[ name ] = value;6064 delete props[ index ];6065 }6066 hooks = jquery.cssHooks[ name ];6067 if ( hooks && "expand" in hooks ) {6068 value = hooks.expand( value );6069 delete props[ name ];6070 // not quite $.extend, this wont overwrite keys already present.6071 // also - reusing 'index' from above because we have the correct "name"6072 for ( index in value ) {6073 if ( !( index in props ) ) {6074 props[ index ] = value[ index ];6075 specialEasing[ index ] = easing;6076 }6077 }6078 } else {6079 specialEasing[ name ] = easing;6080 }6081 }6082}6083function Animation( elem, properties, options ) {6084 var result,6085 stopped,6086 index = 0,6087 length = animationPrefilters.length,6088 deferred = jquery.Deferred().always( function() {6089 // don't match elem in the :animated selector6090 delete tick.elem;6091 }),6092 tick = function() {6093 if ( stopped ) {6094 return false;6095 }6096 var currentTime = fxNow || createFxNow(),6097 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),6098 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)6099 temp = remaining / animation.duration || 0,6100 percent = 1 - temp,6101 index = 0,6102 length = animation.tweens.length;6103 for ( ; index < length ; index++ ) {6104 animation.tweens[ index ].run( percent );6105 }6106 deferred.notifyWith( elem, [ animation, percent, remaining ]);6107 if ( percent < 1 && length ) {6108 return remaining;6109 } else {6110 deferred.resolveWith( elem, [ animation ] );6111 return false;6112 }6113 },6114 animation = deferred.promise({6115 elem: elem,6116 props: jquery.extend( {}, properties ),6117 opts: jquery.extend( true, { specialEasing: {} }, options ),6118 originalProperties: properties,6119 originalOptions: options,6120 startTime: fxNow || createFxNow(),6121 duration: options.duration,6122 tweens: [],6123 createTween: function( prop, end ) {6124 var tween = jquery.Tween( elem, animation.opts, prop, end,6125 animation.opts.specialEasing[ prop ] || animation.opts.easing );6126 animation.tweens.push( tween );6127 return tween;6128 },6129 stop: function( gotoEnd ) {6130 var index = 0,6131 // if we are going to the end, we want to run all the tweens6132 // otherwise we skip this part6133 length = gotoEnd ? animation.tweens.length : 0;6134 if ( stopped ) {6135 return this;6136 }6137 stopped = true;6138 for ( ; index < length ; index++ ) {6139 animation.tweens[ index ].run( 1 );6140 }6141 // resolve when we played the last frame6142 // otherwise, reject6143 if ( gotoEnd ) {6144 deferred.resolveWith( elem, [ animation, gotoEnd ] );6145 } else {6146 deferred.rejectWith( elem, [ animation, gotoEnd ] );6147 }6148 return this;6149 }6150 }),6151 props = animation.props;6152 propFilter( props, animation.opts.specialEasing );6153 for ( ; index < length ; index++ ) {6154 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );6155 if ( result ) {6156 return result;6157 }6158 }6159 jquery.map( props, createTween, animation );6160 if ( jquery.isFunction( animation.opts.start ) ) {6161 animation.opts.start.call( elem, animation );6162 }6163 jquery.fx.timer(6164 jquery.extend( tick, {6165 elem: elem,6166 anim: animation,6167 queue: animation.opts.queue6168 })6169 );6170 // attach callbacks from options6171 return animation.progress( animation.opts.progress )6172 .done( animation.opts.done, animation.opts.complete )6173 .fail( animation.opts.fail )6174 .always( animation.opts.always );6175}6176jquery.Animation = jquery.extend( Animation, {6177 tweener: function( props, callback ) {6178 if ( jquery.isFunction( props ) ) {6179 callback = props;6180 props = [ "*" ];6181 } else {6182 props = props.split(" ");6183 }6184 var prop,6185 index = 0,6186 length = props.length;6187 for ( ; index < length ; index++ ) {6188 prop = props[ index ];6189 tweeners[ prop ] = tweeners[ prop ] || [];6190 tweeners[ prop ].unshift( callback );6191 }6192 },6193 prefilter: function( callback, prepend ) {6194 if ( prepend ) {6195 animationPrefilters.unshift( callback );6196 } else {6197 animationPrefilters.push( callback );6198 }6199 }6200});6201jquery.speed = function( speed, easing, fn ) {6202 var opt = speed && typeof speed === "object" ? jquery.extend( {}, speed ) : {6203 complete: fn || !fn && easing ||6204 jquery.isFunction( speed ) && speed,6205 duration: speed,6206 easing: fn && easing || easing && !jquery.isFunction( easing ) && easing6207 };6208 opt.duration = jquery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :6209 opt.duration in jquery.fx.speeds ? jquery.fx.speeds[ opt.duration ] : jquery.fx.speeds._default;6210 // normalize opt.queue - true/undefined/null -> "fx"6211 if ( opt.queue == null || opt.queue === true ) {6212 opt.queue = "fx";6213 }6214 // Queueing6215 opt.old = opt.complete;6216 opt.complete = function() {6217 if ( jquery.isFunction( opt.old ) ) {6218 opt.old.call( this );6219 }6220 if ( opt.queue ) {6221 jquery.dequeue( this, opt.queue );6222 }6223 };6224 return opt;6225};6226jquery.fn.extend({6227 fadeTo: function( speed, to, easing, callback ) {6228 // show any hidden elements after setting opacity to 06229 return this.filter( isHidden ).css( "opacity", 0 ).show()6230 // animate to the value specified6231 .end().animate({ opacity: to }, speed, easing, callback );6232 },6233 animate: function( prop, speed, easing, callback ) {6234 var empty = jquery.isEmptyObject( prop ),6235 optall = jquery.speed( speed, easing, callback ),6236 doAnimation = function() {6237 // Operate on a copy of prop so per-property easing won't be lost6238 var anim = Animation( this, jquery.extend( {}, prop ), optall );6239 // Empty animations, or finishing resolves immediately6240 if ( empty || jquery._data( this, "finish" ) ) {6241 anim.stop( true );6242 }6243 };6244 doAnimation.finish = doAnimation;6245 return empty || optall.queue === false ?6246 this.each( doAnimation ) :6247 this.queue( optall.queue, doAnimation );6248 },6249 stop: function( type, clearQueue, gotoEnd ) {6250 var stopQueue = function( hooks ) {6251 var stop = hooks.stop;6252 delete hooks.stop;6253 stop( gotoEnd );6254 };6255 if ( typeof type !== "string" ) {6256 gotoEnd = clearQueue;6257 clearQueue = type;6258 type = undefined;6259 }6260 if ( clearQueue && type !== false ) {6261 this.queue( type || "fx", [] );6262 }6263 return this.each(function() {6264 var dequeue = true,6265 index = type != null && type + "queueHooks",6266 timers = jquery.timers,6267 data = jquery._data( this );6268 if ( index ) {6269 if ( data[ index ] && data[ index ].stop ) {6270 stopQueue( data[ index ] );6271 }6272 } else {6273 for ( index in data ) {6274 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {6275 stopQueue( data[ index ] );6276 }6277 }6278 }6279 for ( index = timers.length; index--; ) {6280 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {6281 timers[ index ].anim.stop( gotoEnd );6282 dequeue = false;6283 timers.splice( index, 1 );6284 }6285 }6286 // start the next in the queue if the last step wasn't forced6287 // timers currently will call their complete callbacks, which will dequeue6288 // but only if they were gotoEnd6289 if ( dequeue || !gotoEnd ) {6290 jquery.dequeue( this, type );6291 }6292 });6293 },6294 finish: function( type ) {6295 if ( type !== false ) {6296 type = type || "fx";6297 }6298 return this.each(function() {6299 var index,6300 data = jquery._data( this ),6301 queue = data[ type + "queue" ],6302 hooks = data[ type + "queueHooks" ],6303 timers = jquery.timers,6304 length = queue ? queue.length : 0;6305 // enable finishing flag on private data6306 data.finish = true;6307 // empty the queue first6308 jquery.queue( this, type, [] );6309 if ( hooks && hooks.stop ) {6310 hooks.stop.call( this, true );6311 }6312 // look for any active animations, and finish them6313 for ( index = timers.length; index--; ) {6314 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {6315 timers[ index ].anim.stop( true );6316 timers.splice( index, 1 );6317 }6318 }6319 // look for any animations in the old queue and finish them6320 for ( index = 0; index < length; index++ ) {6321 if ( queue[ index ] && queue[ index ].finish ) {6322 queue[ index ].finish.call( this );6323 }6324 }6325 // turn off finishing flag6326 delete data.finish;6327 });6328 }6329});6330jquery.each([ "toggle", "show", "hide" ], function( i, name ) {6331 var cssFn = jquery.fn[ name ];6332 jquery.fn[ name ] = function( speed, easing, callback ) {6333 return speed == null || typeof speed === "boolean" ?6334 cssFn.apply( this, arguments ) :6335 this.animate( genFx( name, true ), speed, easing, callback );6336 };6337});6338// Generate shortcuts for custom animations6339jquery.each({6340 slideDown: genFx("show"),6341 slideUp: genFx("hide"),6342 slideToggle: genFx("toggle"),6343 fadeIn: { opacity: "show" },6344 fadeOut: { opacity: "hide" },6345 fadeToggle: { opacity: "toggle" }6346}, function( name, props ) {6347 jquery.fn[ name ] = function( speed, easing, callback ) {6348 return this.animate( props, speed, easing, callback );6349 };6350});6351jquery.timers = [];6352jquery.fx.tick = function() {6353 var timer,6354 timers = jquery.timers,6355 i = 0;6356 fxNow = jquery.now();6357 for ( ; i < timers.length; i++ ) {6358 timer = timers[ i ];6359 // Checks the timer has not already been removed6360 if ( !timer() && timers[ i ] === timer ) {6361 timers.splice( i--, 1 );6362 }6363 }6364 if ( !timers.length ) {6365 jquery.fx.stop();6366 }6367 fxNow = undefined;6368};6369jquery.fx.timer = function( timer ) {6370 jquery.timers.push( timer );6371 if ( timer() ) {6372 jquery.fx.start();6373 } else {6374 jquery.timers.pop();6375 }6376};6377jquery.fx.interval = 13;6378jquery.fx.start = function() {6379 if ( !timerId ) {6380 timerId = setInterval( jquery.fx.tick, jquery.fx.interval );6381 }6382};6383jquery.fx.stop = function() {6384 clearInterval( timerId );6385 timerId = null;6386};6387jquery.fx.speeds = {6388 slow: 600,6389 fast: 200,6390 // Default speed6391 _default: 4006392};6393// Based off of the plugin by Clint Helfers, with permission.6394// http://blindsignals.com/index.php/2009/07/jquery-delay/6395jquery.fn.delay = function( time, type ) {6396 time = jquery.fx ? jquery.fx.speeds[ time ] || time : time;6397 type = type || "fx";6398 return this.queue( type, function( next, hooks ) {6399 var timeout = setTimeout( next, time );6400 hooks.stop = function() {6401 clearTimeout( timeout );6402 };6403 });6404};6405(function() {6406 var a, input, select, opt,6407 div = document.createElement("div" );6408 // Setup6409 div.setAttribute( "className", "t" );6410 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";6411 a = div.getElementsByTagName("a")[ 0 ];6412 // First batch of tests.6413 select = document.createElement("select");6414 opt = select.appendChild( document.createElement("option") );6415 input = div.getElementsByTagName("input")[ 0 ];6416 a.style.cssText = "top:1px";6417 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)6418 support.getSetAttribute = div.className !== "t";6419 // Get the style information from getAttribute6420 // (IE uses .cssText instead)6421 support.style = /top/.test( a.getAttribute("style") );6422 // Make sure that URLs aren't manipulated6423 // (IE normalizes it by default)6424 support.hrefNormalized = a.getAttribute("href") === "/a";6425 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)6426 support.checkOn = !!input.value;6427 // Make sure that a selected-by-default option has a working selected property.6428 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)6429 support.optSelected = opt.selected;6430 // Tests for enctype support on a form (#6743)6431 support.enctype = !!document.createElement("form").enctype;6432 // Make sure that the options inside disabled selects aren't marked as disabled6433 // (WebKit marks them as disabled)6434 select.disabled = true;6435 support.optDisabled = !opt.disabled;6436 // Support: IE8 only6437 // Check if we can trust getAttribute("value")6438 input = document.createElement( "input" );6439 input.setAttribute( "value", "" );6440 support.input = input.getAttribute( "value" ) === "";6441 // Check if an input maintains its value after becoming a radio6442 input.value = "t";6443 input.setAttribute( "type", "radio" );6444 support.radioValue = input.value === "t";6445 // Null elements to avoid leaks in IE.6446 a = input = select = opt = div = null;6447})();6448var rreturn = /\r/g;6449jquery.fn.extend({6450 val: function( value ) {6451 var hooks, ret, isFunction,6452 elem = this[0];6453 if ( !arguments.length ) {6454 if ( elem ) {6455 hooks = jquery.valHooks[ elem.type ] || jquery.valHooks[ elem.nodeName.toLowerCase() ];6456 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {6457 return ret;6458 }6459 ret = elem.value;6460 return typeof ret === "string" ?6461 // handle most common string cases6462 ret.replace(rreturn, "") :6463 // handle cases where value is null/undef or number6464 ret == null ? "" : ret;6465 }6466 return;6467 }6468 isFunction = jquery.isFunction( value );6469 return this.each(function( i ) {6470 var val;6471 if ( this.nodeType !== 1 ) {6472 return;6473 }6474 if ( isFunction ) {6475 val = value.call( this, i, jquery( this ).val() );6476 } else {6477 val = value;6478 }6479 // Treat null/undefined as ""; convert numbers to string6480 if ( val == null ) {6481 val = "";6482 } else if ( typeof val === "number" ) {6483 val += "";6484 } else if ( jquery.isArray( val ) ) {6485 val = jquery.map( val, function( value ) {6486 return value == null ? "" : value + "";6487 });6488 }6489 hooks = jquery.valHooks[ this.type ] || jquery.valHooks[ this.nodeName.toLowerCase() ];6490 // If set returns undefined, fall back to normal setting6491 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {6492 this.value = val;6493 }6494 });6495 }6496});6497jquery.extend({6498 valHooks: {6499 option: {6500 get: function( elem ) {6501 var val = jquery.find.attr( elem, "value" );6502 return val != null ?6503 val :6504 jquery.text( elem );6505 }6506 },6507 select: {6508 get: function( elem ) {6509 var value, option,6510 options = elem.options,6511 index = elem.selectedIndex,6512 one = elem.type === "select-one" || index < 0,6513 values = one ? null : [],6514 max = one ? index + 1 : options.length,6515 i = index < 0 ?6516 max :6517 one ? index : 0;6518 // Loop through all the selected options6519 for ( ; i < max; i++ ) {6520 option = options[ i ];6521 // oldIE doesn't update selected after form reset (#2551)6522 if ( ( option.selected || i === index ) &&6523 // Don't return options that are disabled or in a disabled optgroup6524 ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&6525 ( !option.parentNode.disabled || !jquery.nodeName( option.parentNode, "optgroup" ) ) ) {6526 // Get the specific value for the option6527 value = jquery( option ).val();6528 // We don't need an array for one selects6529 if ( one ) {6530 return value;6531 }6532 // Multi-Selects return an array6533 values.push( value );6534 }6535 }6536 return values;6537 },6538 set: function( elem, value ) {6539 var optionSet, option,6540 options = elem.options,6541 values = jquery.makeArray( value ),6542 i = options.length;6543 while ( i-- ) {6544 option = options[ i ];6545 if ( jquery.inArray( jquery.valHooks.option.get( option ), values ) >= 0 ) {6546 // Support: IE66547 // When new option element is added to select box we need to6548 // force reflow of newly added node in order to workaround delay6549 // of initialization properties6550 try {6551 option.selected = optionSet = true;6552 } catch ( _ ) {6553 // Will be executed only in IE66554 option.scrollHeight;6555 }6556 } else {6557 option.selected = false;6558 }6559 }6560 // Force browsers to behave consistently when non-matching value is set6561 if ( !optionSet ) {6562 elem.selectedIndex = -1;6563 }6564 return options;6565 }6566 }6567 }6568});6569// Radios and checkboxes getter/setter6570jquery.each([ "radio", "checkbox" ], function() {6571 jquery.valHooks[ this ] = {6572 set: function( elem, value ) {6573 if ( jquery.isArray( value ) ) {6574 return ( elem.checked = jquery.inArray( jquery(elem).val(), value ) >= 0 );6575 }6576 }6577 };6578 if ( !support.checkOn ) {6579 jquery.valHooks[ this ].get = function( elem ) {6580 // Support: Webkit6581 // "" is returned instead of "on" if a value isn't specified6582 return elem.getAttribute("value") === null ? "on" : elem.value;6583 };6584 }6585});6586var nodeHook, boolHook,6587 attrHandle = jquery.expr.attrHandle,6588 ruseDefault = /^(?:checked|selected)$/i,6589 getSetAttribute = support.getSetAttribute,6590 getSetInput = support.input;6591jquery.fn.extend({6592 attr: function( name, value ) {6593 return access( this, jquery.attr, name, value, arguments.length > 1 );6594 },6595 removeAttr: function( name ) {6596 return this.each(function() {6597 jquery.removeAttr( this, name );6598 });6599 }6600});6601jquery.extend({6602 attr: function( elem, name, value ) {6603 var hooks, ret,6604 nType = elem.nodeType;6605 // don't get/set attributes on text, comment and attribute nodes6606 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {6607 return;6608 }6609 // Fallback to prop when attributes are not supported6610 if ( typeof elem.getAttribute === strundefined ) {6611 return jquery.prop( elem, name, value );6612 }6613 // All attributes are lowercase6614 // Grab necessary hook if one is defined6615 if ( nType !== 1 || !jquery.isXMLDoc( elem ) ) {6616 name = name.toLowerCase();6617 hooks = jquery.attrHooks[ name ] ||6618 ( jquery.expr.match.bool.test( name ) ? boolHook : nodeHook );6619 }6620 if ( value !== undefined ) {6621 if ( value === null ) {6622 jquery.removeAttr( elem, name );6623 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {6624 return ret;6625 } else {6626 elem.setAttribute( name, value + "" );6627 return value;6628 }6629 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {6630 return ret;6631 } else {6632 ret = jquery.find.attr( elem, name );6633 // Non-existent attributes return null, we normalize to undefined6634 return ret == null ?6635 undefined :6636 ret;6637 }6638 },6639 removeAttr: function( elem, value ) {6640 var name, propName,6641 i = 0,6642 attrNames = value && value.match( rnotwhite );6643 if ( attrNames && elem.nodeType === 1 ) {6644 while ( (name = attrNames[i++]) ) {6645 propName = jquery.propFix[ name ] || name;6646 // Boolean attributes get special treatment (#10870)6647 if ( jquery.expr.match.bool.test( name ) ) {6648 // Set corresponding property to false6649 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {6650 elem[ propName ] = false;6651 // Support: IE<96652 // Also clear defaultChecked/defaultSelected (if appropriate)6653 } else {6654 elem[ jquery.camelCase( "default-" + name ) ] =6655 elem[ propName ] = false;6656 }6657 // See #9699 for explanation of this approach (setting first, then removal)6658 } else {6659 jquery.attr( elem, name, "" );6660 }6661 elem.removeAttribute( getSetAttribute ? name : propName );6662 }6663 }6664 },6665 attrHooks: {6666 type: {6667 set: function( elem, value ) {6668 if ( !support.radioValue && value === "radio" && jquery.nodeName(elem, "input") ) {6669 // Setting the type on a radio button after the value resets the value in IE6-96670 // Reset value to default in case type is set after value during creation6671 var val = elem.value;6672 elem.setAttribute( "type", value );6673 if ( val ) {6674 elem.value = val;6675 }6676 return value;6677 }6678 }6679 }6680 }6681});6682// Hook for boolean attributes6683boolHook = {6684 set: function( elem, value, name ) {6685 if ( value === false ) {6686 // Remove boolean attributes when set to false6687 jquery.removeAttr( elem, name );6688 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {6689 // IE<8 needs the *property* name6690 elem.setAttribute( !getSetAttribute && jquery.propFix[ name ] || name, name );6691 // Use defaultChecked and defaultSelected for oldIE6692 } else {6693 elem[ jquery.camelCase( "default-" + name ) ] = elem[ name ] = true;6694 }6695 return name;6696 }6697};6698// Retrieve booleans specially6699jquery.each( jquery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {6700 var getter = attrHandle[ name ] || jquery.find.attr;6701 attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?6702 function( elem, name, isXML ) {6703 var ret, handle;6704 if ( !isXML ) {6705 // Avoid an infinite loop by temporarily removing this function from the getter6706 handle = attrHandle[ name ];6707 attrHandle[ name ] = ret;6708 ret = getter( elem, name, isXML ) != null ?6709 name.toLowerCase() :6710 null;6711 attrHandle[ name ] = handle;6712 }6713 return ret;6714 } :6715 function( elem, name, isXML ) {6716 if ( !isXML ) {6717 return elem[ jquery.camelCase( "default-" + name ) ] ?6718 name.toLowerCase() :6719 null;6720 }6721 };6722});6723// fix oldIE attroperties6724if ( !getSetInput || !getSetAttribute ) {6725 jquery.attrHooks.value = {6726 set: function( elem, value, name ) {6727 if ( jquery.nodeName( elem, "input" ) ) {6728 // Does not return so that setAttribute is also used6729 elem.defaultValue = value;6730 } else {6731 // Use nodeHook if defined (#1954); otherwise setAttribute is fine6732 return nodeHook && nodeHook.set( elem, value, name );6733 }6734 }6735 };6736}6737// IE6/7 do not support getting/setting some attributes with get/setAttribute6738if ( !getSetAttribute ) {6739 // Use this for any attribute in IE6/76740 // This fixes almost every IE6/7 issue6741 nodeHook = {6742 set: function( elem, value, name ) {6743 // Set the existing or create a new attribute node6744 var ret = elem.getAttributeNode( name );6745 if ( !ret ) {6746 elem.setAttributeNode(6747 (ret = elem.ownerDocument.createAttribute( name ))6748 );6749 }6750 ret.value = value += "";6751 // Break association with cloned elements by also using setAttribute (#9646)6752 if ( name === "value" || value === elem.getAttribute( name ) ) {6753 return value;6754 }6755 }6756 };6757 // Some attributes are constructed with empty-string values when not defined6758 attrHandle.id = attrHandle.name = attrHandle.coords =6759 function( elem, name, isXML ) {6760 var ret;6761 if ( !isXML ) {6762 return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?6763 ret.value :6764 null;6765 }6766 };6767 // Fixing value retrieval on a button requires this module6768 jquery.valHooks.button = {6769 get: function( elem, name ) {6770 var ret = elem.getAttributeNode( name );6771 if ( ret && ret.specified ) {6772 return ret.value;6773 }6774 },6775 set: nodeHook.set6776 };6777 // Set contenteditable to false on removals(#10429)6778 // Setting to empty string throws an error as an invalid value6779 jquery.attrHooks.contenteditable = {6780 set: function( elem, value, name ) {6781 nodeHook.set( elem, value === "" ? false : value, name );6782 }6783 };6784 // Set width and height to auto instead of 0 on empty string( Bug #8150 )6785 // This is for removals6786 jquery.each([ "width", "height" ], function( i, name ) {6787 jquery.attrHooks[ name ] = {6788 set: function( elem, value ) {6789 if ( value === "" ) {6790 elem.setAttribute( name, "auto" );6791 return value;6792 }6793 }6794 };6795 });6796}6797if ( !support.style ) {6798 jquery.attrHooks.style = {6799 get: function( elem ) {6800 // Return undefined in the case of empty string6801 // Note: IE uppercases css property names, but if we were to .toLowerCase()6802 // .cssText, that would destroy case senstitivity in URL's, like in "background"6803 return elem.style.cssText || undefined;6804 },6805 set: function( elem, value ) {6806 return ( elem.style.cssText = value + "" );6807 }6808 };6809}6810var rfocusable = /^(?:input|select|textarea|button|object)$/i,6811 rclickable = /^(?:a|area)$/i;6812jquery.fn.extend({6813 prop: function( name, value ) {6814 return access( this, jquery.prop, name, value, arguments.length > 1 );6815 },6816 removeProp: function( name ) {6817 name = jquery.propFix[ name ] || name;6818 return this.each(function() {6819 // try/catch handles cases where IE balks (such as removing a property on window)6820 try {6821 this[ name ] = undefined;6822 delete this[ name ];6823 } catch( e ) {}6824 });6825 }6826});6827jquery.extend({6828 propFix: {6829 "for": "htmlFor",6830 "class": "className"6831 },6832 prop: function( elem, name, value ) {6833 var ret, hooks, notxml,6834 nType = elem.nodeType;6835 // don't get/set properties on text, comment and attribute nodes6836 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {6837 return;6838 }6839 notxml = nType !== 1 || !jquery.isXMLDoc( elem );6840 if ( notxml ) {6841 // Fix name and attach hooks6842 name = jquery.propFix[ name ] || name;6843 hooks = jquery.propHooks[ name ];6844 }6845 if ( value !== undefined ) {6846 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?6847 ret :6848 ( elem[ name ] = value );6849 } else {6850 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?6851 ret :6852 elem[ name ];6853 }6854 },6855 propHooks: {6856 tabIndex: {6857 get: function( elem ) {6858 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set6859 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/6860 // Use proper attribute retrieval(#12072)6861 var tabindex = jquery.find.attr( elem, "tabindex" );6862 return tabindex ?6863 parseInt( tabindex, 10 ) :6864 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?6865 0 :6866 -1;6867 }6868 }6869 }6870});6871// Some attributes require a special call on IE6872// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx6873if ( !support.hrefNormalized ) {6874 // href/src property should get the full normalized URL (#10299/#12915)6875 jquery.each([ "href", "src" ], function( i, name ) {6876 jquery.propHooks[ name ] = {6877 get: function( elem ) {6878 return elem.getAttribute( name, 4 );6879 }6880 };6881 });6882}6883// Support: Safari, IE9+6884// mis-reports the default selected property of an option6885// Accessing the parent's selectedIndex property fixes it6886if ( !support.optSelected ) {6887 jquery.propHooks.selected = {6888 get: function( elem ) {6889 var parent = elem.parentNode;6890 if ( parent ) {6891 parent.selectedIndex;6892 // Make sure that it also works with optgroups, see #57016893 if ( parent.parentNode ) {6894 parent.parentNode.selectedIndex;6895 }6896 }6897 return null;6898 }6899 };6900}6901jquery.each([6902 "tabIndex",6903 "readOnly",6904 "maxLength",6905 "cellSpacing",6906 "cellPadding",6907 "rowSpan",6908 "colSpan",6909 "useMap",6910 "frameBorder",6911 "contentEditable"6912], function() {6913 jquery.propFix[ this.toLowerCase() ] = this;6914});6915// IE6/7 call enctype encoding6916if ( !support.enctype ) {6917 jquery.propFix.enctype = "encoding";6918}6919var rclass = /[\t\r\n\f]/g;6920jquery.fn.extend({6921 addClass: function( value ) {6922 var classes, elem, cur, clazz, j, finalValue,6923 i = 0,6924 len = this.length,6925 proceed = typeof value === "string" && value;6926 if ( jquery.isFunction( value ) ) {6927 return this.each(function( j ) {6928 jquery( this ).addClass( value.call( this, j, this.className ) );6929 });6930 }6931 if ( proceed ) {6932 // The disjunction here is for better compressibility (see removeClass)6933 classes = ( value || "" ).match( rnotwhite ) || [];6934 for ( ; i < len; i++ ) {6935 elem = this[ i ];6936 cur = elem.nodeType === 1 && ( elem.className ?6937 ( " " + elem.className + " " ).replace( rclass, " " ) :6938 " "6939 );6940 if ( cur ) {6941 j = 0;6942 while ( (clazz = classes[j++]) ) {6943 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {6944 cur += clazz + " ";6945 }6946 }6947 // only assign if different to avoid unneeded rendering.6948 finalValue = jquery.trim( cur );6949 if ( elem.className !== finalValue ) {6950 elem.className = finalValue;6951 }6952 }6953 }6954 }6955 return this;6956 },6957 removeClass: function( value ) {6958 var classes, elem, cur, clazz, j, finalValue,6959 i = 0,6960 len = this.length,6961 proceed = arguments.length === 0 || typeof value === "string" && value;6962 if ( jquery.isFunction( value ) ) {6963 return this.each(function( j ) {6964 jquery( this ).removeClass( value.call( this, j, this.className ) );6965 });6966 }6967 if ( proceed ) {6968 classes = ( value || "" ).match( rnotwhite ) || [];6969 for ( ; i < len; i++ ) {6970 elem = this[ i ];6971 // This expression is here for better compressibility (see addClass)6972 cur = elem.nodeType === 1 && ( elem.className ?6973 ( " " + elem.className + " " ).replace( rclass, " " ) :6974 ""6975 );6976 if ( cur ) {6977 j = 0;6978 while ( (clazz = classes[j++]) ) {6979 // Remove *all* instances6980 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {6981 cur = cur.replace( " " + clazz + " ", " " );6982 }6983 }6984 // only assign if different to avoid unneeded rendering.6985 finalValue = value ? jquery.trim( cur ) : "";6986 if ( elem.className !== finalValue ) {6987 elem.className = finalValue;6988 }6989 }6990 }6991 }6992 return this;6993 },6994 toggleClass: function( value, stateVal ) {6995 var type = typeof value;6996 if ( typeof stateVal === "boolean" && type === "string" ) {6997 return stateVal ? this.addClass( value ) : this.removeClass( value );6998 }6999 if ( jquery.isFunction( value ) ) {7000 return this.each(function( i ) {7001 jquery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );7002 });7003 }7004 return this.each(function() {7005 if ( type === "string" ) {7006 // toggle individual class names7007 var className,7008 i = 0,7009 self = jquery( this ),7010 classNames = value.match( rnotwhite ) || [];7011 while ( (className = classNames[ i++ ]) ) {7012 // check each className given, space separated list7013 if ( self.hasClass( className ) ) {7014 self.removeClass( className );7015 } else {7016 self.addClass( className );7017 }7018 }7019 // Toggle whole class name7020 } else if ( type === strundefined || type === "boolean" ) {7021 if ( this.className ) {7022 // store className if set7023 jquery._data( this, "__className__", this.className );7024 }7025 // If the element has a class name or if we're passed "false",7026 // then remove the whole classname (if there was one, the above saved it).7027 // Otherwise bring back whatever was previously saved (if anything),7028 // falling back to the empty string if nothing was stored.7029 this.className = this.className || value === false ? "" : jquery._data( this, "__className__" ) || "";7030 }7031 });7032 },7033 hasClass: function( selector ) {7034 var className = " " + selector + " ",7035 i = 0,7036 l = this.length;7037 for ( ; i < l; i++ ) {7038 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {7039 return true;7040 }7041 }7042 return false;7043 }7044});7045// Return jquery for attributes-only inclusion7046jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +7047 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +7048 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {7049 // Handle event binding7050 jquery.fn[ name ] = function( data, fn ) {7051 return arguments.length > 0 ?7052 this.on( name, null, data, fn ) :7053 this.trigger( name );7054 };7055});7056jquery.fn.extend({7057 hover: function( fnOver, fnOut ) {7058 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );7059 },7060 bind: function( types, data, fn ) {7061 return this.on( types, null, data, fn );7062 },7063 unbind: function( types, fn ) {7064 return this.off( types, null, fn );7065 },7066 delegate: function( selector, types, data, fn ) {7067 return this.on( types, selector, data, fn );7068 },7069 undelegate: function( selector, types, fn ) {7070 // ( namespace ) or ( selector, types [, fn] )7071 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );7072 }7073});7074var nonce = jquery.now();7075var rquery = (/\?/);7076var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;7077jquery.parseJSON = function( data ) {7078 // Attempt to parse using the native JSON parser first7079 if ( window.JSON && window.JSON.parse ) {7080 // Support: Android 2.37081 // Workaround failure to string-cast null input7082 return window.JSON.parse( data + "" );7083 }7084 var requireNonComma,7085 depth = null,7086 str = jquery.trim( data + "" );7087 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains7088 // after removing valid tokens7089 return str && !jquery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {7090 // Force termination if we see a misplaced comma7091 if ( requireNonComma && comma ) {7092 depth = 0;7093 }7094 // Perform no more replacements after returning to outermost depth7095 if ( depth === 0 ) {7096 return token;7097 }7098 // Commas must not follow "[", "{", or ","7099 requireNonComma = open || comma;7100 // Determine new depth7101 // array/object open ("[" or "{"): depth += true - false (increment)7102 // array/object close ("]" or "}"): depth += false - true (decrement)7103 // other cases ("," or primitive): depth += true - true (numeric cast)7104 depth += !close - !open;7105 // Remove this token7106 return "";7107 }) ) ?7108 ( Function( "return " + str ) )() :7109 jquery.error( "Invalid JSON: " + data );7110};7111// Cross-browser xml parsing7112jquery.parseXML = function( data ) {7113 var xml, tmp;7114 if ( !data || typeof data !== "string" ) {7115 return null;7116 }7117 try {7118 if ( window.DOMParser ) { // Standard7119 tmp = new DOMParser();7120 xml = tmp.parseFromString( data, "text/xml" );7121 } else { // IE7122 xml = new ActiveXObject( "Microsoft.XMLDOM" );7123 xml.async = "false";7124 xml.loadXML( data );7125 }7126 } catch( e ) {7127 xml = undefined;7128 }7129 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {7130 jquery.error( "Invalid XML: " + data );7131 }7132 return xml;7133};7134var7135 // Document location7136 ajaxLocParts,7137 ajaxLocation,7138 rhash = /#.*$/,7139 rts = /([?&])_=[^&]*/,7140 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL7141 // #7653, #8125, #8152: local protocol detection7142 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,7143 rnoContent = /^(?:GET|HEAD)$/,7144 rprotocol = /^\/\//,7145 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,7146 /* Prefilters7147 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)7148 * 2) These are called:7149 * - BEFORE asking for a transport7150 * - AFTER param serialization (s.data is a string if s.processData is true)7151 * 3) key is the dataType7152 * 4) the catchall symbol "*" can be used7153 * 5) execution will start with transport dataType and THEN continue down to "*" if needed7154 */7155 prefilters = {},7156 /* Transports bindings7157 * 1) key is the dataType7158 * 2) the catchall symbol "*" can be used7159 * 3) selection will start with transport dataType and THEN go to "*" if needed7160 */7161 transports = {},7162 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression7163 allTypes = "*/".concat("*");7164// #8138, IE may throw an exception when accessing7165// a field from window.location if document.domain has been set7166try {7167 ajaxLocation = location.href;7168} catch( e ) {7169 // Use the href attribute of an A element7170 // since IE will modify it given document.location7171 ajaxLocation = document.createElement( "a" );7172 ajaxLocation.href = "";7173 ajaxLocation = ajaxLocation.href;7174}7175// Segment location into parts7176ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];7177// Base "constructor" for jquery.ajaxPrefilter and jquery.ajaxTransport7178function addToPrefiltersOrTransports( structure ) {7179 // dataTypeExpression is optional and defaults to "*"7180 return function( dataTypeExpression, func ) {7181 if ( typeof dataTypeExpression !== "string" ) {7182 func = dataTypeExpression;7183 dataTypeExpression = "*";7184 }7185 var dataType,7186 i = 0,7187 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];7188 if ( jquery.isFunction( func ) ) {7189 // For each dataType in the dataTypeExpression7190 while ( (dataType = dataTypes[i++]) ) {7191 // Prepend if requested7192 if ( dataType.charAt( 0 ) === "+" ) {7193 dataType = dataType.slice( 1 ) || "*";7194 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );7195 // Otherwise append7196 } else {7197 (structure[ dataType ] = structure[ dataType ] || []).push( func );7198 }7199 }7200 }7201 };7202}7203// Base inspection function for prefilters and transports7204function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {7205 var inspected = {},7206 seekingTransport = ( structure === transports );7207 function inspect( dataType ) {7208 var selected;7209 inspected[ dataType ] = true;7210 jquery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {7211 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );7212 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {7213 options.dataTypes.unshift( dataTypeOrTransport );7214 inspect( dataTypeOrTransport );7215 return false;7216 } else if ( seekingTransport ) {7217 return !( selected = dataTypeOrTransport );7218 }7219 });7220 return selected;7221 }7222 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );7223}7224// A special extend for ajax options7225// that takes "flat" options (not to be deep extended)7226// Fixes #98877227function ajaxExtend( target, src ) {7228 var deep, key,7229 flatOptions = jquery.ajaxSettings.flatOptions || {};7230 for ( key in src ) {7231 if ( src[ key ] !== undefined ) {7232 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];7233 }7234 }7235 if ( deep ) {7236 jquery.extend( true, target, deep );7237 }7238 return target;7239}7240/* Handles responses to an ajax request:7241 * - finds the right dataType (mediates between content-type and expected dataType)7242 * - returns the corresponding response7243 */7244function ajaxHandleResponses( s, jqXHR, responses ) {7245 var firstDataType, ct, finalDataType, type,7246 contents = s.contents,7247 dataTypes = s.dataTypes;7248 // Remove auto dataType and get content-type in the process7249 while ( dataTypes[ 0 ] === "*" ) {7250 dataTypes.shift();7251 if ( ct === undefined ) {7252 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");7253 }7254 }7255 // Check if we're dealing with a known content-type7256 if ( ct ) {7257 for ( type in contents ) {7258 if ( contents[ type ] && contents[ type ].test( ct ) ) {7259 dataTypes.unshift( type );7260 break;7261 }7262 }7263 }7264 // Check to see if we have a response for the expected dataType7265 if ( dataTypes[ 0 ] in responses ) {7266 finalDataType = dataTypes[ 0 ];7267 } else {7268 // Try convertible dataTypes7269 for ( type in responses ) {7270 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {7271 finalDataType = type;7272 break;7273 }7274 if ( !firstDataType ) {7275 firstDataType = type;7276 }7277 }7278 // Or just use first one7279 finalDataType = finalDataType || firstDataType;7280 }7281 // If we found a dataType7282 // We add the dataType to the list if needed7283 // and return the corresponding response7284 if ( finalDataType ) {7285 if ( finalDataType !== dataTypes[ 0 ] ) {7286 dataTypes.unshift( finalDataType );7287 }7288 return responses[ finalDataType ];7289 }7290}7291/* Chain conversions given the request and the original response7292 * Also sets the responseXXX fields on the jqXHR instance7293 */7294function ajaxConvert( s, response, jqXHR, isSuccess ) {7295 var conv2, current, conv, tmp, prev,7296 converters = {},7297 // Work with a copy of dataTypes in case we need to modify it for conversion7298 dataTypes = s.dataTypes.slice();7299 // Create converters map with lowercased keys7300 if ( dataTypes[ 1 ] ) {7301 for ( conv in s.converters ) {7302 converters[ conv.toLowerCase() ] = s.converters[ conv ];7303 }7304 }7305 current = dataTypes.shift();7306 // Convert to each sequential dataType7307 while ( current ) {7308 if ( s.responseFields[ current ] ) {7309 jqXHR[ s.responseFields[ current ] ] = response;7310 }7311 // Apply the dataFilter if provided7312 if ( !prev && isSuccess && s.dataFilter ) {7313 response = s.dataFilter( response, s.dataType );7314 }7315 prev = current;7316 current = dataTypes.shift();7317 if ( current ) {7318 // There's only work to do if current dataType is non-auto7319 if ( current === "*" ) {7320 current = prev;7321 // Convert response if prev dataType is non-auto and differs from current7322 } else if ( prev !== "*" && prev !== current ) {7323 // Seek a direct converter7324 conv = converters[ prev + " " + current ] || converters[ "* " + current ];7325 // If none found, seek a pair7326 if ( !conv ) {7327 for ( conv2 in converters ) {7328 // If conv2 outputs current7329 tmp = conv2.split( " " );7330 if ( tmp[ 1 ] === current ) {7331 // If prev can be converted to accepted input7332 conv = converters[ prev + " " + tmp[ 0 ] ] ||7333 converters[ "* " + tmp[ 0 ] ];7334 if ( conv ) {7335 // Condense equivalence converters7336 if ( conv === true ) {7337 conv = converters[ conv2 ];7338 // Otherwise, insert the intermediate dataType7339 } else if ( converters[ conv2 ] !== true ) {7340 current = tmp[ 0 ];7341 dataTypes.unshift( tmp[ 1 ] );7342 }7343 break;7344 }7345 }7346 }7347 }7348 // Apply converter (if not an equivalence)7349 if ( conv !== true ) {7350 // Unless errors are allowed to bubble, catch and return them7351 if ( conv && s[ "throws" ] ) {7352 response = conv( response );7353 } else {7354 try {7355 response = conv( response );7356 } catch ( e ) {7357 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };7358 }7359 }7360 }7361 }7362 }7363 }7364 return { state: "success", data: response };7365}7366jquery.extend({7367 // Counter for holding the number of active queries7368 active: 0,7369 // Last-Modified header cache for next request7370 lastModified: {},7371 etag: {},7372 ajaxSettings: {7373 url: ajaxLocation,7374 type: "GET",7375 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),7376 global: true,7377 processData: true,7378 async: true,7379 contentType: "application/x-www-form-urlencoded; charset=UTF-8",7380 /*7381 timeout: 0,7382 data: null,7383 dataType: null,7384 username: null,7385 password: null,7386 cache: null,7387 throws: false,7388 traditional: false,7389 headers: {},7390 */7391 accepts: {7392 "*": allTypes,7393 text: "text/plain",7394 html: "text/html",7395 xml: "application/xml, text/xml",7396 json: "application/json, text/javascript"7397 },7398 contents: {7399 xml: /xml/,7400 html: /html/,7401 json: /json/7402 },7403 responseFields: {7404 xml: "responseXML",7405 text: "responseText",7406 json: "responseJSON"7407 },7408 // Data converters7409 // Keys separate source (or catchall "*") and destination types with a single space7410 converters: {7411 // Convert anything to text7412 "* text": String,7413 // Text to html (true = no transformation)7414 "text html": true,7415 // Evaluate text as a json expression7416 "text json": jquery.parseJSON,7417 // Parse text as xml7418 "text xml": jquery.parseXML7419 },7420 // For options that shouldn't be deep extended:7421 // you can add your own custom options here if7422 // and when you create one that shouldn't be7423 // deep extended (see ajaxExtend)7424 flatOptions: {7425 url: true,7426 context: true7427 }7428 },7429 // Creates a full fledged settings object into target7430 // with both ajaxSettings and settings fields.7431 // If target is omitted, writes into ajaxSettings.7432 ajaxSetup: function( target, settings ) {7433 return settings ?7434 // Building a settings object7435 ajaxExtend( ajaxExtend( target, jquery.ajaxSettings ), settings ) :7436 // Extending ajaxSettings7437 ajaxExtend( jquery.ajaxSettings, target );7438 },7439 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),7440 ajaxTransport: addToPrefiltersOrTransports( transports ),7441 // Main method7442 ajax: function( url, options ) {7443 // If url is an object, simulate pre-1.5 signature7444 if ( typeof url === "object" ) {7445 options = url;7446 url = undefined;7447 }7448 // Force options to be an object7449 options = options || {};7450 var // Cross-domain detection vars7451 parts,7452 // Loop variable7453 i,7454 // URL without anti-cache param7455 cacheURL,7456 // Response headers as string7457 responseHeadersString,7458 // timeout handle7459 timeoutTimer,7460 // To know if global events are to be dispatched7461 fireGlobals,7462 transport,7463 // Response headers7464 responseHeaders,7465 // Create the final options object7466 s = jquery.ajaxSetup( {}, options ),7467 // Callbacks context7468 callbackContext = s.context || s,7469 // Context for global events is callbackContext if it is a DOM node or jquery collection7470 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?7471 jquery( callbackContext ) :7472 jquery.event,7473 // Deferreds7474 deferred = jquery.Deferred(),7475 completeDeferred = jquery.Callbacks("once memory"),7476 // Status-dependent callbacks7477 statusCode = s.statusCode || {},7478 // Headers (they are sent all at once)7479 requestHeaders = {},7480 requestHeadersNames = {},7481 // The jqXHR state7482 state = 0,7483 // Default abort message7484 strAbort = "canceled",7485 // Fake xhr7486 jqXHR = {7487 readyState: 0,7488 // Builds headers hashtable if needed7489 getResponseHeader: function( key ) {7490 var match;7491 if ( state === 2 ) {7492 if ( !responseHeaders ) {7493 responseHeaders = {};7494 while ( (match = rheaders.exec( responseHeadersString )) ) {7495 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];7496 }7497 }7498 match = responseHeaders[ key.toLowerCase() ];7499 }7500 return match == null ? null : match;7501 },7502 // Raw string7503 getAllResponseHeaders: function() {7504 return state === 2 ? responseHeadersString : null;7505 },7506 // Caches the header7507 setRequestHeader: function( name, value ) {7508 var lname = name.toLowerCase();7509 if ( !state ) {7510 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;7511 requestHeaders[ name ] = value;7512 }7513 return this;7514 },7515 // Overrides response content-type header7516 overrideMimeType: function( type ) {7517 if ( !state ) {7518 s.mimeType = type;7519 }7520 return this;7521 },7522 // Status-dependent callbacks7523 statusCode: function( map ) {7524 var code;7525 if ( map ) {7526 if ( state < 2 ) {7527 for ( code in map ) {7528 // Lazy-add the new callback in a way that preserves old ones7529 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];7530 }7531 } else {7532 // Execute the appropriate callbacks7533 jqXHR.always( map[ jqXHR.status ] );7534 }7535 }7536 return this;7537 },7538 // Cancel the request7539 abort: function( statusText ) {7540 var finalText = statusText || strAbort;7541 if ( transport ) {7542 transport.abort( finalText );7543 }7544 done( 0, finalText );7545 return this;7546 }7547 };7548 // Attach deferreds7549 deferred.promise( jqXHR ).complete = completeDeferred.add;7550 jqXHR.success = jqXHR.done;7551 jqXHR.error = jqXHR.fail;7552 // Remove hash character (#7531: and string promotion)7553 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)7554 // Handle falsy url in the settings object (#10093: consistency with old signature)7555 // We also use the url parameter if available7556 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );7557 // Alias method option to type as per ticket #120047558 s.type = options.method || options.type || s.method || s.type;7559 // Extract dataTypes list7560 s.dataTypes = jquery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];7561 // A cross-domain request is in order when we have a protocol:host:port mismatch7562 if ( s.crossDomain == null ) {7563 parts = rurl.exec( s.url.toLowerCase() );7564 s.crossDomain = !!( parts &&7565 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||7566 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==7567 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )7568 );7569 }7570 // Convert data if not already a string7571 if ( s.data && s.processData && typeof s.data !== "string" ) {7572 s.data = jquery.param( s.data, s.traditional );7573 }7574 // Apply prefilters7575 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );7576 // If request was aborted inside a prefilter, stop there7577 if ( state === 2 ) {7578 return jqXHR;7579 }7580 // We can fire global events as of now if asked to7581 fireGlobals = s.global;7582 // Watch for a new set of requests7583 if ( fireGlobals && jquery.active++ === 0 ) {7584 jquery.event.trigger("ajaxStart");7585 }7586 // Uppercase the type7587 s.type = s.type.toUpperCase();7588 // Determine if request has content7589 s.hasContent = !rnoContent.test( s.type );7590 // Save the URL in case we're toying with the If-Modified-Since7591 // and/or If-None-Match header later on7592 cacheURL = s.url;7593 // More options handling for requests with no content7594 if ( !s.hasContent ) {7595 // If data is available, append data to url7596 if ( s.data ) {7597 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );7598 // #9682: remove data so that it's not used in an eventual retry7599 delete s.data;7600 }7601 // Add anti-cache in url if needed7602 if ( s.cache === false ) {7603 s.url = rts.test( cacheURL ) ?7604 // If there is already a '_' parameter, set its value7605 cacheURL.replace( rts, "$1_=" + nonce++ ) :7606 // Otherwise add one to the end7607 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;7608 }7609 }7610 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.7611 if ( s.ifModified ) {7612 if ( jquery.lastModified[ cacheURL ] ) {7613 jqXHR.setRequestHeader( "If-Modified-Since", jquery.lastModified[ cacheURL ] );7614 }7615 if ( jquery.etag[ cacheURL ] ) {7616 jqXHR.setRequestHeader( "If-None-Match", jquery.etag[ cacheURL ] );7617 }7618 }7619 // Set the correct header, if data is being sent7620 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {7621 jqXHR.setRequestHeader( "Content-Type", s.contentType );7622 }7623 // Set the Accepts header for the server, depending on the dataType7624 jqXHR.setRequestHeader(7625 "Accept",7626 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?7627 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :7628 s.accepts[ "*" ]7629 );7630 // Check for headers option7631 for ( i in s.headers ) {7632 jqXHR.setRequestHeader( i, s.headers[ i ] );7633 }7634 // Allow custom headers/mimetypes and early abort7635 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {7636 // Abort if not done already and return7637 return jqXHR.abort();7638 }7639 // aborting is no longer a cancellation7640 strAbort = "abort";7641 // Install callbacks on deferreds7642 for ( i in { success: 1, error: 1, complete: 1 } ) {7643 jqXHR[ i ]( s[ i ] );7644 }7645 // Get transport7646 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );7647 // If no transport, we auto-abort7648 if ( !transport ) {7649 done( -1, "No Transport" );7650 } else {7651 jqXHR.readyState = 1;7652 // Send global event7653 if ( fireGlobals ) {7654 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );7655 }7656 // Timeout7657 if ( s.async && s.timeout > 0 ) {7658 timeoutTimer = setTimeout(function() {7659 jqXHR.abort("timeout");7660 }, s.timeout );7661 }7662 try {7663 state = 1;7664 transport.send( requestHeaders, done );7665 } catch ( e ) {7666 // Propagate exception as error if not done7667 if ( state < 2 ) {7668 done( -1, e );7669 // Simply rethrow otherwise7670 } else {7671 throw e;7672 }7673 }7674 }7675 // Callback for when everything is done7676 function done( status, nativeStatusText, responses, headers ) {7677 var isSuccess, success, error, response, modified,7678 statusText = nativeStatusText;7679 // Called once7680 if ( state === 2 ) {7681 return;7682 }7683 // State is "done" now7684 state = 2;7685 // Clear timeout if it exists7686 if ( timeoutTimer ) {7687 clearTimeout( timeoutTimer );7688 }7689 // Dereference transport for early garbage collection7690 // (no matter how long the jqXHR object will be used)7691 transport = undefined;7692 // Cache response headers7693 responseHeadersString = headers || "";7694 // Set readyState7695 jqXHR.readyState = status > 0 ? 4 : 0;7696 // Determine if successful7697 isSuccess = status >= 200 && status < 300 || status === 304;7698 // Get response data7699 if ( responses ) {7700 response = ajaxHandleResponses( s, jqXHR, responses );7701 }7702 // Convert no matter what (that way responseXXX fields are always set)7703 response = ajaxConvert( s, response, jqXHR, isSuccess );7704 // If successful, handle type chaining7705 if ( isSuccess ) {7706 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.7707 if ( s.ifModified ) {7708 modified = jqXHR.getResponseHeader("Last-Modified");7709 if ( modified ) {7710 jquery.lastModified[ cacheURL ] = modified;7711 }7712 modified = jqXHR.getResponseHeader("etag");7713 if ( modified ) {7714 jquery.etag[ cacheURL ] = modified;7715 }7716 }7717 // if no content7718 if ( status === 204 || s.type === "HEAD" ) {7719 statusText = "nocontent";7720 // if not modified7721 } else if ( status === 304 ) {7722 statusText = "notmodified";7723 // If we have data, let's convert it7724 } else {7725 statusText = response.state;7726 success = response.data;7727 error = response.error;7728 isSuccess = !error;7729 }7730 } else {7731 // We extract error from statusText7732 // then normalize statusText and status for non-aborts7733 error = statusText;7734 if ( status || !statusText ) {7735 statusText = "error";7736 if ( status < 0 ) {7737 status = 0;7738 }7739 }7740 }7741 // Set data for the fake xhr object7742 jqXHR.status = status;7743 jqXHR.statusText = ( nativeStatusText || statusText ) + "";7744 // Success/Error7745 if ( isSuccess ) {7746 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );7747 } else {7748 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );7749 }7750 // Status-dependent callbacks7751 jqXHR.statusCode( statusCode );7752 statusCode = undefined;7753 if ( fireGlobals ) {7754 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",7755 [ jqXHR, s, isSuccess ? success : error ] );7756 }7757 // Complete7758 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );7759 if ( fireGlobals ) {7760 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );7761 // Handle the global AJAX counter7762 if ( !( --jquery.active ) ) {7763 jquery.event.trigger("ajaxStop");7764 }7765 }7766 }7767 return jqXHR;7768 },7769 getJSON: function( url, data, callback ) {7770 return jquery.get( url, data, callback, "json" );7771 },7772 getScript: function( url, callback ) {7773 return jquery.get( url, undefined, callback, "script" );7774 }7775});7776jquery.each( [ "get", "post" ], function( i, method ) {7777 jquery[ method ] = function( url, data, callback, type ) {7778 // shift arguments if data argument was omitted7779 if ( jquery.isFunction( data ) ) {7780 type = type || callback;7781 callback = data;7782 data = undefined;7783 }7784 return jquery.ajax({7785 url: url,7786 type: method,7787 dataType: type,7788 data: data,7789 success: callback7790 });7791 };7792});7793// Attach a bunch of functions for handling common AJAX events7794jquery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {7795 jquery.fn[ type ] = function( fn ) {7796 return this.on( type, fn );7797 };7798});7799jquery._evalUrl = function( url ) {7800 return jquery.ajax({7801 url: url,7802 type: "GET",7803 dataType: "script",7804 async: false,7805 global: false,7806 "throws": true7807 });7808};7809jquery.fn.extend({7810 wrapAll: function( html ) {7811 if ( jquery.isFunction( html ) ) {7812 return this.each(function(i) {7813 jquery(this).wrapAll( html.call(this, i) );7814 });7815 }7816 if ( this[0] ) {7817 // The elements to wrap the target around7818 var wrap = jquery( html, this[0].ownerDocument ).eq(0).clone(true);7819 if ( this[0].parentNode ) {7820 wrap.insertBefore( this[0] );7821 }7822 wrap.map(function() {7823 var elem = this;7824 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {7825 elem = elem.firstChild;7826 }7827 return elem;7828 }).append( this );7829 }7830 return this;7831 },7832 wrapInner: function( html ) {7833 if ( jquery.isFunction( html ) ) {7834 return this.each(function(i) {7835 jquery(this).wrapInner( html.call(this, i) );7836 });7837 }7838 return this.each(function() {7839 var self = jquery( this ),7840 contents = self.contents();7841 if ( contents.length ) {7842 contents.wrapAll( html );7843 } else {7844 self.append( html );7845 }7846 });7847 },7848 wrap: function( html ) {7849 var isFunction = jquery.isFunction( html );7850 return this.each(function(i) {7851 jquery( this ).wrapAll( isFunction ? html.call(this, i) : html );7852 });7853 },7854 unwrap: function() {7855 return this.parent().each(function() {7856 if ( !jquery.nodeName( this, "body" ) ) {7857 jquery( this ).replaceWith( this.childNodes );7858 }7859 }).end();7860 }7861});7862jquery.expr.filters.hidden = function( elem ) {7863 // Support: Opera <= 12.127864 // Opera reports offsetWidths and offsetHeights less than zero on some elements7865 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||7866 (!support.reliableHiddenOffsets() &&7867 ((elem.style && elem.style.display) || jquery.css( elem, "display" )) === "none");7868};7869jquery.expr.filters.visible = function( elem ) {7870 return !jquery.expr.filters.hidden( elem );7871};7872var r20 = /%20/g,7873 rbracket = /\[\]$/,7874 rCRLF = /\r?\n/g,7875 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,7876 rsubmittable = /^(?:input|select|textarea|keygen)/i;7877function buildParams( prefix, obj, traditional, add ) {7878 var name;7879 if ( jquery.isArray( obj ) ) {7880 // Serialize array item.7881 jquery.each( obj, function( i, v ) {7882 if ( traditional || rbracket.test( prefix ) ) {7883 // Treat each array item as a scalar.7884 add( prefix, v );7885 } else {7886 // Item is non-scalar (array or object), encode its numeric index.7887 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );7888 }7889 });7890 } else if ( !traditional && jquery.type( obj ) === "object" ) {7891 // Serialize object item.7892 for ( name in obj ) {7893 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );7894 }7895 } else {7896 // Serialize scalar item.7897 add( prefix, obj );7898 }7899}7900// Serialize an array of form elements or a set of7901// key/values into a query string7902jquery.param = function( a, traditional ) {7903 var prefix,7904 s = [],7905 add = function( key, value ) {7906 // If value is a function, invoke it and return its value7907 value = jquery.isFunction( value ) ? value() : ( value == null ? "" : value );7908 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );7909 };7910 // Set traditional to true for jquery <= 1.3.2 behavior.7911 if ( traditional === undefined ) {7912 traditional = jquery.ajaxSettings && jquery.ajaxSettings.traditional;7913 }7914 // If an array was passed in, assume that it is an array of form elements.7915 if ( jquery.isArray( a ) || ( a.jquery && !jquery.isPlainObject( a ) ) ) {7916 // Serialize the form elements7917 jquery.each( a, function() {7918 add( this.name, this.value );7919 });7920 } else {7921 // If traditional, encode the "old" way (the way 1.3.2 or older7922 // did it), otherwise encode params recursively.7923 for ( prefix in a ) {7924 buildParams( prefix, a[ prefix ], traditional, add );7925 }7926 }7927 // Return the resulting serialization7928 return s.join( "&" ).replace( r20, "+" );7929};7930jquery.fn.extend({7931 serialize: function() {7932 return jquery.param( this.serializeArray() );7933 },7934 serializeArray: function() {7935 return this.map(function() {7936 // Can add propHook for "elements" to filter or add form elements7937 var elements = jquery.prop( this, "elements" );7938 return elements ? jquery.makeArray( elements ) : this;7939 })7940 .filter(function() {7941 var type = this.type;7942 // Use .is(":disabled") so that fieldset[disabled] works7943 return this.name && !jquery( this ).is( ":disabled" ) &&7944 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&7945 ( this.checked || !rcheckableType.test( type ) );7946 })7947 .map(function( i, elem ) {7948 var val = jquery( this ).val();7949 return val == null ?7950 null :7951 jquery.isArray( val ) ?7952 jquery.map( val, function( val ) {7953 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };7954 }) :7955 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };7956 }).get();7957 }7958});7959// Create the request object7960// (This is still attached to ajaxSettings for backward compatibility)7961jquery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?7962 // Support: IE6+7963 function() {7964 // XHR cannot access local files, always use ActiveX for that case7965 return !this.isLocal &&7966 // Support: IE7-87967 // oldIE XHR does not support non-RFC2616 methods (#13240)7968 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx7969 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec97970 // Although this check for six methods instead of eight7971 // since IE also does not support "trace" and "connect"7972 /^(get|post|head|put|delete|options)$/i.test( this.type ) &&7973 createStandardXHR() || createActiveXHR();7974 } :7975 // For all other browsers, use the standard XMLHttpRequest object7976 createStandardXHR;7977var xhrId = 0,7978 xhrCallbacks = {},7979 xhrSupported = jquery.ajaxSettings.xhr();7980// Support: IE<107981// Open requests must be manually aborted on unload (#5280)7982if ( window.ActiveXObject ) {7983 jquery( window ).on( "unload", function() {7984 for ( var key in xhrCallbacks ) {7985 xhrCallbacks[ key ]( undefined, true );7986 }7987 });7988}7989// Determine support properties7990support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );7991xhrSupported = support.ajax = !!xhrSupported;7992// Create transport if the browser can provide an xhr7993if ( xhrSupported ) {7994 jquery.ajaxTransport(function( options ) {7995 // Cross domain only allowed if supported through XMLHttpRequest7996 if ( !options.crossDomain || support.cors ) {7997 var callback;7998 return {7999 send: function( headers, complete ) {8000 var i,8001 xhr = options.xhr(),8002 id = ++xhrId;8003 // Open the socket8004 xhr.open( options.type, options.url, options.async, options.username, options.password );8005 // Apply custom fields if provided8006 if ( options.xhrFields ) {8007 for ( i in options.xhrFields ) {8008 xhr[ i ] = options.xhrFields[ i ];8009 }8010 }8011 // Override mime type if needed8012 if ( options.mimeType && xhr.overrideMimeType ) {8013 xhr.overrideMimeType( options.mimeType );8014 }8015 // X-Requested-With header8016 // For cross-domain requests, seeing as conditions for a preflight are8017 // akin to a jigsaw puzzle, we simply never set it to be sure.8018 // (it can always be set on a per-request basis or even using ajaxSetup)8019 // For same-domain requests, won't change header if already provided.8020 if ( !options.crossDomain && !headers["X-Requested-With"] ) {8021 headers["X-Requested-With"] = "XMLHttpRequest";8022 }8023 // Set headers8024 for ( i in headers ) {8025 // Support: IE<98026 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting8027 // request header to a null-value.8028 //8029 // To keep consistent with other XHR implementations, cast the value8030 // to string and ignore `undefined`.8031 if ( headers[ i ] !== undefined ) {8032 xhr.setRequestHeader( i, headers[ i ] + "" );8033 }8034 }8035 // Do send the request8036 // This may raise an exception which is actually8037 // handled in jquery.ajax (so no try/catch here)8038 xhr.send( ( options.hasContent && options.data ) || null );8039 // Listener8040 callback = function( _, isAbort ) {8041 var status, statusText, responses;8042 // Was never called and is aborted or complete8043 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {8044 // Clean up8045 delete xhrCallbacks[ id ];8046 callback = undefined;8047 xhr.onreadystatechange = jquery.noop;8048 // Abort manually if needed8049 if ( isAbort ) {8050 if ( xhr.readyState !== 4 ) {8051 xhr.abort();8052 }8053 } else {8054 responses = {};8055 status = xhr.status;8056 // Support: IE<108057 // Accessing binary-data responseText throws an exception8058 // (#11426)8059 if ( typeof xhr.responseText === "string" ) {8060 responses.text = xhr.responseText;8061 }8062 // Firefox throws an exception when accessing8063 // statusText for faulty cross-domain requests8064 try {8065 statusText = xhr.statusText;8066 } catch( e ) {8067 // We normalize with Webkit giving an empty statusText8068 statusText = "";8069 }8070 // Filter status for non standard behaviors8071 // If the request is local and we have data: assume a success8072 // (success with no data won't get notified, that's the best we8073 // can do given current implementations)8074 if ( !status && options.isLocal && !options.crossDomain ) {8075 status = responses.text ? 200 : 404;8076 // IE - #1450: sometimes returns 1223 when it should be 2048077 } else if ( status === 1223 ) {8078 status = 204;8079 }8080 }8081 }8082 // Call complete if needed8083 if ( responses ) {8084 complete( status, statusText, responses, xhr.getAllResponseHeaders() );8085 }8086 };8087 if ( !options.async ) {8088 // if we're in sync mode we fire the callback8089 callback();8090 } else if ( xhr.readyState === 4 ) {8091 // (IE6 & IE7) if it's in cache and has been8092 // retrieved directly we need to fire the callback8093 setTimeout( callback );8094 } else {8095 // Add to the list of active xhr callbacks8096 xhr.onreadystatechange = xhrCallbacks[ id ] = callback;8097 }8098 },8099 abort: function() {8100 if ( callback ) {8101 callback( undefined, true );8102 }8103 }8104 };8105 }8106 });8107}8108// Functions to create xhrs8109function createStandardXHR() {8110 try {8111 return new window.XMLHttpRequest();8112 } catch( e ) {}8113}8114function createActiveXHR() {8115 try {8116 return new window.ActiveXObject( "Microsoft.XMLHTTP" );8117 } catch( e ) {}8118}8119// Install script dataType8120jquery.ajaxSetup({8121 accepts: {8122 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"8123 },8124 contents: {8125 script: /(?:java|ecma)script/8126 },8127 converters: {8128 "text script": function( text ) {8129 jquery.globalEval( text );8130 return text;8131 }8132 }8133});8134// Handle cache's special case and global8135jquery.ajaxPrefilter( "script", function( s ) {8136 if ( s.cache === undefined ) {8137 s.cache = false;8138 }8139 if ( s.crossDomain ) {8140 s.type = "GET";8141 s.global = false;8142 }8143});8144// Bind script tag hack transport8145jquery.ajaxTransport( "script", function(s) {8146 // This transport only deals with cross domain requests8147 if ( s.crossDomain ) {8148 var script,8149 head = document.head || jquery("head")[0] || document.documentElement;8150 return {8151 send: function( _, callback ) {8152 script = document.createElement("script");8153 script.async = true;8154 if ( s.scriptCharset ) {8155 script.charset = s.scriptCharset;8156 }8157 script.src = s.url;8158 // Attach handlers for all browsers8159 script.onload = script.onreadystatechange = function( _, isAbort ) {8160 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {8161 // Handle memory leak in IE8162 script.onload = script.onreadystatechange = null;8163 // Remove the script8164 if ( script.parentNode ) {8165 script.parentNode.removeChild( script );8166 }8167 // Dereference the script8168 script = null;8169 // Callback if not abort8170 if ( !isAbort ) {8171 callback( 200, "success" );8172 }8173 }8174 };8175 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending8176 // Use native DOM manipulation to avoid our domManip AJAX trickery8177 head.insertBefore( script, head.firstChild );8178 },8179 abort: function() {8180 if ( script ) {8181 script.onload( undefined, true );8182 }8183 }8184 };8185 }8186});8187var oldCallbacks = [],8188 rjsonp = /(=)\?(?=&|$)|\?\?/;8189// Default jsonp settings8190jquery.ajaxSetup({8191 jsonp: "callback",8192 jsonpCallback: function() {8193 var callback = oldCallbacks.pop() || ( jquery.expando + "_" + ( nonce++ ) );8194 this[ callback ] = true;8195 return callback;8196 }8197});8198// Detect, normalize options and install callbacks for jsonp requests8199jquery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {8200 var callbackName, overwritten, responseContainer,8201 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?8202 "url" :8203 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"8204 );8205 // Handle iff the expected data type is "jsonp" or we have a parameter to set8206 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {8207 // Get callback name, remembering preexisting value associated with it8208 callbackName = s.jsonpCallback = jquery.isFunction( s.jsonpCallback ) ?8209 s.jsonpCallback() :8210 s.jsonpCallback;8211 // Insert callback into url or form data8212 if ( jsonProp ) {8213 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );8214 } else if ( s.jsonp !== false ) {8215 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;8216 }8217 // Use data converter to retrieve json after script execution8218 s.converters["script json"] = function() {8219 if ( !responseContainer ) {8220 jquery.error( callbackName + " was not called" );8221 }8222 return responseContainer[ 0 ];8223 };8224 // force json dataType8225 s.dataTypes[ 0 ] = "json";8226 // Install callback8227 overwritten = window[ callbackName ];8228 window[ callbackName ] = function() {8229 responseContainer = arguments;8230 };8231 // Clean-up function (fires after converters)8232 jqXHR.always(function() {8233 // Restore preexisting value8234 window[ callbackName ] = overwritten;8235 // Save back as free8236 if ( s[ callbackName ] ) {8237 // make sure that re-using the options doesn't screw things around8238 s.jsonpCallback = originalSettings.jsonpCallback;8239 // save the callback name for future use8240 oldCallbacks.push( callbackName );8241 }8242 // Call if it was a function and we have a response8243 if ( responseContainer && jquery.isFunction( overwritten ) ) {8244 overwritten( responseContainer[ 0 ] );8245 }8246 responseContainer = overwritten = undefined;8247 });8248 // Delegate to script8249 return "script";8250 }8251});8252// data: string of html8253// context (optional): If specified, the fragment will be created in this context, defaults to document8254// keepScripts (optional): If true, will include scripts passed in the html string8255jquery.parseHTML = function( data, context, keepScripts ) {8256 if ( !data || typeof data !== "string" ) {8257 return null;8258 }8259 if ( typeof context === "boolean" ) {8260 keepScripts = context;8261 context = false;8262 }8263 context = context || document;8264 var parsed = rsingleTag.exec( data ),8265 scripts = !keepScripts && [];8266 // Single tag8267 if ( parsed ) {8268 return [ context.createElement( parsed[1] ) ];8269 }8270 parsed = jquery.buildFragment( [ data ], context, scripts );8271 if ( scripts && scripts.length ) {8272 jquery( scripts ).remove();8273 }8274 return jquery.merge( [], parsed.childNodes );8275};8276// Keep a copy of the old load method8277var _load = jquery.fn.load;8278/**8279 * Load a url into a page8280 */8281jquery.fn.load = function( url, params, callback ) {8282 if ( typeof url !== "string" && _load ) {8283 return _load.apply( this, arguments );8284 }8285 var selector, response, type,8286 self = this,8287 off = url.indexOf(" ");8288 if ( off >= 0 ) {8289 selector = url.slice( off, url.length );8290 url = url.slice( 0, off );8291 }8292 // If it's a function8293 if ( jquery.isFunction( params ) ) {8294 // We assume that it's the callback8295 callback = params;8296 params = undefined;8297 // Otherwise, build a param string8298 } else if ( params && typeof params === "object" ) {8299 type = "POST";8300 }8301 // If we have elements to modify, make the request8302 if ( self.length > 0 ) {8303 jquery.ajax({8304 url: url,8305 // if "type" variable is undefined, then "GET" method will be used8306 type: type,8307 dataType: "html",8308 data: params8309 }).done(function( responseText ) {8310 // Save response for use in complete callback8311 response = arguments;8312 self.html( selector ?8313 // If a selector was specified, locate the right elements in a dummy div8314 // Exclude scripts to avoid IE 'Permission Denied' errors8315 jquery("<div>").append( jquery.parseHTML( responseText ) ).find( selector ) :8316 // Otherwise use the full result8317 responseText );8318 }).complete( callback && function( jqXHR, status ) {8319 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );8320 });8321 }8322 return this;8323};8324jquery.expr.filters.animated = function( elem ) {8325 return jquery.grep(jquery.timers, function( fn ) {8326 return elem === fn.elem;8327 }).length;8328};8329var docElem = window.document.documentElement;8330/**8331 * Gets a window from an element8332 */8333function getWindow( elem ) {8334 return jquery.isWindow( elem ) ?8335 elem :8336 elem.nodeType === 9 ?8337 elem.defaultView || elem.parentWindow :8338 false;8339}8340jquery.offset = {8341 setOffset: function( elem, options, i ) {8342 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,8343 position = jquery.css( elem, "position" ),8344 curElem = jquery( elem ),8345 props = {};8346 // set position first, in-case top/left are set even on static elem8347 if ( position === "static" ) {8348 elem.style.position = "relative";8349 }8350 curOffset = curElem.offset();8351 curCSSTop = jquery.css( elem, "top" );8352 curCSSLeft = jquery.css( elem, "left" );8353 calculatePosition = ( position === "absolute" || position === "fixed" ) &&8354 jquery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;8355 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed8356 if ( calculatePosition ) {8357 curPosition = curElem.position();8358 curTop = curPosition.top;8359 curLeft = curPosition.left;8360 } else {8361 curTop = parseFloat( curCSSTop ) || 0;8362 curLeft = parseFloat( curCSSLeft ) || 0;8363 }8364 if ( jquery.isFunction( options ) ) {8365 options = options.call( elem, i, curOffset );8366 }8367 if ( options.top != null ) {8368 props.top = ( options.top - curOffset.top ) + curTop;8369 }8370 if ( options.left != null ) {8371 props.left = ( options.left - curOffset.left ) + curLeft;8372 }8373 if ( "using" in options ) {8374 options.using.call( elem, props );8375 } else {8376 curElem.css( props );8377 }8378 }8379};8380jquery.fn.extend({8381 offset: function( options ) {8382 if ( arguments.length ) {8383 return options === undefined ?8384 this :8385 this.each(function( i ) {8386 jquery.offset.setOffset( this, options, i );8387 });8388 }8389 var docElem, win,8390 box = { top: 0, left: 0 },8391 elem = this[ 0 ],8392 doc = elem && elem.ownerDocument;8393 if ( !doc ) {8394 return;8395 }8396 docElem = doc.documentElement;8397 // Make sure it's not a disconnected DOM node8398 if ( !jquery.contains( docElem, elem ) ) {8399 return box;8400 }8401 // If we don't have gBCR, just use 0,0 rather than error8402 // BlackBerry 5, iOS 3 (original iPhone)8403 if ( typeof elem.getBoundingClientRect !== strundefined ) {8404 box = elem.getBoundingClientRect();8405 }8406 win = getWindow( doc );8407 return {8408 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),8409 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )8410 };8411 },8412 position: function() {8413 if ( !this[ 0 ] ) {8414 return;8415 }8416 var offsetParent, offset,8417 parentOffset = { top: 0, left: 0 },8418 elem = this[ 0 ];8419 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent8420 if ( jquery.css( elem, "position" ) === "fixed" ) {8421 // we assume that getBoundingClientRect is available when computed position is fixed8422 offset = elem.getBoundingClientRect();8423 } else {8424 // Get *real* offsetParent8425 offsetParent = this.offsetParent();8426 // Get correct offsets8427 offset = this.offset();8428 if ( !jquery.nodeName( offsetParent[ 0 ], "html" ) ) {8429 parentOffset = offsetParent.offset();8430 }8431 // Add offsetParent borders8432 parentOffset.top += jquery.css( offsetParent[ 0 ], "borderTopWidth", true );8433 parentOffset.left += jquery.css( offsetParent[ 0 ], "borderLeftWidth", true );8434 }8435 // Subtract parent offsets and element margins8436 // note: when an element has margin: auto the offsetLeft and marginLeft8437 // are the same in Safari causing offset.left to incorrectly be 08438 return {8439 top: offset.top - parentOffset.top - jquery.css( elem, "marginTop", true ),8440 left: offset.left - parentOffset.left - jquery.css( elem, "marginLeft", true)8441 };8442 },8443 offsetParent: function() {8444 return this.map(function() {8445 var offsetParent = this.offsetParent || docElem;8446 while ( offsetParent && ( !jquery.nodeName( offsetParent, "html" ) && jquery.css( offsetParent, "position" ) === "static" ) ) {8447 offsetParent = offsetParent.offsetParent;8448 }8449 return offsetParent || docElem;8450 });8451 }8452});8453// Create scrollLeft and scrollTop methods8454jquery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {8455 var top = /Y/.test( prop );8456 jquery.fn[ method ] = function( val ) {8457 return access( this, function( elem, method, val ) {8458 var win = getWindow( elem );8459 if ( val === undefined ) {8460 return win ? (prop in win) ? win[ prop ] :8461 win.document.documentElement[ method ] :8462 elem[ method ];8463 }8464 if ( win ) {8465 win.scrollTo(8466 !top ? val : jquery( win ).scrollLeft(),8467 top ? val : jquery( win ).scrollTop()8468 );8469 } else {8470 elem[ method ] = val;8471 }8472 }, method, val, arguments.length, null );8473 };8474});8475// Add the top/left cssHooks using jquery.fn.position8476// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=290848477// getComputedStyle returns percent when specified for top/left/bottom/right8478// rather than make the css module depend on the offset module, we just check for it here8479jquery.each( [ "top", "left" ], function( i, prop ) {8480 jquery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,8481 function( elem, computed ) {8482 if ( computed ) {8483 computed = curCSS( elem, prop );8484 // if curCSS returns percentage, fallback to offset8485 return rnumnonpx.test( computed ) ?8486 jquery( elem ).position()[ prop ] + "px" :8487 computed;8488 }8489 }8490 );8491});8492// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods8493jquery.each( { Height: "height", Width: "width" }, function( name, type ) {8494 jquery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {8495 // margin is only for outerHeight, outerWidth8496 jquery.fn[ funcName ] = function( margin, value ) {8497 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),8498 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );8499 return access( this, function( elem, type, value ) {8500 var doc;8501 if ( jquery.isWindow( elem ) ) {8502 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there8503 // isn't a whole lot we can do. See pull request at this URL for discussion:8504 // https://github.com/jquery/jquery/pull/7648505 return elem.document.documentElement[ "client" + name ];8506 }8507 // Get document width or height8508 if ( elem.nodeType === 9 ) {8509 doc = elem.documentElement;8510 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest8511 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.8512 return Math.max(8513 elem.body[ "scroll" + name ], doc[ "scroll" + name ],8514 elem.body[ "offset" + name ], doc[ "offset" + name ],8515 doc[ "client" + name ]8516 );8517 }8518 return value === undefined ?8519 // Get width or height on the element, requesting but not forcing parseFloat8520 jquery.css( elem, type, extra ) :8521 // Set width or height on the element8522 jquery.style( elem, type, value, extra );8523 }, type, chainable ? margin : undefined, chainable, null );8524 };8525 });8526});8527// The number of elements contained in the matched element set8528jquery.fn.size = function() {8529 return this.length;8530};8531jquery.fn.andSelf = jquery.fn.addBack;8532// Register as a named AMD module, since jquery can be concatenated with other8533// files that may use define, but not via a proper concatenation script that8534// understands anonymous AMD modules. A named AMD is safest and most robust8535// way to register. Lowercase jquery is used because AMD module names are8536// derived from file names, and jquery is normally delivered in a lowercase8537// file name. Do this after creating the global so that if an AMD module wants8538// to call noConflict to hide this version of jquery, it will work.8539if ( typeof define === "function" && define.amd ) {8540 define( "jquery", [], function() {8541 return jquery;8542 });8543}8544var8545 // Map over jquery in case of overwrite8546 _jquery = window.jquery,8547 // Map over the $ in case of overwrite8548 _$ = window.$;8549jquery.noConflict = function( deep ) {8550 if ( window.$ === jquery ) {8551 window.$ = _$;8552 }8553 if ( deep && window.jquery === jquery ) {8554 window.jquery = _jquery;8555 }8556 return jquery;8557};8558// Expose jquery and $ identifiers, even in8559// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)8560// and CommonJS for browser emulators (#13566)8561if ( typeof noGlobal === strundefined ) {8562 window.jquery = window.$ = jquery;8563}8564return jquery;...

Full Screen

Full Screen

jquery-1.11.0.js

Source:jquery-1.11.0.js Github

copy

Full Screen

1/*!2 * jquery JavaScript Library v1.11.03 * http://jquery.com/4 *5 * Includes Sizzle.js6 * http://sizzlejs.com/7 *8 * Copyright 2005, 2014 jquery Foundation, Inc. and other contributors9 * Released under the MIT license10 * http://jquery.org/license11 *12 * Date: 2014-01-23T21:02Z13 */14(function( global, factory ) {15 if ( typeof module === "object" && typeof module.exports === "object" ) {16 // For CommonJS and CommonJS-like environments where a proper window is present,17 // execute the factory and get jquery18 // For environments that do not inherently posses a window with a document19 // (such as Node.js), expose a jquery-making factory as module.exports20 // This accentuates the need for the creation of a real window21 // e.g. var jquery = require("jquery")(window);22 // See ticket #14549 for more info23 module.exports = global.document ?24 factory( global, true ) :25 function( w ) {26 if ( !w.document ) {27 throw new Error( "jquery requires a window with a document" );28 }29 return factory( w );30 };31 } else {32 factory( global );33 }34// Pass this if window is not defined yet35}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {36// Can't do this because several apps including ASP.NET trace37// the stack via arguments.caller.callee and Firefox dies if38// you try to trace through "use strict" call chains. (#13335)39// Support: Firefox 18+40//41var deletedIds = [];42var slice = deletedIds.slice;43var concat = deletedIds.concat;44var push = deletedIds.push;45var indexOf = deletedIds.indexOf;46var class2type = {};47var toString = class2type.toString;48var hasOwn = class2type.hasOwnProperty;49var trim = "".trim;50var support = {};51var52 version = "1.11.0",53 // Define a local copy of jquery54 jquery = function( selector, context ) {55 // The jquery object is actually just the init constructor 'enhanced'56 // Need init if jquery is called (just allow error to be thrown if not included)57 return new jquery.fn.init( selector, context );58 },59 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)60 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,61 // Matches dashed string for camelizing62 rmsPrefix = /^-ms-/,63 rdashAlpha = /-([\da-z])/gi,64 // Used by jquery.camelCase as callback to replace()65 fcamelCase = function( all, letter ) {66 return letter.toUpperCase();67 };68jquery.fn = jquery.prototype = {69 // The current version of jquery being used70 jquery: version,71 constructor: jquery,72 // Start with an empty selector73 selector: "",74 // The default length of a jquery object is 075 length: 0,76 toArray: function() {77 return slice.call( this );78 },79 // Get the Nth element in the matched element set OR80 // Get the whole matched element set as a clean array81 get: function( num ) {82 return num != null ?83 // Return a 'clean' array84 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :85 // Return just the object86 slice.call( this );87 },88 // Take an array of elements and push it onto the stack89 // (returning the new matched element set)90 pushStack: function( elems ) {91 // Build a new jquery matched element set92 var ret = jquery.merge( this.constructor(), elems );93 // Add the old object onto the stack (as a reference)94 ret.prevObject = this;95 ret.context = this.context;96 // Return the newly-formed element set97 return ret;98 },99 // Execute a callback for every element in the matched set.100 // (You can seed the arguments with an array of args, but this is101 // only used internally.)102 each: function( callback, args ) {103 return jquery.each( this, callback, args );104 },105 map: function( callback ) {106 return this.pushStack( jquery.map(this, function( elem, i ) {107 return callback.call( elem, i, elem );108 }));109 },110 slice: function() {111 return this.pushStack( slice.apply( this, arguments ) );112 },113 first: function() {114 return this.eq( 0 );115 },116 last: function() {117 return this.eq( -1 );118 },119 eq: function( i ) {120 var len = this.length,121 j = +i + ( i < 0 ? len : 0 );122 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );123 },124 end: function() {125 return this.prevObject || this.constructor(null);126 },127 // For internal use only.128 // Behaves like an Array's method, not like a jquery method.129 push: push,130 sort: deletedIds.sort,131 splice: deletedIds.splice132};133jquery.extend = jquery.fn.extend = function() {134 var src, copyIsArray, copy, name, options, clone,135 target = arguments[0] || {},136 i = 1,137 length = arguments.length,138 deep = false;139 // Handle a deep copy situation140 if ( typeof target === "boolean" ) {141 deep = target;142 // skip the boolean and the target143 target = arguments[ i ] || {};144 i++;145 }146 // Handle case when target is a string or something (possible in deep copy)147 if ( typeof target !== "object" && !jquery.isFunction(target) ) {148 target = {};149 }150 // extend jquery itself if only one argument is passed151 if ( i === length ) {152 target = this;153 i--;154 }155 for ( ; i < length; i++ ) {156 // Only deal with non-null/undefined values157 if ( (options = arguments[ i ]) != null ) {158 // Extend the base object159 for ( name in options ) {160 src = target[ name ];161 copy = options[ name ];162 // Prevent never-ending loop163 if ( target === copy ) {164 continue;165 }166 // Recurse if we're merging plain objects or arrays167 if ( deep && copy && ( jquery.isPlainObject(copy) || (copyIsArray = jquery.isArray(copy)) ) ) {168 if ( copyIsArray ) {169 copyIsArray = false;170 clone = src && jquery.isArray(src) ? src : [];171 } else {172 clone = src && jquery.isPlainObject(src) ? src : {};173 }174 // Never move original objects, clone them175 target[ name ] = jquery.extend( deep, clone, copy );176 // Don't bring in undefined values177 } else if ( copy !== undefined ) {178 target[ name ] = copy;179 }180 }181 }182 }183 // Return the modified object184 return target;185};186jquery.extend({187 // Unique for each copy of jquery on the page188 expando: "jquery" + ( version + Math.random() ).replace( /\D/g, "" ),189 // Assume jquery is ready without the ready module190 isReady: true,191 error: function( msg ) {192 throw new Error( msg );193 },194 noop: function() {},195 // See test/unit/core.js for details concerning isFunction.196 // Since version 1.3, DOM methods and functions like alert197 // aren't supported. They return false on IE (#2968).198 isFunction: function( obj ) {199 return jquery.type(obj) === "function";200 },201 isArray: Array.isArray || function( obj ) {202 return jquery.type(obj) === "array";203 },204 isWindow: function( obj ) {205 /* jshint eqeqeq: false */206 return obj != null && obj == obj.window;207 },208 isNumeric: function( obj ) {209 // parseFloat NaNs numeric-cast false positives (null|true|false|"")210 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")211 // subtraction forces infinities to NaN212 return obj - parseFloat( obj ) >= 0;213 },214 isEmptyObject: function( obj ) {215 var name;216 for ( name in obj ) {217 return false;218 }219 return true;220 },221 isPlainObject: function( obj ) {222 var key;223 // Must be an Object.224 // Because of IE, we also have to check the presence of the constructor property.225 // Make sure that DOM nodes and window objects don't pass through, as well226 if ( !obj || jquery.type(obj) !== "object" || obj.nodeType || jquery.isWindow( obj ) ) {227 return false;228 }229 try {230 // Not own constructor property must be Object231 if ( obj.constructor &&232 !hasOwn.call(obj, "constructor") &&233 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {234 return false;235 }236 } catch ( e ) {237 // IE8,9 Will throw exceptions on certain host objects #9897238 return false;239 }240 // Support: IE<9241 // Handle iteration over inherited properties before own properties.242 if ( support.ownLast ) {243 for ( key in obj ) {244 return hasOwn.call( obj, key );245 }246 }247 // Own properties are enumerated firstly, so to speed up,248 // if last one is own, then all properties are own.249 for ( key in obj ) {}250 return key === undefined || hasOwn.call( obj, key );251 },252 type: function( obj ) {253 if ( obj == null ) {254 return obj + "";255 }256 return typeof obj === "object" || typeof obj === "function" ?257 class2type[ toString.call(obj) ] || "object" :258 typeof obj;259 },260 // Evaluates a script in a global context261 // Workarounds based on findings by Jim Driscoll262 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context263 globalEval: function( data ) {264 if ( data && jquery.trim( data ) ) {265 // We use execScript on Internet Explorer266 // We use an anonymous function so that context is window267 // rather than jquery in Firefox268 ( window.execScript || function( data ) {269 window[ "eval" ].call( window, data );270 } )( data );271 }272 },273 // Convert dashed to camelCase; used by the css and data modules274 // Microsoft forgot to hump their vendor prefix (#9572)275 camelCase: function( string ) {276 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );277 },278 nodeName: function( elem, name ) {279 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();280 },281 // args is for internal usage only282 each: function( obj, callback, args ) {283 var value,284 i = 0,285 length = obj.length,286 isArray = isArraylike( obj );287 if ( args ) {288 if ( isArray ) {289 for ( ; i < length; i++ ) {290 value = callback.apply( obj[ i ], args );291 if ( value === false ) {292 break;293 }294 }295 } else {296 for ( i in obj ) {297 value = callback.apply( obj[ i ], args );298 if ( value === false ) {299 break;300 }301 }302 }303 // A special, fast, case for the most common use of each304 } else {305 if ( isArray ) {306 for ( ; i < length; i++ ) {307 value = callback.call( obj[ i ], i, obj[ i ] );308 if ( value === false ) {309 break;310 }311 }312 } else {313 for ( i in obj ) {314 value = callback.call( obj[ i ], i, obj[ i ] );315 if ( value === false ) {316 break;317 }318 }319 }320 }321 return obj;322 },323 // Use native String.trim function wherever possible324 trim: trim && !trim.call("\uFEFF\xA0") ?325 function( text ) {326 return text == null ?327 "" :328 trim.call( text );329 } :330 // Otherwise use our own trimming functionality331 function( text ) {332 return text == null ?333 "" :334 ( text + "" ).replace( rtrim, "" );335 },336 // results is for internal usage only337 makeArray: function( arr, results ) {338 var ret = results || [];339 if ( arr != null ) {340 if ( isArraylike( Object(arr) ) ) {341 jquery.merge( ret,342 typeof arr === "string" ?343 [ arr ] : arr344 );345 } else {346 push.call( ret, arr );347 }348 }349 return ret;350 },351 inArray: function( elem, arr, i ) {352 var len;353 if ( arr ) {354 if ( indexOf ) {355 return indexOf.call( arr, elem, i );356 }357 len = arr.length;358 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;359 for ( ; i < len; i++ ) {360 // Skip accessing in sparse arrays361 if ( i in arr && arr[ i ] === elem ) {362 return i;363 }364 }365 }366 return -1;367 },368 merge: function( first, second ) {369 var len = +second.length,370 j = 0,371 i = first.length;372 while ( j < len ) {373 first[ i++ ] = second[ j++ ];374 }375 // Support: IE<9376 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)377 if ( len !== len ) {378 while ( second[j] !== undefined ) {379 first[ i++ ] = second[ j++ ];380 }381 }382 first.length = i;383 return first;384 },385 grep: function( elems, callback, invert ) {386 var callbackInverse,387 matches = [],388 i = 0,389 length = elems.length,390 callbackExpect = !invert;391 // Go through the array, only saving the items392 // that pass the validator function393 for ( ; i < length; i++ ) {394 callbackInverse = !callback( elems[ i ], i );395 if ( callbackInverse !== callbackExpect ) {396 matches.push( elems[ i ] );397 }398 }399 return matches;400 },401 // arg is for internal usage only402 map: function( elems, callback, arg ) {403 var value,404 i = 0,405 length = elems.length,406 isArray = isArraylike( elems ),407 ret = [];408 // Go through the array, translating each of the items to their new values409 if ( isArray ) {410 for ( ; i < length; i++ ) {411 value = callback( elems[ i ], i, arg );412 if ( value != null ) {413 ret.push( value );414 }415 }416 // Go through every key on the object,417 } else {418 for ( i in elems ) {419 value = callback( elems[ i ], i, arg );420 if ( value != null ) {421 ret.push( value );422 }423 }424 }425 // Flatten any nested arrays426 return concat.apply( [], ret );427 },428 // A global GUID counter for objects429 guid: 1,430 // Bind a function to a context, optionally partially applying any431 // arguments.432 proxy: function( fn, context ) {433 var args, proxy, tmp;434 if ( typeof context === "string" ) {435 tmp = fn[ context ];436 context = fn;437 fn = tmp;438 }439 // Quick check to determine if target is callable, in the spec440 // this throws a TypeError, but we will just return undefined.441 if ( !jquery.isFunction( fn ) ) {442 return undefined;443 }444 // Simulated bind445 args = slice.call( arguments, 2 );446 proxy = function() {447 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );448 };449 // Set the guid of unique handler to the same of original handler, so it can be removed450 proxy.guid = fn.guid = fn.guid || jquery.guid++;451 return proxy;452 },453 now: function() {454 return +( new Date() );455 },456 // jquery.support is not used in Core but other projects attach their457 // properties to it so it needs to exist.458 support: support459});460// Populate the class2type map461jquery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {462 class2type[ "[object " + name + "]" ] = name.toLowerCase();463});464function isArraylike( obj ) {465 var length = obj.length,466 type = jquery.type( obj );467 if ( type === "function" || jquery.isWindow( obj ) ) {468 return false;469 }470 if ( obj.nodeType === 1 && length ) {471 return true;472 }473 return type === "array" || length === 0 ||474 typeof length === "number" && length > 0 && ( length - 1 ) in obj;475}476var Sizzle =477/*!478 * Sizzle CSS Selector Engine v1.10.16479 * http://sizzlejs.com/480 *481 * Copyright 2013 jquery Foundation, Inc. and other contributors482 * Released under the MIT license483 * http://jquery.org/license484 *485 * Date: 2014-01-13486 */487(function( window ) {488var i,489 support,490 Expr,491 getText,492 isXML,493 compile,494 outermostContext,495 sortInput,496 hasDuplicate,497 // Local document vars498 setDocument,499 document,500 docElem,501 documentIsHTML,502 rbuggyQSA,503 rbuggyMatches,504 matches,505 contains,506 // Instance-specific data507 expando = "sizzle" + -(new Date()),508 preferredDoc = window.document,509 dirruns = 0,510 done = 0,511 classCache = createCache(),512 tokenCache = createCache(),513 compilerCache = createCache(),514 sortOrder = function( a, b ) {515 if ( a === b ) {516 hasDuplicate = true;517 }518 return 0;519 },520 // General-purpose constants521 strundefined = typeof undefined,522 MAX_NEGATIVE = 1 << 31,523 // Instance methods524 hasOwn = ({}).hasOwnProperty,525 arr = [],526 pop = arr.pop,527 push_native = arr.push,528 push = arr.push,529 slice = arr.slice,530 // Use a stripped-down indexOf if we can't use a native one531 indexOf = arr.indexOf || function( elem ) {532 var i = 0,533 len = this.length;534 for ( ; i < len; i++ ) {535 if ( this[i] === elem ) {536 return i;537 }538 }539 return -1;540 },541 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",542 // Regular expressions543 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace544 whitespace = "[\\x20\\t\\r\\n\\f]",545 // http://www.w3.org/TR/css3-syntax/#characters546 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",547 // Loosely modeled on CSS identifier characters548 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors549 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier550 identifier = characterEncoding.replace( "w", "w#" ),551 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors552 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +553 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",554 // Prefer arguments quoted,555 // then not containing pseudos/brackets,556 // then attribute selectors/non-parenthetical expressions,557 // then anything else558 // These preferences are here to reduce the number of selectors559 // needing tokenize in the PSEUDO preFilter560 pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",561 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter562 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),563 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),564 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),565 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),566 rpseudo = new RegExp( pseudos ),567 ridentifier = new RegExp( "^" + identifier + "$" ),568 matchExpr = {569 "ID": new RegExp( "^#(" + characterEncoding + ")" ),570 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),571 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),572 "ATTR": new RegExp( "^" + attributes ),573 "PSEUDO": new RegExp( "^" + pseudos ),574 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +575 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +576 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),577 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),578 // For use in libraries implementing .is()579 // We use this for POS matching in `select`580 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +581 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )582 },583 rinputs = /^(?:input|select|textarea|button)$/i,584 rheader = /^h\d$/i,585 rnative = /^[^{]+\{\s*\[native \w/,586 // Easily-parseable/retrievable ID or TAG or CLASS selectors587 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,588 rsibling = /[+~]/,589 rescape = /'|\\/g,590 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters591 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),592 funescape = function( _, escaped, escapedWhitespace ) {593 var high = "0x" + escaped - 0x10000;594 // NaN means non-codepoint595 // Support: Firefox596 // Workaround erroneous numeric interpretation of +"0x"597 return high !== high || escapedWhitespace ?598 escaped :599 high < 0 ?600 // BMP codepoint601 String.fromCharCode( high + 0x10000 ) :602 // Supplemental Plane codepoint (surrogate pair)603 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );604 };605// Optimize for push.apply( _, NodeList )606try {607 push.apply(608 (arr = slice.call( preferredDoc.childNodes )),609 preferredDoc.childNodes610 );611 // Support: Android<4.0612 // Detect silently failing push.apply613 arr[ preferredDoc.childNodes.length ].nodeType;614} catch ( e ) {615 push = { apply: arr.length ?616 // Leverage slice if possible617 function( target, els ) {618 push_native.apply( target, slice.call(els) );619 } :620 // Support: IE<9621 // Otherwise append directly622 function( target, els ) {623 var j = target.length,624 i = 0;625 // Can't trust NodeList.length626 while ( (target[j++] = els[i++]) ) {}627 target.length = j - 1;628 }629 };630}631function Sizzle( selector, context, results, seed ) {632 var match, elem, m, nodeType,633 // QSA vars634 i, groups, old, nid, newContext, newSelector;635 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {636 setDocument( context );637 }638 context = context || document;639 results = results || [];640 if ( !selector || typeof selector !== "string" ) {641 return results;642 }643 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {644 return [];645 }646 if ( documentIsHTML && !seed ) {647 // Shortcuts648 if ( (match = rquickExpr.exec( selector )) ) {649 // Speed-up: Sizzle("#ID")650 if ( (m = match[1]) ) {651 if ( nodeType === 9 ) {652 elem = context.getElementById( m );653 // Check parentNode to catch when Blackberry 4.6 returns654 // nodes that are no longer in the document (jquery #6963)655 if ( elem && elem.parentNode ) {656 // Handle the case where IE, Opera, and Webkit return items657 // by name instead of ID658 if ( elem.id === m ) {659 results.push( elem );660 return results;661 }662 } else {663 return results;664 }665 } else {666 // Context is not a document667 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&668 contains( context, elem ) && elem.id === m ) {669 results.push( elem );670 return results;671 }672 }673 // Speed-up: Sizzle("TAG")674 } else if ( match[2] ) {675 push.apply( results, context.getElementsByTagName( selector ) );676 return results;677 // Speed-up: Sizzle(".CLASS")678 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {679 push.apply( results, context.getElementsByClassName( m ) );680 return results;681 }682 }683 // QSA path684 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {685 nid = old = expando;686 newContext = context;687 newSelector = nodeType === 9 && selector;688 // qSA works strangely on Element-rooted queries689 // We can work around this by specifying an extra ID on the root690 // and working up from there (Thanks to Andrew Dupont for the technique)691 // IE 8 doesn't work on object elements692 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {693 groups = tokenize( selector );694 if ( (old = context.getAttribute("id")) ) {695 nid = old.replace( rescape, "\\$&" );696 } else {697 context.setAttribute( "id", nid );698 }699 nid = "[id='" + nid + "'] ";700 i = groups.length;701 while ( i-- ) {702 groups[i] = nid + toSelector( groups[i] );703 }704 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;705 newSelector = groups.join(",");706 }707 if ( newSelector ) {708 try {709 push.apply( results,710 newContext.querySelectorAll( newSelector )711 );712 return results;713 } catch(qsaError) {714 } finally {715 if ( !old ) {716 context.removeAttribute("id");717 }718 }719 }720 }721 }722 // All others723 return select( selector.replace( rtrim, "$1" ), context, results, seed );724}725/**726 * Create key-value caches of limited size727 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with728 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)729 * deleting the oldest entry730 */731function createCache() {732 var keys = [];733 function cache( key, value ) {734 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)735 if ( keys.push( key + " " ) > Expr.cacheLength ) {736 // Only keep the most recent entries737 delete cache[ keys.shift() ];738 }739 return (cache[ key + " " ] = value);740 }741 return cache;742}743/**744 * Mark a function for special use by Sizzle745 * @param {Function} fn The function to mark746 */747function markFunction( fn ) {748 fn[ expando ] = true;749 return fn;750}751/**752 * Support testing using an element753 * @param {Function} fn Passed the created div and expects a boolean result754 */755function assert( fn ) {756 var div = document.createElement("div");757 try {758 return !!fn( div );759 } catch (e) {760 return false;761 } finally {762 // Remove from its parent by default763 if ( div.parentNode ) {764 div.parentNode.removeChild( div );765 }766 // release memory in IE767 div = null;768 }769}770/**771 * Adds the same handler for all of the specified attrs772 * @param {String} attrs Pipe-separated list of attributes773 * @param {Function} handler The method that will be applied774 */775function addHandle( attrs, handler ) {776 var arr = attrs.split("|"),777 i = attrs.length;778 while ( i-- ) {779 Expr.attrHandle[ arr[i] ] = handler;780 }781}782/**783 * Checks document order of two siblings784 * @param {Element} a785 * @param {Element} b786 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b787 */788function siblingCheck( a, b ) {789 var cur = b && a,790 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&791 ( ~b.sourceIndex || MAX_NEGATIVE ) -792 ( ~a.sourceIndex || MAX_NEGATIVE );793 // Use IE sourceIndex if available on both nodes794 if ( diff ) {795 return diff;796 }797 // Check if b follows a798 if ( cur ) {799 while ( (cur = cur.nextSibling) ) {800 if ( cur === b ) {801 return -1;802 }803 }804 }805 return a ? 1 : -1;806}807/**808 * Returns a function to use in pseudos for input types809 * @param {String} type810 */811function createInputPseudo( type ) {812 return function( elem ) {813 var name = elem.nodeName.toLowerCase();814 return name === "input" && elem.type === type;815 };816}817/**818 * Returns a function to use in pseudos for buttons819 * @param {String} type820 */821function createButtonPseudo( type ) {822 return function( elem ) {823 var name = elem.nodeName.toLowerCase();824 return (name === "input" || name === "button") && elem.type === type;825 };826}827/**828 * Returns a function to use in pseudos for positionals829 * @param {Function} fn830 */831function createPositionalPseudo( fn ) {832 return markFunction(function( argument ) {833 argument = +argument;834 return markFunction(function( seed, matches ) {835 var j,836 matchIndexes = fn( [], seed.length, argument ),837 i = matchIndexes.length;838 // Match elements found at the specified indexes839 while ( i-- ) {840 if ( seed[ (j = matchIndexes[i]) ] ) {841 seed[j] = !(matches[j] = seed[j]);842 }843 }844 });845 });846}847/**848 * Checks a node for validity as a Sizzle context849 * @param {Element|Object=} context850 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value851 */852function testContext( context ) {853 return context && typeof context.getElementsByTagName !== strundefined && context;854}855// Expose support vars for convenience856support = Sizzle.support = {};857/**858 * Detects XML nodes859 * @param {Element|Object} elem An element or a document860 * @returns {Boolean} True iff elem is a non-HTML XML node861 */862isXML = Sizzle.isXML = function( elem ) {863 // documentElement is verified for cases where it doesn't yet exist864 // (such as loading iframes in IE - #4833)865 var documentElement = elem && (elem.ownerDocument || elem).documentElement;866 return documentElement ? documentElement.nodeName !== "HTML" : false;867};868/**869 * Sets document-related variables once based on the current document870 * @param {Element|Object} [doc] An element or document object to use to set the document871 * @returns {Object} Returns the current document872 */873setDocument = Sizzle.setDocument = function( node ) {874 var hasCompare,875 doc = node ? node.ownerDocument || node : preferredDoc,876 parent = doc.defaultView;877 // If no document and documentElement is available, return878 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {879 return document;880 }881 // Set our document882 document = doc;883 docElem = doc.documentElement;884 // Support tests885 documentIsHTML = !isXML( doc );886 // Support: IE>8887 // If iframe document is assigned to "document" variable and if iframe has been reloaded,888 // IE will throw "permission denied" error when accessing "document" variable, see jquery #13936889 // IE6-8 do not support the defaultView property so parent will be undefined890 if ( parent && parent !== parent.top ) {891 // IE11 does not have attachEvent, so all must suffer892 if ( parent.addEventListener ) {893 parent.addEventListener( "unload", function() {894 setDocument();895 }, false );896 } else if ( parent.attachEvent ) {897 parent.attachEvent( "onunload", function() {898 setDocument();899 });900 }901 }902 /* Attributes903 ---------------------------------------------------------------------- */904 // Support: IE<8905 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)906 support.attributes = assert(function( div ) {907 div.className = "i";908 return !div.getAttribute("className");909 });910 /* getElement(s)By*911 ---------------------------------------------------------------------- */912 // Check if getElementsByTagName("*") returns only elements913 support.getElementsByTagName = assert(function( div ) {914 div.appendChild( doc.createComment("") );915 return !div.getElementsByTagName("*").length;916 });917 // Check if getElementsByClassName can be trusted918 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {919 div.innerHTML = "<div class='a'></div><div class='a i'></div>";920 // Support: Safari<4921 // Catch class over-caching922 div.firstChild.className = "i";923 // Support: Opera<10924 // Catch gEBCN failure to find non-leading classes925 return div.getElementsByClassName("i").length === 2;926 });927 // Support: IE<10928 // Check if getElementById returns elements by name929 // The broken getElementById methods don't pick up programatically-set names,930 // so use a roundabout getElementsByName test931 support.getById = assert(function( div ) {932 docElem.appendChild( div ).id = expando;933 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;934 });935 // ID find and filter936 if ( support.getById ) {937 Expr.find["ID"] = function( id, context ) {938 if ( typeof context.getElementById !== strundefined && documentIsHTML ) {939 var m = context.getElementById( id );940 // Check parentNode to catch when Blackberry 4.6 returns941 // nodes that are no longer in the document #6963942 return m && m.parentNode ? [m] : [];943 }944 };945 Expr.filter["ID"] = function( id ) {946 var attrId = id.replace( runescape, funescape );947 return function( elem ) {948 return elem.getAttribute("id") === attrId;949 };950 };951 } else {952 // Support: IE6/7953 // getElementById is not reliable as a find shortcut954 delete Expr.find["ID"];955 Expr.filter["ID"] = function( id ) {956 var attrId = id.replace( runescape, funescape );957 return function( elem ) {958 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");959 return node && node.value === attrId;960 };961 };962 }963 // Tag964 Expr.find["TAG"] = support.getElementsByTagName ?965 function( tag, context ) {966 if ( typeof context.getElementsByTagName !== strundefined ) {967 return context.getElementsByTagName( tag );968 }969 } :970 function( tag, context ) {971 var elem,972 tmp = [],973 i = 0,974 results = context.getElementsByTagName( tag );975 // Filter out possible comments976 if ( tag === "*" ) {977 while ( (elem = results[i++]) ) {978 if ( elem.nodeType === 1 ) {979 tmp.push( elem );980 }981 }982 return tmp;983 }984 return results;985 };986 // Class987 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {988 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {989 return context.getElementsByClassName( className );990 }991 };992 /* QSA/matchesSelector993 ---------------------------------------------------------------------- */994 // QSA and matchesSelector support995 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)996 rbuggyMatches = [];997 // qSa(:focus) reports false when true (Chrome 21)998 // We allow this because of a bug in IE8/9 that throws an error999 // whenever `document.activeElement` is accessed on an iframe1000 // So, we allow :focus to pass through QSA all the time to avoid the IE error1001 // See http://bugs.jquery.com/ticket/133781002 rbuggyQSA = [];1003 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {1004 // Build QSA regex1005 // Regex strategy adopted from Diego Perini1006 assert(function( div ) {1007 // Select is set to empty string on purpose1008 // This is to test IE's treatment of not explicitly1009 // setting a boolean content attribute,1010 // since its presence should be enough1011 // http://bugs.jquery.com/ticket/123591012 div.innerHTML = "<select t=''><option selected=''></option></select>";1013 // Support: IE8, Opera 10-121014 // Nothing should be selected when empty strings follow ^= or $= or *=1015 if ( div.querySelectorAll("[t^='']").length ) {1016 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );1017 }1018 // Support: IE81019 // Boolean attributes and "value" are not treated correctly1020 if ( !div.querySelectorAll("[selected]").length ) {1021 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );1022 }1023 // Webkit/Opera - :checked should return selected option elements1024 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1025 // IE8 throws error here and will not see later tests1026 if ( !div.querySelectorAll(":checked").length ) {1027 rbuggyQSA.push(":checked");1028 }1029 });1030 assert(function( div ) {1031 // Support: Windows 8 Native Apps1032 // The type and name attributes are restricted during .innerHTML assignment1033 var input = doc.createElement("input");1034 input.setAttribute( "type", "hidden" );1035 div.appendChild( input ).setAttribute( "name", "D" );1036 // Support: IE81037 // Enforce case-sensitivity of name attribute1038 if ( div.querySelectorAll("[name=d]").length ) {1039 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );1040 }1041 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)1042 // IE8 throws error here and will not see later tests1043 if ( !div.querySelectorAll(":enabled").length ) {1044 rbuggyQSA.push( ":enabled", ":disabled" );1045 }1046 // Opera 10-11 does not throw on post-comma invalid pseudos1047 div.querySelectorAll("*,:x");1048 rbuggyQSA.push(",.*:");1049 });1050 }1051 if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||1052 docElem.mozMatchesSelector ||1053 docElem.oMatchesSelector ||1054 docElem.msMatchesSelector) )) ) {1055 assert(function( div ) {1056 // Check to see if it's possible to do matchesSelector1057 // on a disconnected node (IE 9)1058 support.disconnectedMatch = matches.call( div, "div" );1059 // This should fail with an exception1060 // Gecko does not error, returns false instead1061 matches.call( div, "[s!='']:x" );1062 rbuggyMatches.push( "!=", pseudos );1063 });1064 }1065 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );1066 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );1067 /* Contains1068 ---------------------------------------------------------------------- */1069 hasCompare = rnative.test( docElem.compareDocumentPosition );1070 // Element contains another1071 // Purposefully does not implement inclusive descendent1072 // As in, an element does not contain itself1073 contains = hasCompare || rnative.test( docElem.contains ) ?1074 function( a, b ) {1075 var adown = a.nodeType === 9 ? a.documentElement : a,1076 bup = b && b.parentNode;1077 return a === bup || !!( bup && bup.nodeType === 1 && (1078 adown.contains ?1079 adown.contains( bup ) :1080 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 161081 ));1082 } :1083 function( a, b ) {1084 if ( b ) {1085 while ( (b = b.parentNode) ) {1086 if ( b === a ) {1087 return true;1088 }1089 }1090 }1091 return false;1092 };1093 /* Sorting1094 ---------------------------------------------------------------------- */1095 // Document order sorting1096 sortOrder = hasCompare ?1097 function( a, b ) {1098 // Flag for duplicate removal1099 if ( a === b ) {1100 hasDuplicate = true;1101 return 0;1102 }1103 // Sort on method existence if only one input has compareDocumentPosition1104 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;1105 if ( compare ) {1106 return compare;1107 }1108 // Calculate position if both inputs belong to the same document1109 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?1110 a.compareDocumentPosition( b ) :1111 // Otherwise we know they are disconnected1112 1;1113 // Disconnected nodes1114 if ( compare & 1 ||1115 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {1116 // Choose the first element that is related to our preferred document1117 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {1118 return -1;1119 }1120 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {1121 return 1;1122 }1123 // Maintain original order1124 return sortInput ?1125 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1126 0;1127 }1128 return compare & 4 ? -1 : 1;1129 } :1130 function( a, b ) {1131 // Exit early if the nodes are identical1132 if ( a === b ) {1133 hasDuplicate = true;1134 return 0;1135 }1136 var cur,1137 i = 0,1138 aup = a.parentNode,1139 bup = b.parentNode,1140 ap = [ a ],1141 bp = [ b ];1142 // Parentless nodes are either documents or disconnected1143 if ( !aup || !bup ) {1144 return a === doc ? -1 :1145 b === doc ? 1 :1146 aup ? -1 :1147 bup ? 1 :1148 sortInput ?1149 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :1150 0;1151 // If the nodes are siblings, we can do a quick check1152 } else if ( aup === bup ) {1153 return siblingCheck( a, b );1154 }1155 // Otherwise we need full lists of their ancestors for comparison1156 cur = a;1157 while ( (cur = cur.parentNode) ) {1158 ap.unshift( cur );1159 }1160 cur = b;1161 while ( (cur = cur.parentNode) ) {1162 bp.unshift( cur );1163 }1164 // Walk down the tree looking for a discrepancy1165 while ( ap[i] === bp[i] ) {1166 i++;1167 }1168 return i ?1169 // Do a sibling check if the nodes have a common ancestor1170 siblingCheck( ap[i], bp[i] ) :1171 // Otherwise nodes in our document sort first1172 ap[i] === preferredDoc ? -1 :1173 bp[i] === preferredDoc ? 1 :1174 0;1175 };1176 return doc;1177};1178Sizzle.matches = function( expr, elements ) {1179 return Sizzle( expr, null, null, elements );1180};1181Sizzle.matchesSelector = function( elem, expr ) {1182 // Set document vars if needed1183 if ( ( elem.ownerDocument || elem ) !== document ) {1184 setDocument( elem );1185 }1186 // Make sure that attribute selectors are quoted1187 expr = expr.replace( rattributeQuotes, "='$1']" );1188 if ( support.matchesSelector && documentIsHTML &&1189 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&1190 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {1191 try {1192 var ret = matches.call( elem, expr );1193 // IE 9's matchesSelector returns false on disconnected nodes1194 if ( ret || support.disconnectedMatch ||1195 // As well, disconnected nodes are said to be in a document1196 // fragment in IE 91197 elem.document && elem.document.nodeType !== 11 ) {1198 return ret;1199 }1200 } catch(e) {}1201 }1202 return Sizzle( expr, document, null, [elem] ).length > 0;1203};1204Sizzle.contains = function( context, elem ) {1205 // Set document vars if needed1206 if ( ( context.ownerDocument || context ) !== document ) {1207 setDocument( context );1208 }1209 return contains( context, elem );1210};1211Sizzle.attr = function( elem, name ) {1212 // Set document vars if needed1213 if ( ( elem.ownerDocument || elem ) !== document ) {1214 setDocument( elem );1215 }1216 var fn = Expr.attrHandle[ name.toLowerCase() ],1217 // Don't get fooled by Object.prototype properties (jquery #13807)1218 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?1219 fn( elem, name, !documentIsHTML ) :1220 undefined;1221 return val !== undefined ?1222 val :1223 support.attributes || !documentIsHTML ?1224 elem.getAttribute( name ) :1225 (val = elem.getAttributeNode(name)) && val.specified ?1226 val.value :1227 null;1228};1229Sizzle.error = function( msg ) {1230 throw new Error( "Syntax error, unrecognized expression: " + msg );1231};1232/**1233 * Document sorting and removing duplicates1234 * @param {ArrayLike} results1235 */1236Sizzle.uniqueSort = function( results ) {1237 var elem,1238 duplicates = [],1239 j = 0,1240 i = 0;1241 // Unless we *know* we can detect duplicates, assume their presence1242 hasDuplicate = !support.detectDuplicates;1243 sortInput = !support.sortStable && results.slice( 0 );1244 results.sort( sortOrder );1245 if ( hasDuplicate ) {1246 while ( (elem = results[i++]) ) {1247 if ( elem === results[ i ] ) {1248 j = duplicates.push( i );1249 }1250 }1251 while ( j-- ) {1252 results.splice( duplicates[ j ], 1 );1253 }1254 }1255 // Clear input after sorting to release objects1256 // See https://github.com/jquery/sizzle/pull/2251257 sortInput = null;1258 return results;1259};1260/**1261 * Utility function for retrieving the text value of an array of DOM nodes1262 * @param {Array|Element} elem1263 */1264getText = Sizzle.getText = function( elem ) {1265 var node,1266 ret = "",1267 i = 0,1268 nodeType = elem.nodeType;1269 if ( !nodeType ) {1270 // If no nodeType, this is expected to be an array1271 while ( (node = elem[i++]) ) {1272 // Do not traverse comment nodes1273 ret += getText( node );1274 }1275 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {1276 // Use textContent for elements1277 // innerText usage removed for consistency of new lines (jquery #11153)1278 if ( typeof elem.textContent === "string" ) {1279 return elem.textContent;1280 } else {1281 // Traverse its children1282 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1283 ret += getText( elem );1284 }1285 }1286 } else if ( nodeType === 3 || nodeType === 4 ) {1287 return elem.nodeValue;1288 }1289 // Do not include comment or processing instruction nodes1290 return ret;1291};1292Expr = Sizzle.selectors = {1293 // Can be adjusted by the user1294 cacheLength: 50,1295 createPseudo: markFunction,1296 match: matchExpr,1297 attrHandle: {},1298 find: {},1299 relative: {1300 ">": { dir: "parentNode", first: true },1301 " ": { dir: "parentNode" },1302 "+": { dir: "previousSibling", first: true },1303 "~": { dir: "previousSibling" }1304 },1305 preFilter: {1306 "ATTR": function( match ) {1307 match[1] = match[1].replace( runescape, funescape );1308 // Move the given value to match[3] whether quoted or unquoted1309 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );1310 if ( match[2] === "~=" ) {1311 match[3] = " " + match[3] + " ";1312 }1313 return match.slice( 0, 4 );1314 },1315 "CHILD": function( match ) {1316 /* matches from matchExpr["CHILD"]1317 1 type (only|nth|...)1318 2 what (child|of-type)1319 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)1320 4 xn-component of xn+y argument ([+-]?\d*n|)1321 5 sign of xn-component1322 6 x of xn-component1323 7 sign of y-component1324 8 y of y-component1325 */1326 match[1] = match[1].toLowerCase();1327 if ( match[1].slice( 0, 3 ) === "nth" ) {1328 // nth-* requires argument1329 if ( !match[3] ) {1330 Sizzle.error( match[0] );1331 }1332 // numeric x and y parameters for Expr.filter.CHILD1333 // remember that false/true cast respectively to 0/11334 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );1335 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );1336 // other types prohibit arguments1337 } else if ( match[3] ) {1338 Sizzle.error( match[0] );1339 }1340 return match;1341 },1342 "PSEUDO": function( match ) {1343 var excess,1344 unquoted = !match[5] && match[2];1345 if ( matchExpr["CHILD"].test( match[0] ) ) {1346 return null;1347 }1348 // Accept quoted arguments as-is1349 if ( match[3] && match[4] !== undefined ) {1350 match[2] = match[4];1351 // Strip excess characters from unquoted arguments1352 } else if ( unquoted && rpseudo.test( unquoted ) &&1353 // Get excess from tokenize (recursively)1354 (excess = tokenize( unquoted, true )) &&1355 // advance to the next closing parenthesis1356 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {1357 // excess is a negative index1358 match[0] = match[0].slice( 0, excess );1359 match[2] = unquoted.slice( 0, excess );1360 }1361 // Return only captures needed by the pseudo filter method (type and argument)1362 return match.slice( 0, 3 );1363 }1364 },1365 filter: {1366 "TAG": function( nodeNameSelector ) {1367 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();1368 return nodeNameSelector === "*" ?1369 function() { return true; } :1370 function( elem ) {1371 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;1372 };1373 },1374 "CLASS": function( className ) {1375 var pattern = classCache[ className + " " ];1376 return pattern ||1377 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&1378 classCache( className, function( elem ) {1379 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );1380 });1381 },1382 "ATTR": function( name, operator, check ) {1383 return function( elem ) {1384 var result = Sizzle.attr( elem, name );1385 if ( result == null ) {1386 return operator === "!=";1387 }1388 if ( !operator ) {1389 return true;1390 }1391 result += "";1392 return operator === "=" ? result === check :1393 operator === "!=" ? result !== check :1394 operator === "^=" ? check && result.indexOf( check ) === 0 :1395 operator === "*=" ? check && result.indexOf( check ) > -1 :1396 operator === "$=" ? check && result.slice( -check.length ) === check :1397 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :1398 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :1399 false;1400 };1401 },1402 "CHILD": function( type, what, argument, first, last ) {1403 var simple = type.slice( 0, 3 ) !== "nth",1404 forward = type.slice( -4 ) !== "last",1405 ofType = what === "of-type";1406 return first === 1 && last === 0 ?1407 // Shortcut for :nth-*(n)1408 function( elem ) {1409 return !!elem.parentNode;1410 } :1411 function( elem, context, xml ) {1412 var cache, outerCache, node, diff, nodeIndex, start,1413 dir = simple !== forward ? "nextSibling" : "previousSibling",1414 parent = elem.parentNode,1415 name = ofType && elem.nodeName.toLowerCase(),1416 useCache = !xml && !ofType;1417 if ( parent ) {1418 // :(first|last|only)-(child|of-type)1419 if ( simple ) {1420 while ( dir ) {1421 node = elem;1422 while ( (node = node[ dir ]) ) {1423 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {1424 return false;1425 }1426 }1427 // Reverse direction for :only-* (if we haven't yet done so)1428 start = dir = type === "only" && !start && "nextSibling";1429 }1430 return true;1431 }1432 start = [ forward ? parent.firstChild : parent.lastChild ];1433 // non-xml :nth-child(...) stores cache data on `parent`1434 if ( forward && useCache ) {1435 // Seek `elem` from a previously-cached index1436 outerCache = parent[ expando ] || (parent[ expando ] = {});1437 cache = outerCache[ type ] || [];1438 nodeIndex = cache[0] === dirruns && cache[1];1439 diff = cache[0] === dirruns && cache[2];1440 node = nodeIndex && parent.childNodes[ nodeIndex ];1441 while ( (node = ++nodeIndex && node && node[ dir ] ||1442 // Fallback to seeking `elem` from the start1443 (diff = nodeIndex = 0) || start.pop()) ) {1444 // When found, cache indexes on `parent` and break1445 if ( node.nodeType === 1 && ++diff && node === elem ) {1446 outerCache[ type ] = [ dirruns, nodeIndex, diff ];1447 break;1448 }1449 }1450 // Use previously-cached element index if available1451 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {1452 diff = cache[1];1453 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)1454 } else {1455 // Use the same loop as above to seek `elem` from the start1456 while ( (node = ++nodeIndex && node && node[ dir ] ||1457 (diff = nodeIndex = 0) || start.pop()) ) {1458 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {1459 // Cache the index of each encountered element1460 if ( useCache ) {1461 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];1462 }1463 if ( node === elem ) {1464 break;1465 }1466 }1467 }1468 }1469 // Incorporate the offset, then check against cycle size1470 diff -= last;1471 return diff === first || ( diff % first === 0 && diff / first >= 0 );1472 }1473 };1474 },1475 "PSEUDO": function( pseudo, argument ) {1476 // pseudo-class names are case-insensitive1477 // http://www.w3.org/TR/selectors/#pseudo-classes1478 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters1479 // Remember that setFilters inherits from pseudos1480 var args,1481 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||1482 Sizzle.error( "unsupported pseudo: " + pseudo );1483 // The user may use createPseudo to indicate that1484 // arguments are needed to create the filter function1485 // just as Sizzle does1486 if ( fn[ expando ] ) {1487 return fn( argument );1488 }1489 // But maintain support for old signatures1490 if ( fn.length > 1 ) {1491 args = [ pseudo, pseudo, "", argument ];1492 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?1493 markFunction(function( seed, matches ) {1494 var idx,1495 matched = fn( seed, argument ),1496 i = matched.length;1497 while ( i-- ) {1498 idx = indexOf.call( seed, matched[i] );1499 seed[ idx ] = !( matches[ idx ] = matched[i] );1500 }1501 }) :1502 function( elem ) {1503 return fn( elem, 0, args );1504 };1505 }1506 return fn;1507 }1508 },1509 pseudos: {1510 // Potentially complex pseudos1511 "not": markFunction(function( selector ) {1512 // Trim the selector passed to compile1513 // to avoid treating leading and trailing1514 // spaces as combinators1515 var input = [],1516 results = [],1517 matcher = compile( selector.replace( rtrim, "$1" ) );1518 return matcher[ expando ] ?1519 markFunction(function( seed, matches, context, xml ) {1520 var elem,1521 unmatched = matcher( seed, null, xml, [] ),1522 i = seed.length;1523 // Match elements unmatched by `matcher`1524 while ( i-- ) {1525 if ( (elem = unmatched[i]) ) {1526 seed[i] = !(matches[i] = elem);1527 }1528 }1529 }) :1530 function( elem, context, xml ) {1531 input[0] = elem;1532 matcher( input, null, xml, results );1533 return !results.pop();1534 };1535 }),1536 "has": markFunction(function( selector ) {1537 return function( elem ) {1538 return Sizzle( selector, elem ).length > 0;1539 };1540 }),1541 "contains": markFunction(function( text ) {1542 return function( elem ) {1543 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;1544 };1545 }),1546 // "Whether an element is represented by a :lang() selector1547 // is based solely on the element's language value1548 // being equal to the identifier C,1549 // or beginning with the identifier C immediately followed by "-".1550 // The matching of C against the element's language value is performed case-insensitively.1551 // The identifier C does not have to be a valid language name."1552 // http://www.w3.org/TR/selectors/#lang-pseudo1553 "lang": markFunction( function( lang ) {1554 // lang value must be a valid identifier1555 if ( !ridentifier.test(lang || "") ) {1556 Sizzle.error( "unsupported lang: " + lang );1557 }1558 lang = lang.replace( runescape, funescape ).toLowerCase();1559 return function( elem ) {1560 var elemLang;1561 do {1562 if ( (elemLang = documentIsHTML ?1563 elem.lang :1564 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {1565 elemLang = elemLang.toLowerCase();1566 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;1567 }1568 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );1569 return false;1570 };1571 }),1572 // Miscellaneous1573 "target": function( elem ) {1574 var hash = window.location && window.location.hash;1575 return hash && hash.slice( 1 ) === elem.id;1576 },1577 "root": function( elem ) {1578 return elem === docElem;1579 },1580 "focus": function( elem ) {1581 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);1582 },1583 // Boolean properties1584 "enabled": function( elem ) {1585 return elem.disabled === false;1586 },1587 "disabled": function( elem ) {1588 return elem.disabled === true;1589 },1590 "checked": function( elem ) {1591 // In CSS3, :checked should return both checked and selected elements1592 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1593 var nodeName = elem.nodeName.toLowerCase();1594 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);1595 },1596 "selected": function( elem ) {1597 // Accessing this property makes selected-by-default1598 // options in Safari work properly1599 if ( elem.parentNode ) {1600 elem.parentNode.selectedIndex;1601 }1602 return elem.selected === true;1603 },1604 // Contents1605 "empty": function( elem ) {1606 // http://www.w3.org/TR/selectors/#empty-pseudo1607 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),1608 // but not by others (comment: 8; processing instruction: 7; etc.)1609 // nodeType < 6 works because attributes (2) do not appear as children1610 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1611 if ( elem.nodeType < 6 ) {1612 return false;1613 }1614 }1615 return true;1616 },1617 "parent": function( elem ) {1618 return !Expr.pseudos["empty"]( elem );1619 },1620 // Element/input types1621 "header": function( elem ) {1622 return rheader.test( elem.nodeName );1623 },1624 "input": function( elem ) {1625 return rinputs.test( elem.nodeName );1626 },1627 "button": function( elem ) {1628 var name = elem.nodeName.toLowerCase();1629 return name === "input" && elem.type === "button" || name === "button";1630 },1631 "text": function( elem ) {1632 var attr;1633 return elem.nodeName.toLowerCase() === "input" &&1634 elem.type === "text" &&1635 // Support: IE<81636 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"1637 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );1638 },1639 // Position-in-collection1640 "first": createPositionalPseudo(function() {1641 return [ 0 ];1642 }),1643 "last": createPositionalPseudo(function( matchIndexes, length ) {1644 return [ length - 1 ];1645 }),1646 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {1647 return [ argument < 0 ? argument + length : argument ];1648 }),1649 "even": createPositionalPseudo(function( matchIndexes, length ) {1650 var i = 0;1651 for ( ; i < length; i += 2 ) {1652 matchIndexes.push( i );1653 }1654 return matchIndexes;1655 }),1656 "odd": createPositionalPseudo(function( matchIndexes, length ) {1657 var i = 1;1658 for ( ; i < length; i += 2 ) {1659 matchIndexes.push( i );1660 }1661 return matchIndexes;1662 }),1663 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {1664 var i = argument < 0 ? argument + length : argument;1665 for ( ; --i >= 0; ) {1666 matchIndexes.push( i );1667 }1668 return matchIndexes;1669 }),1670 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {1671 var i = argument < 0 ? argument + length : argument;1672 for ( ; ++i < length; ) {1673 matchIndexes.push( i );1674 }1675 return matchIndexes;1676 })1677 }1678};1679Expr.pseudos["nth"] = Expr.pseudos["eq"];1680// Add button/input type pseudos1681for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {1682 Expr.pseudos[ i ] = createInputPseudo( i );1683}1684for ( i in { submit: true, reset: true } ) {1685 Expr.pseudos[ i ] = createButtonPseudo( i );1686}1687// Easy API for creating new setFilters1688function setFilters() {}1689setFilters.prototype = Expr.filters = Expr.pseudos;1690Expr.setFilters = new setFilters();1691function tokenize( selector, parseOnly ) {1692 var matched, match, tokens, type,1693 soFar, groups, preFilters,1694 cached = tokenCache[ selector + " " ];1695 if ( cached ) {1696 return parseOnly ? 0 : cached.slice( 0 );1697 }1698 soFar = selector;1699 groups = [];1700 preFilters = Expr.preFilter;1701 while ( soFar ) {1702 // Comma and first run1703 if ( !matched || (match = rcomma.exec( soFar )) ) {1704 if ( match ) {1705 // Don't consume trailing commas as valid1706 soFar = soFar.slice( match[0].length ) || soFar;1707 }1708 groups.push( (tokens = []) );1709 }1710 matched = false;1711 // Combinators1712 if ( (match = rcombinators.exec( soFar )) ) {1713 matched = match.shift();1714 tokens.push({1715 value: matched,1716 // Cast descendant combinators to space1717 type: match[0].replace( rtrim, " " )1718 });1719 soFar = soFar.slice( matched.length );1720 }1721 // Filters1722 for ( type in Expr.filter ) {1723 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||1724 (match = preFilters[ type ]( match ))) ) {1725 matched = match.shift();1726 tokens.push({1727 value: matched,1728 type: type,1729 matches: match1730 });1731 soFar = soFar.slice( matched.length );1732 }1733 }1734 if ( !matched ) {1735 break;1736 }1737 }1738 // Return the length of the invalid excess1739 // if we're just parsing1740 // Otherwise, throw an error or return tokens1741 return parseOnly ?1742 soFar.length :1743 soFar ?1744 Sizzle.error( selector ) :1745 // Cache the tokens1746 tokenCache( selector, groups ).slice( 0 );1747}1748function toSelector( tokens ) {1749 var i = 0,1750 len = tokens.length,1751 selector = "";1752 for ( ; i < len; i++ ) {1753 selector += tokens[i].value;1754 }1755 return selector;1756}1757function addCombinator( matcher, combinator, base ) {1758 var dir = combinator.dir,1759 checkNonElements = base && dir === "parentNode",1760 doneName = done++;1761 return combinator.first ?1762 // Check against closest ancestor/preceding element1763 function( elem, context, xml ) {1764 while ( (elem = elem[ dir ]) ) {1765 if ( elem.nodeType === 1 || checkNonElements ) {1766 return matcher( elem, context, xml );1767 }1768 }1769 } :1770 // Check against all ancestor/preceding elements1771 function( elem, context, xml ) {1772 var oldCache, outerCache,1773 newCache = [ dirruns, doneName ];1774 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching1775 if ( xml ) {1776 while ( (elem = elem[ dir ]) ) {1777 if ( elem.nodeType === 1 || checkNonElements ) {1778 if ( matcher( elem, context, xml ) ) {1779 return true;1780 }1781 }1782 }1783 } else {1784 while ( (elem = elem[ dir ]) ) {1785 if ( elem.nodeType === 1 || checkNonElements ) {1786 outerCache = elem[ expando ] || (elem[ expando ] = {});1787 if ( (oldCache = outerCache[ dir ]) &&1788 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {1789 // Assign to newCache so results back-propagate to previous elements1790 return (newCache[ 2 ] = oldCache[ 2 ]);1791 } else {1792 // Reuse newcache so results back-propagate to previous elements1793 outerCache[ dir ] = newCache;1794 // A match means we're done; a fail means we have to keep checking1795 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {1796 return true;1797 }1798 }1799 }1800 }1801 }1802 };1803}1804function elementMatcher( matchers ) {1805 return matchers.length > 1 ?1806 function( elem, context, xml ) {1807 var i = matchers.length;1808 while ( i-- ) {1809 if ( !matchers[i]( elem, context, xml ) ) {1810 return false;1811 }1812 }1813 return true;1814 } :1815 matchers[0];1816}1817function condense( unmatched, map, filter, context, xml ) {1818 var elem,1819 newUnmatched = [],1820 i = 0,1821 len = unmatched.length,1822 mapped = map != null;1823 for ( ; i < len; i++ ) {1824 if ( (elem = unmatched[i]) ) {1825 if ( !filter || filter( elem, context, xml ) ) {1826 newUnmatched.push( elem );1827 if ( mapped ) {1828 map.push( i );1829 }1830 }1831 }1832 }1833 return newUnmatched;1834}1835function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {1836 if ( postFilter && !postFilter[ expando ] ) {1837 postFilter = setMatcher( postFilter );1838 }1839 if ( postFinder && !postFinder[ expando ] ) {1840 postFinder = setMatcher( postFinder, postSelector );1841 }1842 return markFunction(function( seed, results, context, xml ) {1843 var temp, i, elem,1844 preMap = [],1845 postMap = [],1846 preexisting = results.length,1847 // Get initial elements from seed or context1848 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),1849 // Prefilter to get matcher input, preserving a map for seed-results synchronization1850 matcherIn = preFilter && ( seed || !selector ) ?1851 condense( elems, preMap, preFilter, context, xml ) :1852 elems,1853 matcherOut = matcher ?1854 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,1855 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?1856 // ...intermediate processing is necessary1857 [] :1858 // ...otherwise use results directly1859 results :1860 matcherIn;1861 // Find primary matches1862 if ( matcher ) {1863 matcher( matcherIn, matcherOut, context, xml );1864 }1865 // Apply postFilter1866 if ( postFilter ) {1867 temp = condense( matcherOut, postMap );1868 postFilter( temp, [], context, xml );1869 // Un-match failing elements by moving them back to matcherIn1870 i = temp.length;1871 while ( i-- ) {1872 if ( (elem = temp[i]) ) {1873 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);1874 }1875 }1876 }1877 if ( seed ) {1878 if ( postFinder || preFilter ) {1879 if ( postFinder ) {1880 // Get the final matcherOut by condensing this intermediate into postFinder contexts1881 temp = [];1882 i = matcherOut.length;1883 while ( i-- ) {1884 if ( (elem = matcherOut[i]) ) {1885 // Restore matcherIn since elem is not yet a final match1886 temp.push( (matcherIn[i] = elem) );1887 }1888 }1889 postFinder( null, (matcherOut = []), temp, xml );1890 }1891 // Move matched elements from seed to results to keep them synchronized1892 i = matcherOut.length;1893 while ( i-- ) {1894 if ( (elem = matcherOut[i]) &&1895 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {1896 seed[temp] = !(results[temp] = elem);1897 }1898 }1899 }1900 // Add elements to results, through postFinder if defined1901 } else {1902 matcherOut = condense(1903 matcherOut === results ?1904 matcherOut.splice( preexisting, matcherOut.length ) :1905 matcherOut1906 );1907 if ( postFinder ) {1908 postFinder( null, results, matcherOut, xml );1909 } else {1910 push.apply( results, matcherOut );1911 }1912 }1913 });1914}1915function matcherFromTokens( tokens ) {1916 var checkContext, matcher, j,1917 len = tokens.length,1918 leadingRelative = Expr.relative[ tokens[0].type ],1919 implicitRelative = leadingRelative || Expr.relative[" "],1920 i = leadingRelative ? 1 : 0,1921 // The foundational matcher ensures that elements are reachable from top-level context(s)1922 matchContext = addCombinator( function( elem ) {1923 return elem === checkContext;1924 }, implicitRelative, true ),1925 matchAnyContext = addCombinator( function( elem ) {1926 return indexOf.call( checkContext, elem ) > -1;1927 }, implicitRelative, true ),1928 matchers = [ function( elem, context, xml ) {1929 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (1930 (checkContext = context).nodeType ?1931 matchContext( elem, context, xml ) :1932 matchAnyContext( elem, context, xml ) );1933 } ];1934 for ( ; i < len; i++ ) {1935 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {1936 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];1937 } else {1938 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );1939 // Return special upon seeing a positional matcher1940 if ( matcher[ expando ] ) {1941 // Find the next relative operator (if any) for proper handling1942 j = ++i;1943 for ( ; j < len; j++ ) {1944 if ( Expr.relative[ tokens[j].type ] ) {1945 break;1946 }1947 }1948 return setMatcher(1949 i > 1 && elementMatcher( matchers ),1950 i > 1 && toSelector(1951 // If the preceding token was a descendant combinator, insert an implicit any-element `*`1952 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })1953 ).replace( rtrim, "$1" ),1954 matcher,1955 i < j && matcherFromTokens( tokens.slice( i, j ) ),1956 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),1957 j < len && toSelector( tokens )1958 );1959 }1960 matchers.push( matcher );1961 }1962 }1963 return elementMatcher( matchers );1964}1965function matcherFromGroupMatchers( elementMatchers, setMatchers ) {1966 var bySet = setMatchers.length > 0,1967 byElement = elementMatchers.length > 0,1968 superMatcher = function( seed, context, xml, results, outermost ) {1969 var elem, j, matcher,1970 matchedCount = 0,1971 i = "0",1972 unmatched = seed && [],1973 setMatched = [],1974 contextBackup = outermostContext,1975 // We must always have either seed elements or outermost context1976 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),1977 // Use integer dirruns iff this is the outermost matcher1978 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),1979 len = elems.length;1980 if ( outermost ) {1981 outermostContext = context !== document && context;1982 }1983 // Add elements passing elementMatchers directly to results1984 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below1985 // Support: IE<9, Safari1986 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id1987 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {1988 if ( byElement && elem ) {1989 j = 0;1990 while ( (matcher = elementMatchers[j++]) ) {1991 if ( matcher( elem, context, xml ) ) {1992 results.push( elem );1993 break;1994 }1995 }1996 if ( outermost ) {1997 dirruns = dirrunsUnique;1998 }1999 }2000 // Track unmatched elements for set filters2001 if ( bySet ) {2002 // They will have gone through all possible matchers2003 if ( (elem = !matcher && elem) ) {2004 matchedCount--;2005 }2006 // Lengthen the array for every element, matched or not2007 if ( seed ) {2008 unmatched.push( elem );2009 }2010 }2011 }2012 // Apply set filters to unmatched elements2013 matchedCount += i;2014 if ( bySet && i !== matchedCount ) {2015 j = 0;2016 while ( (matcher = setMatchers[j++]) ) {2017 matcher( unmatched, setMatched, context, xml );2018 }2019 if ( seed ) {2020 // Reintegrate element matches to eliminate the need for sorting2021 if ( matchedCount > 0 ) {2022 while ( i-- ) {2023 if ( !(unmatched[i] || setMatched[i]) ) {2024 setMatched[i] = pop.call( results );2025 }2026 }2027 }2028 // Discard index placeholder values to get only actual matches2029 setMatched = condense( setMatched );2030 }2031 // Add matches to results2032 push.apply( results, setMatched );2033 // Seedless set matches succeeding multiple successful matchers stipulate sorting2034 if ( outermost && !seed && setMatched.length > 0 &&2035 ( matchedCount + setMatchers.length ) > 1 ) {2036 Sizzle.uniqueSort( results );2037 }2038 }2039 // Override manipulation of globals by nested matchers2040 if ( outermost ) {2041 dirruns = dirrunsUnique;2042 outermostContext = contextBackup;2043 }2044 return unmatched;2045 };2046 return bySet ?2047 markFunction( superMatcher ) :2048 superMatcher;2049}2050compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {2051 var i,2052 setMatchers = [],2053 elementMatchers = [],2054 cached = compilerCache[ selector + " " ];2055 if ( !cached ) {2056 // Generate a function of recursive functions that can be used to check each element2057 if ( !group ) {2058 group = tokenize( selector );2059 }2060 i = group.length;2061 while ( i-- ) {2062 cached = matcherFromTokens( group[i] );2063 if ( cached[ expando ] ) {2064 setMatchers.push( cached );2065 } else {2066 elementMatchers.push( cached );2067 }2068 }2069 // Cache the compiled function2070 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );2071 }2072 return cached;2073};2074function multipleContexts( selector, contexts, results ) {2075 var i = 0,2076 len = contexts.length;2077 for ( ; i < len; i++ ) {2078 Sizzle( selector, contexts[i], results );2079 }2080 return results;2081}2082function select( selector, context, results, seed ) {2083 var i, tokens, token, type, find,2084 match = tokenize( selector );2085 if ( !seed ) {2086 // Try to minimize operations if there is only one group2087 if ( match.length === 1 ) {2088 // Take a shortcut and set the context if the root selector is an ID2089 tokens = match[0] = match[0].slice( 0 );2090 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&2091 support.getById && context.nodeType === 9 && documentIsHTML &&2092 Expr.relative[ tokens[1].type ] ) {2093 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];2094 if ( !context ) {2095 return results;2096 }2097 selector = selector.slice( tokens.shift().value.length );2098 }2099 // Fetch a seed set for right-to-left matching2100 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;2101 while ( i-- ) {2102 token = tokens[i];2103 // Abort if we hit a combinator2104 if ( Expr.relative[ (type = token.type) ] ) {2105 break;2106 }2107 if ( (find = Expr.find[ type ]) ) {2108 // Search, expanding context for leading sibling combinators2109 if ( (seed = find(2110 token.matches[0].replace( runescape, funescape ),2111 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context2112 )) ) {2113 // If seed is empty or no tokens remain, we can return early2114 tokens.splice( i, 1 );2115 selector = seed.length && toSelector( tokens );2116 if ( !selector ) {2117 push.apply( results, seed );2118 return results;2119 }2120 break;2121 }2122 }2123 }2124 }2125 }2126 // Compile and execute a filtering function2127 // Provide `match` to avoid retokenization if we modified the selector above2128 compile( selector, match )(2129 seed,2130 context,2131 !documentIsHTML,2132 results,2133 rsibling.test( selector ) && testContext( context.parentNode ) || context2134 );2135 return results;2136}2137// One-time assignments2138// Sort stability2139support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;2140// Support: Chrome<142141// Always assume duplicates if they aren't passed to the comparison function2142support.detectDuplicates = !!hasDuplicate;2143// Initialize against the default document2144setDocument();2145// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)2146// Detached nodes confoundingly follow *each other*2147support.sortDetached = assert(function( div1 ) {2148 // Should return 1, but returns 4 (following)2149 return div1.compareDocumentPosition( document.createElement("div") ) & 1;2150});2151// Support: IE<82152// Prevent attribute/property "interpolation"2153// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx2154if ( !assert(function( div ) {2155 div.innerHTML = "<a href='#'></a>";2156 return div.firstChild.getAttribute("href") === "#" ;2157}) ) {2158 addHandle( "type|href|height|width", function( elem, name, isXML ) {2159 if ( !isXML ) {2160 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );2161 }2162 });2163}2164// Support: IE<92165// Use defaultValue in place of getAttribute("value")2166if ( !support.attributes || !assert(function( div ) {2167 div.innerHTML = "<input/>";2168 div.firstChild.setAttribute( "value", "" );2169 return div.firstChild.getAttribute( "value" ) === "";2170}) ) {2171 addHandle( "value", function( elem, name, isXML ) {2172 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {2173 return elem.defaultValue;2174 }2175 });2176}2177// Support: IE<92178// Use getAttributeNode to fetch booleans when getAttribute lies2179if ( !assert(function( div ) {2180 return div.getAttribute("disabled") == null;2181}) ) {2182 addHandle( booleans, function( elem, name, isXML ) {2183 var val;2184 if ( !isXML ) {2185 return elem[ name ] === true ? name.toLowerCase() :2186 (val = elem.getAttributeNode( name )) && val.specified ?2187 val.value :2188 null;2189 }2190 });2191}2192return Sizzle;2193})( window );2194jquery.find = Sizzle;2195jquery.expr = Sizzle.selectors;2196jquery.expr[":"] = jquery.expr.pseudos;2197jquery.unique = Sizzle.uniqueSort;2198jquery.text = Sizzle.getText;2199jquery.isXMLDoc = Sizzle.isXML;2200jquery.contains = Sizzle.contains;2201var rneedsContext = jquery.expr.match.needsContext;2202var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);2203var risSimple = /^.[^:#\[\.,]*$/;2204// Implement the identical functionality for filter and not2205function winnow( elements, qualifier, not ) {2206 if ( jquery.isFunction( qualifier ) ) {2207 return jquery.grep( elements, function( elem, i ) {2208 /* jshint -W018 */2209 return !!qualifier.call( elem, i, elem ) !== not;2210 });2211 }2212 if ( qualifier.nodeType ) {2213 return jquery.grep( elements, function( elem ) {2214 return ( elem === qualifier ) !== not;2215 });2216 }2217 if ( typeof qualifier === "string" ) {2218 if ( risSimple.test( qualifier ) ) {2219 return jquery.filter( qualifier, elements, not );2220 }2221 qualifier = jquery.filter( qualifier, elements );2222 }2223 return jquery.grep( elements, function( elem ) {2224 return ( jquery.inArray( elem, qualifier ) >= 0 ) !== not;2225 });2226}2227jquery.filter = function( expr, elems, not ) {2228 var elem = elems[ 0 ];2229 if ( not ) {2230 expr = ":not(" + expr + ")";2231 }2232 return elems.length === 1 && elem.nodeType === 1 ?2233 jquery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :2234 jquery.find.matches( expr, jquery.grep( elems, function( elem ) {2235 return elem.nodeType === 1;2236 }));2237};2238jquery.fn.extend({2239 find: function( selector ) {2240 var i,2241 ret = [],2242 self = this,2243 len = self.length;2244 if ( typeof selector !== "string" ) {2245 return this.pushStack( jquery( selector ).filter(function() {2246 for ( i = 0; i < len; i++ ) {2247 if ( jquery.contains( self[ i ], this ) ) {2248 return true;2249 }2250 }2251 }) );2252 }2253 for ( i = 0; i < len; i++ ) {2254 jquery.find( selector, self[ i ], ret );2255 }2256 // Needed because $( selector, context ) becomes $( context ).find( selector )2257 ret = this.pushStack( len > 1 ? jquery.unique( ret ) : ret );2258 ret.selector = this.selector ? this.selector + " " + selector : selector;2259 return ret;2260 },2261 filter: function( selector ) {2262 return this.pushStack( winnow(this, selector || [], false) );2263 },2264 not: function( selector ) {2265 return this.pushStack( winnow(this, selector || [], true) );2266 },2267 is: function( selector ) {2268 return !!winnow(2269 this,2270 // If this is a positional/relative selector, check membership in the returned set2271 // so $("p:first").is("p:last") won't return true for a doc with two "p".2272 typeof selector === "string" && rneedsContext.test( selector ) ?2273 jquery( selector ) :2274 selector || [],2275 false2276 ).length;2277 }2278});2279// Initialize a jquery object2280// A central reference to the root jquery(document)2281var rootjquery,2282 // Use the correct document accordingly with window argument (sandbox)2283 document = window.document,2284 // A simple way to check for HTML strings2285 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)2286 // Strict HTML recognition (#11290: must start with <)2287 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,2288 init = jquery.fn.init = function( selector, context ) {2289 var match, elem;2290 // HANDLE: $(""), $(null), $(undefined), $(false)2291 if ( !selector ) {2292 return this;2293 }2294 // Handle HTML strings2295 if ( typeof selector === "string" ) {2296 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {2297 // Assume that strings that start and end with <> are HTML and skip the regex check2298 match = [ null, selector, null ];2299 } else {2300 match = rquickExpr.exec( selector );2301 }2302 // Match html or make sure no context is specified for #id2303 if ( match && (match[1] || !context) ) {2304 // HANDLE: $(html) -> $(array)2305 if ( match[1] ) {2306 context = context instanceof jquery ? context[0] : context;2307 // scripts is true for back-compat2308 // Intentionally let the error be thrown if parseHTML is not present2309 jquery.merge( this, jquery.parseHTML(2310 match[1],2311 context && context.nodeType ? context.ownerDocument || context : document,2312 true2313 ) );2314 // HANDLE: $(html, props)2315 if ( rsingleTag.test( match[1] ) && jquery.isPlainObject( context ) ) {2316 for ( match in context ) {2317 // Properties of context are called as methods if possible2318 if ( jquery.isFunction( this[ match ] ) ) {2319 this[ match ]( context[ match ] );2320 // ...and otherwise set as attributes2321 } else {2322 this.attr( match, context[ match ] );2323 }2324 }2325 }2326 return this;2327 // HANDLE: $(#id)2328 } else {2329 elem = document.getElementById( match[2] );2330 // Check parentNode to catch when Blackberry 4.6 returns2331 // nodes that are no longer in the document #69632332 if ( elem && elem.parentNode ) {2333 // Handle the case where IE and Opera return items2334 // by name instead of ID2335 if ( elem.id !== match[2] ) {2336 return rootjquery.find( selector );2337 }2338 // Otherwise, we inject the element directly into the jquery object2339 this.length = 1;2340 this[0] = elem;2341 }2342 this.context = document;2343 this.selector = selector;2344 return this;2345 }2346 // HANDLE: $(expr, $(...))2347 } else if ( !context || context.jquery ) {2348 return ( context || rootjquery ).find( selector );2349 // HANDLE: $(expr, context)2350 // (which is just equivalent to: $(context).find(expr)2351 } else {2352 return this.constructor( context ).find( selector );2353 }2354 // HANDLE: $(DOMElement)2355 } else if ( selector.nodeType ) {2356 this.context = this[0] = selector;2357 this.length = 1;2358 return this;2359 // HANDLE: $(function)2360 // Shortcut for document ready2361 } else if ( jquery.isFunction( selector ) ) {2362 return typeof rootjquery.ready !== "undefined" ?2363 rootjquery.ready( selector ) :2364 // Execute immediately if ready is not present2365 selector( jquery );2366 }2367 if ( selector.selector !== undefined ) {2368 this.selector = selector.selector;2369 this.context = selector.context;2370 }2371 return jquery.makeArray( selector, this );2372 };2373// Give the init function the jquery prototype for later instantiation2374init.prototype = jquery.fn;2375// Initialize central reference2376rootjquery = jquery( document );2377var rparentsprev = /^(?:parents|prev(?:Until|All))/,2378 // methods guaranteed to produce a unique set when starting from a unique set2379 guaranteedUnique = {2380 children: true,2381 contents: true,2382 next: true,2383 prev: true2384 };2385jquery.extend({2386 dir: function( elem, dir, until ) {2387 var matched = [],2388 cur = elem[ dir ];2389 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jquery( cur ).is( until )) ) {2390 if ( cur.nodeType === 1 ) {2391 matched.push( cur );2392 }2393 cur = cur[dir];2394 }2395 return matched;2396 },2397 sibling: function( n, elem ) {2398 var r = [];2399 for ( ; n; n = n.nextSibling ) {2400 if ( n.nodeType === 1 && n !== elem ) {2401 r.push( n );2402 }2403 }2404 return r;2405 }2406});2407jquery.fn.extend({2408 has: function( target ) {2409 var i,2410 targets = jquery( target, this ),2411 len = targets.length;2412 return this.filter(function() {2413 for ( i = 0; i < len; i++ ) {2414 if ( jquery.contains( this, targets[i] ) ) {2415 return true;2416 }2417 }2418 });2419 },2420 closest: function( selectors, context ) {2421 var cur,2422 i = 0,2423 l = this.length,2424 matched = [],2425 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?2426 jquery( selectors, context || this.context ) :2427 0;2428 for ( ; i < l; i++ ) {2429 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {2430 // Always skip document fragments2431 if ( cur.nodeType < 11 && (pos ?2432 pos.index(cur) > -1 :2433 // Don't pass non-elements to Sizzle2434 cur.nodeType === 1 &&2435 jquery.find.matchesSelector(cur, selectors)) ) {2436 matched.push( cur );2437 break;2438 }2439 }2440 }2441 return this.pushStack( matched.length > 1 ? jquery.unique( matched ) : matched );2442 },2443 // Determine the position of an element within2444 // the matched set of elements2445 index: function( elem ) {2446 // No argument, return index in parent2447 if ( !elem ) {2448 return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;2449 }2450 // index in selector2451 if ( typeof elem === "string" ) {2452 return jquery.inArray( this[0], jquery( elem ) );2453 }2454 // Locate the position of the desired element2455 return jquery.inArray(2456 // If it receives a jquery object, the first element is used2457 elem.jquery ? elem[0] : elem, this );2458 },2459 add: function( selector, context ) {2460 return this.pushStack(2461 jquery.unique(2462 jquery.merge( this.get(), jquery( selector, context ) )2463 )2464 );2465 },2466 addBack: function( selector ) {2467 return this.add( selector == null ?2468 this.prevObject : this.prevObject.filter(selector)2469 );2470 }2471});2472function sibling( cur, dir ) {2473 do {2474 cur = cur[ dir ];2475 } while ( cur && cur.nodeType !== 1 );2476 return cur;2477}2478jquery.each({2479 parent: function( elem ) {2480 var parent = elem.parentNode;2481 return parent && parent.nodeType !== 11 ? parent : null;2482 },2483 parents: function( elem ) {2484 return jquery.dir( elem, "parentNode" );2485 },2486 parentsUntil: function( elem, i, until ) {2487 return jquery.dir( elem, "parentNode", until );2488 },2489 next: function( elem ) {2490 return sibling( elem, "nextSibling" );2491 },2492 prev: function( elem ) {2493 return sibling( elem, "previousSibling" );2494 },2495 nextAll: function( elem ) {2496 return jquery.dir( elem, "nextSibling" );2497 },2498 prevAll: function( elem ) {2499 return jquery.dir( elem, "previousSibling" );2500 },2501 nextUntil: function( elem, i, until ) {2502 return jquery.dir( elem, "nextSibling", until );2503 },2504 prevUntil: function( elem, i, until ) {2505 return jquery.dir( elem, "previousSibling", until );2506 },2507 siblings: function( elem ) {2508 return jquery.sibling( ( elem.parentNode || {} ).firstChild, elem );2509 },2510 children: function( elem ) {2511 return jquery.sibling( elem.firstChild );2512 },2513 contents: function( elem ) {2514 return jquery.nodeName( elem, "iframe" ) ?2515 elem.contentDocument || elem.contentWindow.document :2516 jquery.merge( [], elem.childNodes );2517 }2518}, function( name, fn ) {2519 jquery.fn[ name ] = function( until, selector ) {2520 var ret = jquery.map( this, fn, until );2521 if ( name.slice( -5 ) !== "Until" ) {2522 selector = until;2523 }2524 if ( selector && typeof selector === "string" ) {2525 ret = jquery.filter( selector, ret );2526 }2527 if ( this.length > 1 ) {2528 // Remove duplicates2529 if ( !guaranteedUnique[ name ] ) {2530 ret = jquery.unique( ret );2531 }2532 // Reverse order for parents* and prev-derivatives2533 if ( rparentsprev.test( name ) ) {2534 ret = ret.reverse();2535 }2536 }2537 return this.pushStack( ret );2538 };2539});2540var rnotwhite = (/\S+/g);2541// String to Object options format cache2542var optionsCache = {};2543// Convert String-formatted options into Object-formatted ones and store in cache2544function createOptions( options ) {2545 var object = optionsCache[ options ] = {};2546 jquery.each( options.match( rnotwhite ) || [], function( _, flag ) {2547 object[ flag ] = true;2548 });2549 return object;2550}2551/*2552 * Create a callback list using the following parameters:2553 *2554 * options: an optional list of space-separated options that will change how2555 * the callback list behaves or a more traditional option object2556 *2557 * By default a callback list will act like an event callback list and can be2558 * "fired" multiple times.2559 *2560 * Possible options:2561 *2562 * once: will ensure the callback list can only be fired once (like a Deferred)2563 *2564 * memory: will keep track of previous values and will call any callback added2565 * after the list has been fired right away with the latest "memorized"2566 * values (like a Deferred)2567 *2568 * unique: will ensure a callback can only be added once (no duplicate in the list)2569 *2570 * stopOnFalse: interrupt callings when a callback returns false2571 *2572 */2573jquery.Callbacks = function( options ) {2574 // Convert options from String-formatted to Object-formatted if needed2575 // (we check in cache first)2576 options = typeof options === "string" ?2577 ( optionsCache[ options ] || createOptions( options ) ) :2578 jquery.extend( {}, options );2579 var // Flag to know if list is currently firing2580 firing,2581 // Last fire value (for non-forgettable lists)2582 memory,2583 // Flag to know if list was already fired2584 fired,2585 // End of the loop when firing2586 firingLength,2587 // Index of currently firing callback (modified by remove if needed)2588 firingIndex,2589 // First callback to fire (used internally by add and fireWith)2590 firingStart,2591 // Actual callback list2592 list = [],2593 // Stack of fire calls for repeatable lists2594 stack = !options.once && [],2595 // Fire callbacks2596 fire = function( data ) {2597 memory = options.memory && data;2598 fired = true;2599 firingIndex = firingStart || 0;2600 firingStart = 0;2601 firingLength = list.length;2602 firing = true;2603 for ( ; list && firingIndex < firingLength; firingIndex++ ) {2604 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {2605 memory = false; // To prevent further calls using add2606 break;2607 }2608 }2609 firing = false;2610 if ( list ) {2611 if ( stack ) {2612 if ( stack.length ) {2613 fire( stack.shift() );2614 }2615 } else if ( memory ) {2616 list = [];2617 } else {2618 self.disable();2619 }2620 }2621 },2622 // Actual Callbacks object2623 self = {2624 // Add a callback or a collection of callbacks to the list2625 add: function() {2626 if ( list ) {2627 // First, we save the current length2628 var start = list.length;2629 (function add( args ) {2630 jquery.each( args, function( _, arg ) {2631 var type = jquery.type( arg );2632 if ( type === "function" ) {2633 if ( !options.unique || !self.has( arg ) ) {2634 list.push( arg );2635 }2636 } else if ( arg && arg.length && type !== "string" ) {2637 // Inspect recursively2638 add( arg );2639 }2640 });2641 })( arguments );2642 // Do we need to add the callbacks to the2643 // current firing batch?2644 if ( firing ) {2645 firingLength = list.length;2646 // With memory, if we're not firing then2647 // we should call right away2648 } else if ( memory ) {2649 firingStart = start;2650 fire( memory );2651 }2652 }2653 return this;2654 },2655 // Remove a callback from the list2656 remove: function() {2657 if ( list ) {2658 jquery.each( arguments, function( _, arg ) {2659 var index;2660 while ( ( index = jquery.inArray( arg, list, index ) ) > -1 ) {2661 list.splice( index, 1 );2662 // Handle firing indexes2663 if ( firing ) {2664 if ( index <= firingLength ) {2665 firingLength--;2666 }2667 if ( index <= firingIndex ) {2668 firingIndex--;2669 }2670 }2671 }2672 });2673 }2674 return this;2675 },2676 // Check if a given callback is in the list.2677 // If no argument is given, return whether or not list has callbacks attached.2678 has: function( fn ) {2679 return fn ? jquery.inArray( fn, list ) > -1 : !!( list && list.length );2680 },2681 // Remove all callbacks from the list2682 empty: function() {2683 list = [];2684 firingLength = 0;2685 return this;2686 },2687 // Have the list do nothing anymore2688 disable: function() {2689 list = stack = memory = undefined;2690 return this;2691 },2692 // Is it disabled?2693 disabled: function() {2694 return !list;2695 },2696 // Lock the list in its current state2697 lock: function() {2698 stack = undefined;2699 if ( !memory ) {2700 self.disable();2701 }2702 return this;2703 },2704 // Is it locked?2705 locked: function() {2706 return !stack;2707 },2708 // Call all callbacks with the given context and arguments2709 fireWith: function( context, args ) {2710 if ( list && ( !fired || stack ) ) {2711 args = args || [];2712 args = [ context, args.slice ? args.slice() : args ];2713 if ( firing ) {2714 stack.push( args );2715 } else {2716 fire( args );2717 }2718 }2719 return this;2720 },2721 // Call all the callbacks with the given arguments2722 fire: function() {2723 self.fireWith( this, arguments );2724 return this;2725 },2726 // To know if the callbacks have already been called at least once2727 fired: function() {2728 return !!fired;2729 }2730 };2731 return self;2732};2733jquery.extend({2734 Deferred: function( func ) {2735 var tuples = [2736 // action, add listener, listener list, final state2737 [ "resolve", "done", jquery.Callbacks("once memory"), "resolved" ],2738 [ "reject", "fail", jquery.Callbacks("once memory"), "rejected" ],2739 [ "notify", "progress", jquery.Callbacks("memory") ]2740 ],2741 state = "pending",2742 promise = {2743 state: function() {2744 return state;2745 },2746 always: function() {2747 deferred.done( arguments ).fail( arguments );2748 return this;2749 },2750 then: function( /* fnDone, fnFail, fnProgress */ ) {2751 var fns = arguments;2752 return jquery.Deferred(function( newDefer ) {2753 jquery.each( tuples, function( i, tuple ) {2754 var fn = jquery.isFunction( fns[ i ] ) && fns[ i ];2755 // deferred[ done | fail | progress ] for forwarding actions to newDefer2756 deferred[ tuple[1] ](function() {2757 var returned = fn && fn.apply( this, arguments );2758 if ( returned && jquery.isFunction( returned.promise ) ) {2759 returned.promise()2760 .done( newDefer.resolve )2761 .fail( newDefer.reject )2762 .progress( newDefer.notify );2763 } else {2764 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );2765 }2766 });2767 });2768 fns = null;2769 }).promise();2770 },2771 // Get a promise for this deferred2772 // If obj is provided, the promise aspect is added to the object2773 promise: function( obj ) {2774 return obj != null ? jquery.extend( obj, promise ) : promise;2775 }2776 },2777 deferred = {};2778 // Keep pipe for back-compat2779 promise.pipe = promise.then;2780 // Add list-specific methods2781 jquery.each( tuples, function( i, tuple ) {2782 var list = tuple[ 2 ],2783 stateString = tuple[ 3 ];2784 // promise[ done | fail | progress ] = list.add2785 promise[ tuple[1] ] = list.add;2786 // Handle state2787 if ( stateString ) {2788 list.add(function() {2789 // state = [ resolved | rejected ]2790 state = stateString;2791 // [ reject_list | resolve_list ].disable; progress_list.lock2792 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );2793 }2794 // deferred[ resolve | reject | notify ]2795 deferred[ tuple[0] ] = function() {2796 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );2797 return this;2798 };2799 deferred[ tuple[0] + "With" ] = list.fireWith;2800 });2801 // Make the deferred a promise2802 promise.promise( deferred );2803 // Call given func if any2804 if ( func ) {2805 func.call( deferred, deferred );2806 }2807 // All done!2808 return deferred;2809 },2810 // Deferred helper2811 when: function( subordinate /* , ..., subordinateN */ ) {2812 var i = 0,2813 resolveValues = slice.call( arguments ),2814 length = resolveValues.length,2815 // the count of uncompleted subordinates2816 remaining = length !== 1 || ( subordinate && jquery.isFunction( subordinate.promise ) ) ? length : 0,2817 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.2818 deferred = remaining === 1 ? subordinate : jquery.Deferred(),2819 // Update function for both resolve and progress values2820 updateFunc = function( i, contexts, values ) {2821 return function( value ) {2822 contexts[ i ] = this;2823 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;2824 if ( values === progressValues ) {2825 deferred.notifyWith( contexts, values );2826 } else if ( !(--remaining) ) {2827 deferred.resolveWith( contexts, values );2828 }2829 };2830 },2831 progressValues, progressContexts, resolveContexts;2832 // add listeners to Deferred subordinates; treat others as resolved2833 if ( length > 1 ) {2834 progressValues = new Array( length );2835 progressContexts = new Array( length );2836 resolveContexts = new Array( length );2837 for ( ; i < length; i++ ) {2838 if ( resolveValues[ i ] && jquery.isFunction( resolveValues[ i ].promise ) ) {2839 resolveValues[ i ].promise()2840 .done( updateFunc( i, resolveContexts, resolveValues ) )2841 .fail( deferred.reject )2842 .progress( updateFunc( i, progressContexts, progressValues ) );2843 } else {2844 --remaining;2845 }2846 }2847 }2848 // if we're not waiting on anything, resolve the master2849 if ( !remaining ) {2850 deferred.resolveWith( resolveContexts, resolveValues );2851 }2852 return deferred.promise();2853 }2854});2855// The deferred used on DOM ready2856var readyList;2857jquery.fn.ready = function( fn ) {2858 // Add the callback2859 jquery.ready.promise().done( fn );2860 return this;2861};2862jquery.extend({2863 // Is the DOM ready to be used? Set to true once it occurs.2864 isReady: false,2865 // A counter to track how many items to wait for before2866 // the ready event fires. See #67812867 readyWait: 1,2868 // Hold (or release) the ready event2869 holdReady: function( hold ) {2870 if ( hold ) {2871 jquery.readyWait++;2872 } else {2873 jquery.ready( true );2874 }2875 },2876 // Handle when the DOM is ready2877 ready: function( wait ) {2878 // Abort if there are pending holds or we're already ready2879 if ( wait === true ? --jquery.readyWait : jquery.isReady ) {2880 return;2881 }2882 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).2883 if ( !document.body ) {2884 return setTimeout( jquery.ready );2885 }2886 // Remember that the DOM is ready2887 jquery.isReady = true;2888 // If a normal DOM Ready event fired, decrement, and wait if need be2889 if ( wait !== true && --jquery.readyWait > 0 ) {2890 return;2891 }2892 // If there are functions bound, to execute2893 readyList.resolveWith( document, [ jquery ] );2894 // Trigger any bound ready events2895 if ( jquery.fn.trigger ) {2896 jquery( document ).trigger("ready").off("ready");2897 }2898 }2899});2900/**2901 * Clean-up method for dom ready events2902 */2903function detach() {2904 if ( document.addEventListener ) {2905 document.removeEventListener( "DOMContentLoaded", completed, false );2906 window.removeEventListener( "load", completed, false );2907 } else {2908 document.detachEvent( "onreadystatechange", completed );2909 window.detachEvent( "onload", completed );2910 }2911}2912/**2913 * The ready event handler and self cleanup method2914 */2915function completed() {2916 // readyState === "complete" is good enough for us to call the dom ready in oldIE2917 if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {2918 detach();2919 jquery.ready();2920 }2921}2922jquery.ready.promise = function( obj ) {2923 if ( !readyList ) {2924 readyList = jquery.Deferred();2925 // Catch cases where $(document).ready() is called after the browser event has already occurred.2926 // we once tried to use readyState "interactive" here, but it caused issues like the one2927 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:152928 if ( document.readyState === "complete" ) {2929 // Handle it asynchronously to allow scripts the opportunity to delay ready2930 setTimeout( jquery.ready );2931 // Standards-based browsers support DOMContentLoaded2932 } else if ( document.addEventListener ) {2933 // Use the handy event callback2934 document.addEventListener( "DOMContentLoaded", completed, false );2935 // A fallback to window.onload, that will always work2936 window.addEventListener( "load", completed, false );2937 // If IE event model is used2938 } else {2939 // Ensure firing before onload, maybe late but safe also for iframes2940 document.attachEvent( "onreadystatechange", completed );2941 // A fallback to window.onload, that will always work2942 window.attachEvent( "onload", completed );2943 // If IE and not a frame2944 // continually check to see if the document is ready2945 var top = false;2946 try {2947 top = window.frameElement == null && document.documentElement;2948 } catch(e) {}2949 if ( top && top.doScroll ) {2950 (function doScrollCheck() {2951 if ( !jquery.isReady ) {2952 try {2953 // Use the trick by Diego Perini2954 // http://javascript.nwbox.com/IEContentLoaded/2955 top.doScroll("left");2956 } catch(e) {2957 return setTimeout( doScrollCheck, 50 );2958 }2959 // detach all dom ready events2960 detach();2961 // and execute any waiting functions2962 jquery.ready();2963 }2964 })();2965 }2966 }2967 }2968 return readyList.promise( obj );2969};2970var strundefined = typeof undefined;2971// Support: IE<92972// Iteration over object's inherited properties before its own2973var i;2974for ( i in jquery( support ) ) {2975 break;2976}2977support.ownLast = i !== "0";2978// Note: most support tests are defined in their respective modules.2979// false until the test is run2980support.inlineBlockNeedsLayout = false;2981jquery(function() {2982 // We need to execute this one support test ASAP because we need to know2983 // if body.style.zoom needs to be set.2984 var container, div,2985 body = document.getElementsByTagName("body")[0];2986 if ( !body ) {2987 // Return for frameset docs that don't have a body2988 return;2989 }2990 // Setup2991 container = document.createElement( "div" );2992 container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";2993 div = document.createElement( "div" );2994 body.appendChild( container ).appendChild( div );2995 if ( typeof div.style.zoom !== strundefined ) {2996 // Support: IE<82997 // Check if natively block-level elements act like inline-block2998 // elements when setting their display to 'inline' and giving2999 // them layout3000 div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1";3001 if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) {3002 // Prevent IE 6 from affecting layout for positioned elements #110483003 // Prevent IE from shrinking the body in IE 7 mode #128693004 // Support: IE<83005 body.style.zoom = 1;3006 }3007 }3008 body.removeChild( container );3009 // Null elements to avoid leaks in IE3010 container = div = null;3011});3012(function() {3013 var div = document.createElement( "div" );3014 // Execute the test only if not already executed in another module.3015 if (support.deleteExpando == null) {3016 // Support: IE<93017 support.deleteExpando = true;3018 try {3019 delete div.test;3020 } catch( e ) {3021 support.deleteExpando = false;3022 }3023 }3024 // Null elements to avoid leaks in IE.3025 div = null;3026})();3027/**3028 * Determines whether an object can have data3029 */3030jquery.acceptData = function( elem ) {3031 var noData = jquery.noData[ (elem.nodeName + " ").toLowerCase() ],3032 nodeType = +elem.nodeType || 1;3033 // Do not set data on non-element DOM nodes because it will not be cleared (#8335).3034 return nodeType !== 1 && nodeType !== 9 ?3035 false :3036 // Nodes accept data unless otherwise specified; rejection can be conditional3037 !noData || noData !== true && elem.getAttribute("classid") === noData;3038};3039var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,3040 rmultiDash = /([A-Z])/g;3041function dataAttr( elem, key, data ) {3042 // If nothing was found internally, try to fetch any3043 // data from the HTML5 data-* attribute3044 if ( data === undefined && elem.nodeType === 1 ) {3045 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();3046 data = elem.getAttribute( name );3047 if ( typeof data === "string" ) {3048 try {3049 data = data === "true" ? true :3050 data === "false" ? false :3051 data === "null" ? null :3052 // Only convert to a number if it doesn't change the string3053 +data + "" === data ? +data :3054 rbrace.test( data ) ? jquery.parseJSON( data ) :3055 data;3056 } catch( e ) {}3057 // Make sure we set the data so it isn't changed later3058 jquery.data( elem, key, data );3059 } else {3060 data = undefined;3061 }3062 }3063 return data;3064}3065// checks a cache object for emptiness3066function isEmptyDataObject( obj ) {3067 var name;3068 for ( name in obj ) {3069 // if the public data object is empty, the private is still empty3070 if ( name === "data" && jquery.isEmptyObject( obj[name] ) ) {3071 continue;3072 }3073 if ( name !== "toJSON" ) {3074 return false;3075 }3076 }3077 return true;3078}3079function internalData( elem, name, data, pvt /* Internal Use Only */ ) {3080 if ( !jquery.acceptData( elem ) ) {3081 return;3082 }3083 var ret, thisCache,3084 internalKey = jquery.expando,3085 // We have to handle DOM nodes and JS objects differently because IE6-73086 // can't GC object references properly across the DOM-JS boundary3087 isNode = elem.nodeType,3088 // Only DOM nodes need the global jquery cache; JS object data is3089 // attached directly to the object so GC can occur automatically3090 cache = isNode ? jquery.cache : elem,3091 // Only defining an ID for JS objects if its cache already exists allows3092 // the code to shortcut on the same path as a DOM node with no cache3093 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;3094 // Avoid doing any more work than we need to when trying to get data on an3095 // object that has no data at all3096 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {3097 return;3098 }3099 if ( !id ) {3100 // Only DOM nodes need a new unique ID for each element since their data3101 // ends up in the global cache3102 if ( isNode ) {3103 id = elem[ internalKey ] = deletedIds.pop() || jquery.guid++;3104 } else {3105 id = internalKey;3106 }3107 }3108 if ( !cache[ id ] ) {3109 // Avoid exposing jquery metadata on plain JS objects when the object3110 // is serialized using JSON.stringify3111 cache[ id ] = isNode ? {} : { toJSON: jquery.noop };3112 }3113 // An object can be passed to jquery.data instead of a key/value pair; this gets3114 // shallow copied over onto the existing cache3115 if ( typeof name === "object" || typeof name === "function" ) {3116 if ( pvt ) {3117 cache[ id ] = jquery.extend( cache[ id ], name );3118 } else {3119 cache[ id ].data = jquery.extend( cache[ id ].data, name );3120 }3121 }3122 thisCache = cache[ id ];3123 // jquery data() is stored in a separate object inside the object's internal data3124 // cache in order to avoid key collisions between internal data and user-defined3125 // data.3126 if ( !pvt ) {3127 if ( !thisCache.data ) {3128 thisCache.data = {};3129 }3130 thisCache = thisCache.data;3131 }3132 if ( data !== undefined ) {3133 thisCache[ jquery.camelCase( name ) ] = data;3134 }3135 // Check for both converted-to-camel and non-converted data property names3136 // If a data property was specified3137 if ( typeof name === "string" ) {3138 // First Try to find as-is property data3139 ret = thisCache[ name ];3140 // Test for null|undefined property data3141 if ( ret == null ) {3142 // Try to find the camelCased property3143 ret = thisCache[ jquery.camelCase( name ) ];3144 }3145 } else {3146 ret = thisCache;3147 }3148 return ret;3149}3150function internalRemoveData( elem, name, pvt ) {3151 if ( !jquery.acceptData( elem ) ) {3152 return;3153 }3154 var thisCache, i,3155 isNode = elem.nodeType,3156 // See jquery.data for more information3157 cache = isNode ? jquery.cache : elem,3158 id = isNode ? elem[ jquery.expando ] : jquery.expando;3159 // If there is already no cache entry for this object, there is no3160 // purpose in continuing3161 if ( !cache[ id ] ) {3162 return;3163 }3164 if ( name ) {3165 thisCache = pvt ? cache[ id ] : cache[ id ].data;3166 if ( thisCache ) {3167 // Support array or space separated string names for data keys3168 if ( !jquery.isArray( name ) ) {3169 // try the string as a key before any manipulation3170 if ( name in thisCache ) {3171 name = [ name ];3172 } else {3173 // split the camel cased version by spaces unless a key with the spaces exists3174 name = jquery.camelCase( name );3175 if ( name in thisCache ) {3176 name = [ name ];3177 } else {3178 name = name.split(" ");3179 }3180 }3181 } else {3182 // If "name" is an array of keys...3183 // When data is initially created, via ("key", "val") signature,3184 // keys will be converted to camelCase.3185 // Since there is no way to tell _how_ a key was added, remove3186 // both plain key and camelCase key. #127863187 // This will only penalize the array argument path.3188 name = name.concat( jquery.map( name, jquery.camelCase ) );3189 }3190 i = name.length;3191 while ( i-- ) {3192 delete thisCache[ name[i] ];3193 }3194 // If there is no data left in the cache, we want to continue3195 // and let the cache object itself get destroyed3196 if ( pvt ? !isEmptyDataObject(thisCache) : !jquery.isEmptyObject(thisCache) ) {3197 return;3198 }3199 }3200 }3201 // See jquery.data for more information3202 if ( !pvt ) {3203 delete cache[ id ].data;3204 // Don't destroy the parent cache unless the internal data object3205 // had been the only thing left in it3206 if ( !isEmptyDataObject( cache[ id ] ) ) {3207 return;3208 }3209 }3210 // Destroy the cache3211 if ( isNode ) {3212 jquery.cleanData( [ elem ], true );3213 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)3214 /* jshint eqeqeq: false */3215 } else if ( support.deleteExpando || cache != cache.window ) {3216 /* jshint eqeqeq: true */3217 delete cache[ id ];3218 // When all else fails, null3219 } else {3220 cache[ id ] = null;3221 }3222}3223jquery.extend({3224 cache: {},3225 // The following elements (space-suffixed to avoid Object.prototype collisions)3226 // throw uncatchable exceptions if you attempt to set expando properties3227 noData: {3228 "applet ": true,3229 "embed ": true,3230 // ...but Flash objects (which have this classid) *can* handle expandos3231 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"3232 },3233 hasData: function( elem ) {3234 elem = elem.nodeType ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];3235 return !!elem && !isEmptyDataObject( elem );3236 },3237 data: function( elem, name, data ) {3238 return internalData( elem, name, data );3239 },3240 removeData: function( elem, name ) {3241 return internalRemoveData( elem, name );3242 },3243 // For internal use only.3244 _data: function( elem, name, data ) {3245 return internalData( elem, name, data, true );3246 },3247 _removeData: function( elem, name ) {3248 return internalRemoveData( elem, name, true );3249 }3250});3251jquery.fn.extend({3252 data: function( key, value ) {3253 var i, name, data,3254 elem = this[0],3255 attrs = elem && elem.attributes;3256 // Special expections of .data basically thwart jquery.access,3257 // so implement the relevant behavior ourselves3258 // Gets all values3259 if ( key === undefined ) {3260 if ( this.length ) {3261 data = jquery.data( elem );3262 if ( elem.nodeType === 1 && !jquery._data( elem, "parsedAttrs" ) ) {3263 i = attrs.length;3264 while ( i-- ) {3265 name = attrs[i].name;3266 if ( name.indexOf("data-") === 0 ) {3267 name = jquery.camelCase( name.slice(5) );3268 dataAttr( elem, name, data[ name ] );3269 }3270 }3271 jquery._data( elem, "parsedAttrs", true );3272 }3273 }3274 return data;3275 }3276 // Sets multiple values3277 if ( typeof key === "object" ) {3278 return this.each(function() {3279 jquery.data( this, key );3280 });3281 }3282 return arguments.length > 1 ?3283 // Sets one value3284 this.each(function() {3285 jquery.data( this, key, value );3286 }) :3287 // Gets one value3288 // Try to fetch any internally stored data first3289 elem ? dataAttr( elem, key, jquery.data( elem, key ) ) : undefined;3290 },3291 removeData: function( key ) {3292 return this.each(function() {3293 jquery.removeData( this, key );3294 });3295 }3296});3297jquery.extend({3298 queue: function( elem, type, data ) {3299 var queue;3300 if ( elem ) {3301 type = ( type || "fx" ) + "queue";3302 queue = jquery._data( elem, type );3303 // Speed up dequeue by getting out quickly if this is just a lookup3304 if ( data ) {3305 if ( !queue || jquery.isArray(data) ) {3306 queue = jquery._data( elem, type, jquery.makeArray(data) );3307 } else {3308 queue.push( data );3309 }3310 }3311 return queue || [];3312 }3313 },3314 dequeue: function( elem, type ) {3315 type = type || "fx";3316 var queue = jquery.queue( elem, type ),3317 startLength = queue.length,3318 fn = queue.shift(),3319 hooks = jquery._queueHooks( elem, type ),3320 next = function() {3321 jquery.dequeue( elem, type );3322 };3323 // If the fx queue is dequeued, always remove the progress sentinel3324 if ( fn === "inprogress" ) {3325 fn = queue.shift();3326 startLength--;3327 }3328 if ( fn ) {3329 // Add a progress sentinel to prevent the fx queue from being3330 // automatically dequeued3331 if ( type === "fx" ) {3332 queue.unshift( "inprogress" );3333 }3334 // clear up the last queue stop function3335 delete hooks.stop;3336 fn.call( elem, next, hooks );3337 }3338 if ( !startLength && hooks ) {3339 hooks.empty.fire();3340 }3341 },3342 // not intended for public consumption - generates a queueHooks object, or returns the current one3343 _queueHooks: function( elem, type ) {3344 var key = type + "queueHooks";3345 return jquery._data( elem, key ) || jquery._data( elem, key, {3346 empty: jquery.Callbacks("once memory").add(function() {3347 jquery._removeData( elem, type + "queue" );3348 jquery._removeData( elem, key );3349 })3350 });3351 }3352});3353jquery.fn.extend({3354 queue: function( type, data ) {3355 var setter = 2;3356 if ( typeof type !== "string" ) {3357 data = type;3358 type = "fx";3359 setter--;3360 }3361 if ( arguments.length < setter ) {3362 return jquery.queue( this[0], type );3363 }3364 return data === undefined ?3365 this :3366 this.each(function() {3367 var queue = jquery.queue( this, type, data );3368 // ensure a hooks for this queue3369 jquery._queueHooks( this, type );3370 if ( type === "fx" && queue[0] !== "inprogress" ) {3371 jquery.dequeue( this, type );3372 }3373 });3374 },3375 dequeue: function( type ) {3376 return this.each(function() {3377 jquery.dequeue( this, type );3378 });3379 },3380 clearQueue: function( type ) {3381 return this.queue( type || "fx", [] );3382 },3383 // Get a promise resolved when queues of a certain type3384 // are emptied (fx is the type by default)3385 promise: function( type, obj ) {3386 var tmp,3387 count = 1,3388 defer = jquery.Deferred(),3389 elements = this,3390 i = this.length,3391 resolve = function() {3392 if ( !( --count ) ) {3393 defer.resolveWith( elements, [ elements ] );3394 }3395 };3396 if ( typeof type !== "string" ) {3397 obj = type;3398 type = undefined;3399 }3400 type = type || "fx";3401 while ( i-- ) {3402 tmp = jquery._data( elements[ i ], type + "queueHooks" );3403 if ( tmp && tmp.empty ) {3404 count++;3405 tmp.empty.add( resolve );3406 }3407 }3408 resolve();3409 return defer.promise( obj );3410 }3411});3412var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;3413var cssExpand = [ "Top", "Right", "Bottom", "Left" ];3414var isHidden = function( elem, el ) {3415 // isHidden might be called from jquery#filter function;3416 // in that case, element will be second argument3417 elem = el || elem;3418 return jquery.css( elem, "display" ) === "none" || !jquery.contains( elem.ownerDocument, elem );3419 };3420// Multifunctional method to get and set values of a collection3421// The value/s can optionally be executed if it's a function3422var access = jquery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {3423 var i = 0,3424 length = elems.length,3425 bulk = key == null;3426 // Sets many values3427 if ( jquery.type( key ) === "object" ) {3428 chainable = true;3429 for ( i in key ) {3430 jquery.access( elems, fn, i, key[i], true, emptyGet, raw );3431 }3432 // Sets one value3433 } else if ( value !== undefined ) {3434 chainable = true;3435 if ( !jquery.isFunction( value ) ) {3436 raw = true;3437 }3438 if ( bulk ) {3439 // Bulk operations run against the entire set3440 if ( raw ) {3441 fn.call( elems, value );3442 fn = null;3443 // ...except when executing function values3444 } else {3445 bulk = fn;3446 fn = function( elem, key, value ) {3447 return bulk.call( jquery( elem ), value );3448 };3449 }3450 }3451 if ( fn ) {3452 for ( ; i < length; i++ ) {3453 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );3454 }3455 }3456 }3457 return chainable ?3458 elems :3459 // Gets3460 bulk ?3461 fn.call( elems ) :3462 length ? fn( elems[0], key ) : emptyGet;3463};3464var rcheckableType = (/^(?:checkbox|radio)$/i);3465(function() {3466 var fragment = document.createDocumentFragment(),3467 div = document.createElement("div"),3468 input = document.createElement("input");3469 // Setup3470 div.setAttribute( "className", "t" );3471 div.innerHTML = " <link/><table></table><a href='/a'>a</a>";3472 // IE strips leading whitespace when .innerHTML is used3473 support.leadingWhitespace = div.firstChild.nodeType === 3;3474 // Make sure that tbody elements aren't automatically inserted3475 // IE will insert them into empty tables3476 support.tbody = !div.getElementsByTagName( "tbody" ).length;3477 // Make sure that link elements get serialized correctly by innerHTML3478 // This requires a wrapper element in IE3479 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;3480 // Makes sure cloning an html5 element does not cause problems3481 // Where outerHTML is undefined, this still works3482 support.html5Clone =3483 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";3484 // Check if a disconnected checkbox will retain its checked3485 // value of true after appended to the DOM (IE6/7)3486 input.type = "checkbox";3487 input.checked = true;3488 fragment.appendChild( input );3489 support.appendChecked = input.checked;3490 // Make sure textarea (and checkbox) defaultValue is properly cloned3491 // Support: IE6-IE11+3492 div.innerHTML = "<textarea>x</textarea>";3493 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;3494 // #11217 - WebKit loses check when the name is after the checked attribute3495 fragment.appendChild( div );3496 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";3497 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.33498 // old WebKit doesn't clone checked state correctly in fragments3499 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;3500 // Support: IE<93501 // Opera does not clone events (and typeof div.attachEvent === undefined).3502 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()3503 support.noCloneEvent = true;3504 if ( div.attachEvent ) {3505 div.attachEvent( "onclick", function() {3506 support.noCloneEvent = false;3507 });3508 div.cloneNode( true ).click();3509 }3510 // Execute the test only if not already executed in another module.3511 if (support.deleteExpando == null) {3512 // Support: IE<93513 support.deleteExpando = true;3514 try {3515 delete div.test;3516 } catch( e ) {3517 support.deleteExpando = false;3518 }3519 }3520 // Null elements to avoid leaks in IE.3521 fragment = div = input = null;3522})();3523(function() {3524 var i, eventName,3525 div = document.createElement( "div" );3526 // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)3527 for ( i in { submit: true, change: true, focusin: true }) {3528 eventName = "on" + i;3529 if ( !(support[ i + "Bubbles" ] = eventName in window) ) {3530 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)3531 div.setAttribute( eventName, "t" );3532 support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false;3533 }3534 }3535 // Null elements to avoid leaks in IE.3536 div = null;3537})();3538var rformElems = /^(?:input|select|textarea)$/i,3539 rkeyEvent = /^key/,3540 rmouseEvent = /^(?:mouse|contextmenu)|click/,3541 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,3542 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;3543function returnTrue() {3544 return true;3545}3546function returnFalse() {3547 return false;3548}3549function safeActiveElement() {3550 try {3551 return document.activeElement;3552 } catch ( err ) { }3553}3554/*3555 * Helper functions for managing events -- not part of the public interface.3556 * Props to Dean Edwards' addEvent library for many of the ideas.3557 */3558jquery.event = {3559 global: {},3560 add: function( elem, types, handler, data, selector ) {3561 var tmp, events, t, handleObjIn,3562 special, eventHandle, handleObj,3563 handlers, type, namespaces, origType,3564 elemData = jquery._data( elem );3565 // Don't attach events to noData or text/comment nodes (but allow plain objects)3566 if ( !elemData ) {3567 return;3568 }3569 // Caller can pass in an object of custom data in lieu of the handler3570 if ( handler.handler ) {3571 handleObjIn = handler;3572 handler = handleObjIn.handler;3573 selector = handleObjIn.selector;3574 }3575 // Make sure that the handler has a unique ID, used to find/remove it later3576 if ( !handler.guid ) {3577 handler.guid = jquery.guid++;3578 }3579 // Init the element's event structure and main handler, if this is the first3580 if ( !(events = elemData.events) ) {3581 events = elemData.events = {};3582 }3583 if ( !(eventHandle = elemData.handle) ) {3584 eventHandle = elemData.handle = function( e ) {3585 // Discard the second event of a jquery.event.trigger() and3586 // when an event is called after a page has unloaded3587 return typeof jquery !== strundefined && (!e || jquery.event.triggered !== e.type) ?3588 jquery.event.dispatch.apply( eventHandle.elem, arguments ) :3589 undefined;3590 };3591 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events3592 eventHandle.elem = elem;3593 }3594 // Handle multiple events separated by a space3595 types = ( types || "" ).match( rnotwhite ) || [ "" ];3596 t = types.length;3597 while ( t-- ) {3598 tmp = rtypenamespace.exec( types[t] ) || [];3599 type = origType = tmp[1];3600 namespaces = ( tmp[2] || "" ).split( "." ).sort();3601 // There *must* be a type, no attaching namespace-only handlers3602 if ( !type ) {3603 continue;3604 }3605 // If event changes its type, use the special event handlers for the changed type3606 special = jquery.event.special[ type ] || {};3607 // If selector defined, determine special event api type, otherwise given type3608 type = ( selector ? special.delegateType : special.bindType ) || type;3609 // Update special based on newly reset type3610 special = jquery.event.special[ type ] || {};3611 // handleObj is passed to all event handlers3612 handleObj = jquery.extend({3613 type: type,3614 origType: origType,3615 data: data,3616 handler: handler,3617 guid: handler.guid,3618 selector: selector,3619 needsContext: selector && jquery.expr.match.needsContext.test( selector ),3620 namespace: namespaces.join(".")3621 }, handleObjIn );3622 // Init the event handler queue if we're the first3623 if ( !(handlers = events[ type ]) ) {3624 handlers = events[ type ] = [];3625 handlers.delegateCount = 0;3626 // Only use addEventListener/attachEvent if the special events handler returns false3627 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {3628 // Bind the global event handler to the element3629 if ( elem.addEventListener ) {3630 elem.addEventListener( type, eventHandle, false );3631 } else if ( elem.attachEvent ) {3632 elem.attachEvent( "on" + type, eventHandle );3633 }3634 }3635 }3636 if ( special.add ) {3637 special.add.call( elem, handleObj );3638 if ( !handleObj.handler.guid ) {3639 handleObj.handler.guid = handler.guid;3640 }3641 }3642 // Add to the element's handler list, delegates in front3643 if ( selector ) {3644 handlers.splice( handlers.delegateCount++, 0, handleObj );3645 } else {3646 handlers.push( handleObj );3647 }3648 // Keep track of which events have ever been used, for event optimization3649 jquery.event.global[ type ] = true;3650 }3651 // Nullify elem to prevent memory leaks in IE3652 elem = null;3653 },3654 // Detach an event or set of events from an element3655 remove: function( elem, types, handler, selector, mappedTypes ) {3656 var j, handleObj, tmp,3657 origCount, t, events,3658 special, handlers, type,3659 namespaces, origType,3660 elemData = jquery.hasData( elem ) && jquery._data( elem );3661 if ( !elemData || !(events = elemData.events) ) {3662 return;3663 }3664 // Once for each type.namespace in types; type may be omitted3665 types = ( types || "" ).match( rnotwhite ) || [ "" ];3666 t = types.length;3667 while ( t-- ) {3668 tmp = rtypenamespace.exec( types[t] ) || [];3669 type = origType = tmp[1];3670 namespaces = ( tmp[2] || "" ).split( "." ).sort();3671 // Unbind all events (on this namespace, if provided) for the element3672 if ( !type ) {3673 for ( type in events ) {3674 jquery.event.remove( elem, type + types[ t ], handler, selector, true );3675 }3676 continue;3677 }3678 special = jquery.event.special[ type ] || {};3679 type = ( selector ? special.delegateType : special.bindType ) || type;3680 handlers = events[ type ] || [];3681 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );3682 // Remove matching events3683 origCount = j = handlers.length;3684 while ( j-- ) {3685 handleObj = handlers[ j ];3686 if ( ( mappedTypes || origType === handleObj.origType ) &&3687 ( !handler || handler.guid === handleObj.guid ) &&3688 ( !tmp || tmp.test( handleObj.namespace ) ) &&3689 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {3690 handlers.splice( j, 1 );3691 if ( handleObj.selector ) {3692 handlers.delegateCount--;3693 }3694 if ( special.remove ) {3695 special.remove.call( elem, handleObj );3696 }3697 }3698 }3699 // Remove generic event handler if we removed something and no more handlers exist3700 // (avoids potential for endless recursion during removal of special event handlers)3701 if ( origCount && !handlers.length ) {3702 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {3703 jquery.removeEvent( elem, type, elemData.handle );3704 }3705 delete events[ type ];3706 }3707 }3708 // Remove the expando if it's no longer used3709 if ( jquery.isEmptyObject( events ) ) {3710 delete elemData.handle;3711 // removeData also checks for emptiness and clears the expando if empty3712 // so use it instead of delete3713 jquery._removeData( elem, "events" );3714 }3715 },3716 trigger: function( event, data, elem, onlyHandlers ) {3717 var handle, ontype, cur,3718 bubbleType, special, tmp, i,3719 eventPath = [ elem || document ],3720 type = hasOwn.call( event, "type" ) ? event.type : event,3721 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];3722 cur = tmp = elem = elem || document;3723 // Don't do events on text and comment nodes3724 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {3725 return;3726 }3727 // focus/blur morphs to focusin/out; ensure we're not firing them right now3728 if ( rfocusMorph.test( type + jquery.event.triggered ) ) {3729 return;3730 }3731 if ( type.indexOf(".") >= 0 ) {3732 // Namespaced trigger; create a regexp to match event type in handle()3733 namespaces = type.split(".");3734 type = namespaces.shift();3735 namespaces.sort();3736 }3737 ontype = type.indexOf(":") < 0 && "on" + type;3738 // Caller can pass in a jquery.Event object, Object, or just an event type string3739 event = event[ jquery.expando ] ?3740 event :3741 new jquery.Event( type, typeof event === "object" && event );3742 // Trigger bitmask: & 1 for native handlers; & 2 for jquery (always true)3743 event.isTrigger = onlyHandlers ? 2 : 3;3744 event.namespace = namespaces.join(".");3745 event.namespace_re = event.namespace ?3746 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :3747 null;3748 // Clean up the event in case it is being reused3749 event.result = undefined;3750 if ( !event.target ) {3751 event.target = elem;3752 }3753 // Clone any incoming data and prepend the event, creating the handler arg list3754 data = data == null ?3755 [ event ] :3756 jquery.makeArray( data, [ event ] );3757 // Allow special events to draw outside the lines3758 special = jquery.event.special[ type ] || {};3759 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {3760 return;3761 }3762 // Determine event propagation path in advance, per W3C events spec (#9951)3763 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)3764 if ( !onlyHandlers && !special.noBubble && !jquery.isWindow( elem ) ) {3765 bubbleType = special.delegateType || type;3766 if ( !rfocusMorph.test( bubbleType + type ) ) {3767 cur = cur.parentNode;3768 }3769 for ( ; cur; cur = cur.parentNode ) {3770 eventPath.push( cur );3771 tmp = cur;3772 }3773 // Only add window if we got to document (e.g., not plain obj or detached DOM)3774 if ( tmp === (elem.ownerDocument || document) ) {3775 eventPath.push( tmp.defaultView || tmp.parentWindow || window );3776 }3777 }3778 // Fire handlers on the event path3779 i = 0;3780 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {3781 event.type = i > 1 ?3782 bubbleType :3783 special.bindType || type;3784 // jquery handler3785 handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" );3786 if ( handle ) {3787 handle.apply( cur, data );3788 }3789 // Native handler3790 handle = ontype && cur[ ontype ];3791 if ( handle && handle.apply && jquery.acceptData( cur ) ) {3792 event.result = handle.apply( cur, data );3793 if ( event.result === false ) {3794 event.preventDefault();3795 }3796 }3797 }3798 event.type = type;3799 // If nobody prevented the default action, do it now3800 if ( !onlyHandlers && !event.isDefaultPrevented() ) {3801 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&3802 jquery.acceptData( elem ) ) {3803 // Call a native DOM method on the target with the same name name as the event.3804 // Can't use an .isFunction() check here because IE6/7 fails that test.3805 // Don't do default actions on window, that's where global variables be (#6170)3806 if ( ontype && elem[ type ] && !jquery.isWindow( elem ) ) {3807 // Don't re-trigger an onFOO event when we call its FOO() method3808 tmp = elem[ ontype ];3809 if ( tmp ) {3810 elem[ ontype ] = null;3811 }3812 // Prevent re-triggering of the same event, since we already bubbled it above3813 jquery.event.triggered = type;3814 try {3815 elem[ type ]();3816 } catch ( e ) {3817 // IE<9 dies on focus/blur to hidden element (#1486,#12518)3818 // only reproducible on winXP IE8 native, not IE9 in IE8 mode3819 }3820 jquery.event.triggered = undefined;3821 if ( tmp ) {3822 elem[ ontype ] = tmp;3823 }3824 }3825 }3826 }3827 return event.result;3828 },3829 dispatch: function( event ) {3830 // Make a writable jquery.Event from the native event object3831 event = jquery.event.fix( event );3832 var i, ret, handleObj, matched, j,3833 handlerQueue = [],3834 args = slice.call( arguments ),3835 handlers = ( jquery._data( this, "events" ) || {} )[ event.type ] || [],3836 special = jquery.event.special[ event.type ] || {};3837 // Use the fix-ed jquery.Event rather than the (read-only) native event3838 args[0] = event;3839 event.delegateTarget = this;3840 // Call the preDispatch hook for the mapped type, and let it bail if desired3841 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {3842 return;3843 }3844 // Determine handlers3845 handlerQueue = jquery.event.handlers.call( this, event, handlers );3846 // Run delegates first; they may want to stop propagation beneath us3847 i = 0;3848 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {3849 event.currentTarget = matched.elem;3850 j = 0;3851 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {3852 // Triggered event must either 1) have no namespace, or3853 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).3854 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {3855 event.handleObj = handleObj;3856 event.data = handleObj.data;3857 ret = ( (jquery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )3858 .apply( matched.elem, args );3859 if ( ret !== undefined ) {3860 if ( (event.result = ret) === false ) {3861 event.preventDefault();3862 event.stopPropagation();3863 }3864 }3865 }3866 }3867 }3868 // Call the postDispatch hook for the mapped type3869 if ( special.postDispatch ) {3870 special.postDispatch.call( this, event );3871 }3872 return event.result;3873 },3874 handlers: function( event, handlers ) {3875 var sel, handleObj, matches, i,3876 handlerQueue = [],3877 delegateCount = handlers.delegateCount,3878 cur = event.target;3879 // Find delegate handlers3880 // Black-hole SVG <use> instance trees (#13180)3881 // Avoid non-left-click bubbling in Firefox (#3861)3882 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {3883 /* jshint eqeqeq: false */3884 for ( ; cur != this; cur = cur.parentNode || this ) {3885 /* jshint eqeqeq: true */3886 // Don't check non-elements (#13208)3887 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)3888 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {3889 matches = [];3890 for ( i = 0; i < delegateCount; i++ ) {3891 handleObj = handlers[ i ];3892 // Don't conflict with Object.prototype properties (#13203)3893 sel = handleObj.selector + " ";3894 if ( matches[ sel ] === undefined ) {3895 matches[ sel ] = handleObj.needsContext ?3896 jquery( sel, this ).index( cur ) >= 0 :3897 jquery.find( sel, this, null, [ cur ] ).length;3898 }3899 if ( matches[ sel ] ) {3900 matches.push( handleObj );3901 }3902 }3903 if ( matches.length ) {3904 handlerQueue.push({ elem: cur, handlers: matches });3905 }3906 }3907 }3908 }3909 // Add the remaining (directly-bound) handlers3910 if ( delegateCount < handlers.length ) {3911 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });3912 }3913 return handlerQueue;3914 },3915 fix: function( event ) {3916 if ( event[ jquery.expando ] ) {3917 return event;3918 }3919 // Create a writable copy of the event object and normalize some properties3920 var i, prop, copy,3921 type = event.type,3922 originalEvent = event,3923 fixHook = this.fixHooks[ type ];3924 if ( !fixHook ) {3925 this.fixHooks[ type ] = fixHook =3926 rmouseEvent.test( type ) ? this.mouseHooks :3927 rkeyEvent.test( type ) ? this.keyHooks :3928 {};3929 }3930 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;3931 event = new jquery.Event( originalEvent );3932 i = copy.length;3933 while ( i-- ) {3934 prop = copy[ i ];3935 event[ prop ] = originalEvent[ prop ];3936 }3937 // Support: IE<93938 // Fix target property (#1925)3939 if ( !event.target ) {3940 event.target = originalEvent.srcElement || document;3941 }3942 // Support: Chrome 23+, Safari?3943 // Target should not be a text node (#504, #13143)3944 if ( event.target.nodeType === 3 ) {3945 event.target = event.target.parentNode;3946 }3947 // Support: IE<93948 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)3949 event.metaKey = !!event.metaKey;3950 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;3951 },3952 // Includes some event props shared by KeyEvent and MouseEvent3953 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),3954 fixHooks: {},3955 keyHooks: {3956 props: "char charCode key keyCode".split(" "),3957 filter: function( event, original ) {3958 // Add which for key events3959 if ( event.which == null ) {3960 event.which = original.charCode != null ? original.charCode : original.keyCode;3961 }3962 return event;3963 }3964 },3965 mouseHooks: {3966 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),3967 filter: function( event, original ) {3968 var body, eventDoc, doc,3969 button = original.button,3970 fromElement = original.fromElement;3971 // Calculate pageX/Y if missing and clientX/Y available3972 if ( event.pageX == null && original.clientX != null ) {3973 eventDoc = event.target.ownerDocument || document;3974 doc = eventDoc.documentElement;3975 body = eventDoc.body;3976 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );3977 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );3978 }3979 // Add relatedTarget, if necessary3980 if ( !event.relatedTarget && fromElement ) {3981 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;3982 }3983 // Add which for click: 1 === left; 2 === middle; 3 === right3984 // Note: button is not normalized, so don't use it3985 if ( !event.which && button !== undefined ) {3986 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );3987 }3988 return event;3989 }3990 },3991 special: {3992 load: {3993 // Prevent triggered image.load events from bubbling to window.load3994 noBubble: true3995 },3996 focus: {3997 // Fire native event if possible so blur/focus sequence is correct3998 trigger: function() {3999 if ( this !== safeActiveElement() && this.focus ) {4000 try {4001 this.focus();4002 return false;4003 } catch ( e ) {4004 // Support: IE<94005 // If we error on focus to hidden element (#1486, #12518),4006 // let .trigger() run the handlers4007 }4008 }4009 },4010 delegateType: "focusin"4011 },4012 blur: {4013 trigger: function() {4014 if ( this === safeActiveElement() && this.blur ) {4015 this.blur();4016 return false;4017 }4018 },4019 delegateType: "focusout"4020 },4021 click: {4022 // For checkbox, fire native event so checked state will be right4023 trigger: function() {4024 if ( jquery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {4025 this.click();4026 return false;4027 }4028 },4029 // For cross-browser consistency, don't fire native .click() on links4030 _default: function( event ) {4031 return jquery.nodeName( event.target, "a" );4032 }4033 },4034 beforeunload: {4035 postDispatch: function( event ) {4036 // Even when returnValue equals to undefined Firefox will still show alert4037 if ( event.result !== undefined ) {4038 event.originalEvent.returnValue = event.result;4039 }4040 }4041 }4042 },4043 simulate: function( type, elem, event, bubble ) {4044 // Piggyback on a donor event to simulate a different one.4045 // Fake originalEvent to avoid donor's stopPropagation, but if the4046 // simulated event prevents default then we do the same on the donor.4047 var e = jquery.extend(4048 new jquery.Event(),4049 event,4050 {4051 type: type,4052 isSimulated: true,4053 originalEvent: {}4054 }4055 );4056 if ( bubble ) {4057 jquery.event.trigger( e, null, elem );4058 } else {4059 jquery.event.dispatch.call( elem, e );4060 }4061 if ( e.isDefaultPrevented() ) {4062 event.preventDefault();4063 }4064 }4065};4066jquery.removeEvent = document.removeEventListener ?4067 function( elem, type, handle ) {4068 if ( elem.removeEventListener ) {4069 elem.removeEventListener( type, handle, false );4070 }4071 } :4072 function( elem, type, handle ) {4073 var name = "on" + type;4074 if ( elem.detachEvent ) {4075 // #8545, #7054, preventing memory leaks for custom events in IE6-84076 // detachEvent needed property on element, by name of that event, to properly expose it to GC4077 if ( typeof elem[ name ] === strundefined ) {4078 elem[ name ] = null;4079 }4080 elem.detachEvent( name, handle );4081 }4082 };4083jquery.Event = function( src, props ) {4084 // Allow instantiation without the 'new' keyword4085 if ( !(this instanceof jquery.Event) ) {4086 return new jquery.Event( src, props );4087 }4088 // Event object4089 if ( src && src.type ) {4090 this.originalEvent = src;4091 this.type = src.type;4092 // Events bubbling up the document may have been marked as prevented4093 // by a handler lower down the tree; reflect the correct value.4094 this.isDefaultPrevented = src.defaultPrevented ||4095 src.defaultPrevented === undefined && (4096 // Support: IE < 94097 src.returnValue === false ||4098 // Support: Android < 4.04099 src.getPreventDefault && src.getPreventDefault() ) ?4100 returnTrue :4101 returnFalse;4102 // Event type4103 } else {4104 this.type = src;4105 }4106 // Put explicitly provided properties onto the event object4107 if ( props ) {4108 jquery.extend( this, props );4109 }4110 // Create a timestamp if incoming event doesn't have one4111 this.timeStamp = src && src.timeStamp || jquery.now();4112 // Mark it as fixed4113 this[ jquery.expando ] = true;4114};4115// jquery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding4116// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html4117jquery.Event.prototype = {4118 isDefaultPrevented: returnFalse,4119 isPropagationStopped: returnFalse,4120 isImmediatePropagationStopped: returnFalse,4121 preventDefault: function() {4122 var e = this.originalEvent;4123 this.isDefaultPrevented = returnTrue;4124 if ( !e ) {4125 return;4126 }4127 // If preventDefault exists, run it on the original event4128 if ( e.preventDefault ) {4129 e.preventDefault();4130 // Support: IE4131 // Otherwise set the returnValue property of the original event to false4132 } else {4133 e.returnValue = false;4134 }4135 },4136 stopPropagation: function() {4137 var e = this.originalEvent;4138 this.isPropagationStopped = returnTrue;4139 if ( !e ) {4140 return;4141 }4142 // If stopPropagation exists, run it on the original event4143 if ( e.stopPropagation ) {4144 e.stopPropagation();4145 }4146 // Support: IE4147 // Set the cancelBubble property of the original event to true4148 e.cancelBubble = true;4149 },4150 stopImmediatePropagation: function() {4151 this.isImmediatePropagationStopped = returnTrue;4152 this.stopPropagation();4153 }4154};4155// Create mouseenter/leave events using mouseover/out and event-time checks4156jquery.each({4157 mouseenter: "mouseover",4158 mouseleave: "mouseout"4159}, function( orig, fix ) {4160 jquery.event.special[ orig ] = {4161 delegateType: fix,4162 bindType: fix,4163 handle: function( event ) {4164 var ret,4165 target = this,4166 related = event.relatedTarget,4167 handleObj = event.handleObj;4168 // For mousenter/leave call the handler if related is outside the target.4169 // NB: No relatedTarget if the mouse left/entered the browser window4170 if ( !related || (related !== target && !jquery.contains( target, related )) ) {4171 event.type = handleObj.origType;4172 ret = handleObj.handler.apply( this, arguments );4173 event.type = fix;4174 }4175 return ret;4176 }4177 };4178});4179// IE submit delegation4180if ( !support.submitBubbles ) {4181 jquery.event.special.submit = {4182 setup: function() {4183 // Only need this for delegated form submit events4184 if ( jquery.nodeName( this, "form" ) ) {4185 return false;4186 }4187 // Lazy-add a submit handler when a descendant form may potentially be submitted4188 jquery.event.add( this, "click._submit keypress._submit", function( e ) {4189 // Node name check avoids a VML-related crash in IE (#9807)4190 var elem = e.target,4191 form = jquery.nodeName( elem, "input" ) || jquery.nodeName( elem, "button" ) ? elem.form : undefined;4192 if ( form && !jquery._data( form, "submitBubbles" ) ) {4193 jquery.event.add( form, "submit._submit", function( event ) {4194 event._submit_bubble = true;4195 });4196 jquery._data( form, "submitBubbles", true );4197 }4198 });4199 // return undefined since we don't need an event listener4200 },4201 postDispatch: function( event ) {4202 // If form was submitted by the user, bubble the event up the tree4203 if ( event._submit_bubble ) {4204 delete event._submit_bubble;4205 if ( this.parentNode && !event.isTrigger ) {4206 jquery.event.simulate( "submit", this.parentNode, event, true );4207 }4208 }4209 },4210 teardown: function() {4211 // Only need this for delegated form submit events4212 if ( jquery.nodeName( this, "form" ) ) {4213 return false;4214 }4215 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above4216 jquery.event.remove( this, "._submit" );4217 }4218 };4219}4220// IE change delegation and checkbox/radio fix4221if ( !support.changeBubbles ) {4222 jquery.event.special.change = {4223 setup: function() {4224 if ( rformElems.test( this.nodeName ) ) {4225 // IE doesn't fire change on a check/radio until blur; trigger it on click4226 // after a propertychange. Eat the blur-change in special.change.handle.4227 // This still fires onchange a second time for check/radio after blur.4228 if ( this.type === "checkbox" || this.type === "radio" ) {4229 jquery.event.add( this, "propertychange._change", function( event ) {4230 if ( event.originalEvent.propertyName === "checked" ) {4231 this._just_changed = true;4232 }4233 });4234 jquery.event.add( this, "click._change", function( event ) {4235 if ( this._just_changed && !event.isTrigger ) {4236 this._just_changed = false;4237 }4238 // Allow triggered, simulated change events (#11500)4239 jquery.event.simulate( "change", this, event, true );4240 });4241 }4242 return false;4243 }4244 // Delegated event; lazy-add a change handler on descendant inputs4245 jquery.event.add( this, "beforeactivate._change", function( e ) {4246 var elem = e.target;4247 if ( rformElems.test( elem.nodeName ) && !jquery._data( elem, "changeBubbles" ) ) {4248 jquery.event.add( elem, "change._change", function( event ) {4249 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {4250 jquery.event.simulate( "change", this.parentNode, event, true );4251 }4252 });4253 jquery._data( elem, "changeBubbles", true );4254 }4255 });4256 },4257 handle: function( event ) {4258 var elem = event.target;4259 // Swallow native change events from checkbox/radio, we already triggered them above4260 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {4261 return event.handleObj.handler.apply( this, arguments );4262 }4263 },4264 teardown: function() {4265 jquery.event.remove( this, "._change" );4266 return !rformElems.test( this.nodeName );4267 }4268 };4269}4270// Create "bubbling" focus and blur events4271if ( !support.focusinBubbles ) {4272 jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {4273 // Attach a single capturing handler on the document while someone wants focusin/focusout4274 var handler = function( event ) {4275 jquery.event.simulate( fix, event.target, jquery.event.fix( event ), true );4276 };4277 jquery.event.special[ fix ] = {4278 setup: function() {4279 var doc = this.ownerDocument || this,4280 attaches = jquery._data( doc, fix );4281 if ( !attaches ) {4282 doc.addEventListener( orig, handler, true );4283 }4284 jquery._data( doc, fix, ( attaches || 0 ) + 1 );4285 },4286 teardown: function() {4287 var doc = this.ownerDocument || this,4288 attaches = jquery._data( doc, fix ) - 1;4289 if ( !attaches ) {4290 doc.removeEventListener( orig, handler, true );4291 jquery._removeData( doc, fix );4292 } else {4293 jquery._data( doc, fix, attaches );4294 }4295 }4296 };4297 });4298}4299jquery.fn.extend({4300 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {4301 var type, origFn;4302 // Types can be a map of types/handlers4303 if ( typeof types === "object" ) {4304 // ( types-Object, selector, data )4305 if ( typeof selector !== "string" ) {4306 // ( types-Object, data )4307 data = data || selector;4308 selector = undefined;4309 }4310 for ( type in types ) {4311 this.on( type, selector, data, types[ type ], one );4312 }4313 return this;4314 }4315 if ( data == null && fn == null ) {4316 // ( types, fn )4317 fn = selector;4318 data = selector = undefined;4319 } else if ( fn == null ) {4320 if ( typeof selector === "string" ) {4321 // ( types, selector, fn )4322 fn = data;4323 data = undefined;4324 } else {4325 // ( types, data, fn )4326 fn = data;4327 data = selector;4328 selector = undefined;4329 }4330 }4331 if ( fn === false ) {4332 fn = returnFalse;4333 } else if ( !fn ) {4334 return this;4335 }4336 if ( one === 1 ) {4337 origFn = fn;4338 fn = function( event ) {4339 // Can use an empty set, since event contains the info4340 jquery().off( event );4341 return origFn.apply( this, arguments );4342 };4343 // Use same guid so caller can remove using origFn4344 fn.guid = origFn.guid || ( origFn.guid = jquery.guid++ );4345 }4346 return this.each( function() {4347 jquery.event.add( this, types, fn, data, selector );4348 });4349 },4350 one: function( types, selector, data, fn ) {4351 return this.on( types, selector, data, fn, 1 );4352 },4353 off: function( types, selector, fn ) {4354 var handleObj, type;4355 if ( types && types.preventDefault && types.handleObj ) {4356 // ( event ) dispatched jquery.Event4357 handleObj = types.handleObj;4358 jquery( types.delegateTarget ).off(4359 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,4360 handleObj.selector,4361 handleObj.handler4362 );4363 return this;4364 }4365 if ( typeof types === "object" ) {4366 // ( types-object [, selector] )4367 for ( type in types ) {4368 this.off( type, selector, types[ type ] );4369 }4370 return this;4371 }4372 if ( selector === false || typeof selector === "function" ) {4373 // ( types [, fn] )4374 fn = selector;4375 selector = undefined;4376 }4377 if ( fn === false ) {4378 fn = returnFalse;4379 }4380 return this.each(function() {4381 jquery.event.remove( this, types, fn, selector );4382 });4383 },4384 trigger: function( type, data ) {4385 return this.each(function() {4386 jquery.event.trigger( type, data, this );4387 });4388 },4389 triggerHandler: function( type, data ) {4390 var elem = this[0];4391 if ( elem ) {4392 return jquery.event.trigger( type, data, elem, true );4393 }4394 }4395});4396function createSafeFragment( document ) {4397 var list = nodeNames.split( "|" ),4398 safeFrag = document.createDocumentFragment();4399 if ( safeFrag.createElement ) {4400 while ( list.length ) {4401 safeFrag.createElement(4402 list.pop()4403 );4404 }4405 }4406 return safeFrag;4407}4408var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +4409 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",4410 rinlinejquery = / jquery\d+="(?:null|\d+)"/g,4411 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),4412 rleadingWhitespace = /^\s+/,4413 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,4414 rtagName = /<([\w:]+)/,4415 rtbody = /<tbody/i,4416 rhtml = /<|&#?\w+;/,4417 rnoInnerhtml = /<(?:script|style|link)/i,4418 // checked="checked" or checked4419 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,4420 rscriptType = /^$|\/(?:java|ecma)script/i,4421 rscriptTypeMasked = /^true\/(.*)/,4422 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,4423 // We have to close these tags to support XHTML (#13200)4424 wrapMap = {4425 option: [ 1, "<select multiple='multiple'>", "</select>" ],4426 legend: [ 1, "<fieldset>", "</fieldset>" ],4427 area: [ 1, "<map>", "</map>" ],4428 param: [ 1, "<object>", "</object>" ],4429 thead: [ 1, "<table>", "</table>" ],4430 tr: [ 2, "<table><tbody>", "</tbody></table>" ],4431 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],4432 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],4433 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,4434 // unless wrapped in a div with non-breaking characters in front of it.4435 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]4436 },4437 safeFragment = createSafeFragment( document ),4438 fragmentDiv = safeFragment.appendChild( document.createElement("div") );4439wrapMap.optgroup = wrapMap.option;4440wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;4441wrapMap.th = wrapMap.td;4442function getAll( context, tag ) {4443 var elems, elem,4444 i = 0,4445 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) :4446 typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) :4447 undefined;4448 if ( !found ) {4449 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {4450 if ( !tag || jquery.nodeName( elem, tag ) ) {4451 found.push( elem );4452 } else {4453 jquery.merge( found, getAll( elem, tag ) );4454 }4455 }4456 }4457 return tag === undefined || tag && jquery.nodeName( context, tag ) ?4458 jquery.merge( [ context ], found ) :4459 found;4460}4461// Used in buildFragment, fixes the defaultChecked property4462function fixDefaultChecked( elem ) {4463 if ( rcheckableType.test( elem.type ) ) {4464 elem.defaultChecked = elem.checked;4465 }4466}4467// Support: IE<84468// Manipulating tables requires a tbody4469function manipulationTarget( elem, content ) {4470 return jquery.nodeName( elem, "table" ) &&4471 jquery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?4472 elem.getElementsByTagName("tbody")[0] ||4473 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :4474 elem;4475}4476// Replace/restore the type attribute of script elements for safe DOM manipulation4477function disableScript( elem ) {4478 elem.type = (jquery.find.attr( elem, "type" ) !== null) + "/" + elem.type;4479 return elem;4480}4481function restoreScript( elem ) {4482 var match = rscriptTypeMasked.exec( elem.type );4483 if ( match ) {4484 elem.type = match[1];4485 } else {4486 elem.removeAttribute("type");4487 }4488 return elem;4489}4490// Mark scripts as having already been evaluated4491function setGlobalEval( elems, refElements ) {4492 var elem,4493 i = 0;4494 for ( ; (elem = elems[i]) != null; i++ ) {4495 jquery._data( elem, "globalEval", !refElements || jquery._data( refElements[i], "globalEval" ) );4496 }4497}4498function cloneCopyEvent( src, dest ) {4499 if ( dest.nodeType !== 1 || !jquery.hasData( src ) ) {4500 return;4501 }4502 var type, i, l,4503 oldData = jquery._data( src ),4504 curData = jquery._data( dest, oldData ),4505 events = oldData.events;4506 if ( events ) {4507 delete curData.handle;4508 curData.events = {};4509 for ( type in events ) {4510 for ( i = 0, l = events[ type ].length; i < l; i++ ) {4511 jquery.event.add( dest, type, events[ type ][ i ] );4512 }4513 }4514 }4515 // make the cloned public data object a copy from the original4516 if ( curData.data ) {4517 curData.data = jquery.extend( {}, curData.data );4518 }4519}4520function fixCloneNodeIssues( src, dest ) {4521 var nodeName, e, data;4522 // We do not need to do anything for non-Elements4523 if ( dest.nodeType !== 1 ) {4524 return;4525 }4526 nodeName = dest.nodeName.toLowerCase();4527 // IE6-8 copies events bound via attachEvent when using cloneNode.4528 if ( !support.noCloneEvent && dest[ jquery.expando ] ) {4529 data = jquery._data( dest );4530 for ( e in data.events ) {4531 jquery.removeEvent( dest, e, data.handle );4532 }4533 // Event data gets referenced instead of copied if the expando gets copied too4534 dest.removeAttribute( jquery.expando );4535 }4536 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text4537 if ( nodeName === "script" && dest.text !== src.text ) {4538 disableScript( dest ).text = src.text;4539 restoreScript( dest );4540 // IE6-10 improperly clones children of object elements using classid.4541 // IE10 throws NoModificationAllowedError if parent is null, #12132.4542 } else if ( nodeName === "object" ) {4543 if ( dest.parentNode ) {4544 dest.outerHTML = src.outerHTML;4545 }4546 // This path appears unavoidable for IE9. When cloning an object4547 // element in IE9, the outerHTML strategy above is not sufficient.4548 // If the src has innerHTML and the destination does not,4549 // copy the src.innerHTML into the dest.innerHTML. #103244550 if ( support.html5Clone && ( src.innerHTML && !jquery.trim(dest.innerHTML) ) ) {4551 dest.innerHTML = src.innerHTML;4552 }4553 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {4554 // IE6-8 fails to persist the checked state of a cloned checkbox4555 // or radio button. Worse, IE6-7 fail to give the cloned element4556 // a checked appearance if the defaultChecked value isn't also set4557 dest.defaultChecked = dest.checked = src.checked;4558 // IE6-7 get confused and end up setting the value of a cloned4559 // checkbox/radio button to an empty string instead of "on"4560 if ( dest.value !== src.value ) {4561 dest.value = src.value;4562 }4563 // IE6-8 fails to return the selected option to the default selected4564 // state when cloning options4565 } else if ( nodeName === "option" ) {4566 dest.defaultSelected = dest.selected = src.defaultSelected;4567 // IE6-8 fails to set the defaultValue to the correct value when4568 // cloning other types of input fields4569 } else if ( nodeName === "input" || nodeName === "textarea" ) {4570 dest.defaultValue = src.defaultValue;4571 }4572}4573jquery.extend({4574 clone: function( elem, dataAndEvents, deepDataAndEvents ) {4575 var destElements, node, clone, i, srcElements,4576 inPage = jquery.contains( elem.ownerDocument, elem );4577 if ( support.html5Clone || jquery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {4578 clone = elem.cloneNode( true );4579 // IE<=8 does not properly clone detached, unknown element nodes4580 } else {4581 fragmentDiv.innerHTML = elem.outerHTML;4582 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );4583 }4584 if ( (!support.noCloneEvent || !support.noCloneChecked) &&4585 (elem.nodeType === 1 || elem.nodeType === 11) && !jquery.isXMLDoc(elem) ) {4586 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/24587 destElements = getAll( clone );4588 srcElements = getAll( elem );4589 // Fix all IE cloning issues4590 for ( i = 0; (node = srcElements[i]) != null; ++i ) {4591 // Ensure that the destination node is not null; Fixes #95874592 if ( destElements[i] ) {4593 fixCloneNodeIssues( node, destElements[i] );4594 }4595 }4596 }4597 // Copy the events from the original to the clone4598 if ( dataAndEvents ) {4599 if ( deepDataAndEvents ) {4600 srcElements = srcElements || getAll( elem );4601 destElements = destElements || getAll( clone );4602 for ( i = 0; (node = srcElements[i]) != null; i++ ) {4603 cloneCopyEvent( node, destElements[i] );4604 }4605 } else {4606 cloneCopyEvent( elem, clone );4607 }4608 }4609 // Preserve script evaluation history4610 destElements = getAll( clone, "script" );4611 if ( destElements.length > 0 ) {4612 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );4613 }4614 destElements = srcElements = node = null;4615 // Return the cloned set4616 return clone;4617 },4618 buildFragment: function( elems, context, scripts, selection ) {4619 var j, elem, contains,4620 tmp, tag, tbody, wrap,4621 l = elems.length,4622 // Ensure a safe fragment4623 safe = createSafeFragment( context ),4624 nodes = [],4625 i = 0;4626 for ( ; i < l; i++ ) {4627 elem = elems[ i ];4628 if ( elem || elem === 0 ) {4629 // Add nodes directly4630 if ( jquery.type( elem ) === "object" ) {4631 jquery.merge( nodes, elem.nodeType ? [ elem ] : elem );4632 // Convert non-html into a text node4633 } else if ( !rhtml.test( elem ) ) {4634 nodes.push( context.createTextNode( elem ) );4635 // Convert html into DOM nodes4636 } else {4637 tmp = tmp || safe.appendChild( context.createElement("div") );4638 // Deserialize a standard representation4639 tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase();4640 wrap = wrapMap[ tag ] || wrapMap._default;4641 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];4642 // Descend through wrappers to the right content4643 j = wrap[0];4644 while ( j-- ) {4645 tmp = tmp.lastChild;4646 }4647 // Manually add leading whitespace removed by IE4648 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {4649 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );4650 }4651 // Remove IE's autoinserted <tbody> from table fragments4652 if ( !support.tbody ) {4653 // String was a <table>, *may* have spurious <tbody>4654 elem = tag === "table" && !rtbody.test( elem ) ?4655 tmp.firstChild :4656 // String was a bare <thead> or <tfoot>4657 wrap[1] === "<table>" && !rtbody.test( elem ) ?4658 tmp :4659 0;4660 j = elem && elem.childNodes.length;4661 while ( j-- ) {4662 if ( jquery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {4663 elem.removeChild( tbody );4664 }4665 }4666 }4667 jquery.merge( nodes, tmp.childNodes );4668 // Fix #12392 for WebKit and IE > 94669 tmp.textContent = "";4670 // Fix #12392 for oldIE4671 while ( tmp.firstChild ) {4672 tmp.removeChild( tmp.firstChild );4673 }4674 // Remember the top-level container for proper cleanup4675 tmp = safe.lastChild;4676 }4677 }4678 }4679 // Fix #11356: Clear elements from fragment4680 if ( tmp ) {4681 safe.removeChild( tmp );4682 }4683 // Reset defaultChecked for any radios and checkboxes4684 // about to be appended to the DOM in IE 6/7 (#8060)4685 if ( !support.appendChecked ) {4686 jquery.grep( getAll( nodes, "input" ), fixDefaultChecked );4687 }4688 i = 0;4689 while ( (elem = nodes[ i++ ]) ) {4690 // #4087 - If origin and destination elements are the same, and this is4691 // that element, do not do anything4692 if ( selection && jquery.inArray( elem, selection ) !== -1 ) {4693 continue;4694 }4695 contains = jquery.contains( elem.ownerDocument, elem );4696 // Append to fragment4697 tmp = getAll( safe.appendChild( elem ), "script" );4698 // Preserve script evaluation history4699 if ( contains ) {4700 setGlobalEval( tmp );4701 }4702 // Capture executables4703 if ( scripts ) {4704 j = 0;4705 while ( (elem = tmp[ j++ ]) ) {4706 if ( rscriptType.test( elem.type || "" ) ) {4707 scripts.push( elem );4708 }4709 }4710 }4711 }4712 tmp = null;4713 return safe;4714 },4715 cleanData: function( elems, /* internal */ acceptData ) {4716 var elem, type, id, data,4717 i = 0,4718 internalKey = jquery.expando,4719 cache = jquery.cache,4720 deleteExpando = support.deleteExpando,4721 special = jquery.event.special;4722 for ( ; (elem = elems[i]) != null; i++ ) {4723 if ( acceptData || jquery.acceptData( elem ) ) {4724 id = elem[ internalKey ];4725 data = id && cache[ id ];4726 if ( data ) {4727 if ( data.events ) {4728 for ( type in data.events ) {4729 if ( special[ type ] ) {4730 jquery.event.remove( elem, type );4731 // This is a shortcut to avoid jquery.event.remove's overhead4732 } else {4733 jquery.removeEvent( elem, type, data.handle );4734 }4735 }4736 }4737 // Remove cache only if it was not already removed by jquery.event.remove4738 if ( cache[ id ] ) {4739 delete cache[ id ];4740 // IE does not allow us to delete expando properties from nodes,4741 // nor does it have a removeAttribute function on Document nodes;4742 // we must handle all of these cases4743 if ( deleteExpando ) {4744 delete elem[ internalKey ];4745 } else if ( typeof elem.removeAttribute !== strundefined ) {4746 elem.removeAttribute( internalKey );4747 } else {4748 elem[ internalKey ] = null;4749 }4750 deletedIds.push( id );4751 }4752 }4753 }4754 }4755 }4756});4757jquery.fn.extend({4758 text: function( value ) {4759 return access( this, function( value ) {4760 return value === undefined ?4761 jquery.text( this ) :4762 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );4763 }, null, value, arguments.length );4764 },4765 append: function() {4766 return this.domManip( arguments, function( elem ) {4767 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {4768 var target = manipulationTarget( this, elem );4769 target.appendChild( elem );4770 }4771 });4772 },4773 prepend: function() {4774 return this.domManip( arguments, function( elem ) {4775 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {4776 var target = manipulationTarget( this, elem );4777 target.insertBefore( elem, target.firstChild );4778 }4779 });4780 },4781 before: function() {4782 return this.domManip( arguments, function( elem ) {4783 if ( this.parentNode ) {4784 this.parentNode.insertBefore( elem, this );4785 }4786 });4787 },4788 after: function() {4789 return this.domManip( arguments, function( elem ) {4790 if ( this.parentNode ) {4791 this.parentNode.insertBefore( elem, this.nextSibling );4792 }4793 });4794 },4795 remove: function( selector, keepData /* Internal Use Only */ ) {4796 var elem,4797 elems = selector ? jquery.filter( selector, this ) : this,4798 i = 0;4799 for ( ; (elem = elems[i]) != null; i++ ) {4800 if ( !keepData && elem.nodeType === 1 ) {4801 jquery.cleanData( getAll( elem ) );4802 }4803 if ( elem.parentNode ) {4804 if ( keepData && jquery.contains( elem.ownerDocument, elem ) ) {4805 setGlobalEval( getAll( elem, "script" ) );4806 }4807 elem.parentNode.removeChild( elem );4808 }4809 }4810 return this;4811 },4812 empty: function() {4813 var elem,4814 i = 0;4815 for ( ; (elem = this[i]) != null; i++ ) {4816 // Remove element nodes and prevent memory leaks4817 if ( elem.nodeType === 1 ) {4818 jquery.cleanData( getAll( elem, false ) );4819 }4820 // Remove any remaining nodes4821 while ( elem.firstChild ) {4822 elem.removeChild( elem.firstChild );4823 }4824 // If this is a select, ensure that it displays empty (#12336)4825 // Support: IE<94826 if ( elem.options && jquery.nodeName( elem, "select" ) ) {4827 elem.options.length = 0;4828 }4829 }4830 return this;4831 },4832 clone: function( dataAndEvents, deepDataAndEvents ) {4833 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;4834 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;4835 return this.map(function() {4836 return jquery.clone( this, dataAndEvents, deepDataAndEvents );4837 });4838 },4839 html: function( value ) {4840 return access( this, function( value ) {4841 var elem = this[ 0 ] || {},4842 i = 0,4843 l = this.length;4844 if ( value === undefined ) {4845 return elem.nodeType === 1 ?4846 elem.innerHTML.replace( rinlinejquery, "" ) :4847 undefined;4848 }4849 // See if we can take a shortcut and just use innerHTML4850 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&4851 ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&4852 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&4853 !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) {4854 value = value.replace( rxhtmlTag, "<$1></$2>" );4855 try {4856 for (; i < l; i++ ) {4857 // Remove element nodes and prevent memory leaks4858 elem = this[i] || {};4859 if ( elem.nodeType === 1 ) {4860 jquery.cleanData( getAll( elem, false ) );4861 elem.innerHTML = value;4862 }4863 }4864 elem = 0;4865 // If using innerHTML throws an exception, use the fallback method4866 } catch(e) {}4867 }4868 if ( elem ) {4869 this.empty().append( value );4870 }4871 }, null, value, arguments.length );4872 },4873 replaceWith: function() {4874 var arg = arguments[ 0 ];4875 // Make the changes, replacing each context element with the new content4876 this.domManip( arguments, function( elem ) {4877 arg = this.parentNode;4878 jquery.cleanData( getAll( this ) );4879 if ( arg ) {4880 arg.replaceChild( elem, this );4881 }4882 });4883 // Force removal if there was no new content (e.g., from empty arguments)4884 return arg && (arg.length || arg.nodeType) ? this : this.remove();4885 },4886 detach: function( selector ) {4887 return this.remove( selector, true );4888 },4889 domManip: function( args, callback ) {4890 // Flatten any nested arrays4891 args = concat.apply( [], args );4892 var first, node, hasScripts,4893 scripts, doc, fragment,4894 i = 0,4895 l = this.length,4896 set = this,4897 iNoClone = l - 1,4898 value = args[0],4899 isFunction = jquery.isFunction( value );4900 // We can't cloneNode fragments that contain checked, in WebKit4901 if ( isFunction ||4902 ( l > 1 && typeof value === "string" &&4903 !support.checkClone && rchecked.test( value ) ) ) {4904 return this.each(function( index ) {4905 var self = set.eq( index );4906 if ( isFunction ) {4907 args[0] = value.call( this, index, self.html() );4908 }4909 self.domManip( args, callback );4910 });4911 }4912 if ( l ) {4913 fragment = jquery.buildFragment( args, this[ 0 ].ownerDocument, false, this );4914 first = fragment.firstChild;4915 if ( fragment.childNodes.length === 1 ) {4916 fragment = first;4917 }4918 if ( first ) {4919 scripts = jquery.map( getAll( fragment, "script" ), disableScript );4920 hasScripts = scripts.length;4921 // Use the original fragment for the last item instead of the first because it can end up4922 // being emptied incorrectly in certain situations (#8070).4923 for ( ; i < l; i++ ) {4924 node = fragment;4925 if ( i !== iNoClone ) {4926 node = jquery.clone( node, true, true );4927 // Keep references to cloned scripts for later restoration4928 if ( hasScripts ) {4929 jquery.merge( scripts, getAll( node, "script" ) );4930 }4931 }4932 callback.call( this[i], node, i );4933 }4934 if ( hasScripts ) {4935 doc = scripts[ scripts.length - 1 ].ownerDocument;4936 // Reenable scripts4937 jquery.map( scripts, restoreScript );4938 // Evaluate executable scripts on first document insertion4939 for ( i = 0; i < hasScripts; i++ ) {4940 node = scripts[ i ];4941 if ( rscriptType.test( node.type || "" ) &&4942 !jquery._data( node, "globalEval" ) && jquery.contains( doc, node ) ) {4943 if ( node.src ) {4944 // Optional AJAX dependency, but won't run scripts if not present4945 if ( jquery._evalUrl ) {4946 jquery._evalUrl( node.src );4947 }4948 } else {4949 jquery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );4950 }4951 }4952 }4953 }4954 // Fix #11809: Avoid leaking memory4955 fragment = first = null;4956 }4957 }4958 return this;4959 }4960});4961jquery.each({4962 appendTo: "append",4963 prependTo: "prepend",4964 insertBefore: "before",4965 insertAfter: "after",4966 replaceAll: "replaceWith"4967}, function( name, original ) {4968 jquery.fn[ name ] = function( selector ) {4969 var elems,4970 i = 0,4971 ret = [],4972 insert = jquery( selector ),4973 last = insert.length - 1;4974 for ( ; i <= last; i++ ) {4975 elems = i === last ? this : this.clone(true);4976 jquery( insert[i] )[ original ]( elems );4977 // Modern browsers can apply jquery collections as arrays, but oldIE needs a .get()4978 push.apply( ret, elems.get() );4979 }4980 return this.pushStack( ret );4981 };4982});4983var iframe,4984 elemdisplay = {};4985/**4986 * Retrieve the actual display of a element4987 * @param {String} name nodeName of the element4988 * @param {Object} doc Document object4989 */4990// Called only from within defaultDisplay4991function actualDisplay( name, doc ) {4992 var elem = jquery( doc.createElement( name ) ).appendTo( doc.body ),4993 // getDefaultComputedStyle might be reliably used only on attached element4994 display = window.getDefaultComputedStyle ?4995 // Use of this method is a temporary fix (more like optmization) until something better comes along,4996 // since it was removed from specification and supported only in FF4997 window.getDefaultComputedStyle( elem[ 0 ] ).display : jquery.css( elem[ 0 ], "display" );4998 // We don't have any data stored on the element,4999 // so use "detach" method as fast way to get rid of the element5000 elem.detach();5001 return display;5002}5003/**5004 * Try to determine the default display value of an element5005 * @param {String} nodeName5006 */5007function defaultDisplay( nodeName ) {5008 var doc = document,5009 display = elemdisplay[ nodeName ];5010 if ( !display ) {5011 display = actualDisplay( nodeName, doc );5012 // If the simple way fails, read from inside an iframe5013 if ( display === "none" || !display ) {5014 // Use the already-created iframe if possible5015 iframe = (iframe || jquery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );5016 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse5017 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;5018 // Support: IE5019 doc.write();5020 doc.close();5021 display = actualDisplay( nodeName, doc );5022 iframe.detach();5023 }5024 // Store the correct default display5025 elemdisplay[ nodeName ] = display;5026 }5027 return display;5028}5029(function() {5030 var a, shrinkWrapBlocksVal,5031 div = document.createElement( "div" ),5032 divReset =5033 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +5034 "display:block;padding:0;margin:0;border:0";5035 // Setup5036 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5037 a = div.getElementsByTagName( "a" )[ 0 ];5038 a.style.cssText = "float:left;opacity:.5";5039 // Make sure that element opacity exists5040 // (IE uses filter instead)5041 // Use a regex to work around a WebKit issue. See #51455042 support.opacity = /^0.5/.test( a.style.opacity );5043 // Verify style float existence5044 // (IE uses styleFloat instead of cssFloat)5045 support.cssFloat = !!a.style.cssFloat;5046 div.style.backgroundClip = "content-box";5047 div.cloneNode( true ).style.backgroundClip = "";5048 support.clearCloneStyle = div.style.backgroundClip === "content-box";5049 // Null elements to avoid leaks in IE.5050 a = div = null;5051 support.shrinkWrapBlocks = function() {5052 var body, container, div, containerStyles;5053 if ( shrinkWrapBlocksVal == null ) {5054 body = document.getElementsByTagName( "body" )[ 0 ];5055 if ( !body ) {5056 // Test fired too early or in an unsupported environment, exit.5057 return;5058 }5059 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px";5060 container = document.createElement( "div" );5061 div = document.createElement( "div" );5062 body.appendChild( container ).appendChild( div );5063 // Will be changed later if needed.5064 shrinkWrapBlocksVal = false;5065 if ( typeof div.style.zoom !== strundefined ) {5066 // Support: IE65067 // Check if elements with layout shrink-wrap their children5068 div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1";5069 div.innerHTML = "<div></div>";5070 div.firstChild.style.width = "5px";5071 shrinkWrapBlocksVal = div.offsetWidth !== 3;5072 }5073 body.removeChild( container );5074 // Null elements to avoid leaks in IE.5075 body = container = div = null;5076 }5077 return shrinkWrapBlocksVal;5078 };5079})();5080var rmargin = (/^margin/);5081var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );5082var getStyles, curCSS,5083 rposition = /^(top|right|bottom|left)$/;5084if ( window.getComputedStyle ) {5085 getStyles = function( elem ) {5086 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );5087 };5088 curCSS = function( elem, name, computed ) {5089 var width, minWidth, maxWidth, ret,5090 style = elem.style;5091 computed = computed || getStyles( elem );5092 // getPropertyValue is only needed for .css('filter') in IE9, see #125375093 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;5094 if ( computed ) {5095 if ( ret === "" && !jquery.contains( elem.ownerDocument, elem ) ) {5096 ret = jquery.style( elem, name );5097 }5098 // A tribute to the "awesome hack by Dean Edwards"5099 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right5100 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels5101 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values5102 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {5103 // Remember the original values5104 width = style.width;5105 minWidth = style.minWidth;5106 maxWidth = style.maxWidth;5107 // Put in the new values to get a computed value out5108 style.minWidth = style.maxWidth = style.width = ret;5109 ret = computed.width;5110 // Revert the changed values5111 style.width = width;5112 style.minWidth = minWidth;5113 style.maxWidth = maxWidth;5114 }5115 }5116 // Support: IE5117 // IE returns zIndex value as an integer.5118 return ret === undefined ?5119 ret :5120 ret + "";5121 };5122} else if ( document.documentElement.currentStyle ) {5123 getStyles = function( elem ) {5124 return elem.currentStyle;5125 };5126 curCSS = function( elem, name, computed ) {5127 var left, rs, rsLeft, ret,5128 style = elem.style;5129 computed = computed || getStyles( elem );5130 ret = computed ? computed[ name ] : undefined;5131 // Avoid setting ret to empty string here5132 // so we don't default to auto5133 if ( ret == null && style && style[ name ] ) {5134 ret = style[ name ];5135 }5136 // From the awesome hack by Dean Edwards5137 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022915138 // If we're not dealing with a regular pixel number5139 // but a number that has a weird ending, we need to convert it to pixels5140 // but not position css attributes, as those are proportional to the parent element instead5141 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem5142 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {5143 // Remember the original values5144 left = style.left;5145 rs = elem.runtimeStyle;5146 rsLeft = rs && rs.left;5147 // Put in the new values to get a computed value out5148 if ( rsLeft ) {5149 rs.left = elem.currentStyle.left;5150 }5151 style.left = name === "fontSize" ? "1em" : ret;5152 ret = style.pixelLeft + "px";5153 // Revert the changed values5154 style.left = left;5155 if ( rsLeft ) {5156 rs.left = rsLeft;5157 }5158 }5159 // Support: IE5160 // IE returns zIndex value as an integer.5161 return ret === undefined ?5162 ret :5163 ret + "" || "auto";5164 };5165}5166function addGetHookIf( conditionFn, hookFn ) {5167 // Define the hook, we'll check on the first run if it's really needed.5168 return {5169 get: function() {5170 var condition = conditionFn();5171 if ( condition == null ) {5172 // The test was not ready at this point; screw the hook this time5173 // but check again when needed next time.5174 return;5175 }5176 if ( condition ) {5177 // Hook not needed (or it's not possible to use it due to missing dependency),5178 // remove it.5179 // Since there are no other hooks for marginRight, remove the whole object.5180 delete this.get;5181 return;5182 }5183 // Hook needed; redefine it so that the support test is not executed again.5184 return (this.get = hookFn).apply( this, arguments );5185 }5186 };5187}5188(function() {5189 var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal,5190 pixelPositionVal, reliableMarginRightVal,5191 div = document.createElement( "div" ),5192 containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px",5193 divReset =5194 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +5195 "display:block;padding:0;margin:0;border:0";5196 // Setup5197 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5198 a = div.getElementsByTagName( "a" )[ 0 ];5199 a.style.cssText = "float:left;opacity:.5";5200 // Make sure that element opacity exists5201 // (IE uses filter instead)5202 // Use a regex to work around a WebKit issue. See #51455203 support.opacity = /^0.5/.test( a.style.opacity );5204 // Verify style float existence5205 // (IE uses styleFloat instead of cssFloat)5206 support.cssFloat = !!a.style.cssFloat;5207 div.style.backgroundClip = "content-box";5208 div.cloneNode( true ).style.backgroundClip = "";5209 support.clearCloneStyle = div.style.backgroundClip === "content-box";5210 // Null elements to avoid leaks in IE.5211 a = div = null;5212 jquery.extend(support, {5213 reliableHiddenOffsets: function() {5214 if ( reliableHiddenOffsetsVal != null ) {5215 return reliableHiddenOffsetsVal;5216 }5217 var container, tds, isSupported,5218 div = document.createElement( "div" ),5219 body = document.getElementsByTagName( "body" )[ 0 ];5220 if ( !body ) {5221 // Return for frameset docs that don't have a body5222 return;5223 }5224 // Setup5225 div.setAttribute( "className", "t" );5226 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";5227 container = document.createElement( "div" );5228 container.style.cssText = containerStyles;5229 body.appendChild( container ).appendChild( div );5230 // Support: IE85231 // Check if table cells still have offsetWidth/Height when they are set5232 // to display:none and there are still other visible table cells in a5233 // table row; if so, offsetWidth/Height are not reliable for use when5234 // determining if an element has been hidden directly using5235 // display:none (it is still safe to use offsets if a parent element is5236 // hidden; don safety goggles and see bug #4512 for more information).5237 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";5238 tds = div.getElementsByTagName( "td" );5239 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";5240 isSupported = ( tds[ 0 ].offsetHeight === 0 );5241 tds[ 0 ].style.display = "";5242 tds[ 1 ].style.display = "none";5243 // Support: IE85244 // Check if empty table cells still have offsetWidth/Height5245 reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 );5246 body.removeChild( container );5247 // Null elements to avoid leaks in IE.5248 div = body = null;5249 return reliableHiddenOffsetsVal;5250 },5251 boxSizing: function() {5252 if ( boxSizingVal == null ) {5253 computeStyleTests();5254 }5255 return boxSizingVal;5256 },5257 boxSizingReliable: function() {5258 if ( boxSizingReliableVal == null ) {5259 computeStyleTests();5260 }5261 return boxSizingReliableVal;5262 },5263 pixelPosition: function() {5264 if ( pixelPositionVal == null ) {5265 computeStyleTests();5266 }5267 return pixelPositionVal;5268 },5269 reliableMarginRight: function() {5270 var body, container, div, marginDiv;5271 // Use window.getComputedStyle because jsdom on node.js will break without it.5272 if ( reliableMarginRightVal == null && window.getComputedStyle ) {5273 body = document.getElementsByTagName( "body" )[ 0 ];5274 if ( !body ) {5275 // Test fired too early or in an unsupported environment, exit.5276 return;5277 }5278 container = document.createElement( "div" );5279 div = document.createElement( "div" );5280 container.style.cssText = containerStyles;5281 body.appendChild( container ).appendChild( div );5282 // Check if div with explicit width and no margin-right incorrectly5283 // gets computed margin-right based on width of container. (#3333)5284 // Fails in WebKit before Feb 2011 nightlies5285 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right5286 marginDiv = div.appendChild( document.createElement( "div" ) );5287 marginDiv.style.cssText = div.style.cssText = divReset;5288 marginDiv.style.marginRight = marginDiv.style.width = "0";5289 div.style.width = "1px";5290 reliableMarginRightVal =5291 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );5292 body.removeChild( container );5293 }5294 return reliableMarginRightVal;5295 }5296 });5297 function computeStyleTests() {5298 var container, div,5299 body = document.getElementsByTagName( "body" )[ 0 ];5300 if ( !body ) {5301 // Test fired too early or in an unsupported environment, exit.5302 return;5303 }5304 container = document.createElement( "div" );5305 div = document.createElement( "div" );5306 container.style.cssText = containerStyles;5307 body.appendChild( container ).appendChild( div );5308 div.style.cssText =5309 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +5310 "position:absolute;display:block;padding:1px;border:1px;width:4px;" +5311 "margin-top:1%;top:1%";5312 // Workaround failing boxSizing test due to offsetWidth returning wrong value5313 // with some non-1 values of body zoom, ticket #135435314 jquery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {5315 boxSizingVal = div.offsetWidth === 4;5316 });5317 // Will be changed later if needed.5318 boxSizingReliableVal = true;5319 pixelPositionVal = false;5320 reliableMarginRightVal = true;5321 // Use window.getComputedStyle because jsdom on node.js will break without it.5322 if ( window.getComputedStyle ) {5323 pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";5324 boxSizingReliableVal =5325 ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";5326 }5327 body.removeChild( container );5328 // Null elements to avoid leaks in IE.5329 div = body = null;5330 }5331})();5332// A method for quickly swapping in/out CSS properties to get correct calculations.5333jquery.swap = function( elem, options, callback, args ) {5334 var ret, name,5335 old = {};5336 // Remember the old values, and insert the new ones5337 for ( name in options ) {5338 old[ name ] = elem.style[ name ];5339 elem.style[ name ] = options[ name ];5340 }5341 ret = callback.apply( elem, args || [] );5342 // Revert the old values5343 for ( name in options ) {5344 elem.style[ name ] = old[ name ];5345 }5346 return ret;5347};5348var5349 ralpha = /alpha\([^)]*\)/i,5350 ropacity = /opacity\s*=\s*([^)]*)/,5351 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"5352 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display5353 rdisplayswap = /^(none|table(?!-c[ea]).+)/,5354 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),5355 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),5356 cssShow = { position: "absolute", visibility: "hidden", display: "block" },5357 cssNormalTransform = {5358 letterSpacing: 0,5359 fontWeight: 4005360 },5361 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];5362// return a css property mapped to a potentially vendor prefixed property5363function vendorPropName( style, name ) {5364 // shortcut for names that are not vendor prefixed5365 if ( name in style ) {5366 return name;5367 }5368 // check for vendor prefixed names5369 var capName = name.charAt(0).toUpperCase() + name.slice(1),5370 origName = name,5371 i = cssPrefixes.length;5372 while ( i-- ) {5373 name = cssPrefixes[ i ] + capName;5374 if ( name in style ) {5375 return name;5376 }5377 }5378 return origName;5379}5380function showHide( elements, show ) {5381 var display, elem, hidden,5382 values = [],5383 index = 0,5384 length = elements.length;5385 for ( ; index < length; index++ ) {5386 elem = elements[ index ];5387 if ( !elem.style ) {5388 continue;5389 }5390 values[ index ] = jquery._data( elem, "olddisplay" );5391 display = elem.style.display;5392 if ( show ) {5393 // Reset the inline display of this element to learn if it is5394 // being hidden by cascaded rules or not5395 if ( !values[ index ] && display === "none" ) {5396 elem.style.display = "";5397 }5398 // Set elements which have been overridden with display: none5399 // in a stylesheet to whatever the default browser style is5400 // for such an element5401 if ( elem.style.display === "" && isHidden( elem ) ) {5402 values[ index ] = jquery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );5403 }5404 } else {5405 if ( !values[ index ] ) {5406 hidden = isHidden( elem );5407 if ( display && display !== "none" || !hidden ) {5408 jquery._data( elem, "olddisplay", hidden ? display : jquery.css( elem, "display" ) );5409 }5410 }5411 }5412 }5413 // Set the display of most of the elements in a second loop5414 // to avoid the constant reflow5415 for ( index = 0; index < length; index++ ) {5416 elem = elements[ index ];5417 if ( !elem.style ) {5418 continue;5419 }5420 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {5421 elem.style.display = show ? values[ index ] || "" : "none";5422 }5423 }5424 return elements;5425}5426function setPositiveNumber( elem, value, subtract ) {5427 var matches = rnumsplit.exec( value );5428 return matches ?5429 // Guard against undefined "subtract", e.g., when used as in cssHooks5430 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :5431 value;5432}5433function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {5434 var i = extra === ( isBorderBox ? "border" : "content" ) ?5435 // If we already have the right measurement, avoid augmentation5436 4 :5437 // Otherwise initialize for horizontal or vertical properties5438 name === "width" ? 1 : 0,5439 val = 0;5440 for ( ; i < 4; i += 2 ) {5441 // both box models exclude margin, so add it if we want it5442 if ( extra === "margin" ) {5443 val += jquery.css( elem, extra + cssExpand[ i ], true, styles );5444 }5445 if ( isBorderBox ) {5446 // border-box includes padding, so remove it if we want content5447 if ( extra === "content" ) {5448 val -= jquery.css( elem, "padding" + cssExpand[ i ], true, styles );5449 }5450 // at this point, extra isn't border nor margin, so remove border5451 if ( extra !== "margin" ) {5452 val -= jquery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );5453 }5454 } else {5455 // at this point, extra isn't content, so add padding5456 val += jquery.css( elem, "padding" + cssExpand[ i ], true, styles );5457 // at this point, extra isn't content nor padding, so add border5458 if ( extra !== "padding" ) {5459 val += jquery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );5460 }5461 }5462 }5463 return val;5464}5465function getWidthOrHeight( elem, name, extra ) {5466 // Start with offset property, which is equivalent to the border-box value5467 var valueIsBorderBox = true,5468 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,5469 styles = getStyles( elem ),5470 isBorderBox = support.boxSizing() && jquery.css( elem, "boxSizing", false, styles ) === "border-box";5471 // some non-html elements return undefined for offsetWidth, so check for null/undefined5472 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=6492855473 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=4916685474 if ( val <= 0 || val == null ) {5475 // Fall back to computed then uncomputed css if necessary5476 val = curCSS( elem, name, styles );5477 if ( val < 0 || val == null ) {5478 val = elem.style[ name ];5479 }5480 // Computed unit is not pixels. Stop here and return.5481 if ( rnumnonpx.test(val) ) {5482 return val;5483 }5484 // we need the check for style in case a browser which returns unreliable values5485 // for getComputedStyle silently falls back to the reliable elem.style5486 valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );5487 // Normalize "", auto, and prepare for extra5488 val = parseFloat( val ) || 0;5489 }5490 // use the active box-sizing model to add/subtract irrelevant styles5491 return ( val +5492 augmentWidthOrHeight(5493 elem,5494 name,5495 extra || ( isBorderBox ? "border" : "content" ),5496 valueIsBorderBox,5497 styles5498 )5499 ) + "px";5500}5501jquery.extend({5502 // Add in style property hooks for overriding the default5503 // behavior of getting and setting a style property5504 cssHooks: {5505 opacity: {5506 get: function( elem, computed ) {5507 if ( computed ) {5508 // We should always get a number back from opacity5509 var ret = curCSS( elem, "opacity" );5510 return ret === "" ? "1" : ret;5511 }5512 }5513 }5514 },5515 // Don't automatically add "px" to these possibly-unitless properties5516 cssNumber: {5517 "columnCount": true,5518 "fillOpacity": true,5519 "fontWeight": true,5520 "lineHeight": true,5521 "opacity": true,5522 "order": true,5523 "orphans": true,5524 "widows": true,5525 "zIndex": true,5526 "zoom": true5527 },5528 // Add in properties whose names you wish to fix before5529 // setting or getting the value5530 cssProps: {5531 // normalize float css property5532 "float": support.cssFloat ? "cssFloat" : "styleFloat"5533 },5534 // Get and set the style property on a DOM Node5535 style: function( elem, name, value, extra ) {5536 // Don't set styles on text and comment nodes5537 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {5538 return;5539 }5540 // Make sure that we're working with the right name5541 var ret, type, hooks,5542 origName = jquery.camelCase( name ),5543 style = elem.style;5544 name = jquery.cssProps[ origName ] || ( jquery.cssProps[ origName ] = vendorPropName( style, origName ) );5545 // gets hook for the prefixed version5546 // followed by the unprefixed version5547 hooks = jquery.cssHooks[ name ] || jquery.cssHooks[ origName ];5548 // Check if we're setting a value5549 if ( value !== undefined ) {5550 type = typeof value;5551 // convert relative number strings (+= or -=) to relative numbers. #73455552 if ( type === "string" && (ret = rrelNum.exec( value )) ) {5553 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jquery.css( elem, name ) );5554 // Fixes bug #92375555 type = "number";5556 }5557 // Make sure that null and NaN values aren't set. See: #71165558 if ( value == null || value !== value ) {5559 return;5560 }5561 // If a number was passed in, add 'px' to the (except for certain CSS properties)5562 if ( type === "number" && !jquery.cssNumber[ origName ] ) {5563 value += "px";5564 }5565 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,5566 // but it would mean to define eight (for every problematic property) identical functions5567 if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {5568 style[ name ] = "inherit";5569 }5570 // If a hook was provided, use that value, otherwise just set the specified value5571 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {5572 // Support: IE5573 // Swallow errors from 'invalid' CSS values (#5509)5574 try {5575 // Support: Chrome, Safari5576 // Setting style to blank string required to delete "style: x !important;"5577 style[ name ] = "";5578 style[ name ] = value;5579 } catch(e) {}5580 }5581 } else {5582 // If a hook was provided get the non-computed value from there5583 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {5584 return ret;5585 }5586 // Otherwise just get the value from the style object5587 return style[ name ];5588 }5589 },5590 css: function( elem, name, extra, styles ) {5591 var num, val, hooks,5592 origName = jquery.camelCase( name );5593 // Make sure that we're working with the right name5594 name = jquery.cssProps[ origName ] || ( jquery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );5595 // gets hook for the prefixed version5596 // followed by the unprefixed version5597 hooks = jquery.cssHooks[ name ] || jquery.cssHooks[ origName ];5598 // If a hook was provided get the computed value from there5599 if ( hooks && "get" in hooks ) {5600 val = hooks.get( elem, true, extra );5601 }5602 // Otherwise, if a way to get the computed value exists, use that5603 if ( val === undefined ) {5604 val = curCSS( elem, name, styles );5605 }5606 //convert "normal" to computed value5607 if ( val === "normal" && name in cssNormalTransform ) {5608 val = cssNormalTransform[ name ];5609 }5610 // Return, converting to number if forced or a qualifier was provided and val looks numeric5611 if ( extra === "" || extra ) {5612 num = parseFloat( val );5613 return extra === true || jquery.isNumeric( num ) ? num || 0 : val;5614 }5615 return val;5616 }5617});5618jquery.each([ "height", "width" ], function( i, name ) {5619 jquery.cssHooks[ name ] = {5620 get: function( elem, computed, extra ) {5621 if ( computed ) {5622 // certain elements can have dimension info if we invisibly show them5623 // however, it must have a current display style that would benefit from this5624 return elem.offsetWidth === 0 && rdisplayswap.test( jquery.css( elem, "display" ) ) ?5625 jquery.swap( elem, cssShow, function() {5626 return getWidthOrHeight( elem, name, extra );5627 }) :5628 getWidthOrHeight( elem, name, extra );5629 }5630 },5631 set: function( elem, value, extra ) {5632 var styles = extra && getStyles( elem );5633 return setPositiveNumber( elem, value, extra ?5634 augmentWidthOrHeight(5635 elem,5636 name,5637 extra,5638 support.boxSizing() && jquery.css( elem, "boxSizing", false, styles ) === "border-box",5639 styles5640 ) : 05641 );5642 }5643 };5644});5645if ( !support.opacity ) {5646 jquery.cssHooks.opacity = {5647 get: function( elem, computed ) {5648 // IE uses filters for opacity5649 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?5650 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :5651 computed ? "1" : "";5652 },5653 set: function( elem, value ) {5654 var style = elem.style,5655 currentStyle = elem.currentStyle,5656 opacity = jquery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",5657 filter = currentStyle && currentStyle.filter || style.filter || "";5658 // IE has trouble with opacity if it does not have layout5659 // Force it by setting the zoom level5660 style.zoom = 1;5661 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #66525662 // if value === "", then remove inline opacity #126855663 if ( ( value >= 1 || value === "" ) &&5664 jquery.trim( filter.replace( ralpha, "" ) ) === "" &&5665 style.removeAttribute ) {5666 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText5667 // if "filter:" is present at all, clearType is disabled, we want to avoid this5668 // style.removeAttribute is IE Only, but so apparently is this code path...5669 style.removeAttribute( "filter" );5670 // if there is no filter style applied in a css rule or unset inline opacity, we are done5671 if ( value === "" || currentStyle && !currentStyle.filter ) {5672 return;5673 }5674 }5675 // otherwise, set new filter values5676 style.filter = ralpha.test( filter ) ?5677 filter.replace( ralpha, opacity ) :5678 filter + " " + opacity;5679 }5680 };5681}5682jquery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,5683 function( elem, computed ) {5684 if ( computed ) {5685 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right5686 // Work around by temporarily setting element display to inline-block5687 return jquery.swap( elem, { "display": "inline-block" },5688 curCSS, [ elem, "marginRight" ] );5689 }5690 }5691);5692// These hooks are used by animate to expand properties5693jquery.each({5694 margin: "",5695 padding: "",5696 border: "Width"5697}, function( prefix, suffix ) {5698 jquery.cssHooks[ prefix + suffix ] = {5699 expand: function( value ) {5700 var i = 0,5701 expanded = {},5702 // assumes a single number if not a string5703 parts = typeof value === "string" ? value.split(" ") : [ value ];5704 for ( ; i < 4; i++ ) {5705 expanded[ prefix + cssExpand[ i ] + suffix ] =5706 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];5707 }5708 return expanded;5709 }5710 };5711 if ( !rmargin.test( prefix ) ) {5712 jquery.cssHooks[ prefix + suffix ].set = setPositiveNumber;5713 }5714});5715jquery.fn.extend({5716 css: function( name, value ) {5717 return access( this, function( elem, name, value ) {5718 var styles, len,5719 map = {},5720 i = 0;5721 if ( jquery.isArray( name ) ) {5722 styles = getStyles( elem );5723 len = name.length;5724 for ( ; i < len; i++ ) {5725 map[ name[ i ] ] = jquery.css( elem, name[ i ], false, styles );5726 }5727 return map;5728 }5729 return value !== undefined ?5730 jquery.style( elem, name, value ) :5731 jquery.css( elem, name );5732 }, name, value, arguments.length > 1 );5733 },5734 show: function() {5735 return showHide( this, true );5736 },5737 hide: function() {5738 return showHide( this );5739 },5740 toggle: function( state ) {5741 if ( typeof state === "boolean" ) {5742 return state ? this.show() : this.hide();5743 }5744 return this.each(function() {5745 if ( isHidden( this ) ) {5746 jquery( this ).show();5747 } else {5748 jquery( this ).hide();5749 }5750 });5751 }5752});5753function Tween( elem, options, prop, end, easing ) {5754 return new Tween.prototype.init( elem, options, prop, end, easing );5755}5756jquery.Tween = Tween;5757Tween.prototype = {5758 constructor: Tween,5759 init: function( elem, options, prop, end, easing, unit ) {5760 this.elem = elem;5761 this.prop = prop;5762 this.easing = easing || "swing";5763 this.options = options;5764 this.start = this.now = this.cur();5765 this.end = end;5766 this.unit = unit || ( jquery.cssNumber[ prop ] ? "" : "px" );5767 },5768 cur: function() {5769 var hooks = Tween.propHooks[ this.prop ];5770 return hooks && hooks.get ?5771 hooks.get( this ) :5772 Tween.propHooks._default.get( this );5773 },5774 run: function( percent ) {5775 var eased,5776 hooks = Tween.propHooks[ this.prop ];5777 if ( this.options.duration ) {5778 this.pos = eased = jquery.easing[ this.easing ](5779 percent, this.options.duration * percent, 0, 1, this.options.duration5780 );5781 } else {5782 this.pos = eased = percent;5783 }5784 this.now = ( this.end - this.start ) * eased + this.start;5785 if ( this.options.step ) {5786 this.options.step.call( this.elem, this.now, this );5787 }5788 if ( hooks && hooks.set ) {5789 hooks.set( this );5790 } else {5791 Tween.propHooks._default.set( this );5792 }5793 return this;5794 }5795};5796Tween.prototype.init.prototype = Tween.prototype;5797Tween.propHooks = {5798 _default: {5799 get: function( tween ) {5800 var result;5801 if ( tween.elem[ tween.prop ] != null &&5802 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {5803 return tween.elem[ tween.prop ];5804 }5805 // passing an empty string as a 3rd parameter to .css will automatically5806 // attempt a parseFloat and fallback to a string if the parse fails5807 // so, simple values such as "10px" are parsed to Float.5808 // complex values such as "rotate(1rad)" are returned as is.5809 result = jquery.css( tween.elem, tween.prop, "" );5810 // Empty strings, null, undefined and "auto" are converted to 0.5811 return !result || result === "auto" ? 0 : result;5812 },5813 set: function( tween ) {5814 // use step hook for back compat - use cssHook if its there - use .style if its5815 // available and use plain properties where available5816 if ( jquery.fx.step[ tween.prop ] ) {5817 jquery.fx.step[ tween.prop ]( tween );5818 } else if ( tween.elem.style && ( tween.elem.style[ jquery.cssProps[ tween.prop ] ] != null || jquery.cssHooks[ tween.prop ] ) ) {5819 jquery.style( tween.elem, tween.prop, tween.now + tween.unit );5820 } else {5821 tween.elem[ tween.prop ] = tween.now;5822 }5823 }5824 }5825};5826// Support: IE <=95827// Panic based approach to setting things on disconnected nodes5828Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {5829 set: function( tween ) {5830 if ( tween.elem.nodeType && tween.elem.parentNode ) {5831 tween.elem[ tween.prop ] = tween.now;5832 }5833 }5834};5835jquery.easing = {5836 linear: function( p ) {5837 return p;5838 },5839 swing: function( p ) {5840 return 0.5 - Math.cos( p * Math.PI ) / 2;5841 }5842};5843jquery.fx = Tween.prototype.init;5844// Back Compat <1.8 extension point5845jquery.fx.step = {};5846var5847 fxNow, timerId,5848 rfxtypes = /^(?:toggle|show|hide)$/,5849 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),5850 rrun = /queueHooks$/,5851 animationPrefilters = [ defaultPrefilter ],5852 tweeners = {5853 "*": [ function( prop, value ) {5854 var tween = this.createTween( prop, value ),5855 target = tween.cur(),5856 parts = rfxnum.exec( value ),5857 unit = parts && parts[ 3 ] || ( jquery.cssNumber[ prop ] ? "" : "px" ),5858 // Starting value computation is required for potential unit mismatches5859 start = ( jquery.cssNumber[ prop ] || unit !== "px" && +target ) &&5860 rfxnum.exec( jquery.css( tween.elem, prop ) ),5861 scale = 1,5862 maxIterations = 20;5863 if ( start && start[ 3 ] !== unit ) {5864 // Trust units reported by jquery.css5865 unit = unit || start[ 3 ];5866 // Make sure we update the tween properties later on5867 parts = parts || [];5868 // Iteratively approximate from a nonzero starting point5869 start = +target || 1;5870 do {5871 // If previous iteration zeroed out, double until we get *something*5872 // Use a string for doubling factor so we don't accidentally see scale as unchanged below5873 scale = scale || ".5";5874 // Adjust and apply5875 start = start / scale;5876 jquery.style( tween.elem, prop, start + unit );5877 // Update scale, tolerating zero or NaN from tween.cur()5878 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough5879 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );5880 }5881 // Update tween properties5882 if ( parts ) {5883 start = tween.start = +start || +target || 0;5884 tween.unit = unit;5885 // If a +=/-= token was provided, we're doing a relative animation5886 tween.end = parts[ 1 ] ?5887 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :5888 +parts[ 2 ];5889 }5890 return tween;5891 } ]5892 };5893// Animations created synchronously will run synchronously5894function createFxNow() {5895 setTimeout(function() {5896 fxNow = undefined;5897 });5898 return ( fxNow = jquery.now() );5899}5900// Generate parameters to create a standard animation5901function genFx( type, includeWidth ) {5902 var which,5903 attrs = { height: type },5904 i = 0;5905 // if we include width, step value is 1 to do all cssExpand values,5906 // if we don't include width, step value is 2 to skip over Left and Right5907 includeWidth = includeWidth ? 1 : 0;5908 for ( ; i < 4 ; i += 2 - includeWidth ) {5909 which = cssExpand[ i ];5910 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;5911 }5912 if ( includeWidth ) {5913 attrs.opacity = attrs.width = type;5914 }5915 return attrs;5916}5917function createTween( value, prop, animation ) {5918 var tween,5919 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),5920 index = 0,5921 length = collection.length;5922 for ( ; index < length; index++ ) {5923 if ( (tween = collection[ index ].call( animation, prop, value )) ) {5924 // we're done with this property5925 return tween;5926 }5927 }5928}5929function defaultPrefilter( elem, props, opts ) {5930 /* jshint validthis: true */5931 var prop, value, toggle, tween, hooks, oldfire, display, dDisplay,5932 anim = this,5933 orig = {},5934 style = elem.style,5935 hidden = elem.nodeType && isHidden( elem ),5936 dataShow = jquery._data( elem, "fxshow" );5937 // handle queue: false promises5938 if ( !opts.queue ) {5939 hooks = jquery._queueHooks( elem, "fx" );5940 if ( hooks.unqueued == null ) {5941 hooks.unqueued = 0;5942 oldfire = hooks.empty.fire;5943 hooks.empty.fire = function() {5944 if ( !hooks.unqueued ) {5945 oldfire();5946 }5947 };5948 }5949 hooks.unqueued++;5950 anim.always(function() {5951 // doing this makes sure that the complete handler will be called5952 // before this completes5953 anim.always(function() {5954 hooks.unqueued--;5955 if ( !jquery.queue( elem, "fx" ).length ) {5956 hooks.empty.fire();5957 }5958 });5959 });5960 }5961 // height/width overflow pass5962 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {5963 // Make sure that nothing sneaks out5964 // Record all 3 overflow attributes because IE does not5965 // change the overflow attribute when overflowX and5966 // overflowY are set to the same value5967 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];5968 // Set display property to inline-block for height/width5969 // animations on inline elements that are having width/height animated5970 display = jquery.css( elem, "display" );5971 dDisplay = defaultDisplay( elem.nodeName );5972 if ( display === "none" ) {5973 display = dDisplay;5974 }5975 if ( display === "inline" &&5976 jquery.css( elem, "float" ) === "none" ) {5977 // inline-level elements accept inline-block;5978 // block-level elements need to be inline with layout5979 if ( !support.inlineBlockNeedsLayout || dDisplay === "inline" ) {5980 style.display = "inline-block";5981 } else {5982 style.zoom = 1;5983 }5984 }5985 }5986 if ( opts.overflow ) {5987 style.overflow = "hidden";5988 if ( !support.shrinkWrapBlocks() ) {5989 anim.always(function() {5990 style.overflow = opts.overflow[ 0 ];5991 style.overflowX = opts.overflow[ 1 ];5992 style.overflowY = opts.overflow[ 2 ];5993 });5994 }5995 }5996 // show/hide pass5997 for ( prop in props ) {5998 value = props[ prop ];5999 if ( rfxtypes.exec( value ) ) {6000 delete props[ prop ];6001 toggle = toggle || value === "toggle";6002 if ( value === ( hidden ? "hide" : "show" ) ) {6003 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden6004 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {6005 hidden = true;6006 } else {6007 continue;6008 }6009 }6010 orig[ prop ] = dataShow && dataShow[ prop ] || jquery.style( elem, prop );6011 }6012 }6013 if ( !jquery.isEmptyObject( orig ) ) {6014 if ( dataShow ) {6015 if ( "hidden" in dataShow ) {6016 hidden = dataShow.hidden;6017 }6018 } else {6019 dataShow = jquery._data( elem, "fxshow", {} );6020 }6021 // store state if its toggle - enables .stop().toggle() to "reverse"6022 if ( toggle ) {6023 dataShow.hidden = !hidden;6024 }6025 if ( hidden ) {6026 jquery( elem ).show();6027 } else {6028 anim.done(function() {6029 jquery( elem ).hide();6030 });6031 }6032 anim.done(function() {6033 var prop;6034 jquery._removeData( elem, "fxshow" );6035 for ( prop in orig ) {6036 jquery.style( elem, prop, orig[ prop ] );6037 }6038 });6039 for ( prop in orig ) {6040 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );6041 if ( !( prop in dataShow ) ) {6042 dataShow[ prop ] = tween.start;6043 if ( hidden ) {6044 tween.end = tween.start;6045 tween.start = prop === "width" || prop === "height" ? 1 : 0;6046 }6047 }6048 }6049 }6050}6051function propFilter( props, specialEasing ) {6052 var index, name, easing, value, hooks;6053 // camelCase, specialEasing and expand cssHook pass6054 for ( index in props ) {6055 name = jquery.camelCase( index );6056 easing = specialEasing[ name ];6057 value = props[ index ];6058 if ( jquery.isArray( value ) ) {6059 easing = value[ 1 ];6060 value = props[ index ] = value[ 0 ];6061 }6062 if ( index !== name ) {6063 props[ name ] = value;6064 delete props[ index ];6065 }6066 hooks = jquery.cssHooks[ name ];6067 if ( hooks && "expand" in hooks ) {6068 value = hooks.expand( value );6069 delete props[ name ];6070 // not quite $.extend, this wont overwrite keys already present.6071 // also - reusing 'index' from above because we have the correct "name"6072 for ( index in value ) {6073 if ( !( index in props ) ) {6074 props[ index ] = value[ index ];6075 specialEasing[ index ] = easing;6076 }6077 }6078 } else {6079 specialEasing[ name ] = easing;6080 }6081 }6082}6083function Animation( elem, properties, options ) {6084 var result,6085 stopped,6086 index = 0,6087 length = animationPrefilters.length,6088 deferred = jquery.Deferred().always( function() {6089 // don't match elem in the :animated selector6090 delete tick.elem;6091 }),6092 tick = function() {6093 if ( stopped ) {6094 return false;6095 }6096 var currentTime = fxNow || createFxNow(),6097 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),6098 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)6099 temp = remaining / animation.duration || 0,6100 percent = 1 - temp,6101 index = 0,6102 length = animation.tweens.length;6103 for ( ; index < length ; index++ ) {6104 animation.tweens[ index ].run( percent );6105 }6106 deferred.notifyWith( elem, [ animation, percent, remaining ]);6107 if ( percent < 1 && length ) {6108 return remaining;6109 } else {6110 deferred.resolveWith( elem, [ animation ] );6111 return false;6112 }6113 },6114 animation = deferred.promise({6115 elem: elem,6116 props: jquery.extend( {}, properties ),6117 opts: jquery.extend( true, { specialEasing: {} }, options ),6118 originalProperties: properties,6119 originalOptions: options,6120 startTime: fxNow || createFxNow(),6121 duration: options.duration,6122 tweens: [],6123 createTween: function( prop, end ) {6124 var tween = jquery.Tween( elem, animation.opts, prop, end,6125 animation.opts.specialEasing[ prop ] || animation.opts.easing );6126 animation.tweens.push( tween );6127 return tween;6128 },6129 stop: function( gotoEnd ) {6130 var index = 0,6131 // if we are going to the end, we want to run all the tweens6132 // otherwise we skip this part6133 length = gotoEnd ? animation.tweens.length : 0;6134 if ( stopped ) {6135 return this;6136 }6137 stopped = true;6138 for ( ; index < length ; index++ ) {6139 animation.tweens[ index ].run( 1 );6140 }6141 // resolve when we played the last frame6142 // otherwise, reject6143 if ( gotoEnd ) {6144 deferred.resolveWith( elem, [ animation, gotoEnd ] );6145 } else {6146 deferred.rejectWith( elem, [ animation, gotoEnd ] );6147 }6148 return this;6149 }6150 }),6151 props = animation.props;6152 propFilter( props, animation.opts.specialEasing );6153 for ( ; index < length ; index++ ) {6154 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );6155 if ( result ) {6156 return result;6157 }6158 }6159 jquery.map( props, createTween, animation );6160 if ( jquery.isFunction( animation.opts.start ) ) {6161 animation.opts.start.call( elem, animation );6162 }6163 jquery.fx.timer(6164 jquery.extend( tick, {6165 elem: elem,6166 anim: animation,6167 queue: animation.opts.queue6168 })6169 );6170 // attach callbacks from options6171 return animation.progress( animation.opts.progress )6172 .done( animation.opts.done, animation.opts.complete )6173 .fail( animation.opts.fail )6174 .always( animation.opts.always );6175}6176jquery.Animation = jquery.extend( Animation, {6177 tweener: function( props, callback ) {6178 if ( jquery.isFunction( props ) ) {6179 callback = props;6180 props = [ "*" ];6181 } else {6182 props = props.split(" ");6183 }6184 var prop,6185 index = 0,6186 length = props.length;6187 for ( ; index < length ; index++ ) {6188 prop = props[ index ];6189 tweeners[ prop ] = tweeners[ prop ] || [];6190 tweeners[ prop ].unshift( callback );6191 }6192 },6193 prefilter: function( callback, prepend ) {6194 if ( prepend ) {6195 animationPrefilters.unshift( callback );6196 } else {6197 animationPrefilters.push( callback );6198 }6199 }6200});6201jquery.speed = function( speed, easing, fn ) {6202 var opt = speed && typeof speed === "object" ? jquery.extend( {}, speed ) : {6203 complete: fn || !fn && easing ||6204 jquery.isFunction( speed ) && speed,6205 duration: speed,6206 easing: fn && easing || easing && !jquery.isFunction( easing ) && easing6207 };6208 opt.duration = jquery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :6209 opt.duration in jquery.fx.speeds ? jquery.fx.speeds[ opt.duration ] : jquery.fx.speeds._default;6210 // normalize opt.queue - true/undefined/null -> "fx"6211 if ( opt.queue == null || opt.queue === true ) {6212 opt.queue = "fx";6213 }6214 // Queueing6215 opt.old = opt.complete;6216 opt.complete = function() {6217 if ( jquery.isFunction( opt.old ) ) {6218 opt.old.call( this );6219 }6220 if ( opt.queue ) {6221 jquery.dequeue( this, opt.queue );6222 }6223 };6224 return opt;6225};6226jquery.fn.extend({6227 fadeTo: function( speed, to, easing, callback ) {6228 // show any hidden elements after setting opacity to 06229 return this.filter( isHidden ).css( "opacity", 0 ).show()6230 // animate to the value specified6231 .end().animate({ opacity: to }, speed, easing, callback );6232 },6233 animate: function( prop, speed, easing, callback ) {6234 var empty = jquery.isEmptyObject( prop ),6235 optall = jquery.speed( speed, easing, callback ),6236 doAnimation = function() {6237 // Operate on a copy of prop so per-property easing won't be lost6238 var anim = Animation( this, jquery.extend( {}, prop ), optall );6239 // Empty animations, or finishing resolves immediately6240 if ( empty || jquery._data( this, "finish" ) ) {6241 anim.stop( true );6242 }6243 };6244 doAnimation.finish = doAnimation;6245 return empty || optall.queue === false ?6246 this.each( doAnimation ) :6247 this.queue( optall.queue, doAnimation );6248 },6249 stop: function( type, clearQueue, gotoEnd ) {6250 var stopQueue = function( hooks ) {6251 var stop = hooks.stop;6252 delete hooks.stop;6253 stop( gotoEnd );6254 };6255 if ( typeof type !== "string" ) {6256 gotoEnd = clearQueue;6257 clearQueue = type;6258 type = undefined;6259 }6260 if ( clearQueue && type !== false ) {6261 this.queue( type || "fx", [] );6262 }6263 return this.each(function() {6264 var dequeue = true,6265 index = type != null && type + "queueHooks",6266 timers = jquery.timers,6267 data = jquery._data( this );6268 if ( index ) {6269 if ( data[ index ] && data[ index ].stop ) {6270 stopQueue( data[ index ] );6271 }6272 } else {6273 for ( index in data ) {6274 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {6275 stopQueue( data[ index ] );6276 }6277 }6278 }6279 for ( index = timers.length; index--; ) {6280 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {6281 timers[ index ].anim.stop( gotoEnd );6282 dequeue = false;6283 timers.splice( index, 1 );6284 }6285 }6286 // start the next in the queue if the last step wasn't forced6287 // timers currently will call their complete callbacks, which will dequeue6288 // but only if they were gotoEnd6289 if ( dequeue || !gotoEnd ) {6290 jquery.dequeue( this, type );6291 }6292 });6293 },6294 finish: function( type ) {6295 if ( type !== false ) {6296 type = type || "fx";6297 }6298 return this.each(function() {6299 var index,6300 data = jquery._data( this ),6301 queue = data[ type + "queue" ],6302 hooks = data[ type + "queueHooks" ],6303 timers = jquery.timers,6304 length = queue ? queue.length : 0;6305 // enable finishing flag on private data6306 data.finish = true;6307 // empty the queue first6308 jquery.queue( this, type, [] );6309 if ( hooks && hooks.stop ) {6310 hooks.stop.call( this, true );6311 }6312 // look for any active animations, and finish them6313 for ( index = timers.length; index--; ) {6314 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {6315 timers[ index ].anim.stop( true );6316 timers.splice( index, 1 );6317 }6318 }6319 // look for any animations in the old queue and finish them6320 for ( index = 0; index < length; index++ ) {6321 if ( queue[ index ] && queue[ index ].finish ) {6322 queue[ index ].finish.call( this );6323 }6324 }6325 // turn off finishing flag6326 delete data.finish;6327 });6328 }6329});6330jquery.each([ "toggle", "show", "hide" ], function( i, name ) {6331 var cssFn = jquery.fn[ name ];6332 jquery.fn[ name ] = function( speed, easing, callback ) {6333 return speed == null || typeof speed === "boolean" ?6334 cssFn.apply( this, arguments ) :6335 this.animate( genFx( name, true ), speed, easing, callback );6336 };6337});6338// Generate shortcuts for custom animations6339jquery.each({6340 slideDown: genFx("show"),6341 slideUp: genFx("hide"),6342 slideToggle: genFx("toggle"),6343 fadeIn: { opacity: "show" },6344 fadeOut: { opacity: "hide" },6345 fadeToggle: { opacity: "toggle" }6346}, function( name, props ) {6347 jquery.fn[ name ] = function( speed, easing, callback ) {6348 return this.animate( props, speed, easing, callback );6349 };6350});6351jquery.timers = [];6352jquery.fx.tick = function() {6353 var timer,6354 timers = jquery.timers,6355 i = 0;6356 fxNow = jquery.now();6357 for ( ; i < timers.length; i++ ) {6358 timer = timers[ i ];6359 // Checks the timer has not already been removed6360 if ( !timer() && timers[ i ] === timer ) {6361 timers.splice( i--, 1 );6362 }6363 }6364 if ( !timers.length ) {6365 jquery.fx.stop();6366 }6367 fxNow = undefined;6368};6369jquery.fx.timer = function( timer ) {6370 jquery.timers.push( timer );6371 if ( timer() ) {6372 jquery.fx.start();6373 } else {6374 jquery.timers.pop();6375 }6376};6377jquery.fx.interval = 13;6378jquery.fx.start = function() {6379 if ( !timerId ) {6380 timerId = setInterval( jquery.fx.tick, jquery.fx.interval );6381 }6382};6383jquery.fx.stop = function() {6384 clearInterval( timerId );6385 timerId = null;6386};6387jquery.fx.speeds = {6388 slow: 600,6389 fast: 200,6390 // Default speed6391 _default: 4006392};6393// Based off of the plugin by Clint Helfers, with permission.6394// http://blindsignals.com/index.php/2009/07/jquery-delay/6395jquery.fn.delay = function( time, type ) {6396 time = jquery.fx ? jquery.fx.speeds[ time ] || time : time;6397 type = type || "fx";6398 return this.queue( type, function( next, hooks ) {6399 var timeout = setTimeout( next, time );6400 hooks.stop = function() {6401 clearTimeout( timeout );6402 };6403 });6404};6405(function() {6406 var a, input, select, opt,6407 div = document.createElement("div" );6408 // Setup6409 div.setAttribute( "className", "t" );6410 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";6411 a = div.getElementsByTagName("a")[ 0 ];6412 // First batch of tests.6413 select = document.createElement("select");6414 opt = select.appendChild( document.createElement("option") );6415 input = div.getElementsByTagName("input")[ 0 ];6416 a.style.cssText = "top:1px";6417 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)6418 support.getSetAttribute = div.className !== "t";6419 // Get the style information from getAttribute6420 // (IE uses .cssText instead)6421 support.style = /top/.test( a.getAttribute("style") );6422 // Make sure that URLs aren't manipulated6423 // (IE normalizes it by default)6424 support.hrefNormalized = a.getAttribute("href") === "/a";6425 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)6426 support.checkOn = !!input.value;6427 // Make sure that a selected-by-default option has a working selected property.6428 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)6429 support.optSelected = opt.selected;6430 // Tests for enctype support on a form (#6743)6431 support.enctype = !!document.createElement("form").enctype;6432 // Make sure that the options inside disabled selects aren't marked as disabled6433 // (WebKit marks them as disabled)6434 select.disabled = true;6435 support.optDisabled = !opt.disabled;6436 // Support: IE8 only6437 // Check if we can trust getAttribute("value")6438 input = document.createElement( "input" );6439 input.setAttribute( "value", "" );6440 support.input = input.getAttribute( "value" ) === "";6441 // Check if an input maintains its value after becoming a radio6442 input.value = "t";6443 input.setAttribute( "type", "radio" );6444 support.radioValue = input.value === "t";6445 // Null elements to avoid leaks in IE.6446 a = input = select = opt = div = null;6447})();6448var rreturn = /\r/g;6449jquery.fn.extend({6450 val: function( value ) {6451 var hooks, ret, isFunction,6452 elem = this[0];6453 if ( !arguments.length ) {6454 if ( elem ) {6455 hooks = jquery.valHooks[ elem.type ] || jquery.valHooks[ elem.nodeName.toLowerCase() ];6456 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {6457 return ret;6458 }6459 ret = elem.value;6460 return typeof ret === "string" ?6461 // handle most common string cases6462 ret.replace(rreturn, "") :6463 // handle cases where value is null/undef or number6464 ret == null ? "" : ret;6465 }6466 return;6467 }6468 isFunction = jquery.isFunction( value );6469 return this.each(function( i ) {6470 var val;6471 if ( this.nodeType !== 1 ) {6472 return;6473 }6474 if ( isFunction ) {6475 val = value.call( this, i, jquery( this ).val() );6476 } else {6477 val = value;6478 }6479 // Treat null/undefined as ""; convert numbers to string6480 if ( val == null ) {6481 val = "";6482 } else if ( typeof val === "number" ) {6483 val += "";6484 } else if ( jquery.isArray( val ) ) {6485 val = jquery.map( val, function( value ) {6486 return value == null ? "" : value + "";6487 });6488 }6489 hooks = jquery.valHooks[ this.type ] || jquery.valHooks[ this.nodeName.toLowerCase() ];6490 // If set returns undefined, fall back to normal setting6491 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {6492 this.value = val;6493 }6494 });6495 }6496});6497jquery.extend({6498 valHooks: {6499 option: {6500 get: function( elem ) {6501 var val = jquery.find.attr( elem, "value" );6502 return val != null ?6503 val :6504 jquery.text( elem );6505 }6506 },6507 select: {6508 get: function( elem ) {6509 var value, option,6510 options = elem.options,6511 index = elem.selectedIndex,6512 one = elem.type === "select-one" || index < 0,6513 values = one ? null : [],6514 max = one ? index + 1 : options.length,6515 i = index < 0 ?6516 max :6517 one ? index : 0;6518 // Loop through all the selected options6519 for ( ; i < max; i++ ) {6520 option = options[ i ];6521 // oldIE doesn't update selected after form reset (#2551)6522 if ( ( option.selected || i === index ) &&6523 // Don't return options that are disabled or in a disabled optgroup6524 ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&6525 ( !option.parentNode.disabled || !jquery.nodeName( option.parentNode, "optgroup" ) ) ) {6526 // Get the specific value for the option6527 value = jquery( option ).val();6528 // We don't need an array for one selects6529 if ( one ) {6530 return value;6531 }6532 // Multi-Selects return an array6533 values.push( value );6534 }6535 }6536 return values;6537 },6538 set: function( elem, value ) {6539 var optionSet, option,6540 options = elem.options,6541 values = jquery.makeArray( value ),6542 i = options.length;6543 while ( i-- ) {6544 option = options[ i ];6545 if ( jquery.inArray( jquery.valHooks.option.get( option ), values ) >= 0 ) {6546 // Support: IE66547 // When new option element is added to select box we need to6548 // force reflow of newly added node in order to workaround delay6549 // of initialization properties6550 try {6551 option.selected = optionSet = true;6552 } catch ( _ ) {6553 // Will be executed only in IE66554 option.scrollHeight;6555 }6556 } else {6557 option.selected = false;6558 }6559 }6560 // Force browsers to behave consistently when non-matching value is set6561 if ( !optionSet ) {6562 elem.selectedIndex = -1;6563 }6564 return options;6565 }6566 }6567 }6568});6569// Radios and checkboxes getter/setter6570jquery.each([ "radio", "checkbox" ], function() {6571 jquery.valHooks[ this ] = {6572 set: function( elem, value ) {6573 if ( jquery.isArray( value ) ) {6574 return ( elem.checked = jquery.inArray( jquery(elem).val(), value ) >= 0 );6575 }6576 }6577 };6578 if ( !support.checkOn ) {6579 jquery.valHooks[ this ].get = function( elem ) {6580 // Support: Webkit6581 // "" is returned instead of "on" if a value isn't specified6582 return elem.getAttribute("value") === null ? "on" : elem.value;6583 };6584 }6585});6586var nodeHook, boolHook,6587 attrHandle = jquery.expr.attrHandle,6588 ruseDefault = /^(?:checked|selected)$/i,6589 getSetAttribute = support.getSetAttribute,6590 getSetInput = support.input;6591jquery.fn.extend({6592 attr: function( name, value ) {6593 return access( this, jquery.attr, name, value, arguments.length > 1 );6594 },6595 removeAttr: function( name ) {6596 return this.each(function() {6597 jquery.removeAttr( this, name );6598 });6599 }6600});6601jquery.extend({6602 attr: function( elem, name, value ) {6603 var hooks, ret,6604 nType = elem.nodeType;6605 // don't get/set attributes on text, comment and attribute nodes6606 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {6607 return;6608 }6609 // Fallback to prop when attributes are not supported6610 if ( typeof elem.getAttribute === strundefined ) {6611 return jquery.prop( elem, name, value );6612 }6613 // All attributes are lowercase6614 // Grab necessary hook if one is defined6615 if ( nType !== 1 || !jquery.isXMLDoc( elem ) ) {6616 name = name.toLowerCase();6617 hooks = jquery.attrHooks[ name ] ||6618 ( jquery.expr.match.bool.test( name ) ? boolHook : nodeHook );6619 }6620 if ( value !== undefined ) {6621 if ( value === null ) {6622 jquery.removeAttr( elem, name );6623 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {6624 return ret;6625 } else {6626 elem.setAttribute( name, value + "" );6627 return value;6628 }6629 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {6630 return ret;6631 } else {6632 ret = jquery.find.attr( elem, name );6633 // Non-existent attributes return null, we normalize to undefined6634 return ret == null ?6635 undefined :6636 ret;6637 }6638 },6639 removeAttr: function( elem, value ) {6640 var name, propName,6641 i = 0,6642 attrNames = value && value.match( rnotwhite );6643 if ( attrNames && elem.nodeType === 1 ) {6644 while ( (name = attrNames[i++]) ) {6645 propName = jquery.propFix[ name ] || name;6646 // Boolean attributes get special treatment (#10870)6647 if ( jquery.expr.match.bool.test( name ) ) {6648 // Set corresponding property to false6649 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {6650 elem[ propName ] = false;6651 // Support: IE<96652 // Also clear defaultChecked/defaultSelected (if appropriate)6653 } else {6654 elem[ jquery.camelCase( "default-" + name ) ] =6655 elem[ propName ] = false;6656 }6657 // See #9699 for explanation of this approach (setting first, then removal)6658 } else {6659 jquery.attr( elem, name, "" );6660 }6661 elem.removeAttribute( getSetAttribute ? name : propName );6662 }6663 }6664 },6665 attrHooks: {6666 type: {6667 set: function( elem, value ) {6668 if ( !support.radioValue && value === "radio" && jquery.nodeName(elem, "input") ) {6669 // Setting the type on a radio button after the value resets the value in IE6-96670 // Reset value to default in case type is set after value during creation6671 var val = elem.value;6672 elem.setAttribute( "type", value );6673 if ( val ) {6674 elem.value = val;6675 }6676 return value;6677 }6678 }6679 }6680 }6681});6682// Hook for boolean attributes6683boolHook = {6684 set: function( elem, value, name ) {6685 if ( value === false ) {6686 // Remove boolean attributes when set to false6687 jquery.removeAttr( elem, name );6688 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {6689 // IE<8 needs the *property* name6690 elem.setAttribute( !getSetAttribute && jquery.propFix[ name ] || name, name );6691 // Use defaultChecked and defaultSelected for oldIE6692 } else {6693 elem[ jquery.camelCase( "default-" + name ) ] = elem[ name ] = true;6694 }6695 return name;6696 }6697};6698// Retrieve booleans specially6699jquery.each( jquery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {6700 var getter = attrHandle[ name ] || jquery.find.attr;6701 attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?6702 function( elem, name, isXML ) {6703 var ret, handle;6704 if ( !isXML ) {6705 // Avoid an infinite loop by temporarily removing this function from the getter6706 handle = attrHandle[ name ];6707 attrHandle[ name ] = ret;6708 ret = getter( elem, name, isXML ) != null ?6709 name.toLowerCase() :6710 null;6711 attrHandle[ name ] = handle;6712 }6713 return ret;6714 } :6715 function( elem, name, isXML ) {6716 if ( !isXML ) {6717 return elem[ jquery.camelCase( "default-" + name ) ] ?6718 name.toLowerCase() :6719 null;6720 }6721 };6722});6723// fix oldIE attroperties6724if ( !getSetInput || !getSetAttribute ) {6725 jquery.attrHooks.value = {6726 set: function( elem, value, name ) {6727 if ( jquery.nodeName( elem, "input" ) ) {6728 // Does not return so that setAttribute is also used6729 elem.defaultValue = value;6730 } else {6731 // Use nodeHook if defined (#1954); otherwise setAttribute is fine6732 return nodeHook && nodeHook.set( elem, value, name );6733 }6734 }6735 };6736}6737// IE6/7 do not support getting/setting some attributes with get/setAttribute6738if ( !getSetAttribute ) {6739 // Use this for any attribute in IE6/76740 // This fixes almost every IE6/7 issue6741 nodeHook = {6742 set: function( elem, value, name ) {6743 // Set the existing or create a new attribute node6744 var ret = elem.getAttributeNode( name );6745 if ( !ret ) {6746 elem.setAttributeNode(6747 (ret = elem.ownerDocument.createAttribute( name ))6748 );6749 }6750 ret.value = value += "";6751 // Break association with cloned elements by also using setAttribute (#9646)6752 if ( name === "value" || value === elem.getAttribute( name ) ) {6753 return value;6754 }6755 }6756 };6757 // Some attributes are constructed with empty-string values when not defined6758 attrHandle.id = attrHandle.name = attrHandle.coords =6759 function( elem, name, isXML ) {6760 var ret;6761 if ( !isXML ) {6762 return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?6763 ret.value :6764 null;6765 }6766 };6767 // Fixing value retrieval on a button requires this module6768 jquery.valHooks.button = {6769 get: function( elem, name ) {6770 var ret = elem.getAttributeNode( name );6771 if ( ret && ret.specified ) {6772 return ret.value;6773 }6774 },6775 set: nodeHook.set6776 };6777 // Set contenteditable to false on removals(#10429)6778 // Setting to empty string throws an error as an invalid value6779 jquery.attrHooks.contenteditable = {6780 set: function( elem, value, name ) {6781 nodeHook.set( elem, value === "" ? false : value, name );6782 }6783 };6784 // Set width and height to auto instead of 0 on empty string( Bug #8150 )6785 // This is for removals6786 jquery.each([ "width", "height" ], function( i, name ) {6787 jquery.attrHooks[ name ] = {6788 set: function( elem, value ) {6789 if ( value === "" ) {6790 elem.setAttribute( name, "auto" );6791 return value;6792 }6793 }6794 };6795 });6796}6797if ( !support.style ) {6798 jquery.attrHooks.style = {6799 get: function( elem ) {6800 // Return undefined in the case of empty string6801 // Note: IE uppercases css property names, but if we were to .toLowerCase()6802 // .cssText, that would destroy case senstitivity in URL's, like in "background"6803 return elem.style.cssText || undefined;6804 },6805 set: function( elem, value ) {6806 return ( elem.style.cssText = value + "" );6807 }6808 };6809}6810var rfocusable = /^(?:input|select|textarea|button|object)$/i,6811 rclickable = /^(?:a|area)$/i;6812jquery.fn.extend({6813 prop: function( name, value ) {6814 return access( this, jquery.prop, name, value, arguments.length > 1 );6815 },6816 removeProp: function( name ) {6817 name = jquery.propFix[ name ] || name;6818 return this.each(function() {6819 // try/catch handles cases where IE balks (such as removing a property on window)6820 try {6821 this[ name ] = undefined;6822 delete this[ name ];6823 } catch( e ) {}6824 });6825 }6826});6827jquery.extend({6828 propFix: {6829 "for": "htmlFor",6830 "class": "className"6831 },6832 prop: function( elem, name, value ) {6833 var ret, hooks, notxml,6834 nType = elem.nodeType;6835 // don't get/set properties on text, comment and attribute nodes6836 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {6837 return;6838 }6839 notxml = nType !== 1 || !jquery.isXMLDoc( elem );6840 if ( notxml ) {6841 // Fix name and attach hooks6842 name = jquery.propFix[ name ] || name;6843 hooks = jquery.propHooks[ name ];6844 }6845 if ( value !== undefined ) {6846 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?6847 ret :6848 ( elem[ name ] = value );6849 } else {6850 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?6851 ret :6852 elem[ name ];6853 }6854 },6855 propHooks: {6856 tabIndex: {6857 get: function( elem ) {6858 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set6859 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/6860 // Use proper attribute retrieval(#12072)6861 var tabindex = jquery.find.attr( elem, "tabindex" );6862 return tabindex ?6863 parseInt( tabindex, 10 ) :6864 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?6865 0 :6866 -1;6867 }6868 }6869 }6870});6871// Some attributes require a special call on IE6872// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx6873if ( !support.hrefNormalized ) {6874 // href/src property should get the full normalized URL (#10299/#12915)6875 jquery.each([ "href", "src" ], function( i, name ) {6876 jquery.propHooks[ name ] = {6877 get: function( elem ) {6878 return elem.getAttribute( name, 4 );6879 }6880 };6881 });6882}6883// Support: Safari, IE9+6884// mis-reports the default selected property of an option6885// Accessing the parent's selectedIndex property fixes it6886if ( !support.optSelected ) {6887 jquery.propHooks.selected = {6888 get: function( elem ) {6889 var parent = elem.parentNode;6890 if ( parent ) {6891 parent.selectedIndex;6892 // Make sure that it also works with optgroups, see #57016893 if ( parent.parentNode ) {6894 parent.parentNode.selectedIndex;6895 }6896 }6897 return null;6898 }6899 };6900}6901jquery.each([6902 "tabIndex",6903 "readOnly",6904 "maxLength",6905 "cellSpacing",6906 "cellPadding",6907 "rowSpan",6908 "colSpan",6909 "useMap",6910 "frameBorder",6911 "contentEditable"6912], function() {6913 jquery.propFix[ this.toLowerCase() ] = this;6914});6915// IE6/7 call enctype encoding6916if ( !support.enctype ) {6917 jquery.propFix.enctype = "encoding";6918}6919var rclass = /[\t\r\n\f]/g;6920jquery.fn.extend({6921 addClass: function( value ) {6922 var classes, elem, cur, clazz, j, finalValue,6923 i = 0,6924 len = this.length,6925 proceed = typeof value === "string" && value;6926 if ( jquery.isFunction( value ) ) {6927 return this.each(function( j ) {6928 jquery( this ).addClass( value.call( this, j, this.className ) );6929 });6930 }6931 if ( proceed ) {6932 // The disjunction here is for better compressibility (see removeClass)6933 classes = ( value || "" ).match( rnotwhite ) || [];6934 for ( ; i < len; i++ ) {6935 elem = this[ i ];6936 cur = elem.nodeType === 1 && ( elem.className ?6937 ( " " + elem.className + " " ).replace( rclass, " " ) :6938 " "6939 );6940 if ( cur ) {6941 j = 0;6942 while ( (clazz = classes[j++]) ) {6943 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {6944 cur += clazz + " ";6945 }6946 }6947 // only assign if different to avoid unneeded rendering.6948 finalValue = jquery.trim( cur );6949 if ( elem.className !== finalValue ) {6950 elem.className = finalValue;6951 }6952 }6953 }6954 }6955 return this;6956 },6957 removeClass: function( value ) {6958 var classes, elem, cur, clazz, j, finalValue,6959 i = 0,6960 len = this.length,6961 proceed = arguments.length === 0 || typeof value === "string" && value;6962 if ( jquery.isFunction( value ) ) {6963 return this.each(function( j ) {6964 jquery( this ).removeClass( value.call( this, j, this.className ) );6965 });6966 }6967 if ( proceed ) {6968 classes = ( value || "" ).match( rnotwhite ) || [];6969 for ( ; i < len; i++ ) {6970 elem = this[ i ];6971 // This expression is here for better compressibility (see addClass)6972 cur = elem.nodeType === 1 && ( elem.className ?6973 ( " " + elem.className + " " ).replace( rclass, " " ) :6974 ""6975 );6976 if ( cur ) {6977 j = 0;6978 while ( (clazz = classes[j++]) ) {6979 // Remove *all* instances6980 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {6981 cur = cur.replace( " " + clazz + " ", " " );6982 }6983 }6984 // only assign if different to avoid unneeded rendering.6985 finalValue = value ? jquery.trim( cur ) : "";6986 if ( elem.className !== finalValue ) {6987 elem.className = finalValue;6988 }6989 }6990 }6991 }6992 return this;6993 },6994 toggleClass: function( value, stateVal ) {6995 var type = typeof value;6996 if ( typeof stateVal === "boolean" && type === "string" ) {6997 return stateVal ? this.addClass( value ) : this.removeClass( value );6998 }6999 if ( jquery.isFunction( value ) ) {7000 return this.each(function( i ) {7001 jquery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );7002 });7003 }7004 return this.each(function() {7005 if ( type === "string" ) {7006 // toggle individual class names7007 var className,7008 i = 0,7009 self = jquery( this ),7010 classNames = value.match( rnotwhite ) || [];7011 while ( (className = classNames[ i++ ]) ) {7012 // check each className given, space separated list7013 if ( self.hasClass( className ) ) {7014 self.removeClass( className );7015 } else {7016 self.addClass( className );7017 }7018 }7019 // Toggle whole class name7020 } else if ( type === strundefined || type === "boolean" ) {7021 if ( this.className ) {7022 // store className if set7023 jquery._data( this, "__className__", this.className );7024 }7025 // If the element has a class name or if we're passed "false",7026 // then remove the whole classname (if there was one, the above saved it).7027 // Otherwise bring back whatever was previously saved (if anything),7028 // falling back to the empty string if nothing was stored.7029 this.className = this.className || value === false ? "" : jquery._data( this, "__className__" ) || "";7030 }7031 });7032 },7033 hasClass: function( selector ) {7034 var className = " " + selector + " ",7035 i = 0,7036 l = this.length;7037 for ( ; i < l; i++ ) {7038 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {7039 return true;7040 }7041 }7042 return false;7043 }7044});7045// Return jquery for attributes-only inclusion7046jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +7047 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +7048 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {7049 // Handle event binding7050 jquery.fn[ name ] = function( data, fn ) {7051 return arguments.length > 0 ?7052 this.on( name, null, data, fn ) :7053 this.trigger( name );7054 };7055});7056jquery.fn.extend({7057 hover: function( fnOver, fnOut ) {7058 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );7059 },7060 bind: function( types, data, fn ) {7061 return this.on( types, null, data, fn );7062 },7063 unbind: function( types, fn ) {7064 return this.off( types, null, fn );7065 },7066 delegate: function( selector, types, data, fn ) {7067 return this.on( types, selector, data, fn );7068 },7069 undelegate: function( selector, types, fn ) {7070 // ( namespace ) or ( selector, types [, fn] )7071 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );7072 }7073});7074var nonce = jquery.now();7075var rquery = (/\?/);7076var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;7077jquery.parseJSON = function( data ) {7078 // Attempt to parse using the native JSON parser first7079 if ( window.JSON && window.JSON.parse ) {7080 // Support: Android 2.37081 // Workaround failure to string-cast null input7082 return window.JSON.parse( data + "" );7083 }7084 var requireNonComma,7085 depth = null,7086 str = jquery.trim( data + "" );7087 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains7088 // after removing valid tokens7089 return str && !jquery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {7090 // Force termination if we see a misplaced comma7091 if ( requireNonComma && comma ) {7092 depth = 0;7093 }7094 // Perform no more replacements after returning to outermost depth7095 if ( depth === 0 ) {7096 return token;7097 }7098 // Commas must not follow "[", "{", or ","7099 requireNonComma = open || comma;7100 // Determine new depth7101 // array/object open ("[" or "{"): depth += true - false (increment)7102 // array/object close ("]" or "}"): depth += false - true (decrement)7103 // other cases ("," or primitive): depth += true - true (numeric cast)7104 depth += !close - !open;7105 // Remove this token7106 return "";7107 }) ) ?7108 ( Function( "return " + str ) )() :7109 jquery.error( "Invalid JSON: " + data );7110};7111// Cross-browser xml parsing7112jquery.parseXML = function( data ) {7113 var xml, tmp;7114 if ( !data || typeof data !== "string" ) {7115 return null;7116 }7117 try {7118 if ( window.DOMParser ) { // Standard7119 tmp = new DOMParser();7120 xml = tmp.parseFromString( data, "text/xml" );7121 } else { // IE7122 xml = new ActiveXObject( "Microsoft.XMLDOM" );7123 xml.async = "false";7124 xml.loadXML( data );7125 }7126 } catch( e ) {7127 xml = undefined;7128 }7129 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {7130 jquery.error( "Invalid XML: " + data );7131 }7132 return xml;7133};7134var7135 // Document location7136 ajaxLocParts,7137 ajaxLocation,7138 rhash = /#.*$/,7139 rts = /([?&])_=[^&]*/,7140 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL7141 // #7653, #8125, #8152: local protocol detection7142 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,7143 rnoContent = /^(?:GET|HEAD)$/,7144 rprotocol = /^\/\//,7145 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,7146 /* Prefilters7147 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)7148 * 2) These are called:7149 * - BEFORE asking for a transport7150 * - AFTER param serialization (s.data is a string if s.processData is true)7151 * 3) key is the dataType7152 * 4) the catchall symbol "*" can be used7153 * 5) execution will start with transport dataType and THEN continue down to "*" if needed7154 */7155 prefilters = {},7156 /* Transports bindings7157 * 1) key is the dataType7158 * 2) the catchall symbol "*" can be used7159 * 3) selection will start with transport dataType and THEN go to "*" if needed7160 */7161 transports = {},7162 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression7163 allTypes = "*/".concat("*");7164// #8138, IE may throw an exception when accessing7165// a field from window.location if document.domain has been set7166try {7167 ajaxLocation = location.href;7168} catch( e ) {7169 // Use the href attribute of an A element7170 // since IE will modify it given document.location7171 ajaxLocation = document.createElement( "a" );7172 ajaxLocation.href = "";7173 ajaxLocation = ajaxLocation.href;7174}7175// Segment location into parts7176ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];7177// Base "constructor" for jquery.ajaxPrefilter and jquery.ajaxTransport7178function addToPrefiltersOrTransports( structure ) {7179 // dataTypeExpression is optional and defaults to "*"7180 return function( dataTypeExpression, func ) {7181 if ( typeof dataTypeExpression !== "string" ) {7182 func = dataTypeExpression;7183 dataTypeExpression = "*";7184 }7185 var dataType,7186 i = 0,7187 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];7188 if ( jquery.isFunction( func ) ) {7189 // For each dataType in the dataTypeExpression7190 while ( (dataType = dataTypes[i++]) ) {7191 // Prepend if requested7192 if ( dataType.charAt( 0 ) === "+" ) {7193 dataType = dataType.slice( 1 ) || "*";7194 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );7195 // Otherwise append7196 } else {7197 (structure[ dataType ] = structure[ dataType ] || []).push( func );7198 }7199 }7200 }7201 };7202}7203// Base inspection function for prefilters and transports7204function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {7205 var inspected = {},7206 seekingTransport = ( structure === transports );7207 function inspect( dataType ) {7208 var selected;7209 inspected[ dataType ] = true;7210 jquery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {7211 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );7212 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {7213 options.dataTypes.unshift( dataTypeOrTransport );7214 inspect( dataTypeOrTransport );7215 return false;7216 } else if ( seekingTransport ) {7217 return !( selected = dataTypeOrTransport );7218 }7219 });7220 return selected;7221 }7222 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );7223}7224// A special extend for ajax options7225// that takes "flat" options (not to be deep extended)7226// Fixes #98877227function ajaxExtend( target, src ) {7228 var deep, key,7229 flatOptions = jquery.ajaxSettings.flatOptions || {};7230 for ( key in src ) {7231 if ( src[ key ] !== undefined ) {7232 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];7233 }7234 }7235 if ( deep ) {7236 jquery.extend( true, target, deep );7237 }7238 return target;7239}7240/* Handles responses to an ajax request:7241 * - finds the right dataType (mediates between content-type and expected dataType)7242 * - returns the corresponding response7243 */7244function ajaxHandleResponses( s, jqXHR, responses ) {7245 var firstDataType, ct, finalDataType, type,7246 contents = s.contents,7247 dataTypes = s.dataTypes;7248 // Remove auto dataType and get content-type in the process7249 while ( dataTypes[ 0 ] === "*" ) {7250 dataTypes.shift();7251 if ( ct === undefined ) {7252 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");7253 }7254 }7255 // Check if we're dealing with a known content-type7256 if ( ct ) {7257 for ( type in contents ) {7258 if ( contents[ type ] && contents[ type ].test( ct ) ) {7259 dataTypes.unshift( type );7260 break;7261 }7262 }7263 }7264 // Check to see if we have a response for the expected dataType7265 if ( dataTypes[ 0 ] in responses ) {7266 finalDataType = dataTypes[ 0 ];7267 } else {7268 // Try convertible dataTypes7269 for ( type in responses ) {7270 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {7271 finalDataType = type;7272 break;7273 }7274 if ( !firstDataType ) {7275 firstDataType = type;7276 }7277 }7278 // Or just use first one7279 finalDataType = finalDataType || firstDataType;7280 }7281 // If we found a dataType7282 // We add the dataType to the list if needed7283 // and return the corresponding response7284 if ( finalDataType ) {7285 if ( finalDataType !== dataTypes[ 0 ] ) {7286 dataTypes.unshift( finalDataType );7287 }7288 return responses[ finalDataType ];7289 }7290}7291/* Chain conversions given the request and the original response7292 * Also sets the responseXXX fields on the jqXHR instance7293 */7294function ajaxConvert( s, response, jqXHR, isSuccess ) {7295 var conv2, current, conv, tmp, prev,7296 converters = {},7297 // Work with a copy of dataTypes in case we need to modify it for conversion7298 dataTypes = s.dataTypes.slice();7299 // Create converters map with lowercased keys7300 if ( dataTypes[ 1 ] ) {7301 for ( conv in s.converters ) {7302 converters[ conv.toLowerCase() ] = s.converters[ conv ];7303 }7304 }7305 current = dataTypes.shift();7306 // Convert to each sequential dataType7307 while ( current ) {7308 if ( s.responseFields[ current ] ) {7309 jqXHR[ s.responseFields[ current ] ] = response;7310 }7311 // Apply the dataFilter if provided7312 if ( !prev && isSuccess && s.dataFilter ) {7313 response = s.dataFilter( response, s.dataType );7314 }7315 prev = current;7316 current = dataTypes.shift();7317 if ( current ) {7318 // There's only work to do if current dataType is non-auto7319 if ( current === "*" ) {7320 current = prev;7321 // Convert response if prev dataType is non-auto and differs from current7322 } else if ( prev !== "*" && prev !== current ) {7323 // Seek a direct converter7324 conv = converters[ prev + " " + current ] || converters[ "* " + current ];7325 // If none found, seek a pair7326 if ( !conv ) {7327 for ( conv2 in converters ) {7328 // If conv2 outputs current7329 tmp = conv2.split( " " );7330 if ( tmp[ 1 ] === current ) {7331 // If prev can be converted to accepted input7332 conv = converters[ prev + " " + tmp[ 0 ] ] ||7333 converters[ "* " + tmp[ 0 ] ];7334 if ( conv ) {7335 // Condense equivalence converters7336 if ( conv === true ) {7337 conv = converters[ conv2 ];7338 // Otherwise, insert the intermediate dataType7339 } else if ( converters[ conv2 ] !== true ) {7340 current = tmp[ 0 ];7341 dataTypes.unshift( tmp[ 1 ] );7342 }7343 break;7344 }7345 }7346 }7347 }7348 // Apply converter (if not an equivalence)7349 if ( conv !== true ) {7350 // Unless errors are allowed to bubble, catch and return them7351 if ( conv && s[ "throws" ] ) {7352 response = conv( response );7353 } else {7354 try {7355 response = conv( response );7356 } catch ( e ) {7357 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };7358 }7359 }7360 }7361 }7362 }7363 }7364 return { state: "success", data: response };7365}7366jquery.extend({7367 // Counter for holding the number of active queries7368 active: 0,7369 // Last-Modified header cache for next request7370 lastModified: {},7371 etag: {},7372 ajaxSettings: {7373 url: ajaxLocation,7374 type: "GET",7375 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),7376 global: true,7377 processData: true,7378 async: true,7379 contentType: "application/x-www-form-urlencoded; charset=UTF-8",7380 /*7381 timeout: 0,7382 data: null,7383 dataType: null,7384 username: null,7385 password: null,7386 cache: null,7387 throws: false,7388 traditional: false,7389 headers: {},7390 */7391 accepts: {7392 "*": allTypes,7393 text: "text/plain",7394 html: "text/html",7395 xml: "application/xml, text/xml",7396 json: "application/json, text/javascript"7397 },7398 contents: {7399 xml: /xml/,7400 html: /html/,7401 json: /json/7402 },7403 responseFields: {7404 xml: "responseXML",7405 text: "responseText",7406 json: "responseJSON"7407 },7408 // Data converters7409 // Keys separate source (or catchall "*") and destination types with a single space7410 converters: {7411 // Convert anything to text7412 "* text": String,7413 // Text to html (true = no transformation)7414 "text html": true,7415 // Evaluate text as a json expression7416 "text json": jquery.parseJSON,7417 // Parse text as xml7418 "text xml": jquery.parseXML7419 },7420 // For options that shouldn't be deep extended:7421 // you can add your own custom options here if7422 // and when you create one that shouldn't be7423 // deep extended (see ajaxExtend)7424 flatOptions: {7425 url: true,7426 context: true7427 }7428 },7429 // Creates a full fledged settings object into target7430 // with both ajaxSettings and settings fields.7431 // If target is omitted, writes into ajaxSettings.7432 ajaxSetup: function( target, settings ) {7433 return settings ?7434 // Building a settings object7435 ajaxExtend( ajaxExtend( target, jquery.ajaxSettings ), settings ) :7436 // Extending ajaxSettings7437 ajaxExtend( jquery.ajaxSettings, target );7438 },7439 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),7440 ajaxTransport: addToPrefiltersOrTransports( transports ),7441 // Main method7442 ajax: function( url, options ) {7443 // If url is an object, simulate pre-1.5 signature7444 if ( typeof url === "object" ) {7445 options = url;7446 url = undefined;7447 }7448 // Force options to be an object7449 options = options || {};7450 var // Cross-domain detection vars7451 parts,7452 // Loop variable7453 i,7454 // URL without anti-cache param7455 cacheURL,7456 // Response headers as string7457 responseHeadersString,7458 // timeout handle7459 timeoutTimer,7460 // To know if global events are to be dispatched7461 fireGlobals,7462 transport,7463 // Response headers7464 responseHeaders,7465 // Create the final options object7466 s = jquery.ajaxSetup( {}, options ),7467 // Callbacks context7468 callbackContext = s.context || s,7469 // Context for global events is callbackContext if it is a DOM node or jquery collection7470 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?7471 jquery( callbackContext ) :7472 jquery.event,7473 // Deferreds7474 deferred = jquery.Deferred(),7475 completeDeferred = jquery.Callbacks("once memory"),7476 // Status-dependent callbacks7477 statusCode = s.statusCode || {},7478 // Headers (they are sent all at once)7479 requestHeaders = {},7480 requestHeadersNames = {},7481 // The jqXHR state7482 state = 0,7483 // Default abort message7484 strAbort = "canceled",7485 // Fake xhr7486 jqXHR = {7487 readyState: 0,7488 // Builds headers hashtable if needed7489 getResponseHeader: function( key ) {7490 var match;7491 if ( state === 2 ) {7492 if ( !responseHeaders ) {7493 responseHeaders = {};7494 while ( (match = rheaders.exec( responseHeadersString )) ) {7495 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];7496 }7497 }7498 match = responseHeaders[ key.toLowerCase() ];7499 }7500 return match == null ? null : match;7501 },7502 // Raw string7503 getAllResponseHeaders: function() {7504 return state === 2 ? responseHeadersString : null;7505 },7506 // Caches the header7507 setRequestHeader: function( name, value ) {7508 var lname = name.toLowerCase();7509 if ( !state ) {7510 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;7511 requestHeaders[ name ] = value;7512 }7513 return this;7514 },7515 // Overrides response content-type header7516 overrideMimeType: function( type ) {7517 if ( !state ) {7518 s.mimeType = type;7519 }7520 return this;7521 },7522 // Status-dependent callbacks7523 statusCode: function( map ) {7524 var code;7525 if ( map ) {7526 if ( state < 2 ) {7527 for ( code in map ) {7528 // Lazy-add the new callback in a way that preserves old ones7529 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];7530 }7531 } else {7532 // Execute the appropriate callbacks7533 jqXHR.always( map[ jqXHR.status ] );7534 }7535 }7536 return this;7537 },7538 // Cancel the request7539 abort: function( statusText ) {7540 var finalText = statusText || strAbort;7541 if ( transport ) {7542 transport.abort( finalText );7543 }7544 done( 0, finalText );7545 return this;7546 }7547 };7548 // Attach deferreds7549 deferred.promise( jqXHR ).complete = completeDeferred.add;7550 jqXHR.success = jqXHR.done;7551 jqXHR.error = jqXHR.fail;7552 // Remove hash character (#7531: and string promotion)7553 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)7554 // Handle falsy url in the settings object (#10093: consistency with old signature)7555 // We also use the url parameter if available7556 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );7557 // Alias method option to type as per ticket #120047558 s.type = options.method || options.type || s.method || s.type;7559 // Extract dataTypes list7560 s.dataTypes = jquery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];7561 // A cross-domain request is in order when we have a protocol:host:port mismatch7562 if ( s.crossDomain == null ) {7563 parts = rurl.exec( s.url.toLowerCase() );7564 s.crossDomain = !!( parts &&7565 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||7566 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==7567 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )7568 );7569 }7570 // Convert data if not already a string7571 if ( s.data && s.processData && typeof s.data !== "string" ) {7572 s.data = jquery.param( s.data, s.traditional );7573 }7574 // Apply prefilters7575 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );7576 // If request was aborted inside a prefilter, stop there7577 if ( state === 2 ) {7578 return jqXHR;7579 }7580 // We can fire global events as of now if asked to7581 fireGlobals = s.global;7582 // Watch for a new set of requests7583 if ( fireGlobals && jquery.active++ === 0 ) {7584 jquery.event.trigger("ajaxStart");7585 }7586 // Uppercase the type7587 s.type = s.type.toUpperCase();7588 // Determine if request has content7589 s.hasContent = !rnoContent.test( s.type );7590 // Save the URL in case we're toying with the If-Modified-Since7591 // and/or If-None-Match header later on7592 cacheURL = s.url;7593 // More options handling for requests with no content7594 if ( !s.hasContent ) {7595 // If data is available, append data to url7596 if ( s.data ) {7597 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );7598 // #9682: remove data so that it's not used in an eventual retry7599 delete s.data;7600 }7601 // Add anti-cache in url if needed7602 if ( s.cache === false ) {7603 s.url = rts.test( cacheURL ) ?7604 // If there is already a '_' parameter, set its value7605 cacheURL.replace( rts, "$1_=" + nonce++ ) :7606 // Otherwise add one to the end7607 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;7608 }7609 }7610 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.7611 if ( s.ifModified ) {7612 if ( jquery.lastModified[ cacheURL ] ) {7613 jqXHR.setRequestHeader( "If-Modified-Since", jquery.lastModified[ cacheURL ] );7614 }7615 if ( jquery.etag[ cacheURL ] ) {7616 jqXHR.setRequestHeader( "If-None-Match", jquery.etag[ cacheURL ] );7617 }7618 }7619 // Set the correct header, if data is being sent7620 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {7621 jqXHR.setRequestHeader( "Content-Type", s.contentType );7622 }7623 // Set the Accepts header for the server, depending on the dataType7624 jqXHR.setRequestHeader(7625 "Accept",7626 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?7627 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :7628 s.accepts[ "*" ]7629 );7630 // Check for headers option7631 for ( i in s.headers ) {7632 jqXHR.setRequestHeader( i, s.headers[ i ] );7633 }7634 // Allow custom headers/mimetypes and early abort7635 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {7636 // Abort if not done already and return7637 return jqXHR.abort();7638 }7639 // aborting is no longer a cancellation7640 strAbort = "abort";7641 // Install callbacks on deferreds7642 for ( i in { success: 1, error: 1, complete: 1 } ) {7643 jqXHR[ i ]( s[ i ] );7644 }7645 // Get transport7646 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );7647 // If no transport, we auto-abort7648 if ( !transport ) {7649 done( -1, "No Transport" );7650 } else {7651 jqXHR.readyState = 1;7652 // Send global event7653 if ( fireGlobals ) {7654 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );7655 }7656 // Timeout7657 if ( s.async && s.timeout > 0 ) {7658 timeoutTimer = setTimeout(function() {7659 jqXHR.abort("timeout");7660 }, s.timeout );7661 }7662 try {7663 state = 1;7664 transport.send( requestHeaders, done );7665 } catch ( e ) {7666 // Propagate exception as error if not done7667 if ( state < 2 ) {7668 done( -1, e );7669 // Simply rethrow otherwise7670 } else {7671 throw e;7672 }7673 }7674 }7675 // Callback for when everything is done7676 function done( status, nativeStatusText, responses, headers ) {7677 var isSuccess, success, error, response, modified,7678 statusText = nativeStatusText;7679 // Called once7680 if ( state === 2 ) {7681 return;7682 }7683 // State is "done" now7684 state = 2;7685 // Clear timeout if it exists7686 if ( timeoutTimer ) {7687 clearTimeout( timeoutTimer );7688 }7689 // Dereference transport for early garbage collection7690 // (no matter how long the jqXHR object will be used)7691 transport = undefined;7692 // Cache response headers7693 responseHeadersString = headers || "";7694 // Set readyState7695 jqXHR.readyState = status > 0 ? 4 : 0;7696 // Determine if successful7697 isSuccess = status >= 200 && status < 300 || status === 304;7698 // Get response data7699 if ( responses ) {7700 response = ajaxHandleResponses( s, jqXHR, responses );7701 }7702 // Convert no matter what (that way responseXXX fields are always set)7703 response = ajaxConvert( s, response, jqXHR, isSuccess );7704 // If successful, handle type chaining7705 if ( isSuccess ) {7706 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.7707 if ( s.ifModified ) {7708 modified = jqXHR.getResponseHeader("Last-Modified");7709 if ( modified ) {7710 jquery.lastModified[ cacheURL ] = modified;7711 }7712 modified = jqXHR.getResponseHeader("etag");7713 if ( modified ) {7714 jquery.etag[ cacheURL ] = modified;7715 }7716 }7717 // if no content7718 if ( status === 204 || s.type === "HEAD" ) {7719 statusText = "nocontent";7720 // if not modified7721 } else if ( status === 304 ) {7722 statusText = "notmodified";7723 // If we have data, let's convert it7724 } else {7725 statusText = response.state;7726 success = response.data;7727 error = response.error;7728 isSuccess = !error;7729 }7730 } else {7731 // We extract error from statusText7732 // then normalize statusText and status for non-aborts7733 error = statusText;7734 if ( status || !statusText ) {7735 statusText = "error";7736 if ( status < 0 ) {7737 status = 0;7738 }7739 }7740 }7741 // Set data for the fake xhr object7742 jqXHR.status = status;7743 jqXHR.statusText = ( nativeStatusText || statusText ) + "";7744 // Success/Error7745 if ( isSuccess ) {7746 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );7747 } else {7748 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );7749 }7750 // Status-dependent callbacks7751 jqXHR.statusCode( statusCode );7752 statusCode = undefined;7753 if ( fireGlobals ) {7754 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",7755 [ jqXHR, s, isSuccess ? success : error ] );7756 }7757 // Complete7758 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );7759 if ( fireGlobals ) {7760 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );7761 // Handle the global AJAX counter7762 if ( !( --jquery.active ) ) {7763 jquery.event.trigger("ajaxStop");7764 }7765 }7766 }7767 return jqXHR;7768 },7769 getJSON: function( url, data, callback ) {7770 return jquery.get( url, data, callback, "json" );7771 },7772 getScript: function( url, callback ) {7773 return jquery.get( url, undefined, callback, "script" );7774 }7775});7776jquery.each( [ "get", "post" ], function( i, method ) {7777 jquery[ method ] = function( url, data, callback, type ) {7778 // shift arguments if data argument was omitted7779 if ( jquery.isFunction( data ) ) {7780 type = type || callback;7781 callback = data;7782 data = undefined;7783 }7784 return jquery.ajax({7785 url: url,7786 type: method,7787 dataType: type,7788 data: data,7789 success: callback7790 });7791 };7792});7793// Attach a bunch of functions for handling common AJAX events7794jquery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {7795 jquery.fn[ type ] = function( fn ) {7796 return this.on( type, fn );7797 };7798});7799jquery._evalUrl = function( url ) {7800 return jquery.ajax({7801 url: url,7802 type: "GET",7803 dataType: "script",7804 async: false,7805 global: false,7806 "throws": true7807 });7808};7809jquery.fn.extend({7810 wrapAll: function( html ) {7811 if ( jquery.isFunction( html ) ) {7812 return this.each(function(i) {7813 jquery(this).wrapAll( html.call(this, i) );7814 });7815 }7816 if ( this[0] ) {7817 // The elements to wrap the target around7818 var wrap = jquery( html, this[0].ownerDocument ).eq(0).clone(true);7819 if ( this[0].parentNode ) {7820 wrap.insertBefore( this[0] );7821 }7822 wrap.map(function() {7823 var elem = this;7824 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {7825 elem = elem.firstChild;7826 }7827 return elem;7828 }).append( this );7829 }7830 return this;7831 },7832 wrapInner: function( html ) {7833 if ( jquery.isFunction( html ) ) {7834 return this.each(function(i) {7835 jquery(this).wrapInner( html.call(this, i) );7836 });7837 }7838 return this.each(function() {7839 var self = jquery( this ),7840 contents = self.contents();7841 if ( contents.length ) {7842 contents.wrapAll( html );7843 } else {7844 self.append( html );7845 }7846 });7847 },7848 wrap: function( html ) {7849 var isFunction = jquery.isFunction( html );7850 return this.each(function(i) {7851 jquery( this ).wrapAll( isFunction ? html.call(this, i) : html );7852 });7853 },7854 unwrap: function() {7855 return this.parent().each(function() {7856 if ( !jquery.nodeName( this, "body" ) ) {7857 jquery( this ).replaceWith( this.childNodes );7858 }7859 }).end();7860 }7861});7862jquery.expr.filters.hidden = function( elem ) {7863 // Support: Opera <= 12.127864 // Opera reports offsetWidths and offsetHeights less than zero on some elements7865 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||7866 (!support.reliableHiddenOffsets() &&7867 ((elem.style && elem.style.display) || jquery.css( elem, "display" )) === "none");7868};7869jquery.expr.filters.visible = function( elem ) {7870 return !jquery.expr.filters.hidden( elem );7871};7872var r20 = /%20/g,7873 rbracket = /\[\]$/,7874 rCRLF = /\r?\n/g,7875 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,7876 rsubmittable = /^(?:input|select|textarea|keygen)/i;7877function buildParams( prefix, obj, traditional, add ) {7878 var name;7879 if ( jquery.isArray( obj ) ) {7880 // Serialize array item.7881 jquery.each( obj, function( i, v ) {7882 if ( traditional || rbracket.test( prefix ) ) {7883 // Treat each array item as a scalar.7884 add( prefix, v );7885 } else {7886 // Item is non-scalar (array or object), encode its numeric index.7887 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );7888 }7889 });7890 } else if ( !traditional && jquery.type( obj ) === "object" ) {7891 // Serialize object item.7892 for ( name in obj ) {7893 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );7894 }7895 } else {7896 // Serialize scalar item.7897 add( prefix, obj );7898 }7899}7900// Serialize an array of form elements or a set of7901// key/values into a query string7902jquery.param = function( a, traditional ) {7903 var prefix,7904 s = [],7905 add = function( key, value ) {7906 // If value is a function, invoke it and return its value7907 value = jquery.isFunction( value ) ? value() : ( value == null ? "" : value );7908 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );7909 };7910 // Set traditional to true for jquery <= 1.3.2 behavior.7911 if ( traditional === undefined ) {7912 traditional = jquery.ajaxSettings && jquery.ajaxSettings.traditional;7913 }7914 // If an array was passed in, assume that it is an array of form elements.7915 if ( jquery.isArray( a ) || ( a.jquery && !jquery.isPlainObject( a ) ) ) {7916 // Serialize the form elements7917 jquery.each( a, function() {7918 add( this.name, this.value );7919 });7920 } else {7921 // If traditional, encode the "old" way (the way 1.3.2 or older7922 // did it), otherwise encode params recursively.7923 for ( prefix in a ) {7924 buildParams( prefix, a[ prefix ], traditional, add );7925 }7926 }7927 // Return the resulting serialization7928 return s.join( "&" ).replace( r20, "+" );7929};7930jquery.fn.extend({7931 serialize: function() {7932 return jquery.param( this.serializeArray() );7933 },7934 serializeArray: function() {7935 return this.map(function() {7936 // Can add propHook for "elements" to filter or add form elements7937 var elements = jquery.prop( this, "elements" );7938 return elements ? jquery.makeArray( elements ) : this;7939 })7940 .filter(function() {7941 var type = this.type;7942 // Use .is(":disabled") so that fieldset[disabled] works7943 return this.name && !jquery( this ).is( ":disabled" ) &&7944 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&7945 ( this.checked || !rcheckableType.test( type ) );7946 })7947 .map(function( i, elem ) {7948 var val = jquery( this ).val();7949 return val == null ?7950 null :7951 jquery.isArray( val ) ?7952 jquery.map( val, function( val ) {7953 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };7954 }) :7955 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };7956 }).get();7957 }7958});7959// Create the request object7960// (This is still attached to ajaxSettings for backward compatibility)7961jquery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?7962 // Support: IE6+7963 function() {7964 // XHR cannot access local files, always use ActiveX for that case7965 return !this.isLocal &&7966 // Support: IE7-87967 // oldIE XHR does not support non-RFC2616 methods (#13240)7968 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx7969 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec97970 // Although this check for six methods instead of eight7971 // since IE also does not support "trace" and "connect"7972 /^(get|post|head|put|delete|options)$/i.test( this.type ) &&7973 createStandardXHR() || createActiveXHR();7974 } :7975 // For all other browsers, use the standard XMLHttpRequest object7976 createStandardXHR;7977var xhrId = 0,7978 xhrCallbacks = {},7979 xhrSupported = jquery.ajaxSettings.xhr();7980// Support: IE<107981// Open requests must be manually aborted on unload (#5280)7982if ( window.ActiveXObject ) {7983 jquery( window ).on( "unload", function() {7984 for ( var key in xhrCallbacks ) {7985 xhrCallbacks[ key ]( undefined, true );7986 }7987 });7988}7989// Determine support properties7990support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );7991xhrSupported = support.ajax = !!xhrSupported;7992// Create transport if the browser can provide an xhr7993if ( xhrSupported ) {7994 jquery.ajaxTransport(function( options ) {7995 // Cross domain only allowed if supported through XMLHttpRequest7996 if ( !options.crossDomain || support.cors ) {7997 var callback;7998 return {7999 send: function( headers, complete ) {8000 var i,8001 xhr = options.xhr(),8002 id = ++xhrId;8003 // Open the socket8004 xhr.open( options.type, options.url, options.async, options.username, options.password );8005 // Apply custom fields if provided8006 if ( options.xhrFields ) {8007 for ( i in options.xhrFields ) {8008 xhr[ i ] = options.xhrFields[ i ];8009 }8010 }8011 // Override mime type if needed8012 if ( options.mimeType && xhr.overrideMimeType ) {8013 xhr.overrideMimeType( options.mimeType );8014 }8015 // X-Requested-With header8016 // For cross-domain requests, seeing as conditions for a preflight are8017 // akin to a jigsaw puzzle, we simply never set it to be sure.8018 // (it can always be set on a per-request basis or even using ajaxSetup)8019 // For same-domain requests, won't change header if already provided.8020 if ( !options.crossDomain && !headers["X-Requested-With"] ) {8021 headers["X-Requested-With"] = "XMLHttpRequest";8022 }8023 // Set headers8024 for ( i in headers ) {8025 // Support: IE<98026 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting8027 // request header to a null-value.8028 //8029 // To keep consistent with other XHR implementations, cast the value8030 // to string and ignore `undefined`.8031 if ( headers[ i ] !== undefined ) {8032 xhr.setRequestHeader( i, headers[ i ] + "" );8033 }8034 }8035 // Do send the request8036 // This may raise an exception which is actually8037 // handled in jquery.ajax (so no try/catch here)8038 xhr.send( ( options.hasContent && options.data ) || null );8039 // Listener8040 callback = function( _, isAbort ) {8041 var status, statusText, responses;8042 // Was never called and is aborted or complete8043 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {8044 // Clean up8045 delete xhrCallbacks[ id ];8046 callback = undefined;8047 xhr.onreadystatechange = jquery.noop;8048 // Abort manually if needed8049 if ( isAbort ) {8050 if ( xhr.readyState !== 4 ) {8051 xhr.abort();8052 }8053 } else {8054 responses = {};8055 status = xhr.status;8056 // Support: IE<108057 // Accessing binary-data responseText throws an exception8058 // (#11426)8059 if ( typeof xhr.responseText === "string" ) {8060 responses.text = xhr.responseText;8061 }8062 // Firefox throws an exception when accessing8063 // statusText for faulty cross-domain requests8064 try {8065 statusText = xhr.statusText;8066 } catch( e ) {8067 // We normalize with Webkit giving an empty statusText8068 statusText = "";8069 }8070 // Filter status for non standard behaviors8071 // If the request is local and we have data: assume a success8072 // (success with no data won't get notified, that's the best we8073 // can do given current implementations)8074 if ( !status && options.isLocal && !options.crossDomain ) {8075 status = responses.text ? 200 : 404;8076 // IE - #1450: sometimes returns 1223 when it should be 2048077 } else if ( status === 1223 ) {8078 status = 204;8079 }8080 }8081 }8082 // Call complete if needed8083 if ( responses ) {8084 complete( status, statusText, responses, xhr.getAllResponseHeaders() );8085 }8086 };8087 if ( !options.async ) {8088 // if we're in sync mode we fire the callback8089 callback();8090 } else if ( xhr.readyState === 4 ) {8091 // (IE6 & IE7) if it's in cache and has been8092 // retrieved directly we need to fire the callback8093 setTimeout( callback );8094 } else {8095 // Add to the list of active xhr callbacks8096 xhr.onreadystatechange = xhrCallbacks[ id ] = callback;8097 }8098 },8099 abort: function() {8100 if ( callback ) {8101 callback( undefined, true );8102 }8103 }8104 };8105 }8106 });8107}8108// Functions to create xhrs8109function createStandardXHR() {8110 try {8111 return new window.XMLHttpRequest();8112 } catch( e ) {}8113}8114function createActiveXHR() {8115 try {8116 return new window.ActiveXObject( "Microsoft.XMLHTTP" );8117 } catch( e ) {}8118}8119// Install script dataType8120jquery.ajaxSetup({8121 accepts: {8122 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"8123 },8124 contents: {8125 script: /(?:java|ecma)script/8126 },8127 converters: {8128 "text script": function( text ) {8129 jquery.globalEval( text );8130 return text;8131 }8132 }8133});8134// Handle cache's special case and global8135jquery.ajaxPrefilter( "script", function( s ) {8136 if ( s.cache === undefined ) {8137 s.cache = false;8138 }8139 if ( s.crossDomain ) {8140 s.type = "GET";8141 s.global = false;8142 }8143});8144// Bind script tag hack transport8145jquery.ajaxTransport( "script", function(s) {8146 // This transport only deals with cross domain requests8147 if ( s.crossDomain ) {8148 var script,8149 head = document.head || jquery("head")[0] || document.documentElement;8150 return {8151 send: function( _, callback ) {8152 script = document.createElement("script");8153 script.async = true;8154 if ( s.scriptCharset ) {8155 script.charset = s.scriptCharset;8156 }8157 script.src = s.url;8158 // Attach handlers for all browsers8159 script.onload = script.onreadystatechange = function( _, isAbort ) {8160 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {8161 // Handle memory leak in IE8162 script.onload = script.onreadystatechange = null;8163 // Remove the script8164 if ( script.parentNode ) {8165 script.parentNode.removeChild( script );8166 }8167 // Dereference the script8168 script = null;8169 // Callback if not abort8170 if ( !isAbort ) {8171 callback( 200, "success" );8172 }8173 }8174 };8175 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending8176 // Use native DOM manipulation to avoid our domManip AJAX trickery8177 head.insertBefore( script, head.firstChild );8178 },8179 abort: function() {8180 if ( script ) {8181 script.onload( undefined, true );8182 }8183 }8184 };8185 }8186});8187var oldCallbacks = [],8188 rjsonp = /(=)\?(?=&|$)|\?\?/;8189// Default jsonp settings8190jquery.ajaxSetup({8191 jsonp: "callback",8192 jsonpCallback: function() {8193 var callback = oldCallbacks.pop() || ( jquery.expando + "_" + ( nonce++ ) );8194 this[ callback ] = true;8195 return callback;8196 }8197});8198// Detect, normalize options and install callbacks for jsonp requests8199jquery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {8200 var callbackName, overwritten, responseContainer,8201 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?8202 "url" :8203 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"8204 );8205 // Handle iff the expected data type is "jsonp" or we have a parameter to set8206 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {8207 // Get callback name, remembering preexisting value associated with it8208 callbackName = s.jsonpCallback = jquery.isFunction( s.jsonpCallback ) ?8209 s.jsonpCallback() :8210 s.jsonpCallback;8211 // Insert callback into url or form data8212 if ( jsonProp ) {8213 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );8214 } else if ( s.jsonp !== false ) {8215 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;8216 }8217 // Use data converter to retrieve json after script execution8218 s.converters["script json"] = function() {8219 if ( !responseContainer ) {8220 jquery.error( callbackName + " was not called" );8221 }8222 return responseContainer[ 0 ];8223 };8224 // force json dataType8225 s.dataTypes[ 0 ] = "json";8226 // Install callback8227 overwritten = window[ callbackName ];8228 window[ callbackName ] = function() {8229 responseContainer = arguments;8230 };8231 // Clean-up function (fires after converters)8232 jqXHR.always(function() {8233 // Restore preexisting value8234 window[ callbackName ] = overwritten;8235 // Save back as free8236 if ( s[ callbackName ] ) {8237 // make sure that re-using the options doesn't screw things around8238 s.jsonpCallback = originalSettings.jsonpCallback;8239 // save the callback name for future use8240 oldCallbacks.push( callbackName );8241 }8242 // Call if it was a function and we have a response8243 if ( responseContainer && jquery.isFunction( overwritten ) ) {8244 overwritten( responseContainer[ 0 ] );8245 }8246 responseContainer = overwritten = undefined;8247 });8248 // Delegate to script8249 return "script";8250 }8251});8252// data: string of html8253// context (optional): If specified, the fragment will be created in this context, defaults to document8254// keepScripts (optional): If true, will include scripts passed in the html string8255jquery.parseHTML = function( data, context, keepScripts ) {8256 if ( !data || typeof data !== "string" ) {8257 return null;8258 }8259 if ( typeof context === "boolean" ) {8260 keepScripts = context;8261 context = false;8262 }8263 context = context || document;8264 var parsed = rsingleTag.exec( data ),8265 scripts = !keepScripts && [];8266 // Single tag8267 if ( parsed ) {8268 return [ context.createElement( parsed[1] ) ];8269 }8270 parsed = jquery.buildFragment( [ data ], context, scripts );8271 if ( scripts && scripts.length ) {8272 jquery( scripts ).remove();8273 }8274 return jquery.merge( [], parsed.childNodes );8275};8276// Keep a copy of the old load method8277var _load = jquery.fn.load;8278/**8279 * Load a url into a page8280 */8281jquery.fn.load = function( url, params, callback ) {8282 if ( typeof url !== "string" && _load ) {8283 return _load.apply( this, arguments );8284 }8285 var selector, response, type,8286 self = this,8287 off = url.indexOf(" ");8288 if ( off >= 0 ) {8289 selector = url.slice( off, url.length );8290 url = url.slice( 0, off );8291 }8292 // If it's a function8293 if ( jquery.isFunction( params ) ) {8294 // We assume that it's the callback8295 callback = params;8296 params = undefined;8297 // Otherwise, build a param string8298 } else if ( params && typeof params === "object" ) {8299 type = "POST";8300 }8301 // If we have elements to modify, make the request8302 if ( self.length > 0 ) {8303 jquery.ajax({8304 url: url,8305 // if "type" variable is undefined, then "GET" method will be used8306 type: type,8307 dataType: "html",8308 data: params8309 }).done(function( responseText ) {8310 // Save response for use in complete callback8311 response = arguments;8312 self.html( selector ?8313 // If a selector was specified, locate the right elements in a dummy div8314 // Exclude scripts to avoid IE 'Permission Denied' errors8315 jquery("<div>").append( jquery.parseHTML( responseText ) ).find( selector ) :8316 // Otherwise use the full result8317 responseText );8318 }).complete( callback && function( jqXHR, status ) {8319 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );8320 });8321 }8322 return this;8323};8324jquery.expr.filters.animated = function( elem ) {8325 return jquery.grep(jquery.timers, function( fn ) {8326 return elem === fn.elem;8327 }).length;8328};8329var docElem = window.document.documentElement;8330/**8331 * Gets a window from an element8332 */8333function getWindow( elem ) {8334 return jquery.isWindow( elem ) ?8335 elem :8336 elem.nodeType === 9 ?8337 elem.defaultView || elem.parentWindow :8338 false;8339}8340jquery.offset = {8341 setOffset: function( elem, options, i ) {8342 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,8343 position = jquery.css( elem, "position" ),8344 curElem = jquery( elem ),8345 props = {};8346 // set position first, in-case top/left are set even on static elem8347 if ( position === "static" ) {8348 elem.style.position = "relative";8349 }8350 curOffset = curElem.offset();8351 curCSSTop = jquery.css( elem, "top" );8352 curCSSLeft = jquery.css( elem, "left" );8353 calculatePosition = ( position === "absolute" || position === "fixed" ) &&8354 jquery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;8355 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed8356 if ( calculatePosition ) {8357 curPosition = curElem.position();8358 curTop = curPosition.top;8359 curLeft = curPosition.left;8360 } else {8361 curTop = parseFloat( curCSSTop ) || 0;8362 curLeft = parseFloat( curCSSLeft ) || 0;8363 }8364 if ( jquery.isFunction( options ) ) {8365 options = options.call( elem, i, curOffset );8366 }8367 if ( options.top != null ) {8368 props.top = ( options.top - curOffset.top ) + curTop;8369 }8370 if ( options.left != null ) {8371 props.left = ( options.left - curOffset.left ) + curLeft;8372 }8373 if ( "using" in options ) {8374 options.using.call( elem, props );8375 } else {8376 curElem.css( props );8377 }8378 }8379};8380jquery.fn.extend({8381 offset: function( options ) {8382 if ( arguments.length ) {8383 return options === undefined ?8384 this :8385 this.each(function( i ) {8386 jquery.offset.setOffset( this, options, i );8387 });8388 }8389 var docElem, win,8390 box = { top: 0, left: 0 },8391 elem = this[ 0 ],8392 doc = elem && elem.ownerDocument;8393 if ( !doc ) {8394 return;8395 }8396 docElem = doc.documentElement;8397 // Make sure it's not a disconnected DOM node8398 if ( !jquery.contains( docElem, elem ) ) {8399 return box;8400 }8401 // If we don't have gBCR, just use 0,0 rather than error8402 // BlackBerry 5, iOS 3 (original iPhone)8403 if ( typeof elem.getBoundingClientRect !== strundefined ) {8404 box = elem.getBoundingClientRect();8405 }8406 win = getWindow( doc );8407 return {8408 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),8409 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )8410 };8411 },8412 position: function() {8413 if ( !this[ 0 ] ) {8414 return;8415 }8416 var offsetParent, offset,8417 parentOffset = { top: 0, left: 0 },8418 elem = this[ 0 ];8419 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent8420 if ( jquery.css( elem, "position" ) === "fixed" ) {8421 // we assume that getBoundingClientRect is available when computed position is fixed8422 offset = elem.getBoundingClientRect();8423 } else {8424 // Get *real* offsetParent8425 offsetParent = this.offsetParent();8426 // Get correct offsets8427 offset = this.offset();8428 if ( !jquery.nodeName( offsetParent[ 0 ], "html" ) ) {8429 parentOffset = offsetParent.offset();8430 }8431 // Add offsetParent borders8432 parentOffset.top += jquery.css( offsetParent[ 0 ], "borderTopWidth", true );8433 parentOffset.left += jquery.css( offsetParent[ 0 ], "borderLeftWidth", true );8434 }8435 // Subtract parent offsets and element margins8436 // note: when an element has margin: auto the offsetLeft and marginLeft8437 // are the same in Safari causing offset.left to incorrectly be 08438 return {8439 top: offset.top - parentOffset.top - jquery.css( elem, "marginTop", true ),8440 left: offset.left - parentOffset.left - jquery.css( elem, "marginLeft", true)8441 };8442 },8443 offsetParent: function() {8444 return this.map(function() {8445 var offsetParent = this.offsetParent || docElem;8446 while ( offsetParent && ( !jquery.nodeName( offsetParent, "html" ) && jquery.css( offsetParent, "position" ) === "static" ) ) {8447 offsetParent = offsetParent.offsetParent;8448 }8449 return offsetParent || docElem;8450 });8451 }8452});8453// Create scrollLeft and scrollTop methods8454jquery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {8455 var top = /Y/.test( prop );8456 jquery.fn[ method ] = function( val ) {8457 return access( this, function( elem, method, val ) {8458 var win = getWindow( elem );8459 if ( val === undefined ) {8460 return win ? (prop in win) ? win[ prop ] :8461 win.document.documentElement[ method ] :8462 elem[ method ];8463 }8464 if ( win ) {8465 win.scrollTo(8466 !top ? val : jquery( win ).scrollLeft(),8467 top ? val : jquery( win ).scrollTop()8468 );8469 } else {8470 elem[ method ] = val;8471 }8472 }, method, val, arguments.length, null );8473 };8474});8475// Add the top/left cssHooks using jquery.fn.position8476// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=290848477// getComputedStyle returns percent when specified for top/left/bottom/right8478// rather than make the css module depend on the offset module, we just check for it here8479jquery.each( [ "top", "left" ], function( i, prop ) {8480 jquery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,8481 function( elem, computed ) {8482 if ( computed ) {8483 computed = curCSS( elem, prop );8484 // if curCSS returns percentage, fallback to offset8485 return rnumnonpx.test( computed ) ?8486 jquery( elem ).position()[ prop ] + "px" :8487 computed;8488 }8489 }8490 );8491});8492// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods8493jquery.each( { Height: "height", Width: "width" }, function( name, type ) {8494 jquery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {8495 // margin is only for outerHeight, outerWidth8496 jquery.fn[ funcName ] = function( margin, value ) {8497 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),8498 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );8499 return access( this, function( elem, type, value ) {8500 var doc;8501 if ( jquery.isWindow( elem ) ) {8502 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there8503 // isn't a whole lot we can do. See pull request at this URL for discussion:8504 // https://github.com/jquery/jquery/pull/7648505 return elem.document.documentElement[ "client" + name ];8506 }8507 // Get document width or height8508 if ( elem.nodeType === 9 ) {8509 doc = elem.documentElement;8510 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest8511 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.8512 return Math.max(8513 elem.body[ "scroll" + name ], doc[ "scroll" + name ],8514 elem.body[ "offset" + name ], doc[ "offset" + name ],8515 doc[ "client" + name ]8516 );8517 }8518 return value === undefined ?8519 // Get width or height on the element, requesting but not forcing parseFloat8520 jquery.css( elem, type, extra ) :8521 // Set width or height on the element8522 jquery.style( elem, type, value, extra );8523 }, type, chainable ? margin : undefined, chainable, null );8524 };8525 });8526});8527// The number of elements contained in the matched element set8528jquery.fn.size = function() {8529 return this.length;8530};8531jquery.fn.andSelf = jquery.fn.addBack;8532// Register as a named AMD module, since jquery can be concatenated with other8533// files that may use define, but not via a proper concatenation script that8534// understands anonymous AMD modules. A named AMD is safest and most robust8535// way to register. Lowercase jquery is used because AMD module names are8536// derived from file names, and jquery is normally delivered in a lowercase8537// file name. Do this after creating the global so that if an AMD module wants8538// to call noConflict to hide this version of jquery, it will work.8539if ( typeof define === "function" && define.amd ) {8540 define( "jquery", [], function() {8541 return jquery;8542 });8543}8544var8545 // Map over jquery in case of overwrite8546 _jquery = window.jquery,8547 // Map over the $ in case of overwrite8548 _$ = window.$;8549jquery.noConflict = function( deep ) {8550 if ( window.$ === jquery ) {8551 window.$ = _$;8552 }8553 if ( deep && window.jquery === jquery ) {8554 window.jquery = _jquery;8555 }8556 return jquery;8557};8558// Expose jquery and $ identifiers, even in8559// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)8560// and CommonJS for browser emulators (#13566)8561if ( typeof noGlobal === strundefined ) {8562 window.jquery = window.$ = jquery;8563}8564return jquery;...

Full Screen

Full Screen

jquery-1.11.1.js

Source:jquery-1.11.1.js Github

copy

Full Screen

...2569 if ( rcheckableType.test( elem.type ) ) {2570 elem.defaultChecked = elem.checked;2571 }2572}2573// Support: IE<8 1="" 11="" manipulating="" tables="" requires="" a="" tbody="" function="" manipulationtarget(="" elem,="" content="" )="" {="" return="" jquery.nodename(="" "table"="" &&="" content.nodetype="" !="=" ?="" :="" content.firstchild,="" "tr"="" elem.getelementsbytagname("tbody")[0]="" ||="" elem.appendchild(="" elem.ownerdocument.createelement("tbody")="" elem;="" }="" replace="" restore="" the="" type="" attribute="" of="" script="" elements="" for="" safe="" dom="" manipulation="" disablescript(="" elem="" elem.type="(jQuery.find.attr(" "type"="" null)="" +="" "="" elem.type;="" restorescript(="" var="" match="rscriptTypeMasked.exec(" );="" if="" (="" else="" elem.removeattribute("type");="" mark="" scripts="" as="" having="" already="" been="" evaluated="" setglobaleval(="" elems,="" refelements="" i="0;" ;="" (elem="elems[i])" i++="" jquery._data(="" "globaleval",="" !refelements="" refelements[i],="" "globaleval"="" clonecopyevent(="" src,="" dest="" dest.nodetype="" !jquery.hasdata(="" src="" return;="" type,="" i,="" l,="" olddata="jQuery._data(" ),="" curdata="jQuery._data(" dest,="" events="oldData.events;" delete="" curdata.handle;="" curdata.events="{};" in="" l="events[" ].length;="" <="" l;="" jquery.event.add(="" events[="" ][="" ]="" make="" cloned="" public="" data="" object="" copy="" from="" original="" curdata.data="" {},="" fixclonenodeissues(="" nodename,="" e,="" data;="" we="" do="" not="" need="" to="" anything="" non-elements="" nodename="dest.nodeName.toLowerCase();" ie6-8="" copies="" bound="" via="" attachevent="" when="" using="" clonenode.="" !support.nocloneevent="" dest[="" jquery.expando="" e="" data.events="" jquery.removeevent(="" data.handle="" event="" gets="" referenced="" instead="" copied="" expando="" too="" dest.removeattribute(="" ie="" blanks="" contents="" cloning="" scripts,="" and="" tries="" evaluate="" newly-set="" text="" "script"="" dest.text="" src.text="" ).text="src.text;" ie6-10="" improperly="" clones="" children="" classid.="" ie10="" throws="" nomodificationallowederror="" parent="" is="" null,="" #12132.="" "object"="" dest.parentnode="" dest.outerhtml="src.outerHTML;" this="" path="" appears="" unavoidable="" ie9.="" an="" element="" ie9,="" outerhtml="" strategy="" above="" sufficient.="" has="" innerhtml="" destination="" does="" not,="" src.innerhtml="" into="" dest.innerhtml.="" #10324="" support.html5clone="" !jquery.trim(dest.innerhtml)="" dest.innerhtml="src.innerHTML;" "input"="" rcheckabletype.test(="" src.type="" fails="" persist="" checked state="" checkbox="" or="" radio="" button.="" worse,="" ie6-7="" fail="" give="" appearance="" defaultchecked="" value="" isn't="" also="" set="" dest.defaultchecked="dest.checked" =="" src.checked;="" get="" confused="" end="" up="" setting="" button="" empty="" string="" "on"="" dest.value="" src.value="" selected option="" default options="" "option"="" dest.defaultselected="dest.selected" src.defaultselected;="" defaultvalue="" correct="" other="" types="" input="" fields="" "textarea"="" dest.defaultvalue="src.defaultValue;" jquery.extend({="" clone:="" function(="" dataandevents,="" deepdataandevents="" destelements,="" node,="" clone,="" srcelements,="" inpage="jQuery.contains(" elem.ownerdocument,="" jquery.isxmldoc(elem)="" !rnoshimcache.test(="" "<"="" elem.nodename="">" ) ) {2574 clone = elem.cloneNode( true );2575 // IE<=8 1="" 2="" does="" not="" properly="" clone="" detached,="" unknown="" element="" nodes="" }="" else="" {="" fragmentdiv.innerhtml="elem.outerHTML;" fragmentdiv.removechild(="" );="" if="" (="" (!support.nocloneevent="" ||="" !support.noclonechecked)="" &&="" (elem.nodetype="==" elem.nodetype="==" 11)="" !jquery.isxmldoc(elem)="" )="" we="" eschew="" sizzle="" here="" for="" performance="" reasons:="" http:="" jsperf.com="" getall-vs-sizzle="" destelements="getAll(" srcelements="getAll(" elem="" fix="" all="" ie="" cloning="" issues="" i="0;" (node="srcElements[i])" !="null;" ++i="" ensure="" that="" the="" destination="" node="" is="" null;="" fixes="" #9587="" destelements[i]="" fixclonenodeissues(="" node,="" copy="" events="" from="" original="" to="" dataandevents="" deepdataandevents="" getall(="" i++="" clonecopyevent(="" elem,="" preserve="" script="" evaluation="" history="" clone,="" "script"="" destelements.length=""> 0 ) {2576 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );2577 }2578 destElements = srcElements = node = null;2579 // Return the cloned set2580 return clone;2581 },2582 buildFragment: function( elems, context, scripts, selection ) {2583 var j, elem, contains,2584 tmp, tag, tbody, wrap,2585 l = elems.length,2586 // Ensure a safe fragment2587 safe = createSafeFragment( context ),2588 nodes = [],2589 i = 0;2590 for ( ; i < l; i++ ) {2591 elem = elems[ i ];2592 if ( elem || elem === 0 ) {2593 // Add nodes directly2594 if ( jQuery.type( elem ) === "object" ) {2595 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );2596 // Convert non-html into a text node2597 } else if ( !rhtml.test( elem ) ) {2598 nodes.push( context.createTextNode( elem ) );2599 // Convert html into DOM nodes2600 } else {2601 tmp = tmp || safe.appendChild( context.createElement("div") );2602 // Deserialize a standard representation2603 tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase();2604 wrap = wrapMap[ tag ] || wrapMap._default;2605 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2];2606 // Descend through wrappers to the right content2607 j = wrap[0];2608 while ( j-- ) {2609 tmp = tmp.lastChild;2610 }2611 // Manually add leading whitespace removed by IE2612 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {2613 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );2614 }2615 // Remove IE's autoinserted <tbody> from table fragments2616 if ( !support.tbody ) {2617 // String was a <table>, *may* have spurious <tbody>2618 elem = tag === "table" && !rtbody.test( elem ) ?2619 tmp.firstChild :2620 // String was a bare <thead> or <tfoot>2621 wrap[1] === "<table>" && !rtbody.test( elem ) ?2622 tmp :2623 0;2624 j = elem && elem.childNodes.length;2625 while ( j-- ) {2626 if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {2627 elem.removeChild( tbody );2628 }2629 }2630 }2631 jQuery.merge( nodes, tmp.childNodes );2632 // Fix #12392 for WebKit and IE > 92633 tmp.textContent = "";2634 // Fix #12392 for oldIE2635 while ( tmp.firstChild ) {2636 tmp.removeChild( tmp.firstChild );2637 }2638 // Remember the top-level container for proper cleanup2639 tmp = safe.lastChild;2640 }2641 }2642 }2643 // Fix #11356: Clear elements from fragment2644 if ( tmp ) {2645 safe.removeChild( tmp );2646 }2647 // Reset defaultChecked for any radios and checkboxes2648 // about to be appended to the DOM in IE 6/7 (#8060)2649 if ( !support.appendChecked ) {2650 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );2651 }2652 i = 0;2653 while ( (elem = nodes[ i++ ]) ) {2654 // #4087 - If origin and destination elements are the same, and this is2655 // that element, do not do anything2656 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {2657 continue;2658 }2659 contains = jQuery.contains( elem.ownerDocument, elem );2660 // Append to fragment2661 tmp = getAll( safe.appendChild( elem ), "script" );2662 // Preserve script evaluation history2663 if ( contains ) {2664 setGlobalEval( tmp );2665 }2666 // Capture executables2667 if ( scripts ) {2668 j = 0;2669 while ( (elem = tmp[ j++ ]) ) {2670 if ( rscriptType.test( elem.type || "" ) ) {2671 scripts.push( elem );2672 }2673 }2674 }2675 }2676 tmp = null;2677 return safe;2678 },2679 cleanData: function( elems, /* internal */ acceptData ) {2680 var elem, type, id, data,2681 i = 0,2682 internalKey = jQuery.expando,2683 cache = jQuery.cache,2684 deleteExpando = support.deleteExpando,2685 special = jQuery.event.special;2686 for ( ; (elem = elems[i]) != null; i++ ) {2687 if ( acceptData || jQuery.acceptData( elem ) ) {2688 id = elem[ internalKey ];2689 data = id && cache[ id ];2690 if ( data ) {2691 if ( data.events ) {2692 for ( type in data.events ) {2693 if ( special[ type ] ) {2694 jQuery.event.remove( elem, type );2695 // This is a shortcut to avoid jQuery.event.remove's overhead2696 } else {2697 jQuery.removeEvent( elem, type, data.handle );2698 }2699 }2700 }2701 // Remove cache only if it was not already removed by jQuery.event.remove2702 if ( cache[ id ] ) {2703 delete cache[ id ];2704 // IE does not allow us to delete expando properties from nodes,2705 // nor does it have a removeAttribute function on Document nodes;2706 // we must handle all of these cases2707 if ( deleteExpando ) {2708 delete elem[ internalKey ];2709 } else if ( typeof elem.removeAttribute !== strundefined ) {2710 elem.removeAttribute( internalKey );2711 } else {2712 elem[ internalKey ] = null;2713 }2714 deletedIds.push( id );2715 }2716 }2717 }2718 }2719 }2720});2721jQuery.fn.extend({2722 text: function( value ) {2723 return access( this, function( value ) {2724 return value === undefined ?2725 jQuery.text( this ) :2726 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );2727 }, null, value, arguments.length );2728 },2729 append: function() {2730 return this.domManip( arguments, function( elem ) {2731 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {2732 var target = manipulationTarget( this, elem );2733 target.appendChild( elem );2734 }2735 });2736 },2737 prepend: function() {2738 return this.domManip( arguments, function( elem ) {2739 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {2740 var target = manipulationTarget( this, elem );2741 target.insertBefore( elem, target.firstChild );2742 }2743 });2744 },2745 before: function() {2746 return this.domManip( arguments, function( elem ) {2747 if ( this.parentNode ) {2748 this.parentNode.insertBefore( elem, this );2749 }2750 });2751 },2752 after: function() {2753 return this.domManip( arguments, function( elem ) {2754 if ( this.parentNode ) {2755 this.parentNode.insertBefore( elem, this.nextSibling );2756 }2757 });2758 },2759 remove: function( selector, keepData /* Internal Use Only */ ) {2760 var elem,2761 elems = selector ? jQuery.filter( selector, this ) : this,2762 i = 0;2763 for ( ; (elem = elems[i]) != null; i++ ) {2764 if ( !keepData && elem.nodeType === 1 ) {2765 jQuery.cleanData( getAll( elem ) );2766 }2767 if ( elem.parentNode ) {2768 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {2769 setGlobalEval( getAll( elem, "script" ) );2770 }2771 elem.parentNode.removeChild( elem );2772 }2773 }2774 return this;2775 },2776 empty: function() {2777 var elem,2778 i = 0;2779 for ( ; (elem = this[i]) != null; i++ ) {2780 // Remove element nodes and prevent memory leaks2781 if ( elem.nodeType === 1 ) {2782 jQuery.cleanData( getAll( elem, false ) );2783 }2784 // Remove any remaining nodes2785 while ( elem.firstChild ) {2786 elem.removeChild( elem.firstChild );2787 }2788 // If this is a select, ensure that it displays empty (#12336)2789 // Support: IE<9 0="" 1="" if="" (="" elem.options="" &&="" jquery.nodename(="" elem,="" "select"="" )="" {="" elem.options.length="0;" }="" return="" this;="" },="" clone:="" function(="" dataandevents,="" deepdataandevents="" dataandevents="dataAndEvents" =="null" ?="" false="" :="" dataandevents;="" deepdataandevents;="" this.map(function()="" jquery.clone(="" this,="" );="" });="" html:="" value="" access(="" var="" elem="this[" ]="" ||="" {},="" i="0," l="this.length;" undefined="" elem.nodetype="==" elem.innerhtml.replace(="" rinlinejquery,="" ""="" undefined;="" see="" we="" can="" take="" a="" shortcut="" and="" just="" use="" innerhtml="" typeof="" "string"="" !rnoinnerhtml.test(="" support.htmlserialize="" !rnoshimcache.test(="" support.leadingwhitespace="" !rleadingwhitespace.test(="" !wrapmap[="" (rtagname.exec(="" [="" "",="" ])[="" ].tolowercase()="" rxhtmltag,="" "<$1="">" );2790 try {2791 for (; i < l; i++ ) {2792 // Remove element nodes and prevent memory leaks2793 elem = this[i] || {};2794 if ( elem.nodeType === 1 ) {2795 jQuery.cleanData( getAll( elem, false ) );2796 elem.innerHTML = value;2797 }2798 }2799 elem = 0;2800 // If using innerHTML throws an exception, use the fallback method2801 } catch(e) {}2802 }2803 if ( elem ) {2804 this.empty().append( value );2805 }2806 }, null, value, arguments.length );2807 },2808 replaceWith: function() {2809 var arg = arguments[ 0 ];2810 // Make the changes, replacing each context element with the new content2811 this.domManip( arguments, function( elem ) {2812 arg = this.parentNode;2813 jQuery.cleanData( getAll( this ) );2814 if ( arg ) {2815 arg.replaceChild( elem, this );2816 }2817 });2818 // Force removal if there was no new content (e.g., from empty arguments)2819 return arg && (arg.length || arg.nodeType) ? this : this.remove();2820 },2821 detach: function( selector ) {2822 return this.remove( selector, true );2823 },2824 domManip: function( args, callback ) {2825 // Flatten any nested arrays2826 args = concat.apply( [], args );2827 var first, node, hasScripts,2828 scripts, doc, fragment,2829 i = 0,2830 l = this.length,2831 set = this,2832 iNoClone = l - 1,2833 value = args[0],2834 isFunction = jQuery.isFunction( value );2835 // We can't cloneNode fragments that contain checked, in WebKit2836 if ( isFunction ||2837 ( l > 1 && typeof value === "string" &&2838 !support.checkClone && rchecked.test( value ) ) ) {2839 return this.each(function( index ) {2840 var self = set.eq( index );2841 if ( isFunction ) {2842 args[0] = value.call( this, index, self.html() );2843 }2844 self.domManip( args, callback );2845 });2846 }2847 if ( l ) {2848 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );2849 first = fragment.firstChild;2850 if ( fragment.childNodes.length === 1 ) {2851 fragment = first;2852 }2853 if ( first ) {2854 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );2855 hasScripts = scripts.length;2856 // Use the original fragment for the last item instead of the first because it can end up2857 // being emptied incorrectly in certain situations (#8070).2858 for ( ; i < l; i++ ) {2859 node = fragment;2860 if ( i !== iNoClone ) {2861 node = jQuery.clone( node, true, true );2862 // Keep references to cloned scripts for later restoration2863 if ( hasScripts ) {2864 jQuery.merge( scripts, getAll( node, "script" ) );2865 }2866 }2867 callback.call( this[i], node, i );2868 }2869 if ( hasScripts ) {2870 doc = scripts[ scripts.length - 1 ].ownerDocument;2871 // Reenable scripts2872 jQuery.map( scripts, restoreScript );2873 // Evaluate executable scripts on first document insertion2874 for ( i = 0; i < hasScripts; i++ ) {2875 node = scripts[ i ];2876 if ( rscriptType.test( node.type || "" ) &&2877 !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {2878 if ( node.src ) {2879 // Optional AJAX dependency, but won't run scripts if not present2880 if ( jQuery._evalUrl ) {2881 jQuery._evalUrl( node.src );2882 }2883 } else {2884 jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );2885 }2886 }2887 }2888 }2889 // Fix #11809: Avoid leaking memory2890 fragment = first = null;2891 }2892 }2893 return this;2894 }2895});2896jQuery.each({2897 appendTo: "append",2898 prependTo: "prepend",2899 insertBefore: "before",2900 insertAfter: "after",2901 replaceAll: "replaceWith"2902}, function( name, original ) {2903 jQuery.fn[ name ] = function( selector ) {2904 var elems,2905 i = 0,2906 ret = [],2907 insert = jQuery( selector ),2908 last = insert.length - 1;2909 for ( ; i <= 0="" last;="" i++="" )="" {="" elems="i" =="=" last="" ?="" this="" :="" this.clone(true);="" jquery(="" insert[i]="" )[="" original="" ](="" );="" modern="" browsers="" can="" apply="" jquery="" collections="" as="" arrays,="" but="" oldie="" needs="" a="" .get()="" push.apply(="" ret,="" elems.get()="" }="" return="" this.pushstack(="" ret="" };="" });="" var="" iframe,="" elemdisplay="{};" **="" *="" retrieve="" the="" actual="" display="" of="" element="" @param="" {string}="" name="" nodename="" {object}="" doc="" document="" object="" called="" only="" from="" within="" defaultdisplay="" function="" actualdisplay(="" name,="" style,="" elem="jQuery(" doc.createelement(="" ).appendto(="" doc.body="" ),="" getdefaultcomputedstyle="" might="" be="" reliably="" used="" on="" attached="" &&="" (="" style="window.getDefaultComputedStyle(" elem[="" ]="" use="" method="" is="" temporary="" fix="" (more="" like="" optmization)="" until="" something="" better="" comes="" along,="" since="" it="" was="" removed="" specification="" and="" supported="" in="" ff="" style.display="" jquery.css(="" ],="" "display"="" we="" don't="" have="" any="" data="" stored="" element,="" so="" "detach"="" fast="" way="" to="" get="" rid="" elem.detach();="" display;="" try="" determine="" default value="" an="" defaultdisplay(="" ];="" if="" !display="" nodename,="" simple="" fails,="" read="" inside="" iframe="" "none"="" ||="" already-created="" possible="" "<iframe="" frameborder="0" width="0" height="0">" )).appendTo( doc.documentElement );2910 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse2911 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;2912 // Support: IE2913 doc.write();2914 doc.close();2915 display = actualDisplay( nodeName, doc );2916 iframe.detach();2917 }2918 // Store the correct default display2919 elemdisplay[ nodeName ] = display;2920 }2921 return display;2922}2923(function() {2924 var shrinkWrapBlocksVal;2925 support.shrinkWrapBlocks = function() {2926 if ( shrinkWrapBlocksVal != null ) {2927 return shrinkWrapBlocksVal;2928 }2929 // Will be changed later if needed.2930 shrinkWrapBlocksVal = false;2931 // Minified: var b,c,d2932 var div, body, container;2933 body = document.getElementsByTagName( "body" )[ 0 ];2934 if ( !body || !body.style ) {2935 // Test fired too early or in an unsupported environment, exit.2936 return;2937 }2938 // Setup2939 div = document.createElement( "div" );2940 container = document.createElement( "div" );2941 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";2942 body.appendChild( container ).appendChild( div );2943 // Support: IE62944 // Check if elements with layout shrink-wrap their children2945 if ( typeof div.style.zoom !== strundefined ) {2946 // Reset CSS: box-sizing; display; margin; border2947 div.style.cssText =2948 // Support: Firefox<29, 0="" 1="" 2="" 3="" 4="" 8="" 17="" 27="" 2007="" 13343="" android="" 2.3="" vendor-prefix="" box-sizing="" "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;"="" +="" "box-sizing:content-box;display:block;margin:0;border:0;"="" "padding:1px;width:1px;zoom:1";="" div.appendchild(="" document.createelement(="" "div"="" )="" ).style.width="5px" ;="" shrinkwrapblocksval="div.offsetWidth" !="=" 3;="" }="" body.removechild(="" container="" );="" return="" shrinkwrapblocksval;="" };="" })();="" var="" rmargin="(/^margin/);" rnumnonpx="new" regexp(="" "^("="" pnum="" ")(?!px)[a-z%]+$",="" "i"="" getstyles,="" curcss,="" rposition="/^(top|right|bottom|left)$/;" if="" (="" window.getcomputedstyle="" {="" getstyles="function(" elem="" elem.ownerdocument.defaultview.getcomputedstyle(="" elem,="" null="" curcss="function(" name,="" computed="" width,="" minwidth,="" maxwidth,="" ret,="" style="elem.style;" ||="" getstyles(="" getpropertyvalue="" is="" only="" needed="" for="" .css('filter')="" in="" ie9,="" see="" #12537="" ret="computed" ?="" computed.getpropertyvalue(="" name="" computed[="" ]="" :="" undefined;="" ""="" &&="" !jquery.contains(="" elem.ownerdocument,="" a="" tribute="" to="" the="" "awesome="" hack="" by="" dean="" edwards"="" chrome="" <="" and="" safari="" 5.0="" uses="" "computed="" value"="" instead="" of="" "used="" margin-right="" 5.1.7="" (at="" least)="" returns="" percentage="" larger="" set="" values,="" but="" width="" seems="" be="" reliably="" pixels="" this="" against="" cssom="" draft="" spec:="" http:="" dev.w3.org="" csswg="" #resolved-values="" rnumnonpx.test(="" rmargin.test(="" remember="" original="" values="" minwidth="style.minWidth;" maxwidth="style.maxWidth;" put="" new="" get="" value="" out="" style.minwidth="style.maxWidth" =="" style.width="ret;" revert="" changed="" style.maxwidth="maxWidth;" support:="" ie="" zindex="" as="" an="" integer.="" undefined="" "";="" else="" document.documentelement.currentstyle="" elem.currentstyle;="" left,="" rs,="" rsleft,="" avoid="" setting="" empty="" string="" here="" so="" we="" don't="" default auto="" style[="" ];="" from="" awesome="" edwards="" erik.eae.net="" archives="" 07="" 18.54.15="" #comment-102291="" we're="" not="" dealing="" with="" regular="" pixel="" number="" that="" has="" weird="" ending,="" need="" convert="" it="" position="" css="" attributes,="" those="" are="" proportional="" parent="" element="" can't="" measure="" because="" might="" trigger="" "stacking="" dolls"="" problem="" !rposition.test(="" left="style.left;" rs="elem.runtimeStyle;" rsleft="rs" rs.left;="" rs.left="elem.currentStyle.left;" style.left="name" "fontsize"="" "1em"="" ret;="" "px";="" "auto";="" function="" addgethookif(="" conditionfn,="" hookfn="" define="" hook,="" we'll="" check="" on="" first="" run="" it's="" really="" needed.="" get:="" function()="" condition="conditionFn();" test="" was="" ready="" at="" point;="" screw="" hook="" time="" again="" when="" next="" time.="" return;="" (or="" possible="" use="" due="" missing="" dependency),="" remove="" it.="" since="" there="" no="" other="" hooks="" marginright,="" whole="" object.="" delete="" this.get;="" needed;="" redefine="" support="" executed="" again.="" (this.get="hookFn).apply(" this,="" arguments="" (function()="" minified:="" b,c,d,e,f,g,="" h,i="" div,="" style,="" a,="" pixelpositionval,="" boxsizingreliableval,="" reliablehiddenoffsetsval,="" reliablemarginrightval;="" setup="" div="document.createElement(" div.innerhtml=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>" "a"="" )[="" a.style;="" finish="" early="" limited="" (non-browser)="" environments="" !style="" style.csstext="float:left;opacity:.5" ie<9="" make="" sure="" opacity="" exists="" (as="" opposed="" filter)="" support.opacity="style.opacity" "0.5";="" verify="" float="" existence="" (ie="" stylefloat="" cssfloat)="" support.cssfloat="!!style.cssFloat;" div.style.backgroundclip="content-box" div.clonenode(="" true="" ).style.backgroundclip="" support.clearclonestyle="div.style.backgroundClip" "content-box";="" firefox<29,="" support.boxsizing="style.boxSizing" style.mozboxsizing="==" style.webkitboxsizing="==" jquery.extend(support,="" reliablehiddenoffsets:="" reliablehiddenoffsetsval="=" computestyletests();="" reliablehiddenoffsetsval;="" },="" boxsizingreliable:="" boxsizingreliableval="=" boxsizingreliableval;="" pixelposition:="" pixelpositionval="=" pixelpositionval;="" reliablemarginright:="" reliablemarginrightval="=" });="" computestyletests()="" b,c,d,j="" body,="" container,="" contents;="" body="document.getElementsByTagName(" "body"="" !body="" !body.style="" fired="" too="" or="" unsupported="" environment,="" exit.="" container.style.csstext="position:absolute;border:0;width:0;height:0;top:0;left:-9999px" body.appendchild(="" ).appendchild(="" div.style.csstext="//" "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;"="" "box-sizing:border-box;display:block;margin-top:1%;top:1%;"="" "border:1px;padding:1px;width:4px;position:absolute";="" assume="" reasonable="" absence="" getcomputedstyle="" false;="" code="" ie<9.="" window.getcomputedstyle(="" {}="" ).top="" "1%";="" width:="" "4px"="" ).width="==" "4px";="" explicit="" incorrectly="" gets="" based="" (#3333)="" webkit="" bug="" -="" wrong="" contents="div.appendChild(" reset="" css:="" box-sizing;="" display;="" margin;="" border;="" padding="" contents.style.csstext="div.style.cssText" "box-sizing:content-box;display:block;margin:0;border:0;padding:0";="" contents.style.marginright="contents.style.width" "0";="" div.style.width="1px" contents,="" ).marginright="" ie8="" table="" cells="" still="" have="" offsetwidth="" height="" they="" display:none="" visible="" row;="" so,="" reliable="" determining="" been="" hidden directly="" using="" (it="" safe="" offsets="" hidden;="" don="" safety="" goggles="" #4512="" more="" information).="" "td"="" contents[="" ].style.csstext="margin:0;border:0;padding:0;display:none" ].offsetheight="==" 0;="" ].style.display="" method="" quickly="" swapping="" properties="" correct="" calculations.="" jquery.swap="function(" options,="" callback,="" args="" old="{};" insert="" ones="" options="" old[="" elem.style[="" []="" ralpha="/alpha\([^)]*\)/i," ropacity="/opacity\s*=\s*([^)]*)/," swappable="" display="" none="" starts="" except="" "table",="" "table-cell",="" "table-caption"="" values:="" https:="" developer.mozilla.org="" en-us="" docs="" rdisplayswap="/^(none|table(?!-c[ea]).+)/," rnumsplit="new" ")(.*)$",="" ),="" rrelnum="new" "^([+-])="("" ")",="" cssshow="{" position:="" "absolute",="" visibility:="" "hidden",="" display:="" "block"="" cssnormaltransform="{" letterspacing:="" "0",="" fontweight:="" "400"="" cssprefixes="[" "webkit",="" "o",="" "moz",="" "ms"="" property="" mapped="" potentially="" vendor="" prefixed="" vendorpropname(="" shortcut="" names="" name;="" capname="name.charAt(0).toUpperCase()" name.slice(1),="" origname="name," i="cssPrefixes.length;" while="" i--="" capname;="" origname;="" showhide(="" elements,="" show="" display,="" hidden,="" index="0," length="elements.length;" length;="" index++="" !elem.style="" continue;="" values[="" "olddisplay"="" inline="" learn="" being="" cascaded="" rules="" !values[="" "none"="" elem.style.display="" elements="" which="" overridden="" stylesheet="" whatever="" browser="" such="" ishidden(="" "olddisplay",="" defaultdisplay(elem.nodename)="" !hidden="" jquery._data(="" jquery.css(="" "display"="" most="" second="" loop constant="" reflow="" !show="" "none";="" elements;="" setpositivenumber(="" value,="" subtract="" matches="rnumsplit.exec(" guard="" "subtract",="" e.g.,="" used="" csshooks="" math.max(="" 0,="" matches[="" "px"="" value;="" augmentwidthorheight(="" extra,="" isborderbox,="" styles="" isborderbox="" "border"="" "content"="" already="" right="" measurement,="" augmentation="" otherwise="" initialize="" horizontal="" vertical="" "width"="" val="0;" 4;="" both="" box="" models="" exclude="" margin,="" add="" want="" extra="==" "margin"="" cssexpand[="" ],="" true,="" border-box="" includes="" padding,="" content="" "padding"="" point,="" isn't="" border="" nor="" "width",="" content,="" val;="" getwidthorheight(="" start="" offset="" property,="" equivalent="" valueisborderbox="true," elem.offsetwidth="" elem.offsetheight,="" "boxsizing",="" false,="" "border-box";="" some="" non-html="" offsetwidth,="" svg="" bugzilla.mozilla.org="" show_bug.cgi?id="649285" mathml="" fall="" back="" then="" uncomputed="" necessary="" unit="" pixels.="" stop="" return.="" rnumnonpx.test(val)="" case="" unreliable="" silently="" falls="" elem.style="" support.boxsizingreliable()="" normalize="" "",="" auto,="" prepare="" active="" model="" irrelevant="" valueisborderbox,="" jquery.extend({="" overriding="" behavior="" getting="" csshooks:="" opacity:="" function(="" should="" always="" "opacity"="" "1"="" automatically="" these="" possibly-unitless="" cssnumber:="" "columncount":="" "fillopacity":="" "flexgrow":="" "flexshrink":="" "fontweight":="" "lineheight":="" "opacity":="" "order":="" "orphans":="" "widows":="" "zindex":="" "zoom":="" whose="" you="" wish="" fix="" before="" cssprops:="" "float":="" "cssfloat"="" "stylefloat"="" dom="" node="" style:="" text="" comment="" nodes="" !elem="" elem.nodetype="==" working="" type,="" hooks,="" jquery.cssprops[="" version="" followed="" unprefixed="" jquery.csshooks[="" type="typeof" relative="" strings="" (+="or" numbers.="" #7345="" "string"="" (ret="rrelNum.exec(" ))="" ret[1]="" *="" ret[2]="" parsefloat(="" fixes="" #9237="" nan="" aren't="" set.="" see:="" #7116="" passed="" in,="" 'px'="" (except="" certain="" properties)="" "number"="" !jquery.cssnumber[="" #8908,="" can="" done="" correctly="" specifing="" setters="" csshooks,="" would="" mean="" eight="" (for="" every="" problematic="" property)="" identical="" functions="" !support.clearclonestyle="" name.indexof("background")="==" provided,="" just="" specified="" !hooks="" !("set"="" hooks)="" (value="hooks.set(" swallow="" errors="" 'invalid'="" (#5509)="" try="" catch(e)="" provided="" non-computed="" "get"="" object="" num,="" val,="" elem.style,="" otherwise,="" way="" exists,="" "normal"="" return,="" converting="" forced="" qualifier="" looks="" numeric="" num="parseFloat(" jquery.isnumeric(="" jquery.each([="" "height",="" i,="" computed,="" dimension="" info="" invisibly="" them="" however,="" must="" current="" benefit="" rdisplayswap.test(="" jquery.swap(="" cssshow,="" })="" set:="" "border-box",="" !support.opacity="" jquery.csshooks.opacity="{" filters="" ropacity.test(="" (computed="" elem.currentstyle="" elem.currentstyle.filter="" elem.style.filter)="" 0.01="" regexp.$1="" currentstyle="elem.currentStyle," "alpha(opacity=" + value * 100 + " )"="" filter="currentStyle" currentstyle.filter="" style.filter="" trouble="" does="" layout="" force="" zoom="" level="" style.zoom="1;" 1,="" exist="" attempt="" attribute="" #6652="" #12685="">= 1 || value === "" ) &&2949 jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&2950 style.removeAttribute ) {2951 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText2952 // if "filter:" is present at all, clearType is disabled, we want to avoid this2953 // style.removeAttribute is IE Only, but so apparently is this code path...2954 style.removeAttribute( "filter" );2955 // if there is no filter style applied in a css rule or unset inline opacity, we are done2956 if ( value === "" || currentStyle && !currentStyle.filter ) {2957 return;2958 }2959 }2960 // otherwise, set new filter values2961 style.filter = ralpha.test( filter ) ?2962 filter.replace( ralpha, opacity ) :2963 filter + " " + opacity;2964 }2965 };2966}2967jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,2968 function( elem, computed ) {2969 if ( computed ) {2970 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right2971 // Work around by temporarily setting element display to inline-block2972 return jQuery.swap( elem, { "display": "inline-block" },2973 curCSS, [ elem, "marginRight" ] );2974 }2975 }2976);2977// These hooks are used by animate to expand properties2978jQuery.each({2979 margin: "",2980 padding: "",2981 border: "Width"2982}, function( prefix, suffix ) {2983 jQuery.cssHooks[ prefix + suffix ] = {2984 expand: function( value ) {2985 var i = 0,2986 expanded = {},2987 // assumes a single number if not a string2988 parts = typeof value === "string" ? value.split(" ") : [ value ];2989 for ( ; i < 4; i++ ) {2990 expanded[ prefix + cssExpand[ i ] + suffix ] =2991 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];2992 }2993 return expanded;2994 }2995 };2996 if ( !rmargin.test( prefix ) ) {2997 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;2998 }2999});3000jQuery.fn.extend({3001 css: function( name, value ) {3002 return access( this, function( elem, name, value ) {3003 var styles, len,3004 map = {},3005 i = 0;3006 if ( jQuery.isArray( name ) ) {3007 styles = getStyles( elem );3008 len = name.length;3009 for ( ; i < len; i++ ) {3010 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );3011 }3012 return map;3013 }3014 return value !== undefined ?3015 jQuery.style( elem, name, value ) :3016 jQuery.css( elem, name );3017 }, name, value, arguments.length > 1 );3018 },3019 show: function() {3020 return showHide( this, true );3021 },3022 hide: function() {3023 return showHide( this );3024 },3025 toggle: function( state ) {3026 if ( typeof state === "boolean" ) {3027 return state ? this.show() : this.hide();3028 }3029 return this.each(function() {3030 if ( isHidden( this ) ) {3031 jQuery( this ).show();3032 } else {3033 jQuery( this ).hide();3034 }3035 });3036 }3037});3038function Tween( elem, options, prop, end, easing ) {3039 return new Tween.prototype.init( elem, options, prop, end, easing );3040}3041jQuery.Tween = Tween;3042Tween.prototype = {3043 constructor: Tween,3044 init: function( elem, options, prop, end, easing, unit ) {3045 this.elem = elem;3046 this.prop = prop;3047 this.easing = easing || "swing";3048 this.options = options;3049 this.start = this.now = this.cur();3050 this.end = end;3051 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );3052 },3053 cur: function() {3054 var hooks = Tween.propHooks[ this.prop ];3055 return hooks && hooks.get ?3056 hooks.get( this ) :3057 Tween.propHooks._default.get( this );3058 },3059 run: function( percent ) {3060 var eased,3061 hooks = Tween.propHooks[ this.prop ];3062 if ( this.options.duration ) {3063 this.pos = eased = jQuery.easing[ this.easing ](3064 percent, this.options.duration * percent, 0, 1, this.options.duration3065 );3066 } else {3067 this.pos = eased = percent;3068 }3069 this.now = ( this.end - this.start ) * eased + this.start;3070 if ( this.options.step ) {3071 this.options.step.call( this.elem, this.now, this );3072 }3073 if ( hooks && hooks.set ) {3074 hooks.set( this );3075 } else {3076 Tween.propHooks._default.set( this );3077 }3078 return this;3079 }3080};3081Tween.prototype.init.prototype = Tween.prototype;3082Tween.propHooks = {3083 _default: {3084 get: function( tween ) {3085 var result;3086 if ( tween.elem[ tween.prop ] != null &&3087 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {3088 return tween.elem[ tween.prop ];3089 }3090 // passing an empty string as a 3rd parameter to .css will automatically3091 // attempt a parseFloat and fallback to a string if the parse fails3092 // so, simple values such as "10px" are parsed to Float.3093 // complex values such as "rotate(1rad)" are returned as is.3094 result = jQuery.css( tween.elem, tween.prop, "" );3095 // Empty strings, null, undefined and "auto" are converted to 0.3096 return !result || result === "auto" ? 0 : result;3097 },3098 set: function( tween ) {3099 // use step hook for back compat - use cssHook if its there - use .style if its3100 // available and use plain properties where available3101 if ( jQuery.fx.step[ tween.prop ] ) {3102 jQuery.fx.step[ tween.prop ]( tween );3103 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {3104 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );3105 } else {3106 tween.elem[ tween.prop ] = tween.now;3107 }3108 }3109 }3110};3111// Support: IE <=9 0="" 1="" 2="" 3="" 4="" panic="" based="" approach="" to="" setting="" things="" on="" disconnected="" nodes="" tween.prophooks.scrolltop="Tween.propHooks.scrollLeft" =="" {="" set:="" function(="" tween="" )="" if="" (="" tween.elem.nodetype="" &&="" tween.elem.parentnode="" tween.elem[="" tween.prop="" ]="tween.now;" }="" };="" jquery.easing="{" linear:="" p="" return="" p;="" },="" swing:="" 0.5="" -="" math.cos(="" *="" math.pi="" 2;="" jquery.fx="Tween.prototype.init;" back="" compat="" <1.8="" extension="" point="" jquery.fx.step="{};" var="" fxnow,="" timerid,="" rfxtypes="/^(?:toggle|show|hide)$/," rfxnum="new" regexp(="" "^(?:([+-])="|)("" +="" pnum="" ")([a-z%]*)$",="" "i"="" ),="" rrun="/queueHooks$/," animationprefilters="[" defaultprefilter="" ],="" tweeners="{" "*":="" [="" prop,="" value="" target="tween.cur()," parts="rfxnum.exec(" unit="parts" parts[="" ||="" jquery.cssnumber[="" prop="" ?="" ""="" :="" "px"="" starting="" computation="" is="" required for="" potential="" mismatches="" start="(" !="=" +target="" rfxnum.exec(="" jquery.css(="" tween.elem,="" scale="1," maxiterations="20;" start[="" trust="" units="" reported="" by="" jquery.css="" ];="" make="" sure="" we="" update="" the="" properties="" later="" [];="" iteratively="" approximate="" from="" a="" nonzero="" 1;="" do="" previous="" iteration="" zeroed="" out,="" double="" until="" get="" *something*="" use="" string="" doubling="" factor="" so="" don't="" accidentally="" see="" as="" unchanged="" below="" ".5";="" adjust="" and="" apply="" scale;="" jquery.style(="" );="" scale,="" tolerating="" zero="" or="" nan="" tween.cur()="" breaking="" loop perfect,="" we've="" just="" had="" enough="" while="" (scale="tween.cur()" target)="" --maxiterations="" +start="" 0;="" tween.unit="unit;" token="" was="" provided,="" we're="" doing="" relative="" animation="" tween.end="parts[" +parts[="" tween;="" animations="" created="" synchronously="" will="" run="" function="" createfxnow()="" settimeout(function()="" fxnow="undefined;" });="" generate="" parameters="" create="" standard="" genfx(="" type,="" includewidth="" which,="" attrs="{" height:="" type="" i="0;" include="" width,="" step="" all="" cssexpand="" values,="" skip="" over="" left="" right="" ;="" <="" which="cssExpand[" attrs[="" "margin"="" "padding"="" attrs.opacity="attrs.width" type;="" attrs;="" createtween(="" value,="" tween,="" collection="(" tweeners[="" []="" ).concat(="" "*"="" index="0," length="collection.length;" length;="" index++="" (tween="collection[" ].call(="" animation,="" ))="" done="" with="" this="" property="" defaultprefilter(="" elem,="" props,="" opts="" jshint="" validthis:="" true="" toggle,="" hooks,="" oldfire,="" display,="" checkdisplay,="" anim="this," orig="{}," style="elem.style," hidden="elem.nodeType" ishidden(="" elem="" datashow="jQuery._data(" "fxshow"="" handle="" queue:="" false="" promises="" !opts.queue="" hooks="jQuery._queueHooks(" "fx"="" hooks.unqueued="=" null="" oldfire="hooks.empty.fire;" hooks.empty.fire="function()" !hooks.unqueued="" oldfire();="" hooks.unqueued++;="" anim.always(function()="" makes="" that="" complete="" handler="" be="" called="" before="" completes="" hooks.unqueued--;="" !jquery.queue(="" ).length="" hooks.empty.fire();="" height="" width="" overflow="" pass="" elem.nodetype="==" "height"="" in="" props="" "width"="" nothing="" sneaks="" out="" record="" attributes="" because="" ie="" does="" not="" change="" attribute="" when="" overflowx="" overflowy="" are="" set="" same="" opts.overflow="[" style.overflow,="" style.overflowx,="" style.overflowy="" display="" inline-block="" inline="" elements="" having="" animated="" "display"="" test="" default currently="" "none"="" checkdisplay="display" jquery._data(="" "olddisplay"="" defaultdisplay(="" elem.nodename="" display;="" "inline"="" "float"="" inline-level="" accept="" inline-block;="" block-level="" need="" layout="" !support.inlineblockneedslayout="" style.display="inline-block" else="" style.zoom="1;" style.overflow="hidden" !support.shrinkwrapblocks()="" style.overflowx="opts.overflow[" show="" hide="" rfxtypes.exec(="" delete="" props[="" toggle="toggle" "toggle";="" "hide"="" "show"="" there="" stopped="" going="" proceed="" show,="" should="" pretend="" datashow[="" undefined="" continue;="" orig[="" any="" non-fx="" stops="" us="" restoring="" original="" !jquery.isemptyobject(="" "hidden"="" "fxshow",="" {}="" store="" state="" its="" enables="" .stop().toggle()="" "reverse"="" datashow.hidden="!hidden;" jquery(="" ).show();="" anim.done(function()="" ).hide();="" prop;="" jquery._removedata(="" 0,="" !(="" tween.start="prop" noop="" like="" .hide().hide(),="" restore="" an="" overwritten="" (display="==" display)="==" propfilter(="" specialeasing="" index,="" name,="" easing,="" hooks;="" camelcase,="" expand="" csshook="" name="jQuery.camelCase(" easing="specialEasing[" jquery.isarray(="" "expand"="" quite="" $.extend,="" wont="" overwrite="" keys="" already="" present.="" also="" reusing="" 'index'="" above="" have="" correct="" "name"="" specialeasing[="" animation(="" properties,="" options="" result,="" stopped,="" deferred="jQuery.Deferred().always(" function()="" match="" :animated="" selector="" tick.elem;="" }),="" tick="function()" false;="" currenttime="fxNow" createfxnow(),="" remaining="Math.max(" animation.starttime="" animation.duration="" archaic="" crash="" bug="" won't="" allow="" (#12497)="" temp="remaining" percent="1" temp,="" animation.tweens[="" ].run(="" deferred.notifywith(="" percent,="" ]);="" remaining;="" deferred.resolvewith(="" elem:="" props:="" jquery.extend(="" {},="" opts:="" true,="" specialeasing:="" originalproperties:="" originaloptions:="" options,="" starttime:="" duration:="" options.duration,="" tweens:="" [],="" createtween:="" end="" animation.opts,="" end,="" animation.opts.specialeasing[="" animation.opts.easing="" animation.tweens.push(="" stop:="" gotoend="" want="" tweens="" otherwise="" part="" animation.tweens.length="" this;="" resolve="" played="" last="" frame="" otherwise,="" reject="" deferred.rejectwith(="" animation.opts.specialeasing="" result="animationPrefilters[" animation.opts="" result;="" jquery.map(="" createtween,="" jquery.isfunction(="" animation.opts.start="" animation.opts.start.call(="" jquery.fx.timer(="" tick,="" anim:="" animation.opts.queue="" })="" attach="" callbacks="" animation.progress(="" animation.opts.progress="" .done(="" animation.opts.done,="" animation.opts.complete="" .fail(="" animation.opts.fail="" .always(="" animation.opts.always="" jquery.animation="jQuery.extend(" tweener:="" callback="" ");="" ].unshift(="" prefilter:="" callback,="" prepend="" animationprefilters.unshift(="" animationprefilters.push(="" jquery.speed="function(" speed,="" fn="" opt="speed" typeof="" speed="==" "object"="" complete:="" !fn="" easing:="" !jquery.isfunction(="" opt.duration="jQuery.fx.off" "number"="" jquery.fx.speeds="" jquery.fx.speeds[="" jquery.fx.speeds._default;="" normalize="" opt.queue=""> "fx"3112 if ( opt.queue == null || opt.queue === true ) {3113 opt.queue = "fx";3114 }3115 // Queueing3116 opt.old = opt.complete;3117 opt.complete = function() {3118 if ( jQuery.isFunction( opt.old ) ) {3119 opt.old.call( this );3120 }3121 if ( opt.queue ) {3122 jQuery.dequeue( this, opt.queue );3123 }3124 };3125 return opt;3126};3127jQuery.fn.extend({3128 fadeTo: function( speed, to, easing, callback ) {3129 // show any hidden elements after setting opacity to 03130 return this.filter( isHidden ).css( "opacity", 0 ).show()3131 // animate to the value specified3132 .end().animate({ opacity: to }, speed, easing, callback );3133 },3134 animate: function( prop, speed, easing, callback ) {3135 var empty = jQuery.isEmptyObject( prop ),3136 optall = jQuery.speed( speed, easing, callback ),3137 doAnimation = function() {3138 // Operate on a copy of prop so per-property easing won't be lost3139 var anim = Animation( this, jQuery.extend( {}, prop ), optall );3140 // Empty animations, or finishing resolves immediately3141 if ( empty || jQuery._data( this, "finish" ) ) {3142 anim.stop( true );3143 }3144 };3145 doAnimation.finish = doAnimation;3146 return empty || optall.queue === false ?3147 this.each( doAnimation ) :3148 this.queue( optall.queue, doAnimation );3149 },3150 stop: function( type, clearQueue, gotoEnd ) {3151 var stopQueue = function( hooks ) {3152 var stop = hooks.stop;3153 delete hooks.stop;3154 stop( gotoEnd );3155 };3156 if ( typeof type !== "string" ) {3157 gotoEnd = clearQueue;3158 clearQueue = type;3159 type = undefined;3160 }3161 if ( clearQueue && type !== false ) {3162 this.queue( type || "fx", [] );3163 }3164 return this.each(function() {3165 var dequeue = true,3166 index = type != null && type + "queueHooks",3167 timers = jQuery.timers,3168 data = jQuery._data( this );3169 if ( index ) {3170 if ( data[ index ] && data[ index ].stop ) {3171 stopQueue( data[ index ] );3172 }3173 } else {3174 for ( index in data ) {3175 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {3176 stopQueue( data[ index ] );3177 }3178 }3179 }3180 for ( index = timers.length; index--; ) {3181 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {3182 timers[ index ].anim.stop( gotoEnd );3183 dequeue = false;3184 timers.splice( index, 1 );3185 }3186 }3187 // start the next in the queue if the last step wasn't forced3188 // timers currently will call their complete callbacks, which will dequeue3189 // but only if they were gotoEnd3190 if ( dequeue || !gotoEnd ) {3191 jQuery.dequeue( this, type );3192 }3193 });3194 },3195 finish: function( type ) {3196 if ( type !== false ) {3197 type = type || "fx";3198 }3199 return this.each(function() {3200 var index,3201 data = jQuery._data( this ),3202 queue = data[ type + "queue" ],3203 hooks = data[ type + "queueHooks" ],3204 timers = jQuery.timers,3205 length = queue ? queue.length : 0;3206 // enable finishing flag on private data3207 data.finish = true;3208 // empty the queue first3209 jQuery.queue( this, type, [] );3210 if ( hooks && hooks.stop ) {3211 hooks.stop.call( this, true );3212 }3213 // look for any active animations, and finish them3214 for ( index = timers.length; index--; ) {3215 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {3216 timers[ index ].anim.stop( true );3217 timers.splice( index, 1 );3218 }3219 }3220 // look for any animations in the old queue and finish them3221 for ( index = 0; index < length; index++ ) {3222 if ( queue[ index ] && queue[ index ].finish ) {3223 queue[ index ].finish.call( this );3224 }3225 }3226 // turn off finishing flag3227 delete data.finish;3228 });3229 }3230});3231jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {3232 var cssFn = jQuery.fn[ name ];3233 jQuery.fn[ name ] = function( speed, easing, callback ) {3234 return speed == null || typeof speed === "boolean" ?3235 cssFn.apply( this, arguments ) :3236 this.animate( genFx( name, true ), speed, easing, callback );3237 };3238});3239// Generate shortcuts for custom animations3240jQuery.each({3241 slideDown: genFx("show"),3242 slideUp: genFx("hide"),3243 slideToggle: genFx("toggle"),3244 fadeIn: { opacity: "show" },3245 fadeOut: { opacity: "hide" },3246 fadeToggle: { opacity: "toggle" }3247}, function( name, props ) {3248 jQuery.fn[ name ] = function( speed, easing, callback ) {3249 return this.animate( props, speed, easing, callback );3250 };3251});3252jQuery.timers = [];3253jQuery.fx.tick = function() {3254 var timer,3255 timers = jQuery.timers,3256 i = 0;3257 fxNow = jQuery.now();3258 for ( ; i < timers.length; i++ ) {3259 timer = timers[ i ];3260 // Checks the timer has not already been removed3261 if ( !timer() && timers[ i ] === timer ) {3262 timers.splice( i--, 1 );3263 }3264 }3265 if ( !timers.length ) {3266 jQuery.fx.stop();3267 }3268 fxNow = undefined;3269};3270jQuery.fx.timer = function( timer ) {3271 jQuery.timers.push( timer );3272 if ( timer() ) {3273 jQuery.fx.start();3274 } else {3275 jQuery.timers.pop();3276 }3277};3278jQuery.fx.interval = 13;3279jQuery.fx.start = function() {3280 if ( !timerId ) {3281 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );3282 }3283};3284jQuery.fx.stop = function() {3285 clearInterval( timerId );3286 timerId = null;3287};3288jQuery.fx.speeds = {3289 slow: 600,3290 fast: 200,3291 // Default speed3292 _default: 4003293};3294// Based off of the plugin by Clint Helfers, with permission.3295// http://blindsignals.com/index.php/2009/07/jquery-delay/3296jQuery.fn.delay = function( time, type ) {3297 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;3298 type = type || "fx";3299 return this.queue( type, function( next, hooks ) {3300 var timeout = setTimeout( next, time );3301 hooks.stop = function() {3302 clearTimeout( timeout );3303 };3304 });3305};3306(function() {3307 // Minified: var a,b,c,d,e3308 var input, div, select, a, opt;3309 // Setup3310 div = document.createElement( "div" );3311 div.setAttribute( "className", "t" );3312 div.innerHTML = " <link><table></table><a href="/a">a</a><input type="checkbox">";3313 a = div.getElementsByTagName("a")[ 0 ];3314 // First batch of tests.3315 select = document.createElement("select");3316 opt = select.appendChild( document.createElement("option") );3317 input = div.getElementsByTagName("input")[ 0 ];3318 a.style.cssText = "top:1px";3319 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)3320 support.getSetAttribute = div.className !== "t";3321 // Get the style information from getAttribute3322 // (IE uses .cssText instead)3323 support.style = /top/.test( a.getAttribute("style") );3324 // Make sure that URLs aren't manipulated3325 // (IE normalizes it by default)3326 support.hrefNormalized = a.getAttribute("href") === "/a";3327 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)3328 support.checkOn = !!input.value;3329 // Make sure that a selected-by-default option has a working selected property.3330 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)3331 support.optSelected = opt.selected;3332 // Tests for enctype support on a form (#6743)3333 support.enctype = !!document.createElement("form").enctype;3334 // Make sure that the options inside disabled selects aren't marked as disabled3335 // (WebKit marks them as disabled)3336 select.disabled = true;3337 support.optDisabled = !opt.disabled;3338 // Support: IE8 only3339 // Check if we can trust getAttribute("value")3340 input = document.createElement( "input" );3341 input.setAttribute( "value", "" );3342 support.input = input.getAttribute( "value" ) === "";3343 // Check if an input maintains its value after becoming a radio3344 input.value = "t";3345 input.setAttribute( "type", "radio" );3346 support.radioValue = input.value === "t";3347})();3348var rreturn = /\r/g;3349jQuery.fn.extend({3350 val: function( value ) {3351 var hooks, ret, isFunction,3352 elem = this[0];3353 if ( !arguments.length ) {3354 if ( elem ) {3355 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];3356 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {3357 return ret;3358 }3359 ret = elem.value;3360 return typeof ret === "string" ?3361 // handle most common string cases3362 ret.replace(rreturn, "") :3363 // handle cases where value is null/undef or number3364 ret == null ? "" : ret;3365 }3366 return;3367 }3368 isFunction = jQuery.isFunction( value );3369 return this.each(function( i ) {3370 var val;3371 if ( this.nodeType !== 1 ) {3372 return;3373 }3374 if ( isFunction ) {3375 val = value.call( this, i, jQuery( this ).val() );3376 } else {3377 val = value;3378 }3379 // Treat null/undefined as ""; convert numbers to string3380 if ( val == null ) {3381 val = "";3382 } else if ( typeof val === "number" ) {3383 val += "";3384 } else if ( jQuery.isArray( val ) ) {3385 val = jQuery.map( val, function( value ) {3386 return value == null ? "" : value + "";3387 });3388 }3389 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];3390 // If set returns undefined, fall back to normal setting3391 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {3392 this.value = val;3393 }3394 });3395 }3396});3397jQuery.extend({3398 valHooks: {3399 option: {3400 get: function( elem ) {3401 var val = jQuery.find.attr( elem, "value" );3402 return val != null ?3403 val :3404 // Support: IE10-11+3405 // option.text throws exceptions (#14686, #14858)3406 jQuery.trim( jQuery.text( elem ) );3407 }3408 },3409 select: {3410 get: function( elem ) {3411 var value, option,3412 options = elem.options,3413 index = elem.selectedIndex,3414 one = elem.type === "select-one" || index < 0,3415 values = one ? null : [],3416 max = one ? index + 1 : options.length,3417 i = index < 0 ?3418 max :3419 one ? index : 0;3420 // Loop through all the selected options3421 for ( ; i < max; i++ ) {3422 option = options[ i ];3423 // oldIE doesn't update selected after form reset (#2551)3424 if ( ( option.selected || i === index ) &&3425 // Don't return options that are disabled or in a disabled optgroup3426 ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&3427 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {3428 // Get the specific value for the option3429 value = jQuery( option ).val();3430 // We don't need an array for one selects3431 if ( one ) {3432 return value;3433 }3434 // Multi-Selects return an array3435 values.push( value );3436 }3437 }3438 return values;3439 },3440 set: function( elem, value ) {3441 var optionSet, option,3442 options = elem.options,3443 values = jQuery.makeArray( value ),3444 i = options.length;3445 while ( i-- ) {3446 option = options[ i ];3447 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {3448 // Support: IE63449 // When new option element is added to select box we need to3450 // force reflow of newly added node in order to workaround delay3451 // of initialization properties3452 try {3453 option.selected = optionSet = true;3454 } catch ( _ ) {3455 // Will be executed only in IE63456 option.scrollHeight;3457 }3458 } else {3459 option.selected = false;3460 }3461 }3462 // Force browsers to behave consistently when non-matching value is set3463 if ( !optionSet ) {3464 elem.selectedIndex = -1;3465 }3466 return options;3467 }3468 }3469 }3470});3471// Radios and checkboxes getter/setter3472jQuery.each([ "radio", "checkbox" ], function() {3473 jQuery.valHooks[ this ] = {3474 set: function( elem, value ) {3475 if ( jQuery.isArray( value ) ) {3476 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );3477 }3478 }3479 };3480 if ( !support.checkOn ) {3481 jQuery.valHooks[ this ].get = function( elem ) {3482 // Support: Webkit3483 // "" is returned instead of "on" if a value isn't specified3484 return elem.getAttribute("value") === null ? "on" : elem.value;3485 };3486 }3487});3488var nodeHook, boolHook,3489 attrHandle = jQuery.expr.attrHandle,3490 ruseDefault = /^(?:checked|selected)$/i,3491 getSetAttribute = support.getSetAttribute,3492 getSetInput = support.input;3493jQuery.fn.extend({3494 attr: function( name, value ) {3495 return access( this, jQuery.attr, name, value, arguments.length > 1 );3496 },3497 removeAttr: function( name ) {3498 return this.each(function() {3499 jQuery.removeAttr( this, name );3500 });3501 }3502});3503jQuery.extend({3504 attr: function( elem, name, value ) {3505 var hooks, ret,3506 nType = elem.nodeType;3507 // don't get/set attributes on text, comment and attribute nodes3508 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {3509 return;3510 }3511 // Fallback to prop when attributes are not supported3512 if ( typeof elem.getAttribute === strundefined ) {3513 return jQuery.prop( elem, name, value );3514 }3515 // All attributes are lowercase3516 // Grab necessary hook if one is defined3517 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {3518 name = name.toLowerCase();3519 hooks = jQuery.attrHooks[ name ] ||3520 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );3521 }3522 if ( value !== undefined ) {3523 if ( value === null ) {3524 jQuery.removeAttr( elem, name );3525 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {3526 return ret;3527 } else {3528 elem.setAttribute( name, value + "" );3529 return value;3530 }3531 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {3532 return ret;3533 } else {3534 ret = jQuery.find.attr( elem, name );3535 // Non-existent attributes return null, we normalize to undefined3536 return ret == null ?3537 undefined :3538 ret;3539 }3540 },3541 removeAttr: function( elem, value ) {3542 var name, propName,3543 i = 0,3544 attrNames = value && value.match( rnotwhite );3545 if ( attrNames && elem.nodeType === 1 ) {3546 while ( (name = attrNames[i++]) ) {3547 propName = jQuery.propFix[ name ] || name;3548 // Boolean attributes get special treatment (#10870)3549 if ( jQuery.expr.match.bool.test( name ) ) {3550 // Set corresponding property to false3551 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {3552 elem[ propName ] = false;3553 // Support: IE<9 0="" 7="" also="" clear="" defaultchecked="" defaultselected="" (if="" appropriate)="" }="" else="" {="" elem[="" jquery.camelcase(="" "default-"="" +="" name="" )="" ]="elem[" propname="" see="" #9699="" for="" explanation="" of="" this="" approach="" (setting="" first,="" then="" removal)="" jquery.attr(="" elem,="" name,="" ""="" );="" elem.removeattribute(="" getsetattribute="" ?="" :="" },="" attrhooks:="" type:="" set:="" function(="" value="" if="" (="" !support.radiovalue="" &&="" "radio"="" jquery.nodename(elem,="" "input")="" setting="" the="" type="" on="" a="" radio="" button="" after="" resets="" in="" ie6-9="" reset="" to="" default case="" is="" set="" during="" creation="" var="" val="elem.value;" elem.setattribute(="" "type",="" elem.value="val;" return="" value;="" });="" hook="" boolean="" attributes="" boolhook="{" value,="" false="" remove="" when="" jquery.removeattr(="" getsetinput="" ||="" !rusedefault.test(="" ie<8="" needs="" *property*="" !getsetattribute="" jquery.propfix[="" use="" and="" oldie="" name;="" };="" retrieve="" booleans="" specially="" jquery.each(="" jquery.expr.match.bool.source.match(="" \w+="" g="" ),="" i,="" getter="attrHandle[" jquery.find.attr;="" attrhandle[="" isxml="" ret,="" handle;="" !isxml="" avoid="" an="" infinite="" loop by="" temporarily="" removing="" function="" from="" handle="attrHandle[" ];="" ret="getter(" !="null" name.tolowercase()="" null;="" ret;="" fix="" attroperties="" !getsetinput="" jquery.attrhooks.value="{" jquery.nodename(="" "input"="" does="" not="" so="" that="" setattribute="" used="" elem.defaultvalue="value;" nodehook="" defined="" (#1954);="" otherwise="" fine="" nodehook.set(="" ie6="" do="" support="" getting="" some="" with="" get="" any="" attribute="" fixes="" almost="" every="" issue="" existing="" or="" create="" new="" node="" !ret="" elem.setattributenode(="" (ret="elem.ownerDocument.createAttribute(" ))="" ret.value="value" ;="" break="" association="" cloned="" elements="" using="" (#9646)="" "value"="" elem.getattribute(="" are="" constructed="" empty-string="" values="" attrhandle.id="attrHandle.name" =="" attrhandle.coords="function(" fixing="" retrieval="" requires="" module="" jquery.valhooks.button="{" get:="" ret.specified="" ret.value;="" nodehook.set="" contenteditable="" removals(#10429)="" empty="" string="" throws="" error="" as="" invalid="" jquery.attrhooks.contenteditable="{" width="" height="" auto="" instead="" string(="" bug="" #8150="" removals="" jquery.each([="" "width",="" "height"="" ],="" jquery.attrhooks[="" "auto"="" !support.style="" jquery.attrhooks.style="{" elem="" undefined="" note:="" ie="" uppercases="" css="" property="" names,="" but="" we="" were="" .tolowercase()="" .csstext,="" would="" destroy="" senstitivity="" url's,="" like="" "background"="" elem.style.csstext="" undefined;="" rfocusable="/^(?:input|select|textarea|button|object)$/i," rclickable="/^(?:a|area)$/i;" jquery.fn.extend({="" prop:="" access(="" this,="" jquery.prop,="" arguments.length=""> 1 );3554 },3555 removeProp: function( name ) {3556 name = jQuery.propFix[ name ] || name;3557 return this.each(function() {3558 // try/catch handles cases where IE balks (such as removing a property on window)3559 try {3560 this[ name ] = undefined;3561 delete this[ name ];3562 } catch( e ) {}3563 });3564 }3565});3566jQuery.extend({3567 propFix: {3568 "for": "htmlFor",3569 "class": "className"3570 },3571 prop: function( elem, name, value ) {3572 var ret, hooks, notxml,3573 nType = elem.nodeType;3574 // don't get/set properties on text, comment and attribute nodes3575 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {3576 return;3577 }3578 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );3579 if ( notxml ) {3580 // Fix name and attach hooks3581 name = jQuery.propFix[ name ] || name;3582 hooks = jQuery.propHooks[ name ];3583 }3584 if ( value !== undefined ) {3585 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?3586 ret :3587 ( elem[ name ] = value );3588 } else {3589 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?3590 ret :3591 elem[ name ];3592 }3593 },3594 propHooks: {3595 tabIndex: {3596 get: function( elem ) {3597 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set3598 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/3599 // Use proper attribute retrieval(#12072)3600 var tabindex = jQuery.find.attr( elem, "tabindex" );3601 return tabindex ?3602 parseInt( tabindex, 10 ) :3603 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?3604 0 :3605 -1;3606 }3607 }3608 }3609});3610// Some attributes require a special call on IE3611// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx3612if ( !support.hrefNormalized ) {3613 // href/src property should get the full normalized URL (#10299/#12915)3614 jQuery.each([ "href", "src" ], function( i, name ) {...

Full Screen

Full Screen

SpecJsonProcessing.js

Source:SpecJsonProcessing.js Github

copy

Full Screen

1describe('Test Processing of Json files', function () {2 var $buildStatusIcon = null;3 var $downloadMenuButton = null;4 var $revisions = null;5 var $lastUpdated = null;6 var appendHtmlSet = null;7 var attrKeySet = null;8 var attrTextSet = null;9 var htmlSet = null;10 describe('Test processProjectJson()', function () {11 var commit = {12 created_at: "2017-06-26T20:57:42Z",13 ended_at: "2017-06-26T20:57:45Z",14 id: "39a099622d",15 started_at: "2017-06-26T20:57:43Z",16 status: "success",17 success: true18 };19 beforeEach(function () {20 $revisions = {21 append: jasmine.createSpy().and.callFake(mockJqueryAppend)22 };23 appendHtmlSet = null;24 });25 it('processProjectJson() valid object should update revisions', function () {26 // given27 var commitCount = 1;28 var project = generateProject(commitCount);29 var expectedCallCount = commitCount;30 // when31 processProjectJson(project, $revisions);32 // then33 validateRevision(expectedCallCount);34 });35 it('processProjectJson() valid object with 10 commits should update revisions + more', function () {36 // given37 var commitCount = 10;38 var project = generateProject(commitCount);39 var expectedCallCount = commitCount + 1;40 // when41 processProjectJson(project, $revisions);42 // then43 validateRevision(expectedCallCount);44 });45 //46 // helpers47 //48 function generateProject(commitCount) {49 var commits = [];50 for(var i = 0; i < commitCount; i++) {51 commits.push(commit);52 }53 var project = {54 commits: commits,55 repo: "ar_eph_text_ulb",56 repo_url: "https://https://content.bibletranslationtools.org/dummy/ar_eph_text_ulb",57 user: "dummy"58 };59 return project;60 }61 //62 // helpers63 //64 function validateRevision(expectedCallCount) {65 expect($revisions.append).toHaveBeenCalledTimes(expectedCallCount);66 validateString(appendHtmlSet, 5);67 }68 });69 describe('Test processBuildLogJson()', function () {70 var repo = "ar_eph_text_ulb";71 var user = "dummy_user";72 var build_log_base = {73 commit_id: "39a099622d",74 created_at: "2017-06-26T20:57:42Z",75 started_at: "2017-06-26T20:57:43Z",76 errors: [],77 message: "Conversion successful",78 repo_name: repo,79 repo_owner: user,80 source: "https://s3-us-west-2.amazonaws.com/test-tx-webhook-client/preconvert/39a099622d.zip",81 status: "success",82 success: true,83 warnings: []84 };85 beforeEach(function () {86 $revisions = {87 empty: jasmine.createSpy().and.returnValue(false)88 };89 spyOn(window, 'setDownloadButtonState').and.returnValue(false);90 spyOn(window, 'setOverallConversionStatus').and.returnValue(false);91 $downloadMenuButton = null;92 $buildStatusIcon = {93 find: jasmine.createSpy().and.callFake(mockJqueryFind),94 attr: jasmine.createSpy().and.callFake(mockJqueryAttr)95 };96 $lastUpdated = {97 html: jasmine.createSpy().and.callFake(mockJqueryHtml)98 };99 appendHtmlSet = null;100 attrKeySet = null;101 attrTextSet = null;102 htmlSet = null;103 myCommitId = null;104 myOwner = null;105 myRepoName = null;106 });107 it('processBuildLogJson() valid object should update screen status', function () {108 // given109 var build_log = build_log_base;110 // when111 processBuildLogJson(build_log, $downloadMenuButton, $buildStatusIcon, $lastUpdated, $revisions);112 // then113 validateBuildStatus();114 });115 it('processBuildLogJson() errors should update screen status', function () {116 // given117 var build_log = JSON.parse(JSON.stringify(build_log_base)); // clone118 build_log.errors = ["ERROR!"];119 // when120 processBuildLogJson(build_log, $downloadMenuButton, $buildStatusIcon, $lastUpdated, $revisions);121 // then122 validateBuildStatus();123 });124 it('processBuildLogJson() warnings should update screen status and ok click should work', function () {125 // given126 jasmine.getFixtures().fixturesPath = 'base/test/fixtures';127 loadFixtures('obs-project-page-fixture.html');128 $buildStatusIcon = $('#build-status-icon');129 spyOn($buildStatusIcon, 'attr').and.callFake(mockJqueryAttr);130 spyOn(window, 'showWarningModal').and.returnValue(false);131 var build_log = JSON.parse(JSON.stringify(build_log_base)); // clone132 build_log.warnings = ["warning"];133 // when134 processBuildLogJson(build_log, $downloadMenuButton, $buildStatusIcon, $lastUpdated, $revisions);135 $buildStatusIcon.trigger('click');136 // then137 validateBuildStatus();138 expect(window.showWarningModal).toHaveBeenCalled();139 $('#warning-modal').trigger('hidden.bs.modal'); // clear off screen140 });141 //142 // helpers143 //144 function validateBuildStatus() {145 expect(window.setDownloadButtonState).toHaveBeenCalled();146 expect(window.setOverallConversionStatus).toHaveBeenCalled();147 expect($buildStatusIcon.attr).toHaveBeenCalled();148 validateString(attrKeySet,3);149 validateString(attrTextSet,5);150 expect($lastUpdated.html).toHaveBeenCalled();151 validateString(htmlSet,5);152 expect($revisions.empty).toHaveBeenCalled();153 }154 });155 //156 // helpers157 //158 function mockJqueryAppend(html){159 appendHtmlSet = html;160 }161 function mockJqueryHtml(html){162 htmlSet = html;163 }164 function mockJqueryFind(text){165 return $buildStatusIcon;166 }167 function mockJqueryAttr(key, text){168 attrKeySet = key;169 attrTextSet = text;170 }171 function validateString(value, min_size) {172 expect(typeof(value)).toEqual('string');173 expect(value.length).toBeGreaterThanOrEqual(min_size);174 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('a').first().attr('href')2cy.get('a').first().find('href')3cy.get('a').first().find.attr('href')4cy.get('a').first().find.attr('href')5cy.get('a').first().find.attr('href')6cy.get('a').first().find.attr('href')7cy.get('a').first().find.attr('href')8cy.get('a').first().find.attr('href')9cy.get('a').first().find.attr('href')10cy.get('a').first().find.attr('href')

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('button').find('a').attr('href')2cy.get('button').find('a').prop('href')3cy.get('button').find('a').text()4cy.get('button').find('a').toggleClass('active')5cy.get('button').find('a').val()6cy.get('button').find('a').wrap('<div></div>')7cy.get('button').find('a').wrapAll('<div></div>')8cy.get('button').find('a').wrapInner('<div></div>')9cy.get('button').find('a').addBack()10cy.get('button').find('a').add('div')11cy.get('button').find('a').andSelf()12cy.get('button').find('a').contents()13cy.get('button').find('a').each(function($el, index, $list) {14})15cy.get('button').find('a').eq(1)16cy.get('button').find('a').filter(':visible')17cy.get('button').find('a').find('div')18cy.get('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('test', function() {2 it('test', function() {3 cy.get('a[href*="querying"]').invoke('attr', 'href').then(href => {4 cy.visit(href)5 })6 })7})8describe('test', function() {9 it('test', function() {10 cy.get('a[href*="querying"]').invoke('attr', 'href').then(href => {11 cy.visit(href)12 })13 })14})15describe('test', function() {16 it('test', function() {17 cy.get('a[href*="querying"]').invoke('attr', 'href').then(href => {18 cy.visit(href)19 })20 })21})

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful