How to use rscriptTypeMasked.exec 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中文版v1.9.1注释全翻译.js

Source:jQuery中文版v1.9.1注释全翻译.js Github

copy

Full Screen

1/*!2 * jquery javascript library v1.9.13 * http://jquery .com/4 *5 * includes sizzle.js6 * http://sizzlejs .com/7 *8 * copyright 2005, 2012 jquery foundation, inc. and other contributors9 * released under the mit license10 * http://jquery .org/license11 *12 * 日期: 2013年2月4日13 * 翻译:刘建(毕业院校:家里蹲大学低能班)14 * 联系邮箱:243376129@qq.com15 * 原文地址:http://www.makaidong.com/laonanren/archive/2013/02/14/2912145.html16 * 翻译上的不足之处,希望大家能告诉我,我会尽量修改,本人才疏学浅,文化程度不高,希望大家多多包涵,我会努力改正。17 */18(function( window, undefined ) {19//不要做这个因为各自的应用程序包括asp.net查找20// the stack via arguments.caller.callee and firefox dies if21//你尝试查找通过“精确使用”呼叫链接(#13335)22//支持:火狐浏览器 18+23//“精确使用”;24var25 //deferred对象被使用在dom(document object model翻译:文档对象模型)准备之时26 //deferred(延迟)对象:从jquery 1.5.0版本开始引入的一个新功能27 //在dom准备好时调用28 readylist,29 //一个中心引用对于jquery 根文档30 //对根jquery 对象的主要引用31 rootjquery ,32 //支持:ie9之前的版本33 // for `typeof node.method` instead of `node.method !== undefined`34 core_strundefined = typeof undefined,35 // use the correct document accordingly with window argument (sandbox)36 document = window.document,//window文档赋值给变量document37 location = window.location,38 // map over jquery in case of overwrite(不确定,待修正,希望高人帮忙翻译一下)39 //在jquery 上绘制写在上面的实例40 //防止被覆盖41 _jquery = window.jquery ,42 // map over the $ in case of overwrite43 _$ = window.$,44 //将window正则表达式符号$赋值给变量_$45 //[类]:成双类型46 class2type = {},47 //在贮存区被删除数据id的列表,我们能够再用他们48 core_deletedids = [],49 core_version = "1.9.1",50 //保存一个参考给一些核心的方法51 //为核心方法创建引用52 core_concat = core_deletedids.concat,53 core_push = core_deletedids.push,54 core_slice = core_deletedids.slice,55 core_indexof = core_deletedids.indexof,56 core_tostring = class2type.tostring,57 core_hasown = class2type.hasownproperty,58 core_trim = core_version.trim,59 //规定一个jquery 本地代码60 //构建jquery 对象61 jquery = function( selector, context ) {62 //jquery 对象是实际上初始化名为enhanced(提高的)构造器63 //jquery 对象实际上只是增强的初始化构造方法64 return new jquery .fn.init( selector, context, rootjquery );65 },66 /* 用来匹配数字的正则,匹配可选正负号、浮点型、整型、科学 计数法67 * 没有使用(?)来表示可选而是通过(|)来选择68 * (?:\d*\.|)匹配浮点数时,|前的\d*\.可以匹配整数部分和小数点,小数部分由后面的\d+匹配69 * 匹配整数时,|)可以保证匹配继续向下进行,整数由后面的\d+匹配,同样的\d+在匹配整型和浮点型时负责的匹配部分不同70 * [ee][\-+]?\d+|)处理科学 计数法的匹配,同样没有使用?表示可选71 */72 core_pnum = /[+-]?(?:\d*\.|)\d+(?:[ee][+-]?\d+|)/.source,73 //用于分开空格74 core_rnotwhite = /\s+/g,75 //查找非空白字符串76 // make sure we trim bom and nbsp (here's looking at you, safari 5.0 and ie)77 rtrim = /^[\s\ufeff\xa0]+|[\s\ufeff\xa0]+$/g,78 //\ufeff:字节顺序标志79 //一个简单途径用于检查html字符串80 // prioritize #id over <tag> to avoid xss via location.hash (#9521)81 // strict html recognition (#11290: must start with <)82 rquickexpr = /^(?:(<[\w\w]+>)[^>]*|#([\w-]*))$/,83 //匹配一个独立的标签84 rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,85 // js on regexp(javascript object notation:javascript对象标记法正则表达式)86 rvalidchars = /^[\],:{}\s]*$/,87 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,88 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fa-f]{4})/g,89 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[ee][+-]?\d+|)/g,90 // matches dashed string for camelizing91 rmsprefix = /^-ms-/,92 rdashalpha = /-([\da-z])/gi,93 //以上为正则运算表达式各种形式94此文来自: 马开东博客 转载请注明出处 网址: http://www.makaidong.com95,不太容易理解,尽量掌握。96 //使用jquery .camecase(camel-case:骆驼事例标记法)作为replce()函数(替换函数)的回调函数97 fcamelcase = function( all, letter ) {98 return letter.touppercase();99 },100 //准备事件管理语句101 completed = function( event ) {102 // readystate === "complete" is good enough for us to call the dom ready in oldie103 if ( document.addeventlistener || event.type === "load" || document.readystate === "complete" ) {104 detach();105 jquery .ready();106 }107 },108 //为dom准备事件清理方法109 detach = function() {110 if ( document.addeventlistener ) {111 document.removeeventlistener( "domcontentloaded", completed, false );112 window.removeeventlistener( "load", completed, false );113 } else {114 document.detachevent( "onreadystatechange", completed );115 window.detachevent( "onload", completed );116 }117 };118jquery .fn = jquery .prototype = {119 // the current version of jquery being used120 jquery : core_version,121 constructor: jquery ,122 init: function( selector, context, rootjquery ) {123 var match, elem;124 //handle(句柄):$(""), $(null), $(undefined), $(false)125 if ( !selector ) {126 return this;127 }128 //html字符串句柄129 if ( typeof selector === "string" ) {//如果(选择器的类型等于字符串130 if ( selector.charat(0) === "<" && selector.charat( selector.length - 1 ) === ">" && selector.length >= 3 ) {131 // assume that strings that start and end with <> are html and skip the regex check132 match = [ null, selector, null ];133 } else {134 match = rquickexpr.exec( selector );135 }136 // match html or make sure no context is specified for #id137 //匹配html或者确认对于#id没有环境是规定的138 if ( match && (match[1] || !context) ) {139 // handle: $(html) -> $(array)140 if ( match[1] ) {141 context = context instanceof jquery ? context[0] : context;142 // 脚本向后兼容143 jquery .merge( this, jquery .parsehtml(144 match[1],145 context && context.nodetype ? context.ownerdocument || context : document,146 true147 ) );148 //处理: $(html, props)149 if ( rsingletag.test( match[1] ) && jquery .isplainobject( context ) ) {150 for ( match in context ) {151 // properties of context are called as methods if possible152 //如果可能上下文的性质被访问153 if ( jquery .isfunction( this[ match ] ) ) {154 this[ match ]( context[ match ] );155 // ...and otherwise set as attributes156 } else {157 this.attr( match, context[ match ] );158 }159 }160 }161 return this;162 // handle: $(#id)163 // 处理: $(#id)164 } else {165 elem = document.getelementbyid( match[2] );166 // check parentnode to catch when blackberry 4.6 returns167 //节点不再在文档中 #6963168 if ( elem && elem.parentnode ) {169 // handle the case where ie and opera return items170 // 处理事件无论ie和opera把项目返回到哪里171 // by name instead of id172 // 用名字替代id173 if ( elem.id !== match[2] ) {174 return rootjquery .find( selector );175 }176 // otherwise, we inject the element directly into the jquery object177 this.length = 1;178 this[0] = elem;179 }180 this.context = document;181 this.selector = selector;182 return this;183 }184 // handle: $(expr, $(...))185 } else if ( !context || context.jquery ) {186 return ( context || rootjquery ).find( selector );187 // handle: $(expr, context)188 // (which is just equivalent to: $(context).find(expr)189 } else {190 return this.constructor( context ).find( selector );191 }192 // handle: $(domelement)193 } else if ( selector.nodetype ) {194 this.context = this[0] = selector;195 this.length = 1;196 return this;197 // handle: $(function)198 // shortcut for document ready199 } else if ( jquery .isfunction( selector ) ) {200 return rootjquery .ready( selector );201 }202 if ( selector.selector !== undefined ) {203 this.selector = selector.selector;204 this.context = selector.context;205 }206 return jquery .makearray( selector, this );207 },208 // start with an empty selector209 // 用一个空选择器开始210 selector: "",211 // the default length of a jquery object is 0212 length: 0,213 // the number of elements contained in the matched element set214 // 匹配事件集包含事件的数量215 size: function() {216 return this.length;217 },218 toarray: function() {219 return core_slice.call( this );220 },221 // get the nth element in the matched element set or222 // get the whole matched element set as a clean array223 get: function( num ) {224 return num == null ?225 // return a 'clean' array226 this.toarray() :227 // return just the object228 ( num < 0 ? this[ this.length + num ] : this[ num ] );229 },230 // take an array of elements and push it onto the stack231 // (returning the new matched element set)232 pushstack: function( elems ) {233 // build a new jquery matched element set234 var ret = jquery .merge( this.constructor(), elems );235 // add the old object onto the stack (as a reference)236 ret.prevobject = this;237 ret.context = this.context;238 // return the newly-formed element set239 return ret;240 },241 // execute a callback for every element in the matched set.242 // (you can seed the arguments with an array of args, but this is243 // only used internally.)244 each: function( callback, args ) {245 return jquery .each( this, callback, args );246 },247 ready: function( fn ) {248 // add the callback249 // 增加回调函数250 jquery .ready.promise().done( fn );251 return this;252 },253 slice: function() {254 return this.pushstack( core_slice.apply( this, arguments ) );255 },256 first: function() {257 return this.eq( 0 );258 },259 last: function() {260 return this.eq( -1 );261 },262 eq: function( i ) {263 var len = this.length,264 j = +i + ( i < 0 ? len : 0 );265 return this.pushstack( j >= 0 && j < len ? [ this[j] ] : [] );266 },267 map: function( callback ) {268 return this.pushstack( jquery .map(this, function( elem, i ) {269 return callback.call( elem, i, elem );270 }));271 },272 end: function() {273 return this.prevobject || this.constructor(null);274 },275 // for internal use only.276 // 只是为了内部使用277 // behaves like an array's method, not like a jquery method.278 push: core_push,279 sort: [].sort,280 splice: [].splice281};282// give the init function the jquery prototype for later instantiation283jquery .fn.init.prototype = jquery .fn;284jquery .extend = jquery .fn.extend = function() {285 var src, copyisarray, copy, name, options, clone,286 target = arguments[0] || {},287 i = 1,288 length = arguments.length,289 deep = false;290 // handle a deep copy situation291 if ( typeof target === "boolean" ) {292 deep = target;293 target = arguments[1] || {};294 // skip the boolean and the target295 i = 2;296 }297 // handle case when target is a string or something (possible in deep copy)298 if ( typeof target !== "object" && !jquery .isfunction(target) ) {299 target = {};300 }301 // extend jquery itself if only one argument is passed302 if ( length === i ) {303 target = this;304 --i;305 }306 for ( ; i < length; i++ ) {307 // only deal with non-null/undefined values308 if ( (options = arguments[ i ]) != null ) {309 // extend the base object310 for ( name in options ) {311 src = target[ name ];312 copy = options[ name ];313 // prevent never-ending loop314 if ( target === copy ) {315 continue;316 }317 // recurse if we're merging plain objects or arrays318 if ( deep && copy && ( jquery .isplainobject(copy) || (copyisarray = jquery .isarray(copy)) ) ) {319 if ( copyisarray ) {320 copyisarray = false;321 clone = src && jquery .isarray(src) ? src : [];322 } else {323 clone = src && jquery .isplainobject(src) ? src : {};324 }325 // never move original objects, clone them326 target[ name ] = jquery .extend( deep, clone, copy );327 // don't bring in undefined values328 } else if ( copy !== undefined ) {329 target[ name ] = copy;330 }331 }332 }333 }334 // return the modified object335 // 返回被修改的对象336 return target;337};338jquery .extend({339 noconflict: function( deep ) {340 if ( window.$ === jquery ) {341 window.$ = _$;342 }343 if ( deep && window.jquery === jquery ) {344 window.jquery = _jquery ;345 }346 return jquery ;347 },348 // is the dom ready to be used? set to true once it occurs.349 // dom文档是否准备被使用?一旦发生就设置为真。350 isready: false,351 // a counter to track how many items to wait for before352 // 一个计数器跟踪多少项目等待353 // the ready event fires. see #6781354 // 准备好的事件。请看#6781355 readywait: 1,356 // hold (or release) the ready event357 // 控制(或者释放)准备的事件358 holdready: function( hold ) {359 if ( hold ) {360 jquery .readywait++;361 } else {362 jquery .ready( true );363 }364 },365 // handle when the dom is ready366 // 操纵dom文档何时被准备367 ready: function( wait ) {368 // abort if there are pending holds or we're already ready369 // 终止如果有待定的holds或者已经准备好了370 if ( wait === true ? --jquery .readywait : jquery .isready ) {371 return;372 }373 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).374 //375 if ( !document.body ) {376 return settimeout( jquery .ready );377 }378 // remember that the dom is ready379 // 记住文件对象模型(dom)正在准备380 jquery .isready = true;381 // if a normal dom ready event fired, decrement, and wait if need be382 if ( wait !== true && --jquery .readywait > 0 ) {383 return;384 }385 // if there are functions bound, to execute386 readylist.resolvewith( document, [ jquery ] );387 // trigger any bound ready events388 if ( jquery .fn.trigger ) {389 jquery ( document ).trigger("ready").off("ready");390 }391 },392 // see test/unit/core.js for details concerning isfunction.393 // since version 1.3, dom methods and functions like alert394 // aren't supported. they return false on ie (#2968).395 isfunction: function( obj ) {396 return jquery .type(obj) === "function";397 },398 isarray: array.isarray || function( obj ) {399 return jquery .type(obj) === "array";400 },401 iswindow: function( obj ) {402 return obj != null && obj == obj.window;403 },404 isnumeric: function( obj ) {405 return !isnan( parsefloat(obj) ) && isfinite( obj );406 },407 type: function( obj ) {408 if ( obj == null ) {409 return string( obj );410 }411 return typeof obj === "object" || typeof obj === "function" ?412 class2type[ core_tostring.call(obj) ] || "object" :413 typeof obj;414 },415 isplainobject: function( obj ) {416 // must be an object.417 // 必须是对象418 // because of ie, we also have to check the presence of the constructor property.419 // 由于ie的原因,我们必须检查存在的构造器属性420 // make sure that dom nodes and window objects don't pass through, as well421 // 还有确保dom节点和window对象不被传进来422 if ( !obj || jquery .type(obj) !== "object" || obj.nodetype || jquery .iswindow( obj ) ) {423 return false;424 }425 try {426 // not own constructor property must be object427 // 拥有的构造器属性不一定是对象428 if ( obj.constructor &&429 !core_hasown.call(obj, "constructor") &&430 !core_hasown.call(obj.constructor.prototype, "isprototypeof") ) {431 return false;432 }433 } catch ( e ) {434 // ie8,9 will throw exceptions on certain host objects #9897435 // ie8,9将会扔出例外在某些主机对象#9897436 return false;437 }438 // own properties are enumerated firstly, so to speed up,439 // 首先列举拥有的属性,为了加速,只判断最后一个440 // if last one is own, then all properties are own.441 // 如果含有最后一个属性,那么含有所有的属性442 var key;443 for ( key in obj ) {}444 return key === undefined || core_hasown.call( obj, key );445 //遍历对象中的变量key返回key没有找到446 },447 isemptyobject: function( obj ) {448 var name;449 for ( name in obj ) {450 return false;451 }452 return true;453 },454 error: function( msg ) {455 throw new error( msg );456 },457 // data: string of html458 // 数据:html的字符串459 // context (optional): if specified, the fragment will be created in this context, defaults to document460 // 上下文内容(任意的):如果被指定,片段会被创建到该上下文上,默认是创建在文档上461 // keepscripts (optional): if true, will include scripts passed in the html string462 // 保留脚本(可选的):如果为真,包含的脚本在html字符串中会通过463 parsehtml: function( data, context, keepscripts ) {// 解析html字符串,生成相应的dom元素并返回464 if ( !data || typeof data !== "string" ) {465 return null;466 }467 if ( typeof context === "boolean" ) {// 如果context是布尔类型,则将context的值赋给keepscripts,并将context设置为假468 keepscripts = context;469 context = false;470 }471 context = context || document;472 var parsed = rsingletag.exec( data ),473 scripts = !keepscripts && [];474 // single tag475 // 单独的标签476 if ( parsed ) {477 return [ context.createelement( parsed[1] ) ];478 }479 parsed = jquery .buildfragment( [ data ], context, scripts );480 if ( scripts ) {481 jquery ( scripts ).remove();482 }483 return jquery .merge( [], parsed.childnodes );484 },485 parsejs on: function( data ) {486 // attempt to parse using the native js on parser first487 if ( window.js on && window.js on.parse ) {488 return window.js on.parse( data );489 }490 if ( data === null ) {491 return data;492 }493 if ( typeof data === "string" ) {494 // make sure leading/trailing whitespace is removed (ie can't handle it)495 // 确认开头、末尾空白符号已被移走(ie无法操作)496 data = jquery .trim( data );497 if ( data ) {498 // make sure the incoming data is actual js on499 // 确认输入的数据现在的js on数据500 // logic borrowed from http://js on.org/js on2.js501 // 从http://js on.org/js on2.js 中借用逻辑502 if ( rvalidchars.test( data.replace( rvalidescape, "@" )503 .replace( rvalidtokens, "]" )504 .replace( rvalidbraces, "")) ) {505 return ( new function( "return " + data ) )();506 }507 }508 }509 jquery .error( "invalid js on: " + data );510 },511 // cross-browser xml parsing512 // 跨浏览器开发 的xml解析513 parsexml: function( data ) {514 var xml, tmp;515 if ( !data || typeof data !== "string" ) {516 return null;//如果传入的数据类型不是字符517此文来自: 马开东博客 转载请注明出处 网址: http://www.makaidong.com518串,返回空值。519 }520 try {521 if ( window.domparser ) { // standard(标准)522 tmp = new domparser();523 xml = tmp.parsefromstring( data , "text/xml" );524 } else { // ie525 xml = new activexobject( "microsoft.xmldom" );526 xml.async = "false";527 xml.loadxml( data );528 }529 } catch( e ) {530 xml = undefined;531 }532 if ( !xml || !xml.documentelement || xml.getelementsbytagname( "parsererror" ).length ) {533 jquery .error( "invalid xml: " + data );534 }535 return xml;536 },537 noop: function() {},538 // evaluates a script in a global context539 // 在全局上下文中执行脚本540 // workarounds based on findings by jim driscoll541 // 工作环境基于jim driscoll的发现542 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context543 // 上面提到那人的一篇文章544 globaleval: function( data ) {545 if ( data && jquery .trim( data ) ) {546 // we use execscript on internet explorer547 // we use an anonymous function so that context is window548 // rather than jquery in firefox549 ( window.execscript || function( data ) {550 window[ "eval" ].call( window, data );551 } )( data );552 }553 },554 // convert dashed to camelcase; used by the css and data modules555 // microsoft forgot to hump their vendor prefix (#9572)556 camelcase: function( string ) {557 return string.replace( rmsprefix, "ms-" ).replace( rdashalpha, fcamelcase );558 },559 nodename: function( elem, name ) {560 return elem.nodename && elem.nodename.tolowercase() === name.tolowercase();561 },562 // args is for internal usage only563 each: function( obj, callback, args ) {564 var value,565 i = 0,566 length = obj.length,567 isarray = isarraylike( obj );568 if ( args ) {569 if ( isarray ) {570 for ( ; i < length; i++ ) {571 value = callback.apply( obj[ i ], args );572 if ( value === false ) {573 break;574 }575 }576 } else {577 for ( i in obj ) {578 value = callback.apply( obj[ i ], args );579 if ( value === false ) {580 break;581 }582 }583 }584 //一个特殊的,快速的,实例用于每个大部分普通应用585 } else {586 if ( isarray ) {587 for ( ; i < length; i++ ) {588 value = callback.call( obj[ i ], i, obj[ i ] );589 if ( value === false ) {590 break;591 }592 }593 } else {594 for ( i in obj ) {595 value = callback.call( obj[ i ], i, obj[ i ] );596 if ( value === false ) {597 break;598 }599 }600 }601 }602 return obj;603 },604 // use native string.trim function wherever possible605 trim: core_trim && !core_trim.call("\ufeff\xa0") ?606 function( text ) {607 return text == null ?608 "" :609 core_trim.call( text );610 } :611 // otherwise use our own trimming functionality612 function( text ) {613 return text == null ?614 "" :615 ( text + "" ).replace( rtrim, "" );616 },617 // results is for internal usage only618 makearray: function( arr, results ) {619 var ret = results || [];620 if ( arr != null ) {621 if ( isarraylike( object(arr) ) ) {622 jquery .merge( ret,623 typeof arr === "string" ?624 [ arr ] : arr625 );626 } else {627 core_push.call( ret, arr );628 }629 }630 return ret;631 },632 inarray: function( elem, arr, i ) {633 var len;634 if ( arr ) {635 if ( core_indexof ) {636 return core_indexof.call( arr, elem, i );637 }638 len = arr.length;639 i = i ? i < 0 ? math.max( 0, len + i ) : i : 0;640 for ( ; i < len; i++ ) {641 // skip accessing in sparse arrays642 if ( i in arr && arr[ i ] === elem ) {643 return i;644 }645 }646 }647 return -1;648 },649 merge: function( first, second ) {650 var l = second.length,651 i = first.length,652 j = 0;653 if ( typeof l === "number" ) {654 for ( ; j < l; j++ ) {655 first[ i++ ] = second[ j ];656 }657 } else {658 while ( second[j] !== undefined ) {659 first[ i++ ] = second[ j++ ];660 }661 }662 first.length = i;663 return first;664 },665 grep: function( elems, callback, inv ) {666 var retval,667 ret = [],668 i = 0,669 length = elems.length;670 inv = !!inv;671 // go through the array, only saving the items672 // that pass the validator function673 for ( ; i < length; i++ ) {674 retval = !!callback( elems[ i ], i );675 if ( inv !== retval ) {676 ret.push( elems[ i ] );677 }678 }679 return ret;680 },681 // arg is for internal usage only682 map: function( elems, callback, arg ) {683 var value,684 i = 0,685 length = elems.length,686 isarray = isarraylike( elems ),687 ret = [];688 // go through the array, translating each of the items to their689 if ( isarray ) {690 for ( ; i < length; i++ ) {691 value = callback( elems[ i ], i, arg );692 if ( value != null ) {693 ret[ ret.length ] = value;694 }695 }696 // go through every key on the object,697 } else {698 for ( i in elems ) {699 value = callback( elems[ i ], i, arg );700 if ( value != null ) {701 ret[ ret.length ] = value;702 }703 }704 }705 // flatten any nested arrays706 return core_concat.apply( [], ret );707 },708 // a global guid counter for objects709 guid: 1,710 // bind a function to a context, optionally partially applying any711 // arguments.712 proxy: function( fn, context ) {713 var args, proxy, tmp;714 if ( typeof context === "string" ) {715 tmp = fn[ context ];716 context = fn;717 fn = tmp;718 }719 // quick check to determine if target is callable, in the spec720 // this throws a typeerror, but we will just return undefined.721 if ( !jquery .isfunction( fn ) ) {722 return undefined;723 }724 // simulated bind725 args = core_slice.call( arguments, 2 );726 proxy = function() {727 return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );728 };729 // set the guid of unique handler to the same of original handler, so it can be removed730 proxy.guid = fn.guid = fn.guid || jquery .guid++;731 return proxy;732 },733 // multifunctional method to get and set values of a collection734 // the value/s can optionally be executed if it's a function735 access: function( elems, fn, key, value, chainable, emptyget, raw ) {736 var i = 0,737 length = elems.length,738 bulk = key == null;739 // sets many values740 if ( jquery .type( key ) === "object" ) {741 chainable = true;742 for ( i in key ) {743 jquery .access( elems, fn, i, key[i], true, emptyget, raw );744 }745 // sets one value746 } else if ( value !== undefined ) {747 chainable = true;748 if ( !jquery .isfunction( value ) ) {749 raw = true;750 }751 if ( bulk ) {752 // bulk operations run against the entire set753 if ( raw ) {754 fn.call( elems, value );755 fn = null;756 // ...except when executing function values757 } else {758 bulk = fn;759 fn = function( elem, key, value ) {760 return bulk.call( jquery ( elem ), value );761 };762 }763 }764 if ( fn ) {765 for ( ; i < length; i++ ) {766 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );767 }768 }769 }770 return chainable ?771 elems :772 // gets773 bulk ?774 fn.call( elems ) :775 length ? fn( elems[0], key ) : emptyget;776 },777 now: function() {778 return ( new date() ).gettime();779 }780});781jquery .ready.promise = function( obj ) {782 if ( !readylist ) {783 readylist = jquery .deferred();784 // catch cases where $(document).ready() is called after the browser event has already occurred.785 // we once tried to use readystate "interactive" here, but it caused issues like the one786 // discovered by chriss here: http://bugs.jquery .com/ticket/12282#comment:15787 if ( document.readystate === "complete" ) {788 // handle it asynchronously to allow scripts the opportunity to delay ready789 settimeout( jquery .ready );790 // standards-based browsers support domcontentloaded791 } else if ( document.addeventlistener ) {792 // use the handy event callback793 document.addeventlistener( "domcontentloaded", completed, false );794 // a fallback to window.onload, that will always work795 window.addeventlistener( "load", completed, false );796 // if ie event model is used797 } else {798 // ensure firing before onload, maybe late but safe also for iframes799 document.attachevent( "onreadystatechange", completed );800 // a fallback to window.onload, that will always work801 window.attachevent( "onload", completed );802 // if ie and not a frame803 // continually check to see if the document is ready804 var top = false;805 try {806 top = window.frameelement == null && document.documentelement;807 } catch(e) {}808 if ( top && top.doscroll ) {809 (function doscrollcheck() {810 if ( !jquery .isready ) {811 try {812 // use the trick by diego perini813 // http://javascript.nwbox.com/iecontentloaded/814 top.doscroll("left");815 } catch(e) {816 return settimeout( doscrollcheck, 50 );817 }818 // detach all dom ready events819 detach();820 // and execute any waiting functions821 jquery .ready();822 }823 })();824 }825 }826 }827 return readylist.promise( obj );828};829// populate the class2type map830jquery .each("boolean number string function array date regexp object error".split(" "), function(i, name) {831 class2type[ "[object " + name + "]" ] = name.tolowercase();832});833function isarraylike( obj ) {834 var length = obj.length,835 type = jquery .type( obj );836 if ( jquery .iswindow( obj ) ) {837 return false;838 }839 if ( obj.nodetype === 1 && length ) {840 return true;841 }842 return type === "array" || type !== "function" &&843 ( length === 0 ||844 typeof length === "number" && length > 0 && ( length - 1 ) in obj );845}846// all jquery objects should point back to these847rootjquery = jquery (document);848// string to object options format cache849var optionscache = {};850// convert string-formatted options into object-formatted ones and store in cache851function createoptions( options ) {852 var object = optionscache[ options ] = {};853 jquery .each( options.match( core_rnotwhite ) || [], function( _, flag ) {854 object[ flag ] = true;855 });856 return object;857}858/*859 * create a callback list using the following parameters:860 *861 * options: an optional list of space-separated options that will change how862 * the callback list behaves or a more traditional option object863 *864 * by default a callback list will act like an event callback list and can be865 * "fired" multiple times.866 *867 * possible options:868 *869 * once: will ensure the callback list can only be fired once (like a deferred)870 *871 * memory: will keep track of previous values and will call any callback added872 * after the list has been fired right away with the latest "memorized"873 * values (like a deferred)874 *875 * unique: will ensure a callback can only be added once (no duplicate in the list)876 *877 * stoponfalse: interrupt callings when a callback returns false878 *879 */880jquery .callbacks = function( options ) {881 // convert options from string-formatted to object-formatted if needed882 // (we check in cache first)883 options = typeof options === "string" ?884 ( optionscache[ options ] || createoptions( options ) ) :885 jquery .extend( {}, options );886 var // flag to know if list is currently firing887 firing,888 // last fire value (for non-forgettable lists)889 memory,890 // flag to know if list was already fired891 fired,892 // end of the loop when firing893 firinglength,894 // index of currently firing callback (modified by remove if needed)895 firingindex,896 // first callback to fire (used internally by add and firewith)897 firingstart,898 // actual callback list899 list = [],900 // stack of fire calls for repeatable lists901 stack = !options.once && [],902 // fire callbacks903 fire = function( data ) {904 memory = options.memory && data;905 fired = true;906 firingindex = firingstart || 0;907 firingstart = 0;908 firinglength = list.length;909 firing = true;910 for ( ; list && firingindex < firinglength; firingindex++ ) {911 if ( list[ firingindex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stoponfalse ) {912 memory = false; // to prevent further calls using add913 break;914 }915 }916 firing = false;917 if ( list ) {918 if ( stack ) {919 if ( stack.length ) {920 fire( stack.shift() );921 }922 } else if ( memory ) {923 list = [];924 } else {925 self.disable();926 }927 }928 },929 // actual callbacks object930 self = {931 // add a callback or a collection of callbacks to the list932 add: function() {933 if ( list ) {934 // first, we save the current length935 var start = list.length;936 (function add( args ) {937 jquery .each( args, function( _, arg ) {938 var type = jquery .type( arg );939 if ( type === "function" ) {940 if ( !options.unique || !self.has( arg ) ) {941 list.push( arg );942 }943 } else if ( arg && arg.length && type !== "string" ) {944 // inspect recursively945 add( arg );946 }947 });948 })( arguments );949 // do we need to add the callbacks to the950 // current firing batch?951 if ( firing ) {952 firinglength = list.length;953 // with memory, if we're not firing then954 // we should call right away955 } else if ( memory ) {956 firingstart = start;957 fire( memory );958 }959 }960 return this;961 },962 // remove a callback from the list963 remove: function() {964 if ( list ) {965 jquery .each( arguments, function( _, arg ) {966 var index;967 while( ( index = jquery .inarray( arg, list, index ) ) > -1 ) {968 list.splice( index, 1 );969 // handle firing indexes970 if ( firing ) {971 if ( index <= firinglength ) {972 firinglength--;973 }974 if ( index <= firingindex ) {975 firingindex--;976 }977 }978 }979 });980 }981 return this;982 },983 // check if a given callback is in the list.984 // if no argument is given, return whether or not list has callbacks attached.985 has: function( fn ) {986 return fn ? jquery .inarray( fn, list ) > -1 : !!( list && list.length );987 },988 // remove all callbacks from the list989 empty: function() {990 list = [];991 return this;992 },993 // have the list do nothing anymore994 disable: function() {995 list = stack = memory = undefined;996 return this;997 },998 // is it disabled?999 disabled: function() {1000 return !list;1001 },1002 // lock the list in its current state1003 lock: function() {1004 stack = undefined;1005 if ( !memory ) {1006 self.disable();1007 }1008 return this;1009 },1010 // is it locked?1011 locked: function() {1012 return !stack;1013 },1014 // call all callbacks with the given context and arguments1015 firewith: function( context, args ) {1016 args = args || [];1017 args = [ context, args.slice ? args.slice() : args ];1018 if ( list && ( !fired || stack ) ) {1019 if ( firing ) {1020 stack.push( args );1021 } else {1022 fire( args );1023 }1024 }1025 return this;1026 },1027 // call all the callbacks with the given arguments1028 fire: function() {1029 self.firewith( this, arguments );1030 return this;1031 },1032 // to know if the callbacks have already been called at least once1033 fired: function() {1034 return !!fired;1035 }1036 };1037 return self;1038};1039jquery .extend({1040 deferred: function( func ) {1041 var tuples = [1042 // action, add listener, listener list, final state1043 [ "resolve", "done", jquery .callbacks("once memory"), "resolved" ],1044 [ "reject", "fail", jquery .callbacks("once memory"), "rejected" ],1045 [ "notify", "progress", jquery .callbacks("memory") ]1046 ],1047 state = "pending",1048 promise = {1049 state: function() {1050 return state;1051 },1052 always: function() {1053 deferred.done( arguments ).fail( arguments );1054 return this;1055 },1056 then: function( /* fndone, fnfail, fnprogress */ ) {1057 var fns = arguments;1058 return jquery .deferred(function( newdefer ) {1059 jquery .each( tuples, function( i, tuple ) {1060 var action = tuple[ 0 ],1061 fn = jquery .isfunction( fns[ i ] ) && fns[ i ];1062 // deferred[ done | fail | progress ] for forwarding actions to newdefer1063 deferred[ tuple[1] ](function() {1064 var returned = fn && fn.apply( this, arguments );1065 if ( returned && jquery .isfunction( returned.promise ) ) {1066 returned.promise()1067 .done( newdefer.resolve )1068 .fail( newdefer.reject )1069 .progress( newdefer.notify );1070 } else {1071 newdefer[ action + "with" ]( this === promise ? newdefer.promise() : this, fn ? [ returned ] : arguments );1072 }1073 });1074 });1075 fns = null;1076 }).promise();1077 },1078 // get a promise for this deferred1079 // if obj is provided, the promise aspect is added to the object1080 promise: function( obj ) {1081 return obj != null ? jquery .extend( obj, promise ) : promise;1082 }1083 },1084 deferred = {};1085 // keep pipe for back-compat1086 promise.pipe = promise.then;1087 // add list-specific methods1088 jquery .each( tuples, function( i, tuple ) {1089 var list = tuple[ 2 ],1090 statestring = tuple[ 3 ];1091 // promise[ done | fail | progress ] = list.add1092 promise[ tuple[1] ] = list.add;1093 // handle state1094 if ( statestring ) {1095 list.add(function() {1096 // state = [ resolved | rejected ]1097 state = statestring;1098 // [ reject_list | resolve_list ].disable; progress_list.lock1099 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );1100 }1101 // deferred[ resolve | reject | notify ]1102 deferred[ tuple[0] ] = function() {1103 deferred[ tuple[0] + "with" ]( this === deferred ? promise : this, arguments );1104 return this;1105 };1106 deferred[ tuple[0] + "with" ] = list.firewith;1107 });1108 // make the deferred a promise1109 promise.promise( deferred );1110 // call given func if any1111 if ( func ) {1112 func.call( deferred, deferred );1113 }1114 // all done!1115 return deferred;1116 },1117 // deferred helper1118 when: function( subordinate /* , ..., subordinaten */ ) {1119 var i = 0,1120 resolvevalues = core_slice.call( arguments ),1121 length = resolvevalues.length,1122 // the count of uncompleted subordinates1123 remaining = length !== 1 || ( subordinate && jquery .isfunction( subordinate.promise ) ) ? length : 0,1124 // the master deferred. if resolvevalues consist of only a single deferred, just use that.1125 deferred = remaining === 1 ? subordinate : jquery .deferred(),1126 // update function for both resolve and progress values1127 updatefunc = function( i, contexts, values ) {1128 return function( value ) {1129 contexts[ i ] = this;1130 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;1131 if( values === progressvalues ) {1132 deferred.notifywith( contexts, values );1133 } else if ( !( --remaining ) ) {1134 deferred.resolvewith( contexts, values );1135 }1136 };1137 },1138 progressvalues, progresscontexts, resolvecontexts;1139 // add listeners to deferred subordinates; treat others as resolved1140 if ( length > 1 ) {1141 progressvalues = new array( length );1142 progresscontexts = new array( length );1143 resolvecontexts = new array( length );1144 for ( ; i < length; i++ ) {1145 if ( resolvevalues[ i ] && jquery .isfunction( resolvevalues[ i ].promise ) ) {1146 resolvevalues[ i ].promise()1147 .done( updatefunc( i, resolvecontexts, resolvevalues ) )1148 .fail( deferred.reject )1149 .progress( updatefunc( i, progresscontexts, progressvalues ) );1150 } else {1151 --remaining;1152 }1153 }1154 }1155 // if we're not waiting on anything, resolve the master1156 if ( !remaining ) {1157 deferred.resolvewith( resolvecontexts, resolvevalues );1158 }1159 return deferred.promise();1160 }1161});1162jquery .support = (function() {1163 var support, all, a,1164 input, select, fragment,1165 opt, eventname, issupported, i,1166 div = document.createelement("div");1167 // setup1168 div.setattribute( "classname", "t" );1169 div.innerhtml = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";1170 // support tests won't run in some limited or non-browser environments1171 all = div.getelementsbytagname("*");1172 a = div.getelementsbytagname("a")[ 0 ];1173 if ( !all || !a || !all.length ) {1174 return {};1175 }1176 // first batch of tests1177 select = document.createelement("select");1178 opt = select.appendchild( document.createelement("option") );1179 input = div.getelementsbytagname("input")[ 0 ];1180 a.style.csstext = "top:1px;float:left;opacity:.5";1181 support = {1182 // test setattribute on camelcase class. if it works, we need attrfixes when doing get/setattribute (ie6/7)1183 getsetattribute: div.classname !== "t",1184 // ie strips leading whitespace when .innerhtml is used1185 leadingwhitespace: div.firstchild.nodetype === 3,1186 // make sure that tbody elements aren't automatically inserted1187 // ie will insert them into empty tables1188 tbody: !div.getelementsbytagname("tbody").length,1189 // make sure that link elements get serialized correctly by innerhtml1190 // this requires a wrapper element in ie1191 htmlserialize: !!div.getelementsbytagname("link").length,1192 // get the style information from getattribute1193 // (ie uses .csstext instead)1194 style: /top/.test( a.getattribute("style") ),1195 // make sure that urls aren't manipulated1196 // (ie normalizes it by default)1197 hrefnormalized: a.getattribute("href") === "/a",1198 // make sure that element opacity exists1199 // (ie uses filter instead)1200 // use a regex to work around a webkit issue. see #51451201 opacity: /^0.5/.test( a.style.opacity ),1202 // verify style float existence1203 // (ie uses stylefloat instead of cssfloat)1204 cssfloat: !!a.style.cssfloat,1205 // check the default checkbox/radio value ("" on webkit; "on" elsewhere)1206 checkon: !!input.value,1207 // make sure that a selected-by-default option has a working selected property.1208 // (webkit defaults to false instead of true, ie too, if it's in an optgroup)1209 optselected: opt.selected,1210 // tests for enctype support on a form (#6743)1211 enctype: !!document.createelement("form").enctype,1212 // makes sure cloning an html5 element does not cause problems1213 // where outerhtml is undefined, this still works1214 html5clone: document.createelement("nav").clonenode( true ).outerhtml !== "<:nav></:nav>",1215 // jquery .support.boxmodel deprecated in 1.8 since we don't support quirks mode1216 boxmodel: document.compatmode === "css1compat",1217 // will be defined later1218 deleteexpando: true,1219 nocloneevent: true,1220 inlineblockneedslayout: false,1221 shrinkwrapblocks: false,1222 reliablemarginright: true,1223 boxsizingreliable: true,1224 pixelposition: false1225 };1226 // make sure checked status is properly cloned1227 // 确认勾选的属性正确地被复制1228 input.checked = true;1229 support.noclonechecked = input.clonenode( true ).checked;1230 // make sure that the options inside disabled selects aren't marked as disabled1231 // 确认在无效选择中的选项没有被标记为无效1232 // (webkit marks them as disabled)1233 // webkit标记他们为无效1234 select.disabled = true;1235 support.optdisabled = !opt.disabled;1236 // support: ie<91237 // 支持:te<91238 try {1239 delete div.test;1240 } catch( e ) {1241 support.deleteexpando = false;1242 }1243 // check if we can trust getattribute("value")1244 // 检测我们是否能依赖getattribute得到的属性值1245 input = document.createelement("input");1246 input.setattribute( "value", "" );1247 support.input = input.getattribute( "value" ) === "";1248 // check if an input maintains its value after becoming a radio1249 // 在变成按钮后检测是否输入保持的值1250 input.value = "t";1251 input.setattribute( "type", "radio" );1252 support.radiovalue = input.value === "t";1253 // #11217 - webkit loses check when the name is after the checked attribute1254 input.setattribute( "checked", "t" );1255 input.setattribute( "name", "t" );1256 fragment = document.createdocumentfragment();1257 fragment.appendchild( input );1258 // check if a disconnected checkbox will retain its checked1259 // value of true after appended to the dom (ie6/7)1260 support.appendchecked = input.checked;1261 // webkit doesn't clone checked state correctly in fragments1262 support.checkclone = fragment.clonenode( true ).clonenode( true ).lastchild.checked;1263 // support: ie<91264 // opera does not clone events (and typeof div.attachevent === undefined).1265 // ie9-10 clones events bound via attachevent, but they don't trigger with .click()1266 if ( div.attachevent ) {1267 div.attachevent( "onclick", function() {1268 support.nocloneevent = false;1269 });1270 div.clonenode( true ).click();1271 }1272 // support: ie<9 (lack submit/change bubble), firefox 17+ (lack focusin event)1273 // beware of csp rest rictions (https://developer.mozilla.org/en/security/csp), test/csp.php1274 for ( i in { submit: true, change: true, focusin: true }) {1275 div.setattribute( eventname = "on" + i, "t" );1276 support[ i + "bubbles" ] = eventname in window || div.attributes[ eventname ].expando === false;1277 }1278 div.style.backgroundclip = "content-box";1279 div.clonenode( true ).style.backgroundclip = "";1280 support.clearclonestyle = div.style.backgroundclip === "content-box";1281 // run tests that need a body at doc ready1282 jquery (function() {1283 var container, margindiv, tds,1284 divreset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",1285 body = document.getelementsbytagname("body")[0];1286 if ( !body ) {1287 // return for frameset docs that don't have a body1288 // frameset文档中没有body节点就返回1289 return;1290 }1291 container = document.createelement("div");1292 container.style.csstext = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";1293 body.appendchild( container ).appendchild( div );1294 // support: ie81295 // 支持:ie81296 // check if table cells still have offsetwidth/height when they are set1297 // 检查表单单元格是否还有返回元素的宽度/高度属性,当他们被设置时。1298 // to display:none and there are still other visible table cells in a1299 // 为了显示:没有,仍然有其他的可见单元格在一个表单行里1300 // table row; if so, offsetwidth/height are not reliable for use when1301 // 如此,返回元素的宽度/高度属性对于使用不是可靠的1302 // determining if an element has been hidden directly using1303 // 判断是否一个元素被直接隐藏使用1304 // display:none (it is still safe to use offsets if a parent element is1305 // 显示:没有(如果父元素是隐藏的,它仍居可以安全使用形成分支1306 // hidden; don safety goggles and see bug #4512 for more information).1307 // 看bug编号(#4512)查询更多信息1308 div.innerhtml = "<table><tr><td></td><td>t</td></tr></table>";1309 tds = div.getelementsbytagname("td");1310 tds[ 0 ].style.csstext = "padding:0;margin:0;border:0;display:none";1311 issupported = ( tds[ 0 ].offsetheight === 0 );1312 tds[ 0 ].style.display = "";1313 tds[ 1 ].style.display = "none";1314 // support: ie81315 // 支持:ie81316 // check if empty table cells still have offsetwidth/height1317 // 检查空的表单单元格是否仍旧有返回设置元素宽度、高度的属性1318 support.reliablehiddenoffsets = issupported && ( tds[ 0 ].offsetheight === 0 );1319 // check box-sizing and margin behavior1320 // 检测盒子大小和边界(详情参考css盒子模式)1321 div.innerhtml = "";1322 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%;";1323 support.boxsizing = ( div.offsetwidth === 4 );1324 support.doesnotincludemargininbodyoffset = ( body.offsettop !== 1 );1325 // use window.getcomputedstyle because js dom on node.js will break without it.1326 // 使用window.getcomputedstyle方法,因为没有他在node.js 上的js dom将会损坏1327 if ( window.getcomputedstyle ) {1328 support.pixelposition = ( window.getcomputedstyle( div, null ) || {} ).top !== "1%";1329 support.boxsizingreliable = ( window.getcomputedstyle( div, null ) || { width: "4px" } ).width === "4px";1330 // check if div with explicit width and no margin-right incorrectly1331 // 检查div是否有明确的宽度和正确地右边缘1332 // gets computed margin-right based on width of container. (#3333)1333 // fails in webkit before feb 2011 nightlies1334 // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right1335 // webkit bug 编号:13343——得到计算样式返回错误的值给右边缘1336 margindiv = div.appendchild( document.createelement("div") );1337 margindiv.style.csstext = div.style.csstext = divreset;1338 margindiv.style.marginright = margindiv.style.width = "0";1339 div.style.width = "1px";1340 support.reliablemarginright =1341 !parsefloat( ( window.getcomputedstyle( margindiv, null ) || {} ).marginright );1342 }1343 if ( typeof div.style.zoom !== core_strundefined ) {1344 // support: ie<81345 // check if natively block-level elements act like inline-block1346 // elements when setting their display to 'inline' and giving1347 // them layout1348 div.innerhtml = "";1349 div.style.csstext = divreset + "width:1px;padding:1px;display:inline;zoom:1";1350 support.inlineblockneedslayout = ( div.offsetwidth === 3 );1351 // support: ie61352 // check if elements with layout shrink-wrap their children1353 div.style.display = "block";1354 div.innerhtml = "<div></div>";1355 div.firstchild.style.width = "5px";1356 support.shrinkwrapblocks = ( div.offsetwidth !== 3 );1357 if ( support.inlineblockneedslayout ) {1358 // prevent ie 6 from affecting layout for positioned elements #110481359 // prevent ie from shrinking the body in ie 7 mode #128691360 // support: ie<81361 body.style.zoom = 1;1362 }1363 }1364 body.removechild( container );1365 // null elements to avoid leaks in ie1366 container = div = tds = margindiv = null;1367 });1368 // null elements to avoid leaks in ie1369 all = select = fragment = opt = a = input = null;1370 return support;1371})();1372var rbrace = /(?:\{[\s\s]*\}|\[[\s\s]*\])$/,1373 rmultidash = /([a-z])/g;1374function internaldata( elem, name, data, pvt /* internal use only */ ){1375 if ( !jquery .acceptdata( elem ) ) {1376 return;1377 }1378 var thiscache, ret,1379 internalkey = jquery .expando,1380 getbyname = typeof name === "string",1381 // we have to handle dom nodes and js objects differently because ie6-71382 // can't gc object references properly across the dom-js boundary1383 isnode = elem.nodetype,1384 // only dom nodes need the global jquery cache; js object data is1385 // attached directly to the object so gc can occur automatically1386 cache = isnode ? jquery .cache : elem,1387 // only defining an id for js objects if its cache already exists allows1388 // the code to shortcut on the same path as a dom node with no cache1389 id = isnode ? elem[ internalkey ] : elem[ internalkey ] && internalkey;1390 // avoid doing any more work than we need to when trying to get data on an1391 // object that has no data at all1392 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getbyname && data === undefined ) {1393 return;1394 }1395 if ( !id ) {1396 // only dom nodes need a new unique id for each element since their data1397 // ends up in the global cache1398 if ( isnode ) {1399 elem[ internalkey ] = id = core_deletedids.pop() || jquery .guid++;1400 } else {1401 id = internalkey;1402 }1403 }1404 if ( !cache[ id ] ) {1405 cache[ id ] = {};1406 // avoids exposing jquery metadata on plain js objects when the object1407 // is serialized using js on.stringify1408 if ( !isnode ) {1409 cache[ id ].tojs on = jquery .noop;1410 }1411 }1412 // an object can be passed to jquery .data instead of a key/value pair; this gets1413 // shallow copied over onto the existing cache1414 if ( typeof name === "object" || typeof name === "function" ) {1415 if ( pvt ) {1416 cache[ id ] = jquery .extend( cache[ id ], name );1417 } else {1418 cache[ id ].data = jquery .extend( cache[ id ].data, name );1419 }1420 }1421 thiscache = cache[ id ];1422 // jquery data() is stored in a separate object inside the object's internal data1423 // cache in order to avoid key collisions between internal data and user-defined1424 // data.1425 if ( !pvt ) {1426 if ( !thiscache.data ) {1427 thiscache.data = {};1428 }1429 thiscache = thiscache.data;1430 }1431 if ( data !== undefined ) {1432 thiscache[ jquery .camelcase( name ) ] = data;1433 }1434 // check for both converted-to-camel and non-converted data property names1435 // if a data property was specified1436 if ( getbyname ) {1437 // first try to find as-is property data1438 ret = thiscache[ name ];1439 // test for null|undefined property data1440 if ( ret == null ) {1441 // try to find the camelcased property1442 ret = thiscache[ jquery .camelcase( name ) ];1443 }1444 } else {1445 ret = thiscache;1446 }1447 return ret;1448}1449function internalremovedata( elem, name, pvt ) {1450 if ( !jquery .acceptdata( elem ) ) {1451 return;1452 }1453 var i, l, thiscache,1454 isnode = elem.nodetype,1455 // see jquery .data for more information1456 cache = isnode ? jquery .cache : elem,1457 id = isnode ? elem[ jquery .expando ] : jquery .expando;1458 // if there is already no cache entry for this object, there is no1459 // purpose in continuing1460 if ( !cache[ id ] ) {1461 return;1462 }1463 if ( name ) {1464 thiscache = pvt ? cache[ id ] : cache[ id ].data;1465 if ( thiscache ) {1466 // support array or space separated string names for data keys1467 if ( !jquery .isarray( name ) ) {1468 // try the string as a key before any manipulation1469 if ( name in thiscache ) {1470 name = [ name ];1471 } else {1472 // split the camel cased version by spaces unless a key with the spaces exists1473 name = jquery .camelcase( name );1474 if ( name in thiscache ) {1475 name = [ name ];1476 } else {1477 name = name.split(" ");1478 }1479 }1480 } else {1481 // if "name" is an array of keys...1482 // when data is initially created, via ("key", "val") signature,1483 // keys will be converted to camelcase.1484 // since there is no way to tell _how_ a key was added, remove1485 // both plain key and camelcase key. #127861486 // this will only penalize the array argument path.1487 name = name.concat( jquery .map( name, jquery .camelcase ) );1488 }1489 for ( i = 0, l = name.length; i < l; i++ ) {1490 delete thiscache[ name[i] ];1491 }1492 // if there is no data left in the cache, we want to continue1493 // and let the cache object itself get destroyed1494 if ( !( pvt ? isemptydataobject : jquery .isemptyobject )( thiscache ) ) {1495 return;1496 }1497 }1498 }1499 // see jquery .data for more information1500 if ( !pvt ) {1501 delete cache[ id ].data;1502 // don't destroy the parent cache unless the internal data object1503 // had been the only thing left in it1504 if ( !isemptydataobject( cache[ id ] ) ) {1505 return;1506 }1507 }1508 // destroy the cache1509 if ( isnode ) {1510 jquery .cleandata( [ elem ], true );1511 // use delete when supported for expandos or `cache` is not a window per iswindow (#10080)1512 } else if ( jquery .support.deleteexpando || cache != cache.window ) {1513 delete cache[ id ];1514 // when all else fails, null1515 } else {1516 cache[ id ] = null;1517 }1518}1519jquery .extend({1520 cache: {},1521 // unique for each copy of jquery on the page1522 // non-digits removed to match rinlinejquery1523 expando: "jquery " + ( core_version + math.random() ).replace( /\d/g, "" ),1524 // the following elements throw uncatchable exceptions if you1525 // attempt to add expando properties to them.1526 nodata: {1527 "embed": true,1528 // ban all objects except for flash (which handle expandos)1529 "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",1530 "applet": true1531 },1532 hasdata: function( elem ) {1533 elem = elem.nodetype ? jquery .cache[ elem[jquery .expando] ] : elem[ jquery .expando ];1534 return !!elem && !isemptydataobject( elem );1535 },1536 data: function( elem, name, data ) {1537 return internaldata( elem, name, data );1538 },1539 removedata: function( elem, name ) {1540 return internalremovedata( elem, name );1541 },1542 // for internal use only.1543 _data: function( elem, name, data ) {1544 return internaldata( elem, name, data, true );1545 },1546 _removedata: function( elem, name ) {1547 return internalremovedata( elem, name, true );1548 },1549 // a method for determining if a dom node can handle the data expando1550 acceptdata: function( elem ) {1551 // do not set data on non-element because it will not be cleared (#8335).1552 if ( elem.nodetype && elem.nodetype !== 1 && elem.nodetype !== 9 ) {1553 return false;1554 }1555 var nodata = elem.nodename && jquery .nodata[ elem.nodename.tolowercase() ];1556 // nodes accept data unless otherwise specified; rejection can be conditional1557 return !nodata || nodata !== true && elem.getattribute("classid") === nodata;1558 }1559});1560jquery .fn.extend({1561 data: function( key, value ) {1562 var attrs, name,1563 elem = this[0],1564 i = 0,1565 data = null;1566 // gets all values1567 if ( key === undefined ) {1568 if ( this.length ) {1569 data = jquery .data( elem );1570 if ( elem.nodetype === 1 && !jquery ._data( elem, "parsedattrs" ) ) {1571 attrs = elem.attributes;1572 for ( ; i < attrs.length; i++ ) {1573 name = attrs[i].name;1574 if ( !name.indexof( "data-" ) ) {1575 name = jquery .camelcase( name.slice(5) );1576 dataattr( elem, name, data[ name ] );1577 }1578 }1579 jquery ._data( elem, "parsedattrs", true );1580 }1581 }1582 return data;1583 }1584 // sets multiple values1585 if ( typeof key === "object" ) {1586 return this.each(function() {1587 jquery .data( this, key );1588 });1589 }1590 return jquery .access( this, function( value ) {1591 if ( value === undefined ) {1592 // try to fetch any internally stored data first1593 return elem ? dataattr( elem, key, jquery .data( elem, key ) ) : null;1594 }1595 this.each(function() {1596 jquery .data( this, key, value );1597 });1598 }, null, value, arguments.length > 1, null, true );1599 },1600 removedata: function( key ) {1601 return this.each(function() {1602 jquery .removedata( this, key );1603 });1604 }1605});1606function dataattr( elem, key, data ) {1607 //如果在内心什么都没有找到,尝试接收任何数据1608 //数据从html5到任何类型1609 if ( data === undefined && elem.nodetype === 1 ) {1610 var name = "data-" + key.replace( rmultidash, "-$1" ).tolowercase();1611 data = elem.getattribute( name );1612 if ( typeof data === "string" ) {//如果数据类型为字符串1613 try {1614 data = data === "true" ? true ://如果数据等于【true】将true赋值给变量【data】否则执行下一步1615 data === "false" ? false :1616 data === "null" ? null :1617 // only convert to a number if it doesn't change the string1618 +data + "" === data ? +data :1619 rbrace.test( data ) ? jquery .parsejs on( data ) :1620 data;//这三元运算表达式真复杂!!!1621 //test函数:检索为字符串的数据是否匹配1622 //parsejs on函数:接收一个js on字符串,返回解析后的对象1623 } catch( e ) {}1624 // make sure we set the data so it isn't changed later1625 // 确认我们设定数据所以它在稍后不会被改变1626 jquery .data( elem, key, data );1627 } else {1628 data = undefined;1629 }1630 }1631 return data;1632}1633// checks a cache object for emptiness1634function isemptydataobject( obj ) {1635 var name;1636 for ( name in obj ) {1637 // if the public data object is empty, the private is still empty1638 if ( name === "data" && jquery .isemptyobject( obj[name] ) ) {1639 continue;1640 }1641 if ( name !== "tojs on" ) {1642 return false;1643 }1644 }1645 return true;1646}1647jquery .extend({1648 queue: function( elem, type, data ) {1649 var queue;1650 if ( elem ) {1651 type = ( type || "fx" ) + "queue";1652 queue = jquery ._data( elem, type );1653 // speed up dequeue by getting out quickly if this is just a lookup1654 if ( data ) {1655 if ( !queue || jquery .isarray(data) ) {1656 queue = jquery ._data( elem, type, jquery .makearray(data) );1657 } else {1658 queue.push( data );1659 }1660 }1661 return queue || [];1662 }1663 },1664 dequeue: function( elem, type ) {1665 type = type || "fx";1666 var queue = jquery .queue( elem, type ),1667 startlength = queue.length,1668 fn = queue.shift(),1669 hooks = jquery ._queuehooks( elem, type ),1670 next = function() {1671 jquery .dequeue( elem, type );1672 };1673 // if the fx queue is dequeued, always remove the progress sentinel1674 if ( fn === "inprogress" ) {1675 fn = queue.shift();1676 startlength--;1677 }1678 hooks.cur = fn;1679 if ( fn ) {1680 // add a progress sentinel to prevent the fx queue from being1681 // automatically dequeued1682 if ( type === "fx" ) {1683 queue.unshift( "inprogress" );1684 }1685 // clear up the last queue stop function1686 // 清理最后的队列停止功能1687 delete hooks.stop;1688 fn.call( elem, next, hooks );1689 }1690 if ( !startlength && hooks ) {1691 hooks.empty.fire();1692 }1693 },1694 // not intended for public consumption - generates a queuehooks object, or returns the current one1695 _queuehooks: function( elem, type ) {1696 var key = type + "queuehooks";1697 return jquery ._data( elem, key ) || jquery ._data( elem, key, {1698 empty: jquery .callbacks("once memory").add(function() {1699 jquery ._removedata( elem, type + "queue" );1700 jquery ._removedata( elem, key );1701 })1702 });1703 }1704});1705jquery .fn.extend({1706 queue: function( type, data ) {1707 var setter = 2;1708 if ( typeof type !== "string" ) {1709 data = type;1710 type = "fx";1711 setter--;1712 }1713 if ( arguments.length < setter ) {1714 return jquery .queue( this[0], type );1715 }1716 return data === undefined ?1717 this :1718 this.each(function() {1719 var queue = jquery .queue( this, type, data );1720 // ensure a hooks for this queue1721 jquery ._queuehooks( this, type );1722 if ( type === "fx" && queue[0] !== "inprogress" ) {1723 jquery .dequeue( this, type );1724 }1725 });1726 },1727 dequeue: function( type ) {1728 return this.each(function() {1729 jquery .dequeue( this, type );1730 });1731 },1732 // based off of the plugin by clint helfers, with permission.1733 // http://blindsignals.com/index.php/2009/07/jquery -delay/1734 delay: function( time, type ) {1735 time = jquery .fx ? jquery .fx.speeds[ time ] || time : time;1736 type = type || "fx";1737 return this.queue( type, function( next, hooks ) {1738 var timeout = settimeout( next, time );1739 hooks.stop = function() {1740 cleartimeout( timeout );1741 };1742 });1743 },1744 clearqueue: function( type ) {1745 return this.queue( type || "fx", [] );1746 },1747 // get a promise resolved when queues of a certain type1748 // are emptied (fx is the type by default)1749 promise: function( type, obj ) {1750 var tmp,1751 count = 1,1752 defer = jquery .deferred(),1753 elements = this,1754 i = this.length,1755 resolve = function() {1756 if ( !( --count ) ) {1757 defer.resolvewith( elements, [ elements ] );1758 }1759 };1760 if ( typeof type !== "string" ) {1761 obj = type;1762 type = undefined;1763 }1764 type = type || "fx";1765 while( i-- ) {1766 tmp = jquery ._data( elements[ i ], type + "queuehooks" );1767 if ( tmp && tmp.empty ) {1768 count++;1769 tmp.empty.add( resolve );1770 }1771 }1772 resolve();1773 return defer.promise( obj );1774 }1775});1776var nodehook, boolhook,1777 rclass = /[\t\r\n]/g,1778 rreturn = /\r/g,1779 rfocusable = /^(?:input|select|textarea|button|object)$/i,1780 rclickable = /^(?:a|area)$/i,1781 rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,1782 rusedefault = /^(?:checked|selected)$/i,1783 getsetattribute = jquery .support.getsetattribute,1784 getsetinput = jquery .support.input;1785jquery .fn.extend({1786 attr: function( name, value ) {1787 return jquery .access( this, jquery .attr, name, value, arguments.length > 1 );1788 },1789 removeattr: function( name ) {1790 return this.each(function() {1791 jquery .removeattr( this, name );1792 });1793 },1794 prop: function( name, value ) {1795 return jquery .access( this, jquery .prop, name, value, arguments.length > 1 );1796 },1797 removeprop: function( name ) {1798 name = jquery .propfix[ name ] || name;1799 return this.each(function() {1800 // try/catch handles cases where ie balks (such as removing a property on window)1801 try {1802 this[ name ] = undefined;1803 delete this[ name ];1804 } catch( e ) {}1805 });1806 },1807 addclass: function( value ) {1808 var classes, elem, cur, clazz, j,1809 i = 0,1810 len = this.length,1811 proceed = typeof value === "string" && value;1812 if ( jquery .isfunction( value ) ) {1813 return this.each(function( j ) {1814 jquery ( this ).addclass( value.call( this, j, this.classname ) );1815 });1816 }1817 if ( proceed ) {1818 // the disjunction here is for better compressibility (see removeclass)1819 classes = ( value || "" ).match( core_rnotwhite ) || [];1820 for ( ; i < len; i++ ) {1821 elem = this[ i ];1822 cur = elem.nodetype === 1 && ( elem.classname ?1823 ( " " + elem.classname + " " ).replace( rclass, " " ) :1824 " "1825 );1826 if ( cur ) {1827 j = 0;1828 while ( (clazz = classes[j++]) ) {1829 if ( cur.indexof( " " + clazz + " " ) < 0 ) {1830 cur += clazz + " ";1831 }1832 }1833 elem.classname = jquery .trim( cur );1834 }1835 }1836 }1837 return this;1838 },1839 removeclass: function( value ) {1840 var classes, elem, cur, clazz, j,1841 i = 0,1842 len = this.length,1843 proceed = arguments.length === 0 || typeof value === "string" && value;1844 if ( jquery .isfunction( value ) ) {1845 return this.each(function( j ) {1846 jquery ( this ).removeclass( value.call( this, j, this.classname ) );1847 });1848 }1849 if ( proceed ) {1850 classes = ( value || "" ).match( core_rnotwhite ) || [];1851 for ( ; i < len; i++ ) {1852 elem = this[ i ];1853 // this expression is here for better compressibility (see addclass)1854 cur = elem.nodetype === 1 && ( elem.classname ?1855 ( " " + elem.classname + " " ).replace( rclass, " " ) :1856 ""1857 );1858 if ( cur ) {1859 j = 0;1860 while ( (clazz = classes[j++]) ) {1861 // remove *all* instances1862 while ( cur.indexof( " " + clazz + " " ) >= 0 ) {1863 cur = cur.replace( " " + clazz + " ", " " );1864 }1865 }1866 elem.classname = value ? jquery .trim( cur ) : "";1867 }1868 }1869 }1870 return this;1871 },1872 toggleclass: function( value, stateval ) {1873 var type = typeof value,1874 isbool = typeof stateval === "boolean";1875 if ( jquery .isfunction( value ) ) {1876 return this.each(function( i ) {1877 jquery ( this ).toggleclass( value.call(this, i, this.classname, stateval), stateval );1878 });1879 }1880 return this.each(function() {1881 if ( type === "string" ) {1882 // toggle individual class names1883 var classname,1884 i = 0,1885 self = jquery ( this ),1886 state = stateval,1887 classnames = value.match( core_rnotwhite ) || [];1888 while ( (classname = classnames[ i++ ]) ) {1889 // check each classname given, space separated list1890 state = isbool ? state : !self.hasclass( classname );1891 self[ state ? "addclass" : "removeclass" ]( classname );1892 }1893 // toggle whole class name1894 } else if ( type === core_strundefined || type === "boolean" ) {1895 if ( this.classname ) {1896 // store classname if set1897 jquery ._data( this, "__classname__", this.classname );1898 }1899 // if the element has a class name or if we're passed "false",1900 // then remove the whole classname (if there was one, the above saved it).1901 // otherwise bring back whatever was previously saved (if anything),1902 // falling back to the empty string if nothing was stored.1903 this.classname = this.classname || value === false ? "" : jquery ._data( this, "__classname__" ) || "";1904 }1905 });1906 },1907 hasclass: function( selector ) {1908 var classname = " " + selector + " ",1909 i = 0,1910 l = this.length;1911 for ( ; i < l; i++ ) {1912 if ( this[i].nodetype === 1 && (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) >= 0 ) {1913 return true;1914 }1915 }1916 return false;1917 },1918 val: function( value ) {1919 var ret, hooks, isfunction,1920 elem = this[0];1921 if ( !arguments.length ) {1922 if ( elem ) {1923 hooks = jquery .valhooks[ elem.type ] || jquery .valhooks[ elem.nodename.tolowercase() ];1924 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {1925 return ret;1926 }1927 ret = elem.value;1928 return typeof ret === "string" ?1929 // handle most common string cases1930 ret.replace(rreturn, "") :1931 // handle cases where value is null/undef or number1932 ret == null ? "" : ret;1933 }1934 return;1935 }1936 isfunction = jquery .isfunction( value );1937 return this.each(function( i ) {1938 var val,1939 self = jquery (this);1940 if ( this.nodetype !== 1 ) {1941 return;1942 }1943 if ( isfunction ) {1944 val = value.call( this, i, self.val() );1945 } else {1946 val = value;1947 }1948 // treat null/undefined as ""; convert numbers to string1949 if ( val == null ) {1950 val = "";1951 } else if ( typeof val === "number" ) {1952 val += "";1953 } else if ( jquery .isarray( val ) ) {1954 val = jquery .map(val, function ( value ) {1955 return value == null ? "" : value + "";1956 });1957 }1958 hooks = jquery .valhooks[ this.type ] || jquery .valhooks[ this.nodename.tolowercase() ];1959 // if set returns undefined, fall back to normal setting1960 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {1961 this.value = val;1962 }1963 });1964 }1965});1966jquery .extend({1967 valhooks: {1968 option: {1969 get: function( elem ) {1970 // attributes.value is undefined in blackberry 4.7 but1971 // uses .value. see #69321972 var val = elem.attributes.value;1973 return !val || val.specified ? elem.value : elem.text;1974 }1975 },1976 select: {1977 get: function( elem ) {1978 var value, option,1979 options = elem.options,1980 index = elem.selectedindex,1981 one = elem.type === "select-one" || index < 0,1982 values = one ? null : [],1983 max = one ? index + 1 : options.length,1984 i = index < 0 ?1985 max :1986 one ? index : 0;1987 // loop through all the selected options1988 for ( ; i < max; i++ ) {1989 option = options[ i ];1990 // oldie doesn't update selected after form reset (#2551)1991 if ( ( option.selected || i === index ) &&1992 // don't return options that are disabled or in a disabled optgroup1993 ( jquery .support.optdisabled ? !option.disabled : option.getattribute("disabled") === null ) &&1994 ( !option.parentnode.disabled || !jquery .nodename( option.parentnode, "optgroup" ) ) ) {1995 // get the specific value for the option1996 value = jquery ( option ).val();1997 // we don't need an array for one selects1998 if ( one ) {1999 return value;2000 }2001 // multi-selects return an array2002 values.push( value );2003 }2004 }2005 return values;2006 },2007 set: function( elem, value ) {2008 var values = jquery .makearray( value );2009 jquery (elem).find("option").each(function() {2010 this.selected = jquery .inarray( jquery (this).val(), values ) >= 0;2011 });2012 if ( !values.length ) {2013 elem.selectedindex = -1;2014 }2015 return values;2016 }2017 }2018 },2019 attr: function( elem, name, value ) {2020 var hooks, notxml, ret,2021 ntype = elem.nodetype;2022 // don't get/set attributes on text, comment and attribute nodes2023 if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) {2024 return;2025 }2026 // fallback to prop when attributes are not supported2027 if ( typeof elem.getattribute === core_strundefined ) {2028 return jquery .prop( elem, name, value );2029 }2030 notxml = ntype !== 1 || !jquery .isxmldoc( elem );2031 // all attributes are lowercase2032 // grab necessary hook if one is defined2033 if ( notxml ) {2034 name = name.tolowercase();2035 hooks = jquery .attrhooks[ name ] || ( rboolean.test( name ) ? boolhook : nodehook );2036 }2037 if ( value !== undefined ) {2038 if ( value === null ) {2039 jquery .removeattr( elem, name );2040 } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {2041 return ret;2042 } else {2043 elem.setattribute( name, value + "" );2044 return value;2045 }2046 } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {2047 return ret;2048 } else {2049 // in ie9+, flash objects don't have .getattribute (#12945)2050 // support: ie9+2051 if ( typeof elem.getattribute !== core_strundefined ) {2052 ret = elem.getattribute( name );2053 }2054 // non-existent attributes return null, we normalize to undefined2055 return ret == null ?2056 undefined :2057 ret;2058 }2059 },2060 removeattr: function( elem, value ) {2061 var name, propname,2062 i = 0,2063 attrnames = value && value.match( core_rnotwhite );2064 if ( attrnames && elem.nodetype === 1 ) {2065 while ( (name = attrnames[i++]) ) {2066 propname = jquery .propfix[ name ] || name;2067 // boolean attributes get special treatment (#10870)2068 if ( rboolean.test( name ) ) {2069 // set corresponding property to false for boolean attributes2070 // also clear defaultchecked/defaultselected (if appropriate) for ie<82071 if ( !getsetattribute && rusedefault.test( name ) ) {2072 elem[ jquery .camelcase( "default-" + name ) ] =2073 elem[ propname ] = false;2074 } else {2075 elem[ propname ] = false;2076 }2077 // see #9699 for explanation of this approach (setting first, then removal)2078 } else {2079 jquery .attr( elem, name, "" );2080 }2081 elem.removeattribute( getsetattribute ? name : propname );2082 }2083 }2084 },2085 attrhooks: {2086 type: {2087 set: function( elem, value ) {2088 if ( !jquery .support.radiovalue && value === "radio" && jquery .nodename(elem, "input") ) {2089 // setting the type on a radio button after the value resets the value in ie6-92090 // reset value to default in case type is set after value during creation2091 var val = elem.value;2092 elem.setattribute( "type", value );2093 if ( val ) {2094 elem.value = val;2095 }2096 return value;2097 }2098 }2099 }2100 },2101 propfix: {2102 tabindex: "tabindex",2103 readonly: "readonly",2104 "for": "htmlfor",2105 "class": "classname",2106 maxlength: "maxlength",2107 cellspacing: "cellspacing",2108 cellpadding: "cellpadding",2109 rowspan: "rowspan",2110 colspan: "colspan",2111 usemap: "usemap",2112 frameborder: "frameborder",2113 contenteditable: "contenteditable"2114 },2115 prop: function( elem, name, value ) {2116 var ret, hooks, notxml,2117 ntype = elem.nodetype;2118 // don't get/set properties on text, comment and attribute nodes2119 if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) {2120 return;2121 }2122 notxml = ntype !== 1 || !jquery .isxmldoc( elem );2123 if ( notxml ) {2124 // fix name and attach hooks2125 name = jquery .propfix[ name ] || name;2126 hooks = jquery .prophooks[ name ];2127 }2128 if ( value !== undefined ) {2129 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {2130 return ret;2131 } else {2132 return ( elem[ name ] = value );2133 }2134 } else {2135 if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {2136 return ret;2137 } else {2138 return elem[ name ];2139 }2140 }2141 },2142 prophooks: {2143 tabindex: {2144 get: function( elem ) {2145 // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set2146 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/2147 var attributenode = elem.getattributenode("tabindex");2148 return attributenode && attributenode.specified ?2149 parseint( attributenode.value, 10 ) :2150 rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ?2151 0 :2152 undefined;2153 }2154 }2155 }2156});2157// hook for boolean attributes2158boolhook = {2159 get: function( elem, name ) {2160 var2161 // use .prop to determine if this attribute is understood as boolean2162 prop = jquery .prop( elem, name ),2163 // fetch it accordingly2164 attr = typeof prop === "boolean" && elem.getattribute( name ),2165 detail = typeof prop === "boolean" ?2166 getsetinput && getsetattribute ?2167 attr != null :2168 // oldie fabricates an empty string for missing boolean attributes2169 // and conflates checked/selected into attroperties2170 rusedefault.test( name ) ?2171 elem[ jquery .camelcase( "default-" + name ) ] :2172 !!attr :2173 // fetch an attribute node for properties not recognized as boolean2174 elem.getattributenode( name );2175 return detail && detail.value !== false ?2176 name.tolowercase() :2177 undefined;2178 },2179 set: function( elem, value, name ) {2180 if ( value === false ) {2181 // remove boolean attributes when set to false2182 jquery .removeattr( elem, name );2183 } else if ( getsetinput && getsetattribute || !rusedefault.test( name ) ) {2184 // ie<8 needs the *property* name2185 elem.setattribute( !getsetattribute && jquery .propfix[ name ] || name, name );2186 // use defaultchecked and defaultselected for oldie2187 } else {2188 elem[ jquery .camelcase( "default-" + name ) ] = elem[ name ] = true;2189 }2190 return name;2191 }2192};2193// fix oldie value attroperty2194if ( !getsetinput || !getsetattribute ) {2195 jquery .attrhooks.value = {2196 get: function( elem, name ) {2197 var ret = elem.getattributenode( name );2198 return jquery .nodename( elem, "input" ) ?2199 // ignore the value *property* by using defaultvalue2200 elem.defaultvalue :2201 ret && ret.specified ? ret.value : undefined;2202 },2203 set: function( elem, value, name ) {2204 if ( jquery .nodename( elem, "input" ) ) {2205 // does not return so that setattribute is also used2206 elem.defaultvalue = value;2207 } else {2208 // use nodehook if defined (#1954); otherwise setattribute is fine2209 return nodehook && nodehook.set( elem, value, name );2210 }2211 }2212 };2213}2214// ie6/7 do not support getting/setting some attributes with get/setattribute2215if ( !getsetattribute ) {2216 // use this for any attribute in ie6/72217 // this fixes almost every ie6/7 issue2218 nodehook = jquery .valhooks.button = {2219 get: function( elem, name ) {2220 var ret = elem.getattributenode( name );2221 return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?2222 ret.value :2223 undefined;2224 },2225 set: function( elem, value, name ) {2226 // set the existing or create a new attribute node2227 var ret = elem.getattributenode( name );2228 if ( !ret ) {2229 elem.setattributenode(2230 (ret = elem.ownerdocument.createattribute( name ))2231 );2232 }2233 ret.value = value += "";2234 // break association with cloned elements by also using setattribute (#9646)2235 return name === "value" || value === elem.getattribute( name ) ?2236 value :2237 undefined;2238 }2239 };2240 // set contenteditable to false on removals(#10429)2241 // setting to empty string throws an error as an invalid value2242 jquery .attrhooks.contenteditable = {2243 get: nodehook.get,2244 set: function( elem, value, name ) {2245 nodehook.set( elem, value === "" ? false : value, name );2246 }2247 };2248 // set width and height to auto instead of 0 on empty string( bug #8150 )2249 // this is for removals2250 jquery .each([ "width", "height" ], function( i, name ) {2251 jquery .attrhooks[ name ] = jquery .extend( jquery .attrhooks[ name ], {2252 set: function( elem, value ) {2253 if ( value === "" ) {2254 elem.setattribute( name, "auto" );2255 return value;2256 }2257 }2258 });2259 });2260}2261// some attributes require a special call on ie2262// http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx2263if ( !jquery .support.hrefnormalized ) {2264 jquery .each([ "href", "src", "width", "height" ], function( i, name ) {2265 jquery .attrhooks[ name ] = jquery .extend( jquery .attrhooks[ name ], {2266 get: function( elem ) {2267 var ret = elem.getattribute( name, 2 );2268 return ret == null ? undefined : ret;2269 }2270 });2271 });2272 // href/src property should get the full normalized url (#10299/#12915)2273 jquery .each([ "href", "src" ], function( i, name ) {2274 jquery .prophooks[ name ] = {2275 get: function( elem ) {2276 return elem.getattribute( name, 4 );2277 }2278 };2279 });2280}2281if ( !jquery .support.style ) {2282 jquery .attrhooks.style = {2283 get: function( elem ) {2284 // return undefined in the case of empty string2285 // note: ie uppercases css property names, but if we were to .tolowercase()2286 // .csstext, that would destroy case senstitivity in url's, like in "background"2287 return elem.style.csstext || undefined;2288 },2289 set: function( elem, value ) {2290 return ( elem.style.csstext = value + "" );2291 }2292 };2293}2294// safari mis-reports the default selected property of an option2295// accessing the parent's selectedindex property fixes it2296if ( !jquery .support.optselected ) {2297 jquery .prophooks.selected = jquery .extend( jquery .prophooks.selected, {2298 get: function( elem ) {2299 var parent = elem.parentnode;2300 if ( parent ) {2301 parent.selectedindex;2302 // make sure that it also works with optgroups, see #57012303 if ( parent.parentnode ) {2304 parent.parentnode.selectedindex;2305 }2306 }2307 return null;2308 }2309 });2310}2311// ie6/7 call enctype encoding2312if ( !jquery .support.enctype ) {2313 jquery .propfix.enctype = "encoding";2314}2315// radios and checkboxes getter/setter2316if ( !jquery .support.checkon ) {2317 jquery .each([ "radio", "checkbox" ], function() {2318 jquery .valhooks[ this ] = {2319 get: function( elem ) {2320 // handle the case where in webkit "" is returned instead of "on" if a value isn't specified2321 return elem.getattribute("value") === null ? "on" : elem.value;2322 }2323 };2324 });2325}2326jquery .each([ "radio", "checkbox" ], function() {2327 jquery .valhooks[ this ] = jquery .extend( jquery .valhooks[ this ], {2328 set: function( elem, value ) {2329 if ( jquery .isarray( value ) ) {2330 return ( elem.checked = jquery .inarray( jquery (elem).val(), value ) >= 0 );2331 }2332 }2333 });2334});2335var rformelems = /^(?:input|select|textarea)$/i,2336 rkeyevent = /^key/,2337 rmouseevent = /^(?:mouse|contextmenu)|click/,2338 rfocusmorph = /^(?:focusinfocus|focusoutblur)$/,2339 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;2340function returntrue() {2341 return true;2342}2343function returnfalse() {2344 return false;2345}2346/*2347 * helper functions for managing events -- not part of the public interface.2348 * props to dean edwards' addevent library for many of the ideas.2349 */2350jquery .event = {2351 global: {},2352 add: function( elem, types, handler, data, selector ) {2353 var tmp, events, t, handleobjin,2354 special, eventhandle, handleobj,2355 handlers, type, namespaces, origtype,2356 elemdata = jquery ._data( elem );2357 // don't attach events to nodata or text/comment nodes (but allow plain objects)2358 if ( !elemdata ) {2359 return;2360 }2361 // caller can pass in an object of custom data in lieu of the handler2362 if ( handler.handler ) {2363 handleobjin = handler;2364 handler = handleobjin.handler;2365 selector = handleobjin.selector;2366 }2367 // make sure that the handler has a unique id, used to find/remove it later2368 if ( !handler.guid ) {2369 handler.guid = jquery .guid++;2370 }2371 // init the element's event structure and main handler, if this is the first2372 if ( !(events = elemdata.events) ) {2373 events = elemdata.events = {};2374 }2375 if ( !(eventhandle = elemdata.handle) ) {2376 eventhandle = elemdata.handle = function( e ) {2377 // discard the second event of a jquery .event.trigger() and2378 // when an event is called after a page has unloaded2379 return typeof jquery !== core_strundefined && (!e || jquery .event.triggered !== e.type) ?2380 jquery .event.dispatch.apply( eventhandle.elem, arguments ) :2381 undefined;2382 };2383 // add elem as a property of the handle fn to prevent a memory leak with ie non-native events2384 eventhandle.elem = elem;2385 }2386 // handle multiple events separated by a space2387 // jquery (...).bind("mouseover mouseout", fn);2388 types = ( types || "" ).match( core_rnotwhite ) || [""];2389 t = types.length;2390 while ( t-- ) {2391 tmp = rtypenamespace.exec( types[t] ) || [];2392 type = origtype = tmp[1];2393 namespaces = ( tmp[2] || "" ).split( "." ).sort();2394 // if event changes its type, use the special event handlers for the changed type2395 special = jquery .event.special[ type ] || {};2396 // if selector defined, determine special event api type, otherwise given type2397 type = ( selector ? special.delegatetype : special.bindtype ) || type;2398 // update special based on newly reset type2399 special = jquery .event.special[ type ] || {};2400 // handleobj is passed to all event handlers2401 handleobj = jquery .extend({2402 type: type,2403 origtype: origtype,2404 data: data,2405 handler: handler,2406 guid: handler.guid,2407 selector: selector,2408 needscontext: selector && jquery .expr.match.needscontext.test( selector ),2409 namespace: namespaces.join(".")2410 }, handleobjin );2411 // init the event handler queue if we're the first2412 if ( !(handlers = events[ type ]) ) {2413 handlers = events[ type ] = [];2414 handlers.delegatecount = 0;2415 // only use addeventlistener/attachevent if the special events handler returns false2416 if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) {2417 // bind the global event handler to the element2418 if ( elem.addeventlistener ) {2419 elem.addeventlistener( type, eventhandle, false );2420 } else if ( elem.attachevent ) {2421 elem.attachevent( "on" + type, eventhandle );2422 }2423 }2424 }2425 if ( special.add ) {2426 special.add.call( elem, handleobj );2427 if ( !handleobj.handler.guid ) {2428 handleobj.handler.guid = handler.guid;2429 }2430 }2431 // add to the element's handler list, delegates in front2432 if ( selector ) {2433 handlers.splice( handlers.delegatecount++, 0, handleobj );2434 } else {2435 handlers.push( handleobj );2436 }2437 // keep track of which events have ever been used, for event optimization2438 jquery .event.global[ type ] = true;2439 }2440 // nullify elem to prevent memory leaks in ie2441 elem = null;2442 },2443 // detach an event or set of events from an element2444 remove: function( elem, types, handler, selector, mappedtypes ) {2445 var j, handleobj, tmp,2446 origcount, t, events,2447 special, handlers, type,2448 namespaces, origtype,2449 elemdata = jquery .hasdata( elem ) && jquery ._data( elem );2450 if ( !elemdata || !(events = elemdata.events) ) {2451 return;2452 }2453 // once for each type.namespace in types; type may be omitted2454 types = ( types || "" ).match( core_rnotwhite ) || [""];2455 t = types.length;2456 while ( t-- ) {2457 tmp = rtypenamespace.exec( types[t] ) || [];2458 type = origtype = tmp[1];2459 namespaces = ( tmp[2] || "" ).split( "." ).sort();2460 // unbind all events (on this namespace, if provided) for the element2461 if ( !type ) {2462 for ( type in events ) {2463 jquery .event.remove( elem, type + types[ t ], handler, selector, true );2464 }2465 continue;2466 }2467 special = jquery .event.special[ type ] || {};2468 type = ( selector ? special.delegatetype : special.bindtype ) || type;2469 handlers = events[ type ] || [];2470 tmp = tmp[2] && new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );2471 // remove matching events2472 origcount = j = handlers.length;2473 while ( j-- ) {2474 handleobj = handlers[ j ];2475 if ( ( mappedtypes || origtype === handleobj.origtype ) &&2476 ( !handler || handler.guid === handleobj.guid ) &&2477 ( !tmp || tmp.test( handleobj.namespace ) ) &&2478 ( !selector || selector === handleobj.selector || selector === "**" && handleobj.selector ) ) {2479 handlers.splice( j, 1 );2480 if ( handleobj.selector ) {2481 handlers.delegatecount--;2482 }2483 if ( special.remove ) {2484 special.remove.call( elem, handleobj );2485 }2486 }2487 }2488 // remove generic event handler if we removed something and no more handlers exist2489 // (avoids potential for endless recursion during removal of special event handlers)2490 if ( origcount && !handlers.length ) {2491 if ( !special.teardown || special.teardown.call( elem, namespaces, elemdata.handle ) === false ) {2492 jquery .removeevent( elem, type, elemdata.handle );2493 }2494 delete events[ type ];2495 }2496 }2497 // remove the expando if it's no longer used2498 if ( jquery .isemptyobject( events ) ) {2499 delete elemdata.handle;2500 // removedata also checks for emptiness and clears the expando if empty2501 // so use it instead of delete2502 jquery ._removedata( elem, "events" );2503 }2504 },2505 trigger: function( event, data, elem, onlyhandlers ) {2506 var handle, ontype, cur,2507 bubbletype, special, tmp, i,2508 eventpath = [ elem || document ],2509 type = core_hasown.call( event, "type" ) ? event.type : event,2510 namespaces = core_hasown.call( event, "namespace" ) ? event.namespace.split(".") : [];2511 cur = tmp = elem = elem || document;2512 // don't do events on text and comment nodes2513 // 不要在文本和内容节点上做事件2514 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {2515 return;2516 }2517 // focus/blur morphs to focus in/out; ensure we're not firing them right now2518 // 聚焦/模糊 改变为了聚焦 内/外;确保我们现在没有解雇他们(这里fire中文怎么翻译暂时没想好,先翻译为解雇)2519 if ( rfocusmorph.test( type + jquery .event.triggered ) ) {2520 return;2521 }2522 if ( type.indexof(".") >= 0 ) {2523 // namespaced trigger; create a regexp to match event type in handle()2524 // 命名空间触发;用handle()函数创建一个正则表达式匹配的事件类型2525 namespaces = type.split(".");2526 type = namespaces.shift();2527 namespaces.sort();2528 }2529 ontype = type.indexof(":") < 0 && "on" + type;2530 // caller can pass in a jquery .event object, object, or just an event type string2531 // 访问者可以通过一个jquery 事件对象,对象,或者只是一个事件类型字符串2532 event = event[ jquery .expando ] ?2533 event :2534 new jquery .event( type, typeof event === "object" && event );2535 event.istrigger = true;2536 event.namespace = namespaces.join(".");2537 // 用符号(.)将命名空间连接起来2538 event.namespace_re = event.namespace ?2539 new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :2540 null;2541 // clean up the event in case it is being reused2542 // 清理事件以免它被重用2543 event.result = undefined;2544 if ( !event.target ) {2545 event.target = elem;2546 }2547 // clone any incoming data and prepend the event, creating the handler arg list2548 // 克隆任何输入的数据并且前面加上事件,创建处理程序的参数列表2549 data = data == null ?2550 [ event ] :2551 jquery .makearray( data, [ event ] );2552 // allow special events to draw outside the lines2553 // 允许特殊事件为了利用外部的线(draw outside the lines暂时按字面翻译)2554 special = jquery .event.special[ type ] || {};2555 if ( !onlyhandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {2556 return;2557 }2558 // determine event propagation path in advance, per w3c events spec (#9951)2559 // 提前确定事件的传输路径,根据w3c事件标准(#9951)2560 // bubble up to document, then to window; watch for a global ownerdocument var (#9724)2561 // bubble up(冒泡)对文档,然后对window; 观察一个全局ownerdocument变量(#9724)2562 if ( !onlyhandlers && !special.nobubble && !jquery .iswindow( elem ) ) {2563 bubbletype = special.delegatetype || type;2564 if ( !rfocusmorph.test( bubbletype + type ) ) {2565 cur = cur.parentnode;2566 }2567 for ( ; cur; cur = cur.parentnode ) {2568 eventpath.push( cur );2569 tmp = cur;2570 }2571 // only add window if we got to document (e.g., not plain obj or detached dom)2572 if ( tmp === (elem.ownerdocument || document) ) {2573 eventpath.push( tmp.defaultview || tmp.parentwindow || window );2574 }2575 }2576 // fire handlers on the event path2577 // 在事件的处理途径上解雇处理者(fire handlers暂时译为:解雇处理者,没想到更好的翻译)2578 i = 0;2579 while ( (cur = eventpath[i++]) && !event.ispropagationstopped() ) {2580 event.type = i > 1 ?2581 bubbletype :2582 special.bindtype || type;2583 // jquery handler2584 // jquery 处理2585 handle = ( jquery ._data( cur, "events" ) || {} )[ event.type ] && jquery ._data( cur, "handle" );2586 if ( handle ) {2587 handle.apply( cur, data );2588 }2589 // native handler2590 // native处理2591 handle = ontype && cur[ ontype ];2592 if ( handle && jquery .acceptdata( cur ) && handle.apply && handle.apply( cur, data ) === false ) {2593 event.preventdefault();2594 }2595 }2596 event.type = type;2597 // if nobody prevented the default action, do it now2598 if ( !onlyhandlers && !event.isdefaultprevented() ) {2599 if ( (!special._default || special._default.apply( elem.ownerdocument, data ) === false) &&2600 !(type === "click" && jquery .nodename( elem, "a" )) && jquery .acceptdata( elem ) ) {2601 // call a native dom method on the target with the same name name as the event.2602 // can't use an .isfunction() check here because ie6/7 fails that test.2603 // don't do default actions on window, that's where global variables be (#6170)2604 if ( ontype && elem[ type ] && !jquery .iswindow( elem ) ) {2605 // don't re-trigger an onfoo event when we call its foo() method2606 tmp = elem[ ontype ];2607 if ( tmp ) {2608 elem[ ontype ] = null;2609 }2610 // prevent re-triggering of the same event, since we already bubbled it above2611 jquery .event.triggered = type;2612 try {2613 elem[ type ]();2614 } catch ( e ) {2615 // ie<9 dies on focus/blur to hidden element (#1486,#12518)2616 // only reproducible on winxp ie8 native, not ie9 in ie8 mode2617 }2618 jquery .event.triggered = undefined;2619 if ( tmp ) {2620 elem[ ontype ] = tmp;2621 }2622 }2623 }2624 }2625 return event.result;2626 },2627 dispatch: function( event ) {2628 // make a writable jquery .event from the native event object2629 event = jquery .event.fix( event );2630 var i, ret, handleobj, matched, j,2631 handlerqueue = [],2632 args = core_slice.call( arguments ),2633 handlers = ( jquery ._data( this, "events" ) || {} )[ event.type ] || [],2634 special = jquery .event.special[ event.type ] || {};2635 // use the fix-ed jquery .event rather than the (read-only) native event2636 args[0] = event;2637 event.delegatetarget = this;2638 // call the predispatch hook for the mapped type, and let it bail if desired2639 if ( special.predispatch && special.predispatch.call( this, event ) === false ) {2640 return;2641 }2642 // determine handlers2643 handlerqueue = jquery .event.handlers.call( this, event, handlers );2644 // run delegates first; they may want to stop propagation beneath us2645 i = 0;2646 while ( (matched = handlerqueue[ i++ ]) && !event.ispropagationstopped() ) {2647 event.currenttarget = matched.elem;2648 j = 0;2649 while ( (handleobj = matched.handlers[ j++ ]) && !event.isimmediatepropagationstopped() ) {2650 // triggered event must either 1) have no namespace, or2651 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).2652 if ( !event.namespace_re || event.namespace_re.test( handleobj.namespace ) ) {2653 event.handleobj = handleobj;2654 event.data = handleobj.data;2655 ret = ( (jquery .event.special[ handleobj.origtype ] || {}).handle || handleobj.handler )2656 .apply( matched.elem, args );2657 if ( ret !== undefined ) {2658 if ( (event.result = ret) === false ) {2659 event.preventdefault();2660 event.stoppropagation();2661 }2662 }2663 }2664 }2665 }2666 // call the postdispatch hook for the mapped type2667 if ( special.postdispatch ) {2668 special.postdispatch.call( this, event );2669 }2670 return event.result;2671 },2672 handlers: function( event, handlers ) {2673 var sel, handleobj, matches, i,2674 handlerqueue = [],2675 delegatecount = handlers.delegatecount,2676 cur = event.target;2677 // find delegate handlers2678 // black-hole svg <use> instance trees (#13180)2679 // avoid non-left-click bubbling in firefox (#3861)2680 if ( delegatecount && cur.nodetype && (!event.button || event.type !== "click") ) {2681 for ( ; cur != this; cur = cur.parentnode || this ) {2682 // don't check non-elements (#13208)2683 // don't process clicks on disabled elements (#6911, #8165, #11382, #11764)2684 if ( cur.nodetype === 1 && (cur.disabled !== true || event.type !== "click") ) {2685 matches = [];2686 for ( i = 0; i < delegatecount; i++ ) {2687 handleobj = handlers[ i ];2688 // don't conflict with object.prototype properties (#13203)2689 sel = handleobj.selector + " ";2690 if ( matches[ sel ] === undefined ) {2691 matches[ sel ] = handleobj.needscontext ?2692 jquery ( sel, this ).index( cur ) >= 0 :2693 jquery .find( sel, this, null, [ cur ] ).length;2694 }2695 if ( matches[ sel ] ) {2696 matches.push( handleobj );2697 }2698 }2699 if ( matches.length ) {2700 handlerqueue.push({ elem: cur, handlers: matches });2701 }2702 }2703 }2704 }2705 // add the remaining (directly-bound) handlers2706 if ( delegatecount < handlers.length ) {2707 handlerqueue.push({ elem: this, handlers: handlers.slice( delegatecount ) });2708 }2709 return handlerqueue;2710 },2711 fix: function( event ) {2712 if ( event[ jquery .expando ] ) {2713 return event;2714 }2715 // create a writable copy of the event object and normalize some properties2716 var i, prop, copy,2717 type = event.type,2718 originalevent = event,2719 fixhook = this.fixhooks[ type ];2720 if ( !fixhook ) {2721 this.fixhooks[ type ] = fixhook =2722 rmouseevent.test( type ) ? this.mousehooks :2723 rkeyevent.test( type ) ? this.keyhooks :2724 {};2725 }2726 copy = fixhook.props ? this.props.concat( fixhook.props ) : this.props;2727 event = new jquery .event( originalevent );2728 i = copy.length;2729 while ( i-- ) {2730 prop = copy[ i ];2731 event[ prop ] = originalevent[ prop ];2732 }2733 // support: ie<92734 // fix target property (#1925)2735 if ( !event.target ) {2736 event.target = originalevent.srcelement || document;2737 }2738 // support: chrome 23+, safari?2739 // target should not be a text node (#504, #13143)2740 if ( event.target.nodetype === 3 ) {2741 event.target = event.target.parentnode;2742 }2743 // support: ie<92744 // for mouse/key events, metakey==false if it's undefined (#3368, #11328)2745 event.metakey = !!event.metakey;2746 return fixhook.filter ? fixhook.filter( event, originalevent ) : event;2747 },2748 // includes some event props shared by keyevent and mouseevent2749 props: "altkey bubbles cancelable ctrlkey currenttarget eventphase metakey relatedtarget shiftkey target timestamp view which".split(" "),2750 fixhooks: {},2751 keyhooks: {2752 props: "char charcode key keycode".split(" "),2753 filter: function( event, original ) {2754 // add which for key events2755 if ( event.which == null ) {2756 event.which = original.charcode != null ? original.charcode : original.keycode;2757 }2758 return event;2759 }2760 },2761 mousehooks: {2762 props: "button buttons clientx clienty fromelement offsetx offsety pagex pagey screenx screeny toelement".split(" "),2763 filter: function( event, original ) {2764 var body, eventdoc, doc,2765 button = original.button,2766 fromelement = original.fromelement;2767 // calculate pagex/y if missing and clientx/y available2768 if ( event.pagex == null && original.clientx != null ) {2769 eventdoc = event.target.ownerdocument || document;2770 doc = eventdoc.documentelement;2771 body = eventdoc.body;2772 event.pagex = original.clientx + ( doc && doc.scrollleft || body && body.scrollleft || 0 ) - ( doc && doc.clientleft || body && body.clientleft || 0 );2773 event.pagey = original.clienty + ( doc && doc.scrolltop || body && body.scrolltop || 0 ) - ( doc && doc.clienttop || body && body.clienttop || 0 );2774 }2775 // add relatedtarget, if necessary2776 if ( !event.relatedtarget && fromelement ) {2777 event.relatedtarget = fromelement === event.target ? original.toelement : fromelement;2778 }2779 // add which for click: 1 === left; 2 === middle; 3 === right2780 // note: button is not normalized, so don't use it2781 if ( !event.which && button !== undefined ) {2782 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );2783 }2784 return event;2785 }2786 },2787 special: {2788 load: {2789 // prevent triggered image.load events from bubbling to window.load2790 nobubble: true2791 },2792 click: {2793 // for checkbox, fire native event so checked state will be right2794 trigger: function() {2795 if ( jquery .nodename( this, "input" ) && this.type === "checkbox" && this.click ) {2796 this.click();2797 return false;2798 }2799 }2800 },2801 focus: {2802 // fire native event if possible so blur/focus sequence is correct2803 trigger: function() {2804 if ( this !== document.activeelement && this.focus ) {2805 try {2806 this.focus();2807 return false;2808 } catch ( e ) {2809 // support: ie<92810 // if we error on focus to hidden element (#1486, #12518),2811 // let .trigger() run the handlers2812 }2813 }2814 },2815 delegatetype: "focusin"2816 },2817 blur: {2818 trigger: function() {2819 if ( this === document.activeelement && this.blur ) {2820 this.blur();2821 return false;2822 }2823 },2824 delegatetype: "focusout"2825 },2826 beforeunload: {2827 postdispatch: function( event ) {2828 // even when returnvalue equals to undefined firefox will still show alert2829 if ( event.result !== undefined ) {2830 event.originalevent.returnvalue = event.result;2831 }2832 }2833 }2834 },2835 simulate: function( type, elem, event, bubble ) {2836 // piggyback on a donor event to simulate a different one.2837 // fake originalevent to avoid donor's stoppropagation, but if the2838 // simulated event prevents default then we do the same on the donor.2839 var e = jquery .extend(2840 new jquery .event(),2841 event,2842 { type: type,2843 issimulated: true,2844 originalevent: {}2845 }2846 );2847 if ( bubble ) {2848 jquery .event.trigger( e, null, elem );2849 } else {2850 jquery .event.dispatch.call( elem, e );2851 }2852 if ( e.isdefaultprevented() ) {2853 event.preventdefault();2854 }2855 }2856};2857jquery .removeevent = document.removeeventlistener ?2858 function( elem, type, handle ) {2859 if ( elem.removeeventlistener ) {2860 elem.removeeventlistener( type, handle, false );2861 }2862 } :2863 function( elem, type, handle ) {2864 var name = "on" + type;2865 if ( elem.detachevent ) {2866 // #8545, #7054, preventing memory leaks for custom events in ie6-82867 // detachevent needed property on element, by name of that event, to properly expose it to gc2868 if ( typeof elem[ name ] === core_strundefined ) {2869 elem[ name ] = null;2870 }2871 elem.detachevent( name, handle );2872 }2873 };2874jquery .event = function( src, props ) {2875 // allow instantiation without the 'new' keyword2876 if ( !(this instanceof jquery .event) ) {2877 return new jquery .event( src, props );2878 }2879 // event object2880 if ( src && src.type ) {2881 this.originalevent = src;2882 this.type = src.type;2883 // events bubbling up the document may have been marked as prevented2884 // by a handler lower down the tree; reflect the correct value.2885 this.isdefaultprevented = ( src.defaultprevented || src.returnvalue === false ||2886 src.getpreventdefault && src.getpreventdefault() ) ? returntrue : returnfalse;2887 // event type2888 } else {2889 this.type = src;2890 }2891 // put explicitly provided properties onto the event object2892 if ( props ) {2893 jquery .extend( this, props );2894 }2895 // create a timestamp if incoming event doesn't have one2896 this.timestamp = src && src.timestamp || jquery .now();2897 // mark it as fixed2898 this[ jquery .expando ] = true;2899};2900// jquery .event is based on dom3 events as specified by the ecmascript language binding2901// http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html2902jquery .event.prototype = {2903 isdefaultprevented: returnfalse,2904 ispropagationstopped: returnfalse,2905 isimmediatepropagationstopped: returnfalse,2906 preventdefault: function() {2907 var e = this.originalevent;2908 this.isdefaultprevented = returntrue;2909 if ( !e ) {2910 return;2911 }2912 // if preventdefault exists, run it on the original event2913 if ( e.preventdefault ) {2914 e.preventdefault();2915 // support: ie2916 // otherwise set the returnvalue property of the original event to false2917 } else {2918 e.returnvalue = false;2919 }2920 },2921 stoppropagation: function() {2922 var e = this.originalevent;2923 this.ispropagationstopped = returntrue;2924 if ( !e ) {2925 return;2926 }2927 // if stoppropagation exists, run it on the original event2928 if ( e.stoppropagation ) {2929 e.stoppropagation();2930 }2931 // support: ie2932 // set the cancelbubble property of the original event to true2933 e.cancelbubble = true;2934 },2935 stopimmediatepropagation: function() {2936 this.isimmediatepropagationstopped = returntrue;2937 this.stoppropagation();2938 }2939};2940//创建鼠标进入/鼠标离开事件,使用鼠标在上面/鼠标离开和时间检查事件。2941jquery .each({2942 mouseenter: "mouseover",2943 mouseleave: "mouseout"2944}, function( orig, fix ) {2945 jquery .event.special[ orig ] = {2946 delegatetype: fix,2947 bindtype: fix,2948 handle: function( event ) {2949 var ret,2950 target = this,2951 related = event.relatedtarget,2952 handleobj = event.handleobj;2953 // for mousenter/leave call the handler if related is outside the target.2954 // nb: no relatedtarget if the mouse left/entered the browser window2955 if ( !related || (related !== target && !jquery .contains( target, related )) ) {2956 event.type = handleobj.origtype;2957 ret = handleobj.handler.apply( this, arguments );2958 event.type = fix;2959 }2960 return ret;2961 }2962 };2963});2964// ie submit delegation2965if ( !jquery .support.submitbubbles ) {2966 jquery .event.special.submit = {2967 setup: function() {2968 // only need this for delegated form submit events2969 if ( jquery .nodename( this, "form" ) ) {2970 return false;2971 }2972 // lazy-add a submit handler when a descendant form may potentially be submitted2973 jquery .event.add( this, "click._submit keypress._submit", function( e ) {2974 // node name check avoids a vml-related crash in ie (#9807)2975 var elem = e.target,2976 form = jquery .nodename( elem, "input" ) || jquery .nodename( elem, "button" ) ? elem.form : undefined;2977 if ( form && !jquery ._data( form, "submitbubbles" ) ) {2978 jquery .event.add( form, "submit._submit", function( event ) {2979 event._submit_bubble = true;2980 });2981 jquery ._data( form, "submitbubbles", true );2982 }2983 });2984 // return undefined since we don't need an event listener2985 },2986 postdispatch: function( event ) {2987 // if form was submitted by the user, bubble the event up the tree2988 if ( event._submit_bubble ) {2989 delete event._submit_bubble;2990 if ( this.parentnode && !event.istrigger ) {2991 jquery .event.simulate( "submit", this.parentnode, event, true );2992 }2993 }2994 },2995 teardown: function() {2996 // only need this for delegated form submit events2997 if ( jquery .nodename( this, "form" ) ) {2998 return false;2999 }3000 // remove delegated handlers; cleandata eventually reaps submit handlers attached above3001 jquery .event.remove( this, "._submit" );3002 }3003 };3004}3005// ie change delegation and checkbox/radio fix3006if ( !jquery .support.changebubbles ) {3007 jquery .event.special.change = {3008 setup: function() {3009 if ( rformelems.test( this.nodename ) ) {3010 // ie doesn't fire change on a check/radio until blur; trigger it on click3011 // after a propertychange. eat the blur-change in special.change.handle.3012 // this still fires onchange a second time for check/radio after blur.3013 if ( this.type === "checkbox" || this.type === "radio" ) {3014 jquery .event.add( this, "propertychange._change", function( event ) {3015 if ( event.originalevent.propertyname === "checked" ) {3016 this._just_changed = true;3017 }3018 });3019 jquery .event.add( this, "click._change", function( event ) {3020 if ( this._just_changed && !event.istrigger ) {3021 this._just_changed = false;3022 }3023 // allow triggered, simulated change events (#11500)3024 jquery .event.simulate( "change", this, event, true );3025 });3026 }3027 return false;3028 }3029 // delegated event; lazy-add a change handler on descendant inputs3030 jquery .event.add( this, "beforeactivate._change", function( e ) {3031 var elem = e.target;3032 if ( rformelems.test( elem.nodename ) && !jquery ._data( elem, "changebubbles" ) ) {3033 jquery .event.add( elem, "change._change", function( event ) {3034 if ( this.parentnode && !event.issimulated && !event.istrigger ) {3035 jquery .event.simulate( "change", this.parentnode, event, true );3036 }3037 });3038 jquery ._data( elem, "changebubbles", true );3039 }3040 });3041 },3042 handle: function( event ) {3043 var elem = event.target;3044 // swallow native change events from checkbox/radio, we already triggered them above3045 if ( this !== elem || event.issimulated || event.istrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {3046 return event.handleobj.handler.apply( this, arguments );3047 }3048 },3049 teardown: function() {3050 jquery .event.remove( this, "._change" );3051 return !rformelems.test( this.nodename );3052 }3053 };3054}3055// create "bubbling" focus and blur events3056if ( !jquery .support.focusinbubbles ) {3057 jquery .each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {3058 // attach a single capturing handler while someone wants focusin/focusout3059 var attaches = 0,3060 handler = function( event ) {3061 jquery .event.simulate( fix, event.target, jquery .event.fix( event ), true );3062 };3063 jquery .event.special[ fix ] = {3064 setup: function() {3065 if ( attaches++ === 0 ) {3066 document.addeventlistener( orig, handler, true );3067 }3068 },3069 teardown: function() {3070 if ( --attaches === 0 ) {3071 document.removeeventlistener( orig, handler, true );3072 }3073 }3074 };3075 });3076}3077jquery .fn.extend({3078 on: function( types, selector, data, fn, /*internal*/ one ) {3079 var type, origfn;3080 // types can be a map of types/handlers3081 if ( typeof types === "object" ) {3082 // ( types-object, selector, data )3083 if ( typeof selector !== "string" ) {3084 // ( types-object, data )3085 data = data || selector;3086 selector = undefined;3087 }3088 for ( type in types ) {3089 this.on( type, selector, data, types[ type ], one );3090 }3091 return this;3092 }3093 if ( data == null && fn == null ) {3094 // ( types, fn )3095 fn = selector;3096 data = selector = undefined;3097 } else if ( fn == null ) {3098 if ( typeof selector === "string" ) {3099 // ( types, selector, fn )3100 fn = data;3101 data = undefined;3102 } else {3103 // ( types, data, fn )3104 fn = data;3105 data = selector;3106 selector = undefined;3107 }3108 }3109 if ( fn === false ) {3110 fn = returnfalse;3111 } else if ( !fn ) {3112 return this;3113 }3114 if ( one === 1 ) {3115 origfn = fn;3116 fn = function( event ) {3117 // can use an empty set, since event contains the info3118 jquery ().off( event );3119 return origfn.apply( this, arguments );3120 };3121 // use same guid so caller can remove using origfn3122 fn.guid = origfn.guid || ( origfn.guid = jquery .guid++ );3123 }3124 return this.each( function() {3125 jquery .event.add( this, types, fn, data, selector );3126 });3127 },3128 one: function( types, selector, data, fn ) {3129 return this.on( types, selector, data, fn, 1 );3130 },3131 off: function( types, selector, fn ) {3132 var handleobj, type;3133 if ( types && types.preventdefault && types.handleobj ) {3134 // ( event ) dispatched jquery .event3135 handleobj = types.handleobj;3136 jquery ( types.delegatetarget ).off(3137 handleobj.namespace ? handleobj.origtype + "." + handleobj.namespace : handleobj.origtype,3138 handleobj.selector,3139 handleobj.handler3140 );3141 return this;3142 }3143 if ( typeof types === "object" ) {3144 // ( types-object [, selector] )3145 for ( type in types ) {3146 this.off( type, selector, types[ type ] );3147 }3148 return this;3149 }3150 if ( selector === false || typeof selector === "function" ) {3151 // ( types [, fn] )3152 fn = selector;3153 selector = undefined;3154 }3155 if ( fn === false ) {3156 fn = returnfalse;3157 }3158 return this.each(function() {3159 jquery .event.remove( this, types, fn, selector );3160 });3161 },3162 bind: function( types, data, fn ) {3163 return this.on( types, null, data, fn );3164 },3165 unbind: function( types, fn ) {3166 return this.off( types, null, fn );3167 },3168 delegate: function( selector, types, data, fn ) {3169 return this.on( types, selector, data, fn );3170 },3171 undelegate: function( selector, types, fn ) {3172 // ( namespace ) or ( selector, types [, fn] )3173 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );3174 },3175 trigger: function( type, data ) {3176 return this.each(function() {3177 jquery .event.trigger( type, data, this );3178 });3179 },3180 triggerhandler: function( type, data ) {3181 var elem = this[0];3182 if ( elem ) {3183 return jquery .event.trigger( type, data, elem, true );3184 }3185 }3186});3187/*!3188 * sizzle css selector engine3189 * copyright 2012 jquery foundation and other contributors3190 * released under the mit license3191 * http://sizzlejs .com/3192 */3193(function( window, undefined ) {3194var i,3195 cachedruns,3196 expr,3197 gettext,3198 isxml,3199 compile,3200 hasduplicate,3201 outermostcontext,3202 // local document vars3203 setdocument,3204 document,3205 docelem,3206 documentisxml,3207 rbuggyqsa,3208 rbuggymatches,3209 matches,3210 contains,3211 sortorder,3212 // instance-specific data3213 expando = "sizzle" + -(new date()),3214 preferreddoc = window.document,3215 support = {},3216 dirruns = 0,3217 done = 0,3218 classcache = createcache(),3219 tokencache = createcache(),3220 compilercache = createcache(),3221 // general-purpose constants3222 strundefined = typeof undefined,3223 max_negative = 1 << 31,3224 // array methods3225 arr = [],3226 pop = arr.pop,3227 push = arr.push,3228 slice = arr.slice,3229 // use a stripped-down indexof if we can't use a native one3230 indexof = arr.indexof || function( elem ) {3231 var i = 0,3232 len = this.length;3233 for ( ; i < len; i++ ) {3234 if ( this[i] === elem ) {3235 return i;3236 }3237 }3238 return -1;3239 },3240 // regular expressions3241 // whitespace characters http://www.w3.org/tr/css3-selectors/#whitespace3242 whitespace = "[\\x20\\t\\r\\n\\f]",3243 // http://www.w3.org/tr/css3-syntax/#characters3244 characterencoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",3245 // loosely modeled on css identifier characters3246 // an unquoted value should be a css identifier http://www.w3.org/tr/css3-selectors/#attribute-selectors3247 // proper syntax: http://www.w3.org/tr/css21/syndata.html#value-def-identifier3248 identifier = characterencoding.replace( "w", "w#" ),3249 // acceptable operators http://www.w3.org/tr/selectors/#attribute-selectors3250 operators = "([*^$|!~]?=)",3251 attributes = "\\[" + whitespace + "*(" + characterencoding + ")" + whitespace +3252 "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",3253 // prefer arguments quoted,3254 // then not containing pseudos/brackets,3255 // then attribute selectors/non-parenthetical expressions,3256 // then anything else3257 // these preferences are here to reduce the number of selectors3258 // needing tokenize in the pseudo prefilter3259 pseudos = ":(" + characterencoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",3260 // leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter3261 rtrim = new regexp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),3262 rcomma = new regexp( "^" + whitespace + "*," + whitespace + "*" ),3263 rcombinators = new regexp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),3264 rpseudo = new regexp( pseudos ),3265 ridentifier = new regexp( "^" + identifier + "$" ),3266 matchexpr = {3267 "id": new regexp( "^#(" + characterencoding + ")" ),3268 "class": new regexp( "^\\.(" + characterencoding + ")" ),3269 "name": new regexp( "^\\[name=['\"]?(" + characterencoding + ")['\"]?\\]" ),3270 "tag": new regexp( "^(" + characterencoding.replace( "w", "w*" ) + ")" ),3271 "attr": new regexp( "^" + attributes ),3272 "pseudo": new regexp( "^" + pseudos ),3273 "child": new regexp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +3274 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +3275 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),3276 // for use in libraries implementing .is()3277 // we use this for pos matching in `select`3278 "needscontext": new regexp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +3279 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )3280 },3281 rsibling = /[\x20\t\r\n\f]*[+~]/,3282 rnative = /^[^{]+\{\s*\[native code/,3283 // easily-parseable/retrievable id or tag or class selectors3284 rquickexpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,3285 rinputs = /^(?:input|select|textarea|button)$/i,3286 rheader = /^h\d$/i,3287 rescape = /'|\\/g,3288 rattributequotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,3289 // css escapes http://www.w3.org/tr/css21/syndata.html#escaped-characters3290 runescape = /\\([\da-fa-f]{1,6}[\x20\t\r\n\f]?|.)/g,3291 funescape = function( _, escaped ) {3292 var high = "0x" + escaped - 0x10000;3293 // nan means non-codepoint3294 return high !== high ?3295 escaped :3296 // bmp codepoint3297 high < 0 ?3298 string.fromcharcode( high + 0x10000 ) :3299 // supplemental plane codepoint (surrogate pair)3300 string.fromcharcode( high >> 10 | 0xd800, high & 0x3ff | 0xdc00 );3301 };3302// use a stripped-down slice if we can't use a native one3303try {3304 slice.call( preferreddoc.documentelement.childnodes, 0 )[0].nodetype;3305} catch ( e ) {3306 slice = function( i ) {3307 var elem,3308 results = [];3309 while ( (elem = this[i++]) ) {3310 results.push( elem );3311 }3312 return results;3313 };3314}3315/**3316 * for feature detection3317 * @param {function} fn the function to test for native support3318 */3319function isnative( fn ) {3320 return rnative.test( fn + "" );3321}3322/**3323 * create key-value caches of limited size3324 * @returns {function(string, object)} returns the object data after storing it on itself with3325 * property name the (space-suffixed) string and (if the cache is larger than expr.cachelength)3326 * deleting the oldest entry3327 */3328function createcache() {3329 var cache,3330 keys = [];3331 return (cache = function( key, value ) {3332 // use (key + " ") to avoid collision with native prototype properties (see issue #157)3333 if ( keys.push( key += " " ) > expr.cachelength ) {3334 // only keep the most recent entries3335 delete cache[ keys.shift() ];3336 }3337 return (cache[ key ] = value);3338 });3339}3340/**3341 * mark a function for special use by sizzle3342 * @param {function} fn the function to mark3343 */3344function markfunction( fn ) {3345 fn[ expando ] = true;3346 return fn;3347}3348/**3349 * support testing using an element3350 * @param {function} fn passed the created div and expects a boolean result3351 */3352function assert( fn ) {3353 var div = document.createelement("div");3354 try {3355 return fn( div );3356 } catch (e) {3357 return false;3358 } finally {3359 // release memory in ie3360 div = null;3361 }3362}3363function sizzle( selector, context, results, seed ) {3364 var match, elem, m, nodetype,3365 // qsa vars3366 i, groups, old, nid, newcontext, newselector;3367 if ( ( context ? context.ownerdocument || context : preferreddoc ) !== document ) {3368 setdocument( context );3369 }3370 context = context || document;3371 results = results || [];3372 if ( !selector || typeof selector !== "string" ) {3373 return results;3374 }3375 if ( (nodetype = context.nodetype) !== 1 && nodetype !== 9 ) {3376 return [];3377 }3378 if ( !documentisxml && !seed ) {3379 // shortcuts3380 if ( (match = rquickexpr.exec( selector )) ) {3381 // speed-up: sizzle("#id")3382 if ( (m = match[1]) ) {3383 if ( nodetype === 9 ) {3384 elem = context.getelementbyid( m );3385 // check parentnode to catch when blackberry 4.6 returns3386 // nodes that are no longer in the document #69633387 if ( elem && elem.parentnode ) {3388 // handle the case where ie, opera, and webkit return items3389 // by name instead of id3390 if ( elem.id === m ) {3391 results.push( elem );3392 return results;3393 }3394 } else {3395 return results;3396 }3397 } else {3398 // context is not a document3399 if ( context.ownerdocument && (elem = context.ownerdocument.getelementbyid( m )) &&3400 contains( context, elem ) && elem.id === m ) {3401 results.push( elem );3402 return results;3403 }3404 }3405 // speed-up: sizzle("tag")3406 } else if ( match[2] ) {3407 push.apply( results, slice.call(context.getelementsbytagname( selector ), 0) );3408 return results;3409 // speed-up: sizzle(".class")3410 } else if ( (m = match[3]) && support.getbyclassname && context.getelementsbyclassname ) {3411 push.apply( results, slice.call(context.getelementsbyclassname( m ), 0) );3412 return results;3413 }3414 }3415 // qsa path3416 if ( support.qsa && !rbuggyqsa.test(selector) ) {3417 old = true;3418 nid = expando;3419 newcontext = context;3420 newselector = nodetype === 9 && selector;3421 // qsa works strangely on element-rooted queries3422 // we can work around this by specifying an extra id on the root3423 // and working up from there (thanks to andrew dupont for the technique)3424 // ie 8 doesn't work on object elements3425 if ( nodetype === 1 && context.nodename.tolowercase() !== "object" ) {3426 groups = tokenize( selector );3427 if ( (old = context.getattribute("id")) ) {3428 nid = old.replace( rescape, "\\$&" );3429 } else {3430 context.setattribute( "id", nid );3431 }3432 nid = "[id='" + nid + "'] ";3433 i = groups.length;3434 while ( i-- ) {3435 groups[i] = nid + toselector( groups[i] );3436 }3437 newcontext = rsibling.test( selector ) && context.parentnode || context;3438 newselector = groups.join(",");3439 }3440 if ( newselector ) {3441 try {3442 push.apply( results, slice.call( newcontext.queryselectorall(3443 newselector3444 ), 0 ) );3445 return results;3446 } catch(qsaerror) {3447 } finally {3448 if ( !old ) {3449 context.removeattribute("id");3450 }3451 }3452 }3453 }3454 }3455 // all others3456 return select( selector.replace( rtrim, "$1" ), context, results, seed );3457}3458/**3459 * detect xml3460 * @param {element|object} elem an element or a document3461 */3462isxml = sizzle.isxml = function( elem ) {3463 // documentelement is verified for cases where it doesn't yet exist3464 // (such as loading iframes in ie - #4833)3465 var documentelement = elem && (elem.ownerdocument || elem).documentelement;3466 return documentelement ? documentelement.nodename !== "html" : false;3467};3468/**3469 * sets document-related variables once based on the current document3470 * @param {element|object} [doc] an element or document object to use to set the document3471 * @returns {object} returns the current document3472 */3473setdocument = sizzle.setdocument = function( node ) {3474 var doc = node ? node.ownerdocument || node : preferreddoc;3475 // if no document and documentelement is available, return3476 if ( doc === document || doc.nodetype !== 9 || !doc.documentelement ) {3477 return document;3478 }3479 // set our document3480 document = doc;3481 docelem = doc.documentelement;3482 // support tests3483 documentisxml = isxml( doc );3484 // check if getelementsbytagname("*") returns only elements3485 support.tagnamenocomments = assert(function( div ) {3486 div.appendchild( doc.createcomment("") );3487 return !div.getelementsbytagname("*").length;3488 });3489 // check if attributes should be retrieved by attribute nodes3490 support.attributes = assert(function( div ) {3491 div.innerhtml = "<select></select>";3492 var type = typeof div.lastchild.getattribute("multiple");3493 // ie8 returns a string for some attributes even when not present3494 return type !== "boolean" && type !== "string";3495 });3496 // check if getelementsbyclassname can be trusted3497 support.getbyclassname = assert(function( div ) {3498 // opera can't find a second classname (in 9.6)3499 div.innerhtml = "<div class='hidden e'></div><div class='hidden'></div>";3500 if ( !div.getelementsbyclassname || !div.getelementsbyclassname("e").length ) {3501 return false;3502 }3503 // safari 3.2 caches class attributes and doesn't catch changes3504 div.lastchild.classname = "e";3505 return div.getelementsbyclassname("e").length === 2;3506 });3507 // check if getelementbyid returns elements by name3508 // check if getelementsbyname privileges form controls or returns elements by id3509 support.getbyname = assert(function( div ) {3510 // inject content3511 div.id = expando + 0;3512 div.innerhtml = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";3513 docelem.insertbefore( div, docelem.firstchild );3514 // test3515 var pass = doc.getelementsbyname &&3516 // buggy browsers will return fewer than the correct 23517 doc.getelementsbyname( expando ).length === 2 +3518 // buggy browsers will return more than the correct 03519 doc.getelementsbyname( expando + 0 ).length;3520 support.getidnotname = !doc.getelementbyid( expando );3521 // cleanup3522 docelem.removechild( div );3523 return pass;3524 });3525 // ie6/7 return modified attributes3526 expr.attrhandle = assert(function( div ) {3527 div.innerhtml = "<a href='#'></a>";3528 return div.firstchild && typeof div.firstchild.getattribute !== strundefined &&3529 div.firstchild.getattribute("href") === "#";3530 }) ?3531 {} :3532 {3533 "href": function( elem ) {3534 return elem.getattribute( "href", 2 );3535 },3536 "type": function( elem ) {3537 return elem.getattribute("type");3538 }3539 };3540 // id find and filter3541 if ( support.getidnotname ) {3542 expr.find["id"] = function( id, context ) {3543 if ( typeof context.getelementbyid !== strundefined && !documentisxml ) {3544 var m = context.getelementbyid( id );3545 // check parentnode to catch when blackberry 4.6 returns3546 // nodes that are no longer in the document #69633547 return m && m.parentnode ? [m] : [];3548 }3549 };3550 expr.filter["id"] = function( id ) {3551 var attrid = id.replace( runescape, funescape );3552 return function( elem ) {3553 return elem.getattribute("id") === attrid;3554 };3555 };3556 } else {3557 expr.find["id"] = function( id, context ) {3558 if ( typeof context.getelementbyid !== strundefined && !documentisxml ) {3559 var m = context.getelementbyid( id );3560 return m ?3561 m.id === id || typeof m.getattributenode !== strundefined && m.getattributenode("id").value === id ?3562 [m] :3563 undefined :3564 [];3565 }3566 };3567 expr.filter["id"] = function( id ) {3568 var attrid = id.replace( runescape, funescape );3569 return function( elem ) {3570 var node = typeof elem.getattributenode !== strundefined && elem.getattributenode("id");3571 return node && node.value === attrid;3572 };3573 };3574 }3575 // tag3576 expr.find["tag"] = support.tagnamenocomments ?3577 function( tag, context ) {3578 if ( typeof context.getelementsbytagname !== strundefined ) {3579 return context.getelementsbytagname( tag );3580 }3581 } :3582 function( tag, context ) {3583 var elem,3584 tmp = [],3585 i = 0,3586 results = context.getelementsbytagname( tag );3587 // filter out possible comments3588 if ( tag === "*" ) {3589 while ( (elem = results[i++]) ) {3590 if ( elem.nodetype === 1 ) {3591 tmp.push( elem );3592 }3593 }3594 return tmp;3595 }3596 return results;3597 };3598 // name3599 expr.find["name"] = support.getbyname && function( tag, context ) {3600 if ( typeof context.getelementsbyname !== strundefined ) {3601 return context.getelementsbyname( name );3602 }3603 };3604 // class3605 expr.find["class"] = support.getbyclassname && function( classname, context ) {3606 if ( typeof context.getelementsbyclassname !== strundefined && !documentisxml ) {3607 return context.getelementsbyclassname( classname );3608 }3609 };3610 // qsa and matchesselector support3611 // matchesselector(:active) reports false when true (ie9/opera 11.5)3612 rbuggymatches = [];3613 // qsa(:focus) reports false when true (chrome 21),3614 // no need to also add to buggymatches since matches checks buggyqsa3615 // a support test would require too much code (would include document ready)3616 rbuggyqsa = [ ":focus" ];3617 if ( (support.qsa = isnative(doc.queryselectorall)) ) {3618 // build qsa regex3619 // regex strategy adopted from diego perini3620 assert(function( div ) {3621 // select is set to empty string on purpose3622 // this is to test ie's treatment of not explictly3623 // setting a boolean content attribute,3624 // since its presence should be enough3625 // http://bugs.jquery .com/ticket/123593626 div.innerhtml = "<select><option selected=''></option></select>";3627 // ie8 - some boolean attributes are not treated correctly3628 if ( !div.queryselectorall("[selected]").length ) {3629 rbuggyqsa.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );3630 }3631 // webkit/opera - :checked should return selected option elements3632 // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked3633 // ie8 throws error here and will not see later tests3634 if ( !div.queryselectorall(":checked").length ) {3635 rbuggyqsa.push(":checked");3636 }3637 });3638 assert(function( div ) {3639 // opera 10-12/ie8 - ^= $= *= and empty values3640 // should not select anything3641 div.innerhtml = "<input type='hidden' i=''/>";3642 if ( div.queryselectorall("[i^='']").length ) {3643 rbuggyqsa.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );3644 }3645 // ff 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)3646 // ie8 throws error here and will not see later tests3647 if ( !div.queryselectorall(":enabled").length ) {3648 rbuggyqsa.push( ":enabled", ":disabled" );3649 }3650 // opera 10-11 does not throw on post-comma invalid pseudos3651 div.queryselectorall("*,:x");3652 rbuggyqsa.push(",.*:");3653 });3654 }3655 if ( (support.matchesselector = isnative( (matches = docelem.matchesselector ||3656 docelem.mozmatchesselector ||3657 docelem.webkitmatchesselector ||3658 docelem.omatchesselector ||3659 docelem.msmatchesselector) )) ) {3660 assert(function( div ) {3661 // check to see if it's possible to do matchesselector3662 // on a disconnected node (ie 9)3663 support.disconnectedmatch = matches.call( div, "div" );3664 // this should fail with an exception3665 // gecko does not error, returns false instead3666 matches.call( div, "[s!='']:x" );3667 rbuggymatches.push( "!=", pseudos );3668 });3669 }3670 rbuggyqsa = new regexp( rbuggyqsa.join("|") );3671 rbuggymatches = new regexp( rbuggymatches.join("|") );3672 // element contains another3673 // purposefully does not implement inclusive descendent3674 // as in, an element does not contain itself3675 contains = isnative(docelem.contains) || docelem.comparedocumentposition ?3676 function( a, b ) {3677 var adown = a.nodetype === 9 ? a.documentelement : a,3678 bup = b && b.parentnode;3679 return a === bup || !!( bup && bup.nodetype === 1 && (3680 adown.contains ?3681 adown.contains( bup ) :3682 a.comparedocumentposition && a.comparedocumentposition( bup ) & 163683 ));3684 } :3685 function( a, b ) {3686 if ( b ) {3687 while ( (b = b.parentnode) ) {3688 if ( b === a ) {3689 return true;3690 }3691 }3692 }3693 return false;3694 };3695 // document order sorting3696 sortorder = docelem.comparedocumentposition ?3697 function( a, b ) {3698 var compare;3699 if ( a === b ) {3700 hasduplicate = true;3701 return 0;3702 }3703 if ( (compare = b.comparedocumentposition && a.comparedocumentposition && a.comparedocumentposition( b )) ) {3704 if ( compare & 1 || a.parentnode && a.parentnode.nodetype === 11 ) {3705 if ( a === doc || contains( preferreddoc, a ) ) {3706 return -1;3707 }3708 if ( b === doc || contains( preferreddoc, b ) ) {3709 return 1;3710 }3711 return 0;3712 }3713 return compare & 4 ? -1 : 1;3714 }3715 return a.comparedocumentposition ? -1 : 1;3716 } :3717 function( a, b ) {3718 var cur,3719 i = 0,3720 aup = a.parentnode,3721 bup = b.parentnode,3722 ap = [ a ],3723 bp = [ b ];3724 // exit early if the nodes are identical3725 if ( a === b ) {3726 hasduplicate = true;3727 return 0;3728 // parentless nodes are either documents or disconnected3729 } else if ( !aup || !bup ) {3730 return a === doc ? -1 :3731 b === doc ? 1 :3732 aup ? -1 :3733 bup ? 1 :3734 0;3735 // if the nodes are siblings, we can do a quick check3736 } else if ( aup === bup ) {3737 return siblingcheck( a, b );3738 }3739 // otherwise we need full lists of their ancestors for comparIphone 苹果 ios n3740 cur = a;3741 while ( (cur = cur.parentnode) ) {3742 ap.unshift( cur );3743 }3744 cur = b;3745 while ( (cur = cur.parentnode) ) {3746 bp.unshift( cur );3747 }3748 // walk down the tree looking for a discrepancy3749 while ( ap[i] === bp[i] ) {3750 i++;3751 }3752 return i ?3753 // do a sibling check if the nodes have a common ancestor3754 siblingcheck( ap[i], bp[i] ) :3755 // otherwise nodes in our document sort first3756 ap[i] === preferreddoc ? -1 :3757 bp[i] === preferreddoc ? 1 :3758 0;3759 };3760 // always assume the presence of duplicates if sort doesn't3761 // pass them to our comparIphone 苹果 ios n function (as in google chrome).3762 hasduplicate = false;3763 [0, 0].sort( sortorder );3764 support.detectduplicates = hasduplicate;3765 return document;3766};3767sizzle.matches = function( expr, elements ) {3768 return sizzle( expr, null, null, elements );3769};3770sizzle.matchesselector = function( elem, expr ) {3771 // set document vars if needed3772 if ( ( elem.ownerdocument || elem ) !== document ) {3773 setdocument( elem );3774 }3775 // make sure that attribute selectors are quoted3776 expr = expr.replace( rattributequotes, "='$1']" );3777 // rbuggyqsa always contains :focus, so no need for an existence check3778 if ( support.matchesselector && !documentisxml && (!rbuggymatches || !rbuggymatches.test(expr)) && !rbuggyqsa.test(expr) ) {3779 try {3780 var ret = matches.call( elem, expr );3781 // ie 9's matchesselector returns false on disconnected nodes3782 if ( ret || support.disconnectedmatch ||3783 // as well, disconnected nodes are said to be in a document3784 // fragment in ie 93785 elem.document && elem.document.nodetype !== 11 ) {3786 return ret;3787 }3788 } catch(e) {}3789 }3790 return sizzle( expr, document, null, [elem] ).length > 0;3791};3792sizzle.contains = function( context, elem ) {3793 // set document vars if needed3794 if ( ( context.ownerdocument || context ) !== document ) {3795 setdocument( context );3796 }3797 return contains( context, elem );3798};3799sizzle.attr = function( elem, name ) {3800 var val;3801 // set document vars if needed3802 if ( ( elem.ownerdocument || elem ) !== document ) {3803 setdocument( elem );3804 }3805 if ( !documentisxml ) {3806 name = name.tolowercase();3807 }3808 if ( (val = expr.attrhandle[ name ]) ) {3809 return val( elem );3810 }3811 if ( documentisxml || support.attributes ) {3812 return elem.getattribute( name );3813 }3814 return ( (val = elem.getattributenode( name )) || elem.getattribute( name ) ) && elem[ name ] === true ?3815 name :3816 val && val.specified ? val.value : null;3817};3818sizzle.error = function( msg ) {3819 throw new error( "syntax error, unrecognized expression: " + msg );3820};3821// document sorting and removing duplicates3822sizzle.uniquesort = function( results ) {3823 var elem,3824 duplicates = [],3825 i = 1,3826 j = 0;3827 // unless we *know* we can detect duplicates, assume their presence3828 hasduplicate = !support.detectduplicates;3829 results.sort( sortorder );3830 if ( hasduplicate ) {3831 for ( ; (elem = results[i]); i++ ) {3832 if ( elem === results[ i - 1 ] ) {3833 j = duplicates.push( i );3834 }3835 }3836 while ( j-- ) {3837 results.splice( duplicates[ j ], 1 );3838 }3839 }3840 return results;3841};3842function siblingcheck( a, b ) {3843 var cur = b && a,3844 diff = cur && ( ~b.sourceindex || max_negative ) - ( ~a.sourceindex || max_negative );3845 // use ie sourceindex if available on both nodes3846 if ( diff ) {3847 return diff;3848 }3849 // check if b follows a3850 if ( cur ) {3851 while ( (cur = cur.nextsibling) ) {3852 if ( cur === b ) {3853 return -1;3854 }3855 }3856 }3857 return a ? 1 : -1;3858}3859// returns a function to use in pseudos for input types3860function createinputpseudo( type ) {3861 return function( elem ) {3862 var name = elem.nodename.tolowercase();3863 return name === "input" && elem.type === type;3864 };3865}3866// returns a function to use in pseudos for buttons3867function createbuttonpseudo( type ) {3868 return function( elem ) {3869 var name = elem.nodename.tolowercase();3870 return (name === "input" || name === "button") && elem.type === type;3871 };3872}3873// returns a function to use in pseudos for positionals3874function createpositionalpseudo( fn ) {3875 return markfunction(function( argument ) {3876 argument = +argument;3877 return markfunction(function( seed, matches ) {3878 var j,3879 matchindexes = fn( [], seed.length, argument ),3880 i = matchindexes.length;3881 // match elements found at the specified indexes3882 while ( i-- ) {3883 if ( seed[ (j = matchindexes[i]) ] ) {3884 seed[j] = !(matches[j] = seed[j]);3885 }3886 }3887 });3888 });3889}3890/**3891 * utility function for retrieving the text value of an array of dom nodes3892 * @param {array|element} elem3893 */3894gettext = sizzle.gettext = function( elem ) {3895 var node,3896 ret = "",3897 i = 0,3898 nodetype = elem.nodetype;3899 if ( !nodetype ) {3900 // if no nodetype, this is expected to be an array3901 for ( ; (node = elem[i]); i++ ) {3902 // do not traverse comment nodes3903 ret += gettext( node );3904 }3905 } else if ( nodetype === 1 || nodetype === 9 || nodetype === 11 ) {3906 // use textcontent for elements3907 // innertext usage removed for consistency of new lines (see #11153)3908 if ( typeof elem.textcontent === "string" ) {3909 return elem.textcontent;3910 } else {3911 // traverse its children3912 for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {3913 ret += gettext( elem );3914 }3915 }3916 } else if ( nodetype === 3 || nodetype === 4 ) {3917 return elem.nodevalue;3918 }3919 // do not include comment or processing instruction nodes3920 return ret;3921};3922expr = sizzle.selectors = {3923 // can be adjusted by the user3924 cachelength: 50,3925 createpseudo: markfunction,3926 match: matchexpr,3927 find: {},3928 relative: {3929 ">": { dir: "parentnode", first: true },3930 " ": { dir: "parentnode" },3931 "+": { dir: "previoussibling", first: true },3932 "~": { dir: "previoussibling" }3933 },3934 prefilter: {3935 "attr": function( match ) {3936 match[1] = match[1].replace( runescape, funescape );3937 // move the given value to match[3] whether quoted or unquoted3938 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );3939 if ( match[2] === "~=" ) {3940 match[3] = " " + match[3] + " ";3941 }3942 return match.slice( 0, 4 );3943 },3944 "child": function( match ) {3945 /* matches from matchexpr["child"]3946 1 type (only|nth|...)3947 2 what (child|of-type)3948 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)3949 4 xn-component of xn+y argument ([+-]?\d*n|)3950 5 sign of xn-component3951 6 x of xn-component3952 7 sign of y-component3953 8 y of y-component3954 */3955 match[1] = match[1].tolowercase();3956 if ( match[1].slice( 0, 3 ) === "nth" ) {3957 // nth-* requires argument3958 if ( !match[3] ) {3959 sizzle.error( match[0] );3960 }3961 // numeric x and y parameters for expr.filter.child3962 // remember that false/true cast respectively to 0/13963 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );3964 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );3965 // other types prohibit arguments3966 } else if ( match[3] ) {3967 sizzle.error( match[0] );3968 }3969 return match;3970 },3971 "pseudo": function( match ) {3972 var excess,3973 unquoted = !match[5] && match[2];3974 if ( matchexpr["child"].test( match[0] ) ) {3975 return null;3976 }3977 // accept quoted arguments as-is3978 if ( match[4] ) {3979 match[2] = match[4];3980 // strip excess characters from unquoted arguments3981 } else if ( unquoted && rpseudo.test( unquoted ) &&3982 // get excess from tokenize (recursively)3983 (excess = tokenize( unquoted, true )) &&3984 // advance to the next closing parenthesis3985 (excess = unquoted.indexof( ")", unquoted.length - excess ) - unquoted.length) ) {3986 // excess is a negative index3987 match[0] = match[0].slice( 0, excess );3988 match[2] = unquoted.slice( 0, excess );3989 }3990 // return only captures needed by the pseudo filter method (type and argument)3991 return match.slice( 0, 3 );3992 }3993 },3994 filter: {3995 "tag": function( nodename ) {3996 if ( nodename === "*" ) {3997 return function() { return true; };3998 }3999 nodename = nodename.replace( runescape, funescape ).tolowercase();4000 return function( elem ) {4001 return elem.nodename && elem.nodename.tolowercase() === nodename;4002 };4003 },4004 "class": function( classname ) {4005 var pattern = classcache[ classname + " " ];4006 return pattern ||4007 (pattern = new regexp( "(^|" + whitespace + ")" + classname + "(" + whitespace + "|$)" )) &&4008 classcache( classname, function( elem ) {4009 return pattern.test( elem.classname || (typeof elem.getattribute !== strundefined && elem.getattribute("class")) || "" );4010 });4011 },4012 "attr": function( name, operator, check ) {4013 return function( elem ) {4014 var result = sizzle.attr( elem, name );4015 if ( result == null ) {4016 return operator === "!=";4017 }4018 if ( !operator ) {4019 return true;4020 }4021 result += "";4022 return operator === "=" ? result === check :4023 operator === "!=" ? result !== check :4024 operator === "^=" ? check && result.indexof( check ) === 0 :4025 operator === "*=" ? check && result.indexof( check ) > -1 :4026 operator === "$=" ? check && result.slice( -check.length ) === check :4027 operator === "~=" ? ( " " + result + " " ).indexof( check ) > -1 :4028 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :4029 false;4030 };4031 },4032 "child": function( type, what, argument, first, last ) {4033 var simple = type.slice( 0, 3 ) !== "nth",4034 forward = type.slice( -4 ) !== "last",4035 oftype = what === "of-type";4036 return first === 1 && last === 0 ?4037 // shortcut for :nth-*(n)4038 function( elem ) {4039 return !!elem.parentnode;4040 } :4041 function( elem, context, xml ) {4042 var cache, outercache, node, diff, nodeindex, start,4043 dir = simple !== forward ? "nextsibling" : "previoussibling",4044 parent = elem.parentnode,4045 name = oftype && elem.nodename.tolowercase(),4046 usecache = !xml && !oftype;4047 if ( parent ) {4048 // :(first|last|only)-(child|of-type)4049 if ( simple ) {4050 while ( dir ) {4051 node = elem;4052 while ( (node = node[ dir ]) ) {4053 if ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) {4054 return false;4055 }4056 }4057 // reverse direction for :only-* (if we haven't yet done so)4058 start = dir = type === "only" && !start && "nextsibling";4059 }4060 return true;4061 }4062 start = [ forward ? parent.firstchild : parent.lastchild ];4063 // non-xml :nth-child(...) stores cache data on `parent`4064 if ( forward && usecache ) {4065 // seek `elem` from a previously-cached index4066 outercache = parent[ expando ] || (parent[ expando ] = {});4067 cache = outercache[ type ] || [];4068 nodeindex = cache[0] === dirruns && cache[1];4069 diff = cache[0] === dirruns && cache[2];4070 node = nodeindex && parent.childnodes[ nodeindex ];4071 while ( (node = ++nodeindex && node && node[ dir ] ||4072 // fallback to seeking `elem` from the start4073 (diff = nodeindex = 0) || start.pop()) ) {4074 // when found, cache indexes on `parent` and break4075 if ( node.nodetype === 1 && ++diff && node === elem ) {4076 outercache[ type ] = [ dirruns, nodeindex, diff ];4077 break;4078 }4079 }4080 // use previously-cached element index if available4081 } else if ( usecache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {4082 diff = cache[1];4083 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)4084 } else {4085 // use the same loop as above to seek `elem` from the start4086 while ( (node = ++nodeindex && node && node[ dir ] ||4087 (diff = nodeindex = 0) || start.pop()) ) {4088 if ( ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) && ++diff ) {4089 // cache the index of each encountered element4090 if ( usecache ) {4091 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];4092 }4093 if ( node === elem ) {4094 break;4095 }4096 }4097 }4098 }4099 // incorporate the offset, then check against cycle size4100 diff -= last;4101 return diff === first || ( diff % first === 0 && diff / first >= 0 );4102 }4103 };4104 },4105 "pseudo": function( pseudo, argument ) {4106 // pseudo-class names are case-insensitive4107 // http://www.w3.org/tr/selectors/#pseudo-classes4108 // prioritize by case sensitivity in case custom pseudos are added with uppercase letters4109 // remember that setfilters inherits from pseudos4110 var args,4111 fn = expr.pseudos[ pseudo ] || expr.setfilters[ pseudo.tolowercase() ] ||4112 sizzle.error( "unsupported pseudo: " + pseudo );4113 // the user may use createpseudo to indicate that4114 // arguments are needed to create the filter function4115 // just as sizzle does4116 if ( fn[ expando ] ) {4117 return fn( argument );4118 }4119 // but maintain support for old signatures4120 if ( fn.length > 1 ) {4121 args = [ pseudo, pseudo, "", argument ];4122 return expr.setfilters.hasownproperty( pseudo.tolowercase() ) ?4123 markfunction(function( seed, matches ) {4124 var idx,4125 matched = fn( seed, argument ),4126 i = matched.length;4127 while ( i-- ) {4128 idx = indexof.call( seed, matched[i] );4129 seed[ idx ] = !( matches[ idx ] = matched[i] );4130 }4131 }) :4132 function( elem ) {4133 return fn( elem, 0, args );4134 };4135 }4136 return fn;4137 }4138 },4139 pseudos: {4140 // potentially complex pseudos4141 "not": markfunction(function( selector ) {4142 // trim the selector passed to compile4143 // to avoid treating leading and trailing4144 // spaces as combinators4145 var input = [],4146 results = [],4147 matcher = compile( selector.replace( rtrim, "$1" ) );4148 return matcher[ expando ] ?4149 markfunction(function( seed, matches, context, xml ) {4150 var elem,4151 unmatched = matcher( seed, null, xml, [] ),4152 i = seed.length;4153 // match elements unmatched by `matcher`4154 while ( i-- ) {4155 if ( (elem = unmatched[i]) ) {4156 seed[i] = !(matches[i] = elem);4157 }4158 }4159 }) :4160 function( elem, context, xml ) {4161 input[0] = elem;4162 matcher( input, null, xml, results );4163 return !results.pop();4164 };4165 }),4166 "has": markfunction(function( selector ) {4167 return function( elem ) {4168 return sizzle( selector, elem ).length > 0;4169 };4170 }),4171 "contains": markfunction(function( text ) {4172 return function( elem ) {4173 return ( elem.textcontent || elem.innertext || gettext( elem ) ).indexof( text ) > -1;4174 };4175 }),4176 // "whether an element is represented by a :lang() selector4177 // is based solely on the element's language value4178 // being equal to the identifier c,4179 // or beginning with the identifier c immediately followed by "-".4180 // the matching of c against the element's language value is performed case-insensitively.4181 // the identifier c does not have to be a valid language name."4182 // http://www.w3.org/tr/selectors/#lang-pseudo4183 "lang": markfunction( function( lang ) {4184 // lang value must be a valid identifider4185 if ( !ridentifier.test(lang || "") ) {4186 sizzle.error( "unsupported lang: " + lang );4187 }4188 lang = lang.replace( runescape, funescape ).tolowercase();4189 return function( elem ) {4190 var elemlang;4191 do {4192 if ( (elemlang = documentisxml ?4193 elem.getattribute("xml:lang") || elem.getattribute("lang") :4194 elem.lang) ) {4195 elemlang = elemlang.tolowercase();4196 return elemlang === lang || elemlang.indexof( lang + "-" ) === 0;4197 }4198 } while ( (elem = elem.parentnode) && elem.nodetype === 1 );4199 return false;4200 };4201 }),4202 // miscellaneous4203 "target": function( elem ) {4204 var hash = window.location && window.location.hash;4205 return hash && hash.slice( 1 ) === elem.id;4206 },4207 "root": function( elem ) {4208 return elem === docelem;4209 },4210 "focus": function( elem ) {4211 return elem === document.activeelement && (!document.hasfocus || document.hasfocus()) && !!(elem.type || elem.href || ~elem.tabindex);4212 },4213 // boolean properties4214 "enabled": function( elem ) {4215 return elem.disabled === false;4216 },4217 "disabled": function( elem ) {4218 return elem.disabled === true;4219 },4220 "checked": function( elem ) {4221 // in css3, :checked should return both checked and selected elements4222 // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked4223 var nodename = elem.nodename.tolowercase();4224 return (nodename === "input" && !!elem.checked) || (nodename === "option" && !!elem.selected);4225 },4226 "selected": function( elem ) {4227 // accessing this property makes selected-by-default4228 // options in safari work properly4229 if ( elem.parentnode ) {4230 elem.parentnode.selectedindex;4231 }4232 return elem.selected === true;4233 },4234 // contents4235 "empty": function( elem ) {4236 // http://www.w3.org/tr/selectors/#empty-pseudo4237 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),4238 // not comment, processing instructions, or others4239 // thanks to diego perini for the nodename shortcut4240 // greater than "@" means alpha characters (specifically not starting with "#" or "?")4241 for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) {4242 if ( elem.nodename > "@" || elem.nodetype === 3 || elem.nodetype === 4 ) {4243 return false;4244 }4245 }4246 return true;4247 },4248 "parent": function( elem ) {4249 return !expr.pseudos["empty"]( elem );4250 },4251 // element/input types4252 "header": function( elem ) {4253 return rheader.test( elem.nodename );4254 },4255 "input": function( elem ) {4256 return rinputs.test( elem.nodename );4257 },4258 "button": function( elem ) {4259 var name = elem.nodename.tolowercase();4260 return name === "input" && elem.type === "button" || name === "button";4261 },4262 "text": function( elem ) {4263 var attr;4264 // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc)4265 // use getattribute instead to test this case4266 return elem.nodename.tolowercase() === "input" &&4267 elem.type === "text" &&4268 ( (attr = elem.getattribute("type")) == null || attr.tolowercase() === elem.type );4269 },4270 // position-in-collection4271 "first": createpositionalpseudo(function() {4272 return [ 0 ];4273 }),4274 "last": createpositionalpseudo(function( matchindexes, length ) {4275 return [ length - 1 ];4276 }),4277 "eq": createpositionalpseudo(function( matchindexes, length, argument ) {4278 return [ argument < 0 ? argument + length : argument ];4279 }),4280 "even": createpositionalpseudo(function( matchindexes, length ) {4281 var i = 0;4282 for ( ; i < length; i += 2 ) {4283 matchindexes.push( i );4284 }4285 return matchindexes;4286 }),4287 "odd": createpositionalpseudo(function( matchindexes, length ) {4288 var i = 1;4289 for ( ; i < length; i += 2 ) {4290 matchindexes.push( i );4291 }4292 return matchindexes;4293 }),4294 "lt": createpositionalpseudo(function( matchindexes, length, argument ) {4295 var i = argument < 0 ? argument + length : argument;4296 for ( ; --i >= 0; ) {4297 matchindexes.push( i );4298 }4299 return matchindexes;4300 }),4301 "gt": createpositionalpseudo(function( matchindexes, length, argument ) {4302 var i = argument < 0 ? argument + length : argument;4303 for ( ; ++i < length; ) {4304 matchindexes.push( i );4305 }4306 return matchindexes;4307 })4308 }4309};4310// add button/input type pseudos4311for ( i in { radio: true, checkbox: true, file: true, password : true, image: true } ) {4312 expr.pseudos[ i ] = createinputpseudo( i );4313}4314for ( i in { submit: true, reset: true } ) {4315 expr.pseudos[ i ] = createbuttonpseudo( i );4316}4317function tokenize( selector, parseonly ) {4318 var matched, match, tokens, type,4319 sofar, groups, prefilters,4320 cached = tokencache[ selector + " " ];4321 if ( cached ) {4322 return parseonly ? 0 : cached.slice( 0 );4323 }4324 sofar = selector;4325 groups = [];4326 prefilters = expr.prefilter;4327 while ( sofar ) {4328 // comma and first run4329 if ( !matched || (match = rcomma.exec( sofar )) ) {4330 if ( match ) {4331 // don't consume trailing commas as valid4332 sofar = sofar.slice( match[0].length ) || sofar;4333 }4334 groups.push( tokens = [] );4335 }4336 matched = false;4337 // combinators4338 if ( (match = rcombinators.exec( sofar )) ) {4339 matched = match.shift();4340 tokens.push( {4341 value: matched,4342 // cast descendant combinators to space4343 type: match[0].replace( rtrim, " " )4344 } );4345 sofar = sofar.slice( matched.length );4346 }4347 // filters4348 for ( type in expr.filter ) {4349 if ( (match = matchexpr[ type ].exec( sofar )) && (!prefilters[ type ] ||4350 (match = prefilters[ type ]( match ))) ) {4351 matched = match.shift();4352 tokens.push( {4353 value: matched,4354 type: type,4355 matches: match4356 } );4357 sofar = sofar.slice( matched.length );4358 }4359 }4360 if ( !matched ) {4361 break;4362 }4363 }4364 // return the length of the invalid excess4365 // if we're just parsing4366 // otherwise, throw an error or return tokens4367 return parseonly ?4368 sofar.length :4369 sofar ?4370 sizzle.error( selector ) :4371 // cache the tokens4372 tokencache( selector, groups ).slice( 0 );4373}4374function toselector( tokens ) {4375 var i = 0,4376 len = tokens.length,4377 selector = "";4378 for ( ; i < len; i++ ) {4379 selector += tokens[i].value;4380 }4381 return selector;4382}4383function addcombinator( matcher, combinator, base ) {4384 var dir = combinator.dir,4385 checknonelements = base && dir === "parentnode",4386 donename = done++;4387 return combinator.first ?4388 // check against closest ancestor/preceding element4389 function( elem, context, xml ) {4390 while ( (elem = elem[ dir ]) ) {4391 if ( elem.nodetype === 1 || checknonelements ) {4392 return matcher( elem, context, xml );4393 }4394 }4395 } :4396 // check against all ancestor/preceding elements4397 function( elem, context, xml ) {4398 var data, cache, outercache,4399 dirkey = dirruns + " " + donename;4400 // we can't set arbitrary data on xml nodes, so they don't benefit from dir caching4401 if ( xml ) {4402 while ( (elem = elem[ dir ]) ) {4403 if ( elem.nodetype === 1 || checknonelements ) {4404 if ( matcher( elem, context, xml ) ) {4405 return true;4406 }4407 }4408 }4409 } else {4410 while ( (elem = elem[ dir ]) ) {4411 if ( elem.nodetype === 1 || checknonelements ) {4412 outercache = elem[ expando ] || (elem[ expando ] = {});4413 if ( (cache = outercache[ dir ]) && cache[0] === dirkey ) {4414 if ( (data = cache[1]) === true || data === cachedruns ) {4415 return data === true;4416 }4417 } else {4418 cache = outercache[ dir ] = [ dirkey ];4419 cache[1] = matcher( elem, context, xml ) || cachedruns;4420 if ( cache[1] === true ) {4421 return true;4422 }4423 }4424 }4425 }4426 }4427 };4428}4429function elementmatcher( matchers ) {4430 return matchers.length > 1 ?4431 function( elem, context, xml ) {4432 var i = matchers.length;4433 while ( i-- ) {4434 if ( !matchers[i]( elem, context, xml ) ) {4435 return false;4436 }4437 }4438 return true;4439 } :4440 matchers[0];4441}4442function condense( unmatched, map, filter, context, xml ) {4443 var elem,4444 newunmatched = [],4445 i = 0,4446 len = unmatched.length,4447 mapped = map != null;4448 for ( ; i < len; i++ ) {4449 if ( (elem = unmatched[i]) ) {4450 if ( !filter || filter( elem, context, xml ) ) {4451 newunmatched.push( elem );4452 if ( mapped ) {4453 map.push( i );4454 }4455 }4456 }4457 }4458 return newunmatched;4459}4460function setmatcher( prefilter, selector, matcher, postfilter, postfinder, postselector ) {4461 if ( postfilter && !postfilter[ expando ] ) {4462 postfilter = setmatcher( postfilter );4463 }4464 if ( postfinder && !postfinder[ expando ] ) {4465 postfinder = setmatcher( postfinder, postselector );4466 }4467 return markfunction(function( seed, results, context, xml ) {4468 var temp, i, elem,4469 premap = [],4470 postmap = [],4471 preexisting = results.length,4472 // get initial elements from seed or context4473 elems = seed || multiplecontexts( selector || "*", context.nodetype ? [ context ] : context, [] ),4474 // prefilter to get matcher input, preserving a map for seed-results synchronization4475 matcherin = prefilter && ( seed || !selector ) ?4476 condense( elems, premap, prefilter, context, xml ) :4477 elems,4478 matcherout = matcher ?4479 // if we have a postfinder, or filtered seed, or non-seed postfilter or preexisting results,4480 postfinder || ( seed ? prefilter : preexisting || postfilter ) ?4481 // ...intermediate processing is necessary4482 [] :4483 // ...otherwise use results directly4484 results :4485 matcherin;4486 // find primary matches4487 if ( matcher ) {4488 matcher( matcherin, matcherout, context, xml );4489 }4490 // apply postfilter4491 if ( postfilter ) {4492 temp = condense( matcherout, postmap );4493 postfilter( temp, [], context, xml );4494 // un-match failing elements by moving them back to matcherin4495 i = temp.length;4496 while ( i-- ) {4497 if ( (elem = temp[i]) ) {4498 matcherout[ postmap[i] ] = !(matcherin[ postmap[i] ] = elem);4499 }4500 }4501 }4502 if ( seed ) {4503 if ( postfinder || prefilter ) {4504 if ( postfinder ) {4505 // get the final matcherout by condensing this intermediate into postfinder contexts4506 temp = [];4507 i = matcherout.length;4508 while ( i-- ) {4509 if ( (elem = matcherout[i]) ) {4510 // rest ore matcherin since elem is not yet a final match4511 temp.push( (matcherin[i] = elem) );4512 }4513 }4514 postfinder( null, (matcherout = []), temp, xml );4515 }4516 // move matched elements from seed to results to keep them synchronized4517 i = matcherout.length;4518 while ( i-- ) {4519 if ( (elem = matcherout[i]) &&4520 (temp = postfinder ? indexof.call( seed, elem ) : premap[i]) > -1 ) {4521 seed[temp] = !(results[temp] = elem);4522 }4523 }4524 }4525 // add elements to results, through postfinder if defined4526 } else {4527 matcherout = condense(4528 matcherout === results ?4529 matcherout.splice( preexisting, matcherout.length ) :4530 matcherout4531 );4532 if ( postfinder ) {4533 postfinder( null, results, matcherout, xml );4534 } else {4535 push.apply( results, matcherout );4536 }4537 }4538 });4539}4540function matcherfromtokens( tokens ) {4541 var checkcontext, matcher, j,4542 len = tokens.length,4543 leadingrelative = expr.relative[ tokens[0].type ],4544 implicitrelative = leadingrelative || expr.relative[" "],4545 i = leadingrelative ? 1 : 0,4546 // the foundational matcher ensures that elements are reachable from top-level context(s)4547 matchcontext = addcombinator( function( elem ) {4548 return elem === checkcontext;4549 }, implicitrelative, true ),4550 matchanycontext = addcombinator( function( elem ) {4551 return indexof.call( checkcontext, elem ) > -1;4552 }, implicitrelative, true ),4553 matchers = [ function( elem, context, xml ) {4554 return ( !leadingrelative && ( xml || context !== outermostcontext ) ) || (4555 (checkcontext = context).nodetype ?4556 matchcontext( elem, context, xml ) :4557 matchanycontext( elem, context, xml ) );4558 } ];4559 for ( ; i < len; i++ ) {4560 if ( (matcher = expr.relative[ tokens[i].type ]) ) {4561 matchers = [ addcombinator(elementmatcher( matchers ), matcher) ];4562 } else {4563 matcher = expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );4564 // return special upon seeing a positional matcher4565 if ( matcher[ expando ] ) {4566 // find the next relative operator (if any) for proper handling4567 j = ++i;4568 for ( ; j < len; j++ ) {4569 if ( expr.relative[ tokens[j].type ] ) {4570 break;4571 }4572 }4573 return setmatcher(4574 i > 1 && elementmatcher( matchers ),4575 i > 1 && toselector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),4576 matcher,4577 i < j && matcherfromtokens( tokens.slice( i, j ) ),4578 j < len && matcherfromtokens( (tokens = tokens.slice( j )) ),4579 j < len && toselector( tokens )4580 );4581 }4582 matchers.push( matcher );4583 }4584 }4585 return elementmatcher( matchers );4586}4587function matcherfromgroupmatchers( elementmatchers, setmatchers ) {4588 // a counter to specify which element is currently being matched4589 var matchercachedruns = 0,4590 byset = setmatchers.length > 0,4591 byelement = elementmatchers.length > 0,4592 supermatcher = function( seed, context, xml, results, expandcontext ) {4593 var elem, j, matcher,4594 setmatched = [],4595 matchedcount = 0,4596 i = "0",4597 unmatched = seed && [],4598 outermost = expandcontext != null,4599 contextbackup = outermostcontext,4600 // we must always have either seed elements or context4601 elems = seed || byelement && expr.find["tag"]( "*", expandcontext && context.parentnode || context ),4602 // use integer dirruns iff this is the outermost matcher4603 dirrunsunique = (dirruns += contextbackup == null ? 1 : math.random() || 0.1);4604 if ( outermost ) {4605 outermostcontext = context !== document && context;4606 cachedruns = matchercachedruns;4607 }4608 // add elements passing elementmatchers directly to results4609 // keep `i` a string if there are no elements so `matchedcount` will be "00" below4610 for ( ; (elem = elems[i]) != null; i++ ) {4611 if ( byelement && elem ) {4612 j = 0;4613 while ( (matcher = elementmatchers[j++]) ) {4614 if ( matcher( elem, context, xml ) ) {4615 results.push( elem );4616 break;4617 }4618 }4619 if ( outermost ) {4620 dirruns = dirrunsunique;4621 cachedruns = ++matchercachedruns;4622 }4623 }4624 // track unmatched elements for set filters4625 if ( byset ) {4626 // they will have gone through all possible matchers4627 if ( (elem = !matcher && elem) ) {4628 matchedcount--;4629 }4630 // lengthen the array for every element, matched or not4631 if ( seed ) {4632 unmatched.push( elem );4633 }4634 }4635 }4636 // apply set filters to unmatched elements4637 matchedcount += i;4638 if ( byset && i !== matchedcount ) {4639 j = 0;4640 while ( (matcher = setmatchers[j++]) ) {4641 matcher( unmatched, setmatched, context, xml );4642 }4643 if ( seed ) {4644 // reintegrate element matches to eliminate the need for sorting4645 if ( matchedcount > 0 ) {4646 while ( i-- ) {4647 if ( !(unmatched[i] || setmatched[i]) ) {4648 setmatched[i] = pop.call( results );4649 }4650 }4651 }4652 // discard index placeholder values to get only actual matches4653 setmatched = condense( setmatched );4654 }4655 // add matches to results4656 push.apply( results, setmatched );4657 // seedless set matches succeeding multiple successful matchers stipulate sorting4658 if ( outermost && !seed && setmatched.length > 0 &&4659 ( matchedcount + setmatchers.length ) > 1 ) {4660 sizzle.uniquesort( results );4661 }4662 }4663 // override manipulation of globals by nested matchers4664 if ( outermost ) {4665 dirruns = dirrunsunique;4666 outermostcontext = contextbackup;4667 }4668 return unmatched;4669 };4670 return byset ?4671 markfunction( supermatcher ) :4672 supermatcher;4673}4674compile = sizzle.compile = function( selector, group /* internal use only */ ) {4675 var i,4676 setmatchers = [],4677 elementmatchers = [],4678 cached = compilercache[ selector + " " ];4679 if ( !cached ) {4680 // generate a function of recursive functions that can be used to check each element4681 if ( !group ) {4682 group = tokenize( selector );4683 }4684 i = group.length;4685 while ( i-- ) {4686 cached = matcherfromtokens( group[i] );4687 if ( cached[ expando ] ) {4688 setmatchers.push( cached );4689 } else {4690 elementmatchers.push( cached );4691 }4692 }4693 // cache the compiled function4694 cached = compilercache( selector, matcherfromgroupmatchers( elementmatchers, setmatchers ) );4695 }4696 return cached;4697};4698function multiplecontexts( selector, contexts, results ) {4699 var i = 0,4700 len = contexts.length;4701 for ( ; i < len; i++ ) {4702 sizzle( selector, contexts[i], results );4703 }4704 return results;4705}4706function select( selector, context, results, seed ) {4707 var i, tokens, token, type, find,4708 match = tokenize( selector );4709 if ( !seed ) {4710 // try to minimize operations if there is only one group4711 if ( match.length === 1 ) {4712 // take a shortcut and set the context if the root selector is an id4713 tokens = match[0] = match[0].slice( 0 );4714 if ( tokens.length > 2 && (token = tokens[0]).type === "id" &&4715 context.nodetype === 9 && !documentisxml &&4716 expr.relative[ tokens[1].type ] ) {4717 context = expr.find["id"]( token.matches[0].replace( runescape, funescape ), context )[0];4718 if ( !context ) {4719 return results;4720 }4721 selector = selector.slice( tokens.shift().value.length );4722 }4723 // fetch a seed set for right-to-left matching4724 i = matchexpr["needscontext"].test( selector ) ? 0 : tokens.length;4725 while ( i-- ) {4726 token = tokens[i];4727 // abort if we hit a combinator4728 if ( expr.relative[ (type = token.type) ] ) {4729 break;4730 }4731 if ( (find = expr.find[ type ]) ) {4732 // search, expanding context for leading sibling combinators4733 if ( (seed = find(4734 token.matches[0].replace( runescape, funescape ),4735 rsibling.test( tokens[0].type ) && context.parentnode || context4736 )) ) {4737 // if seed is empty or no tokens remain, we can return early4738 tokens.splice( i, 1 );4739 selector = seed.length && toselector( tokens );4740 if ( !selector ) {4741 push.apply( results, slice.call( seed, 0 ) );4742 return results;4743 }4744 break;4745 }4746 }4747 }4748 }4749 }4750 // compile and execute a filtering function4751 // provide `match` to avoid retokenization if we modified the selector above4752 compile( selector, match )(4753 seed,4754 context,4755 documentisxml,4756 results,4757 rsibling.test( selector )4758 );4759 return results;4760}4761// deprecated4762expr.pseudos["nth"] = expr.pseudos["eq"];4763// easy api for creating new setfilters4764function setfilters() {}4765expr.filters = setfilters.prototype = expr.pseudos;4766expr.setfilters = new setfilters();4767// initialize with the default document4768setdocument();4769// override sizzle attribute retrieval4770sizzle.attr = jquery .attr;4771jquery .find = sizzle;4772jquery .expr = sizzle.selectors;4773jquery .expr[":"] = jquery .expr.pseudos;4774jquery .unique = sizzle.uniquesort;4775jquery .text = sizzle.gettext;4776jquery .isxmldoc = sizzle.isxml;4777jquery .contains = sizzle.contains;4778})( window );4779var runtil = /until$/,4780 rparentsprev = /^(?:parents|prev(?:until|all))/,4781 issimple = /^.[^:#\[\.,]*$/,4782 rneedscontext = jquery .expr.match.needscontext,4783 // methods guaranteed to produce a unique set when starting from a unique set4784 guaranteedunique = {4785 children: true,4786 contents: true,4787 next: true,4788 prev: true4789 };4790jquery .fn.extend({4791 find: function( selector ) {4792 var i, ret, self,4793 len = this.length;4794 if ( typeof selector !== "string" ) {4795 self = this;4796 return this.pushstack( jquery ( selector ).filter(function() {4797 for ( i = 0; i < len; i++ ) {4798 if ( jquery .contains( self[ i ], this ) ) {4799 return true;4800 }4801 }4802 }) );4803 }4804 ret = [];4805 for ( i = 0; i < len; i++ ) {4806 jquery .find( selector, this[ i ], ret );4807 }4808 // needed because $( selector, context ) becomes $( context ).find( selector )4809 ret = this.pushstack( len > 1 ? jquery .unique( ret ) : ret );4810 ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;4811 return ret;4812 },4813 has: function( target ) {4814 var i,4815 targets = jquery ( target, this ),4816 len = targets.length;4817 return this.filter(function() {4818 for ( i = 0; i < len; i++ ) {4819 if ( jquery .contains( this, targets[i] ) ) {4820 return true;4821 }4822 }4823 });4824 },4825 not: function( selector ) {4826 return this.pushstack( winnow(this, selector, false) );4827 },4828 filter: function( selector ) {4829 return this.pushstack( winnow(this, selector, true) );4830 },4831 is: function( selector ) {4832 return !!selector && (4833 typeof selector === "string" ?4834 // if this is a positional/relative selector, check membership in the returned set4835 // so $("p:first").is("p:last") won't return true for a doc with two "p".4836 rneedscontext.test( selector ) ?4837 jquery ( selector, this.context ).index( this[0] ) >= 0 :4838 jquery .filter( selector, this ).length > 0 :4839 this.filter( selector ).length > 0 );4840 },4841 closest: function( selectors, context ) {4842 var cur,4843 i = 0,4844 l = this.length,4845 ret = [],4846 pos = rneedscontext.test( selectors ) || typeof selectors !== "string" ?4847 jquery ( selectors, context || this.context ) :4848 0;4849 for ( ; i < l; i++ ) {4850 cur = this[i];4851 while ( cur && cur.ownerdocument && cur !== context && cur.nodetype !== 11 ) {4852 if ( pos ? pos.index(cur) > -1 : jquery .find.matchesselector(cur, selectors) ) {4853 ret.push( cur );4854 break;4855 }4856 cur = cur.parentnode;4857 }4858 }4859 return this.pushstack( ret.length > 1 ? jquery .unique( ret ) : ret );4860 },4861 // determine the position of an element within4862 // the matched set of elements4863 index: function( elem ) {4864 // no argument, return index in parent4865 if ( !elem ) {4866 return ( this[0] && this[0].parentnode ) ? this.first().prevall().length : -1;4867 }4868 // index in selector4869 if ( typeof elem === "string" ) {4870 return jquery .inarray( this[0], jquery ( elem ) );4871 }4872 // locate the position of the desired element4873 return jquery .inarray(4874 // if it receives a jquery object, the first element is used4875 elem.jquery ? elem[0] : elem, this );4876 },4877 add: function( selector, context ) {4878 var set = typeof selector === "string" ?4879 jquery ( selector, context ) :4880 jquery .makearray( selector && selector.nodetype ? [ selector ] : selector ),4881 all = jquery .merge( this.get(), set );4882 return this.pushstack( jquery .unique(all) );4883 },4884 addback: function( selector ) {4885 return this.add( selector == null ?4886 this.prevobject : this.prevobject.filter(selector)4887 );4888 }4889});4890jquery .fn.andself = jquery .fn.addback;4891function sibling( cur, dir ) {4892 do {4893 cur = cur[ dir ];4894 } while ( cur && cur.nodetype !== 1 );4895 return cur;4896}4897jquery .each({4898 parent: function( elem ) {4899 var parent = elem.parentnode;4900 return parent && parent.nodetype !== 11 ? parent : null;4901 },4902 parents: function( elem ) {4903 return jquery .dir( elem, "parentnode" );4904 },4905 parentsuntil: function( elem, i, until ) {4906 return jquery .dir( elem, "parentnode", until );4907 },4908 next: function( elem ) {4909 return sibling( elem, "nextsibling" );4910 },4911 prev: function( elem ) {4912 return sibling( elem, "previoussibling" );4913 },4914 nextall: function( elem ) {4915 return jquery .dir( elem, "nextsibling" );4916 },4917 prevall: function( elem ) {4918 return jquery .dir( elem, "previoussibling" );4919 },4920 nextuntil: function( elem, i, until ) {4921 return jquery .dir( elem, "nextsibling", until );4922 },4923 prevuntil: function( elem, i, until ) {4924 return jquery .dir( elem, "previoussibling", until );4925 },4926 siblings: function( elem ) {4927 return jquery .sibling( ( elem.parentnode || {} ).firstchild, elem );4928 },4929 children: function( elem ) {4930 return jquery .sibling( elem.firstchild );4931 },4932 contents: function( elem ) {4933 return jquery .nodename( elem, "iframe" ) ?4934 elem.contentdocument || elem.contentwindow.document :4935 jquery .merge( [], elem.childnodes );4936 }4937}, function( name, fn ) {4938 jquery .fn[ name ] = function( until, selector ) {4939 var ret = jquery .map( this, fn, until );4940 if ( !runtil.test( name ) ) {4941 selector = until;4942 }4943 if ( selector && typeof selector === "string" ) {4944 ret = jquery .filter( selector, ret );4945 }4946 ret = this.length > 1 && !guaranteedunique[ name ] ? jquery .unique( ret ) : ret;4947 if ( this.length > 1 && rparentsprev.test( name ) ) {4948 ret = ret.reverse();4949 }4950 return this.pushstack( ret );4951 };4952});4953jquery .extend({4954 filter: function( expr, elems, not ) {4955 if ( not ) {4956 expr = ":not(" + expr + ")";4957 }4958 return elems.length === 1 ?4959 jquery .find.matchesselector(elems[0], expr) ? [ elems[0] ] : [] :4960 jquery .find.matches(expr, elems);4961 },4962 dir: function( elem, dir, until ) {4963 var matched = [],4964 cur = elem[ dir ];4965 while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery ( cur ).is( until )) ) {4966 if ( cur.nodetype === 1 ) {4967 matched.push( cur );4968 }4969 cur = cur[dir];4970 }4971 return matched;4972 },4973 sibling: function( n, elem ) {4974 var r = [];4975 for ( ; n; n = n.nextsibling ) {4976 if ( n.nodetype === 1 && n !== elem ) {4977 r.push( n );4978 }4979 }4980 return r;4981 }4982});4983// implement the identical functionality for filter and not4984function winnow( elements, qualifier, keep ) {4985 // can't pass null or undefined to indexof in firefox 44986 // set to 0 to skip string check4987 qualifier = qualifier || 0;4988 if ( jquery .isfunction( qualifier ) ) {4989 return jquery .grep(elements, function( elem, i ) {4990 var retval = !!qualifier.call( elem, i, elem );4991 return retval === keep;4992 });4993 } else if ( qualifier.nodetype ) {4994 return jquery .grep(elements, function( elem ) {4995 return ( elem === qualifier ) === keep;4996 });4997 } else if ( typeof qualifier === "string" ) {4998 var filtered = jquery .grep(elements, function( elem ) {4999 return elem.nodetype === 1;5000 });5001 if ( issimple.test( qualifier ) ) {5002 return jquery .filter(qualifier, filtered, !keep);5003 } else {5004 qualifier = jquery .filter( qualifier, filtered );5005 }5006 }5007 return jquery .grep(elements, function( elem ) {5008 return ( jquery .inarray( elem, qualifier ) >= 0 ) === keep;5009 });5010}5011function createsafefragment( document ) {5012 var list = nodenames.split( "|" ),5013 safefrag = document.createdocumentfragment();5014 if ( safefrag.createelement ) {5015 while ( list.length ) {5016 safefrag.createelement(5017 list.pop()5018 );5019 }5020 }5021 return safefrag;5022}5023var nodenames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +5024 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",5025 rinlinejquery = / jquery \d+="(?:null|\d+)"/g,5026 rnoshimcache = new regexp("<(?:" + nodenames + ")[\\s/>]", "i"),5027 rleadingwhitespace = /^\s+/,5028 rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,5029 rtagname = /<([\w:]+)/,5030 rtbody = /<tbody/i,5031 rhtml = /<|&#?\w+;/,5032 rnoinnerhtml = /<(?:script|style|link)/i,5033 manipulation_rcheckabletype = /^(?:checkbox|radio)$/i,5034 // checked="checked" or checked5035 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,5036 rscripttype = /^$|\/(?:java|ecma)script/i,5037 rscripttypemasked = /^true\/(.*)/,5038 rcleanscript = /^\s*<!(?:\[cdata\[|--)|(?:\]\]|--)>\s*$/g,5039 // we have to close these tags to support xhtml (#13200)5040 wrapmap = {5041 option: [ 1, "<select multiple='multiple'>", "</select>" ],5042 legend: [ 1, "<fieldset>", "</fieldset>" ],5043 area: [ 1, "<map>", "</map>" ],5044 param: [ 1, "<object>", "</object>" ],5045 thead: [ 1, "<table>", "</table>" ],5046 tr: [ 2, "<table><tbody>", "</tbody></table>" ],5047 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],5048 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],5049 // ie6-8 can't serialize link, script, style, or any html5 (noscope) tags,5050 // unless wrapped in a div with non-breaking characters in front of it.5051 _default: jquery .support.htmlserialize ? [ 0, "", "" ] : [ 1, "x<div>", "</div>" ]5052 },5053 safefragment = createsafefragment( document ),5054 fragmentdiv = safefragment.appendchild( document.createelement("div") );5055wrapmap.optgroup = wrapmap.option;5056wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead;5057wrapmap.th = wrapmap.td;5058jquery .fn.extend({5059 text: function( value ) {5060 return jquery .access( this, function( value ) {5061 return value === undefined ?5062 jquery .text( this ) :5063 this.empty().append( ( this[0] && this[0].ownerdocument || document ).createtextnode( value ) );5064 }, null, value, arguments.length );5065 },5066 wrapall: function( html ) {5067 if ( jquery .isfunction( html ) ) {5068 return this.each(function(i) {5069 jquery (this).wrapall( html.call(this, i) );5070 });5071 }5072 if ( this[0] ) {5073 // the elements to wrap the target around5074 var wrap = jquery ( html, this[0].ownerdocument ).eq(0).clone(true);5075 if ( this[0].parentnode ) {5076 wrap.insertbefore( this[0] );5077 }5078 wrap.map(function() {5079 var elem = this;5080 while ( elem.firstchild && elem.firstchild.nodetype === 1 ) {5081 elem = elem.firstchild;5082 }5083 return elem;5084 }).append( this );5085 }5086 return this;5087 },5088 wrapinner: function( html ) {5089 if ( jquery .isfunction( html ) ) {5090 return this.each(function(i) {5091 jquery (this).wrapinner( html.call(this, i) );5092 });5093 }5094 return this.each(function() {5095 var self = jquery ( this ),5096 contents = self.contents();5097 if ( contents.length ) {5098 contents.wrapall( html );5099 } else {5100 self.append( html );5101 }5102 });5103 },5104 wrap: function( html ) {5105 var isfunction = jquery .isfunction( html );5106 return this.each(function(i) {5107 jquery ( this ).wrapall( isfunction ? html.call(this, i) : html );5108 });5109 },5110 unwrap: function() {5111 return this.parent().each(function() {5112 if ( !jquery .nodename( this, "body" ) ) {5113 jquery ( this ).replacewith( this.childnodes );5114 }5115 }).end();5116 },5117 append: function() {5118 return this.dommanip(arguments, true, function( elem ) {5119 if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) {5120 this.appendchild( elem );5121 }5122 });5123 },5124 prepend: function() {5125 return this.dommanip(arguments, true, function( elem ) {5126 if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) {5127 this.insertbefore( elem, this.firstchild );5128 }5129 });5130 },5131 before: function() {5132 return this.dommanip( arguments, false, function( elem ) {5133 if ( this.parentnode ) {5134 this.parentnode.insertbefore( elem, this );5135 }5136 });5137 },5138 after: function() {5139 return this.dommanip( arguments, false, function( elem ) {5140 if ( this.parentnode ) {5141 this.parentnode.insertbefore( elem, this.nextsibling );5142 }5143 });5144 },5145 // keepdata is for internal use only--do not document5146 remove: function( selector, keepdata ) {5147 var elem,5148 i = 0;5149 for ( ; (elem = this[i]) != null; i++ ) {5150 if ( !selector || jquery .filter( selector, [ elem ] ).length > 0 ) {5151 if ( !keepdata && elem.nodetype === 1 ) {5152 jquery .cleandata( getall( elem ) );5153 }5154 if ( elem.parentnode ) {5155 if ( keepdata && jquery .contains( elem.ownerdocument, elem ) ) {5156 setglobaleval( getall( elem, "script" ) );5157 }5158 elem.parentnode.removechild( elem );5159 }5160 }5161 }5162 return this;5163 },5164 empty: function() {5165 var elem,5166 i = 0;5167 for ( ; (elem = this[i]) != null; i++ ) {5168 // remove element nodes and prevent memory leaks5169 if ( elem.nodetype === 1 ) {5170 jquery .cleandata( getall( elem, false ) );5171 }5172 // remove any remaining nodes5173 while ( elem.firstchild ) {5174 elem.removechild( elem.firstchild );5175 }5176 // if this is a select, ensure that it displays empty (#12336)5177 // support: ie<95178 if ( elem.options && jquery .nodename( elem, "select" ) ) {5179 elem.options.length = 0;5180 }5181 }5182 return this;5183 },5184 clone: function( dataandevents, deepdataandevents ) {5185 dataandevents = dataandevents == null ? false : dataandevents;5186 deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents;5187 return this.map( function () {5188 return jquery .clone( this, dataandevents, deepdataandevents );5189 });5190 },5191 html: function( value ) {5192 return jquery .access( this, function( value ) {5193 var elem = this[0] || {},5194 i = 0,5195 l = this.length;5196 if ( value === undefined ) {5197 return elem.nodetype === 1 ?5198 elem.innerhtml.replace( rinlinejquery , "" ) :5199 undefined;5200 }5201 // see if we can take a shortcut and just use innerhtml5202 if ( typeof value === "string" && !rnoinnerhtml.test( value ) &&5203 ( jquery .support.htmlserialize || !rnoshimcache.test( value ) ) &&5204 ( jquery .support.leadingwhitespace || !rleadingwhitespace.test( value ) ) &&5205 !wrapmap[ ( rtagname.exec( value ) || ["", ""] )[1].tolowercase() ] ) {5206 value = value.replace( rxhtmltag, "<$1></$2>" );5207 try {5208 for (; i < l; i++ ) {5209 // remove element nodes and prevent memory leaks5210 elem = this[i] || {};5211 if ( elem.nodetype === 1 ) {5212 jquery .cleandata( getall( elem, false ) );5213 elem.innerhtml = value;5214 }5215 }5216 elem = 0;5217 // if using innerhtml throws an exception, use the fallback method5218 } catch(e) {}5219 }5220 if ( elem ) {5221 this.empty().append( value );5222 }5223 }, null, value, arguments.length );5224 },5225 replacewith: function( value ) {5226 var isfunc = jquery .isfunction( value );5227 // make sure that the elements are removed from the dom before they are inserted5228 // this can help fix replacing a parent with child elements5229 if ( !isfunc && typeof value !== "string" ) {5230 value = jquery ( value ).not( this ).detach();5231 }5232 return this.dommanip( [ value ], true, function( elem ) {5233 var next = this.nextsibling,5234 parent = this.parentnode;5235 if ( parent ) {5236 jquery ( this ).remove();5237 parent.insertbefore( elem, next );5238 }5239 });5240 },5241 detach: function( selector ) {5242 return this.remove( selector, true );5243 },5244 dommanip: function( args, table, callback ) {5245 // flatten any nested arrays5246 args = core_concat.apply( [], args );5247 var first, node, hasscripts,5248 scripts, doc, fragment,5249 i = 0,5250 l = this.length,5251 set = this,5252 inoclone = l - 1,5253 value = args[0],5254 isfunction = jquery .isfunction( value );5255 // we can't clonenode fragments that contain checked, in webkit5256 if ( isfunction || !( l <= 1 || typeof value !== "string" || jquery .support.checkclone || !rchecked.test( value ) ) ) {5257 return this.each(function( index ) {5258 var self = set.eq( index );5259 if ( isfunction ) {5260 args[0] = value.call( this, index, table ? self.html() : undefined );5261 }5262 self.dommanip( args, table, callback );5263 });5264 }5265 if ( l ) {5266 fragment = jquery .buildfragment( args, this[ 0 ].ownerdocument, false, this );5267 first = fragment.firstchild;5268 if ( fragment.childnodes.length === 1 ) {5269 fragment = first;5270 }5271 if ( first ) {5272 table = table && jquery .nodename( first, "tr" );5273 scripts = jquery .map( getall( fragment, "script" ), disablescript );5274 hasscripts = scripts.length;5275 // use the original fragment for the last item instead of the first because it can end up5276 // being emptied incorrectly in certain situations (#8070).5277 for ( ; i < l; i++ ) {5278 node = fragment;5279 if ( i !== inoclone ) {5280 node = jquery .clone( node, true, true );5281 // keep references to cloned scripts for later rest oration5282 if ( hasscripts ) {5283 jquery .merge( scripts, getall( node, "script" ) );5284 }5285 }5286 callback.call(5287 table && jquery .nodename( this[i], "table" ) ?5288 findorappend( this[i], "tbody" ) :5289 this[i],5290 node,5291 i5292 );5293 }5294 if ( hasscripts ) {5295 doc = scripts[ scripts.length - 1 ].ownerdocument;5296 // reenable scripts5297 // 重新启用脚本5298 jquery .map( scripts, rest orescript );5299 // evaluate executable scripts on first document insertion5300 for ( i = 0; i < hasscripts; i++ ) {5301 node = scripts[ i ];5302 if ( rscripttype.test( node.type || "" ) &&5303 !jquery ._data( node, "globaleval" ) && jquery .contains( doc, node ) ) {5304 if ( node.src ) {5305 // hope ajax is available...5306 jquery .ajax({5307 url: node.src,5308 type: "get",5309 datatype: "script",5310 async: false,5311 global: false,5312 "throws": true5313 });5314 } else {5315 jquery .globaleval( ( node.text || node.textcontent || node.innerhtml || "" ).replace( rcleanscript, "" ) );5316 }5317 }5318 }5319 }5320 // fix #11809: avoid leaking memory5321 fragment = first = null;5322 }5323 }5324 return this;5325 }5326});5327function findorappend( elem, tag ) {5328 return elem.getelementsbytagname( tag )[0] || elem.appendchild( elem.ownerdocument.createelement( tag ) );5329}5330// replace/rest ore the type attribute of script elements for safe dom manipulation5331function disablescript( elem ) {5332 var attr = elem.getattributenode("type");5333 elem.type = ( attr && attr.specified ) + "/" + elem.type;5334 return elem;5335}5336function rest orescript( elem ) {5337 var match = rscripttypemasked.exec( elem.type );5338 if ( match ) {5339 elem.type = match[1];5340 } else {5341 elem.removeattribute("type");5342 }5343 return elem;5344}5345// mark scripts as having already been evaluated5346function setglobaleval( elems, refelements ) {5347 var elem,5348 i = 0;5349 for ( ; (elem = elems[i]) != null; i++ ) {5350 jquery ._data( elem, "globaleval", !refelements || jquery ._data( refelements[i], "globaleval" ) );5351 }5352}5353function clonecopyevent( src, dest ) {5354 if ( dest.nodetype !== 1 || !jquery .hasdata( src ) ) {5355 return;5356 }5357 var type, i, l,5358 olddata = jquery ._data( src ),5359 curdata = jquery ._data( dest, olddata ),5360 events = olddata.events;5361 if ( events ) {5362 delete curdata.handle;5363 curdata.events = {};5364 for ( type in events ) {5365 for ( i = 0, l = events[ type ].length; i < l; i++ ) {5366 jquery .event.add( dest, type, events[ type ][ i ] );5367 }5368 }5369 }5370 // make the cloned public data object a copy from the original5371 if ( curdata.data ) {5372 curdata.data = jquery .extend( {}, curdata.data );5373 }5374}5375function fixclonenodeissues( src, dest ) {5376 var nodename, e, data;5377 // we do not need to do anything for non-elements5378 if ( dest.nodetype !== 1 ) {5379 return;5380 }5381 nodename = dest.nodename.tolowercase();5382 // ie6-8 copies events bound via attachevent when using clonenode.5383 if ( !jquery .support.nocloneevent && dest[ jquery .expando ] ) {5384 data = jquery ._data( dest );5385 for ( e in data.events ) {5386 jquery .removeevent( dest, e, data.handle );5387 }5388 // event data gets referenced instead of copied if the expando gets copied too5389 dest.removeattribute( jquery .expando );5390 }5391 // ie blanks contents when cloning scripts, and tries to evaluate newly-set text5392 if ( nodename === "script" && dest.text !== src.text ) {5393 disablescript( dest ).text = src.text;5394 rest orescript( dest );5395 // ie6-10 improperly clones children of object elements using classid.5396 // ie10 throws nomodificationallowederror if parent is null, #12132.5397 } else if ( nodename === "object" ) {5398 if ( dest.parentnode ) {5399 dest.outerhtml = src.outerhtml;5400 }5401 // this path appears unavoidable for ie9. when cloning an object5402 // element in ie9, the outerhtml strategy above is not sufficient.5403 // if the src has innerhtml and the destination does not,5404 // copy the src.innerhtml into the dest.innerhtml. #103245405 if ( jquery .support.html5clone && ( src.innerhtml && !jquery .trim(dest.innerhtml) ) ) {5406 dest.innerhtml = src.innerhtml;5407 }5408 } else if ( nodename === "input" && manipulation_rcheckabletype.test( src.type ) ) {5409 // ie6-8 fails to persist the checked state of a cloned checkbox5410 // or radio button. worse, ie6-7 fail to give the cloned element5411 // a checked appearance if the defaultchecked value isn't also set5412 dest.defaultchecked = dest.checked = src.checked;5413 // ie6-7 get confused and end up setting the value of a cloned5414 // checkbox/radio button to an empty string instead of "on"5415 if ( dest.value !== src.value ) {5416 dest.value = src.value;5417 }5418 // ie6-8 fails to return the selected option to the default selected5419 // state when cloning options5420 } else if ( nodename === "option" ) {5421 dest.defaultselected = dest.selected = src.defaultselected;5422 // ie6-8 fails to set the defaultvalue to the correct value when5423 // cloning other types of input fields5424 } else if ( nodename === "input" || nodename === "textarea" ) {5425 dest.defaultvalue = src.defaultvalue;5426 }5427}5428jquery .each({5429 appendto: "append",5430 prependto: "prepend",5431 insertbefore: "before",5432 insertafter: "after",5433 replaceall: "replacewith"5434}, function( name, original ) {5435 jquery .fn[ name ] = function( selector ) {5436 var elems,5437 i = 0,5438 ret = [],5439 insert = jquery ( selector ),5440 last = insert.length - 1;5441 for ( ; i <= last; i++ ) {5442 elems = i === last ? this : this.clone(true);5443 jquery ( insert[i] )[ original ]( elems );5444 // modern browsers can apply jquery collections as arrays, but oldie needs a .get()5445 core_push.apply( ret, elems.get() );5446 }5447 return this.pushstack( ret );5448 };5449});5450function getall( context, tag ) {5451 var elems, elem,5452 i = 0,5453 found = typeof context.getelementsbytagname !== core_strundefined ? context.getelementsbytagname( tag || "*" ) :5454 typeof context.queryselectorall !== core_strundefined ? context.queryselectorall( tag || "*" ) :5455 undefined;5456 if ( !found ) {5457 for ( found = [], elems = context.childnodes || context; (elem = elems[i]) != null; i++ ) {5458 if ( !tag || jquery .nodename( elem, tag ) ) {5459 found.push( elem );5460 } else {5461 jquery .merge( found, getall( elem, tag ) );5462 }5463 }5464 }5465 return tag === undefined || tag && jquery .nodename( context, tag ) ?5466 jquery .merge( [ context ], found ) :5467 found;5468}5469// used in buildfragment, fixes the defaultchecked property5470function fixdefaultchecked( elem ) {5471 if ( manipulation_rcheckabletype.test( elem.type ) ) {5472 elem.defaultchecked = elem.checked;5473 }5474}5475jquery .extend({5476 clone: function( elem, dataandevents, deepdataandevents ) {5477 var destelements, node, clone, i, srcelements,5478 inpage = jquery .contains( elem.ownerdocument, elem );5479 if ( jquery .support.html5clone || jquery .isxmldoc(elem) || !rnoshimcache.test( "<" + elem.nodename + ">" ) ) {5480 clone = elem.clonenode( true );5481 // ie<=8 does not properly clone detached, unknown element nodes5482 } else {5483 fragmentdiv.innerhtml = elem.outerhtml;5484 fragmentdiv.removechild( clone = fragmentdiv.firstchild );5485 }5486 if ( (!jquery .support.nocloneevent || !jquery .support.noclonechecked) &&5487 (elem.nodetype === 1 || elem.nodetype === 11) && !jquery .isxmldoc(elem) ) {5488 // we eschew sizzle here for performance reasons: http://js perf.com/getall-vs-sizzle/25489 destelements = getall( clone );5490 srcelements = getall( elem );5491 // fix all ie cloning issues5492 for ( i = 0; (node = srcelements[i]) != null; ++i ) {5493 // ensure that the destination node is not null; fixes #95875494 if ( destelements[i] ) {5495 fixclonenodeissues( node, destelements[i] );5496 }5497 }5498 }5499 // copy the events from the original to the clone5500 if ( dataandevents ) {5501 if ( deepdataandevents ) {5502 srcelements = srcelements || getall( elem );5503 destelements = destelements || getall( clone );5504 for ( i = 0; (node = srcelements[i]) != null; i++ ) {5505 clonecopyevent( node, destelements[i] );5506 }5507 } else {5508 clonecopyevent( elem, clone );5509 }5510 }5511 // preserve script evaluation history5512 destelements = getall( clone, "script" );5513 if ( destelements.length > 0 ) {5514 setglobaleval( destelements, !inpage && getall( elem, "script" ) );5515 }5516 destelements = srcelements = node = null;5517 // return the cloned set5518 return clone;5519 },5520 buildfragment: function( elems, context, scripts, selection ) {5521 var j, elem, contains,5522 tmp, tag, tbody, wrap,5523 l = elems.length,5524 // ensure a safe fragment5525 safe = createsafefragment( context ),5526 nodes = [],5527 i = 0;5528 for ( ; i < l; i++ ) {5529 elem = elems[ i ];5530 if ( elem || elem === 0 ) {5531 // add nodes directly5532 if ( jquery .type( elem ) === "object" ) {5533 jquery .merge( nodes, elem.nodetype ? [ elem ] : elem );5534 // convert non-html into a text node5535 } else if ( !rhtml.test( elem ) ) {5536 nodes.push( context.createtextnode( elem ) );5537 // convert html into dom nodes5538 } else {5539 tmp = tmp || safe.appendchild( context.createelement("div") );5540 // deserialize a standard representation5541 tag = ( rtagname.exec( elem ) || ["", ""] )[1].tolowercase();5542 wrap = wrapmap[ tag ] || wrapmap._default;5543 tmp.innerhtml = wrap[1] + elem.replace( rxhtmltag, "<$1></$2>" ) + wrap[2];5544 // descend through wrappers to the right content5545 j = wrap[0];5546 while ( j-- ) {5547 tmp = tmp.lastchild;5548 }5549 // manually add leading whitespace removed by ie5550 if ( !jquery .support.leadingwhitespace && rleadingwhitespace.test( elem ) ) {5551 nodes.push( context.createtextnode( rleadingwhitespace.exec( elem )[0] ) );5552 }5553 // remove ie's autoinserted <tbody> from table fragments5554 if ( !jquery .support.tbody ) {5555 // string was a <table>, *may* have spurious <tbody>5556 elem = tag === "table" && !rtbody.test( elem ) ?5557 tmp.firstchild :5558 // string was a bare <thead> or <tfoot>5559 wrap[1] === "<table>" && !rtbody.test( elem ) ?5560 tmp :5561 0;5562 j = elem && elem.childnodes.length;5563 while ( j-- ) {5564 if ( jquery .nodename( (tbody = elem.childnodes[j]), "tbody" ) && !tbody.childnodes.length ) {5565 elem.removechild( tbody );5566 }5567 }5568 }5569 jquery .merge( nodes, tmp.childnodes );5570 // fix #12392 for webkit and ie > 95571 tmp.textcontent = "";5572 // fix #12392 for oldie5573 while ( tmp.firstchild ) {5574 tmp.removechild( tmp.firstchild );5575 }5576 // remember the top-level container for proper cleanup5577 tmp = safe.lastchild;5578 }5579 }5580 }5581 // fix #11356: clear elements from fragment5582 if ( tmp ) {5583 safe.removechild( tmp );5584 }5585 // reset defaultchecked for any radios and checkboxes5586 // about to be appended to the dom in ie 6/7 (#8060)5587 if ( !jquery .support.appendchecked ) {5588 jquery .grep( getall( nodes, "input" ), fixdefaultchecked );5589 }5590 i = 0;5591 while ( (elem = nodes[ i++ ]) ) {5592 // #4087 - if origin and destination elements are the same, and this is5593 // that element, do not do anything5594 if ( selection && jquery .inarray( elem, selection ) !== -1 ) {5595 continue;5596 }5597 contains = jquery .contains( elem.ownerdocument, elem );5598 // append to fragment5599 tmp = getall( safe.appendchild( elem ), "script" );5600 // preserve script evaluation history5601 if ( contains ) {5602 setglobaleval( tmp );5603 }5604 // capture executables5605 if ( scripts ) {5606 j = 0;5607 while ( (elem = tmp[ j++ ]) ) {5608 if ( rscripttype.test( elem.type || "" ) ) {5609 scripts.push( elem );5610 }5611 }5612 }5613 }5614 tmp = null;5615 return safe;5616 },5617 cleandata: function( elems, /* internal */ acceptdata ) {5618 var elem, type, id, data,5619 i = 0,5620 internalkey = jquery .expando,5621 cache = jquery .cache,5622 deleteexpando = jquery .support.deleteexpando,5623 special = jquery .event.special;5624 for ( ; (elem = elems[i]) != null; i++ ) {5625 if ( acceptdata || jquery .acceptdata( elem ) ) {5626 id = elem[ internalkey ];5627 data = id && cache[ id ];5628 if ( data ) {5629 if ( data.events ) {5630 for ( type in data.events ) {5631 if ( special[ type ] ) {5632 jquery .event.remove( elem, type );5633 // this is a shortcut to avoid jquery .event.remove's overhead5634 } else {5635 jquery .removeevent( elem, type, data.handle );5636 }5637 }5638 }5639 // remove cache only if it was not already removed by jquery .event.remove5640 if ( cache[ id ] ) {5641 delete cache[ id ];5642 // ie does not allow us to delete expando properties from nodes,5643 // nor does it have a removeattribute function on document nodes;5644 // we must handle all of these cases5645 if ( deleteexpando ) {5646 delete elem[ internalkey ];5647 } else if ( typeof elem.removeattribute !== core_strundefined ) {5648 elem.removeattribute( internalkey );5649 } else {5650 elem[ internalkey ] = null;5651 }5652 core_deletedids.push( id );5653 }5654 }5655 }5656 }5657 }5658});5659var iframe, getstyles, curcss,5660 ralpha = /alpha\([^)]*\)/i,5661 ropacity = /opacity\s*=\s*([^)]*)/,5662 rposition = /^(top|right|bottom|left)$/,5663 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"5664 // see here for display values: https://developer.mozilla.org/en-us/docs/css/display5665 rdisplayswap = /^(none|table(?!-c[ea]).+)/,5666 rmargin = /^margin/,5667 rnumsplit = new regexp( "^(" + core_pnum + ")(.*)$", "i" ),5668 rnumnonpx = new regexp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),5669 rrelnum = new regexp( "^([+-])=(" + core_pnum + ")", "i" ),5670 elemdisplay = { body: "block" },5671 cssshow = { position: "absolute", visibility: "hidden", display: "block" },5672 cssnormaltransform = {5673 letterspacing: 0,5674 fontweight: 4005675 },5676 cssexpand = [ "top", "right", "bottom", "left" ],5677 cssprefixes = [ "webkit", "o", "moz", "ms" ];5678// return a css property mapped to a potentially vendor prefixed property5679function vendorpropname( style, name ) {5680 // shortcut for names that are not vendor prefixed5681 if ( name in style ) {5682 return name;5683 }5684 // check for vendor prefixed names5685 var capname = name.charat(0).touppercase() + name.slice(1),5686 origname = name,5687 i = cssprefixes.length;5688 while ( i-- ) {5689 name = cssprefixes[ i ] + capname;5690 if ( name in style ) {5691 return name;5692 }5693 }5694 return origname;5695}5696function ishidden( elem, el ) {5697 // ishidden might be called from jquery #filter function;5698 // in that case, element will be second argument5699 elem = el || elem;5700 return jquery .css( elem, "display" ) === "none" || !jquery .contains( elem.ownerdocument, elem );5701}5702function showhide( elements, show ) {5703 var display, elem, hidden,5704 values = [],5705 index = 0,5706 length = elements.length;5707 for ( ; index < length; index++ ) {5708 elem = elements[ index ];5709 //索引的事件赋值给变量elem5710 if ( !elem.style ) {5711 continue;5712 }5713 values[ index ] = jquery ._data( elem, "olddisplay" );5714 display = elem.style.display;5715 if ( show ) {5716 // reset the inline display of this element to learn if it is5717 // being hidden by cascaded rules or not5718 // 重置内联元素5719 if ( !values[ index ] && display === "none" ) {5720 elem.style.display = "";5721 }5722 // set elements which have been overridden with display: none5723 // in a stylesheet to whatever the default browser style is5724 // for such an element5725 if ( elem.style.display === "" && ishidden( elem ) ) {5726 values[ index ] = jquery ._data( elem, "olddisplay", css_defaultdisplay(elem.nodename) );5727 }5728 } else {5729 if ( !values[ index ] ) {5730 hidden = ishidden( elem );5731 if ( display && display !== "none" || !hidden ) {5732 jquery ._data( elem, "olddisplay", hidden ? display : jquery .css( elem, "display" ) );5733 }5734 }5735 }5736 }5737 // set the display of most of the elements in a second loop5738 // to avoid the constant reflow5739 for ( index = 0; index < length; index++ ) {5740 elem = elements[ index ];5741 if ( !elem.style ) {5742 continue;5743 }5744 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {5745 elem.style.display = show ? values[ index ] || "" : "none";5746 }5747 }5748 return elements;5749}5750jquery .fn.extend({5751 css: function( name, value ) {5752 return jquery .access( this, function( elem, name, value ) {5753 var len, styles,5754 map = {},5755 i = 0;5756 if ( jquery .isarray( name ) ) {5757 styles = getstyles( elem );5758 len = name.length;5759 for ( ; i < len; i++ ) {5760 map[ name[ i ] ] = jquery .css( elem, name[ i ], false, styles );5761 }5762 return map;5763 }5764 return value !== undefined ?5765 jquery .style( elem, name, value ) :5766 jquery .css( elem, name );5767 }, name, value, arguments.length > 1 );5768 },5769 show: function() {5770 return showhide( this, true );5771 },5772 hide: function() {5773 return showhide( this );5774 },5775 toggle: function( state ) {5776 var bool = typeof state === "boolean";5777 return this.each(function() {5778 if ( bool ? state : ishidden( this ) ) {5779 jquery ( this ).show();5780 } else {5781 jquery ( this ).hide();5782 }5783 });5784 }5785});5786jquery .extend({5787 // add in style property hooks for overriding the default5788 // behavior of getting and setting a style property5789 csshooks: {5790 opacity: {5791 get: function( elem, computed ) {5792 if ( computed ) {5793 // we should always get a number back from opacity5794 var ret = curcss( elem, "opacity" );5795 return ret === "" ? "1" : ret;5796 }5797 }5798 }5799 },5800 // exclude the following css properties to add px5801 cssnumber: {5802 "columncount": true,5803 "fillopacity": true,5804 "fontweight": true,5805 "lineheight": true,5806 "opacity": true,5807 "orphans": true,5808 "widows": true,5809 "zindex": true,5810 "zoom": true5811 },5812 // add in properties whose names you wish to fix before5813 // setting or getting the value5814 cssprops: {5815 // normalize float css property5816 "float": jquery .support.cssfloat ? "cssfloat" : "stylefloat"5817 },5818 // get and set the style property on a dom node5819 style: function( elem, name, value, extra ) {5820 // don't set styles on text and comment nodes5821 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || !elem.style ) {5822 return;5823 }5824 // make sure that we're working with the right name5825 var ret, type, hooks,5826 origname = jquery .camelcase( name ),5827 style = elem.style;5828 name = jquery .cssprops[ origname ] || ( jquery .cssprops[ origname ] = vendorpropname( style, origname ) );5829 // gets hook for the prefixed version5830 // followed by the unprefixed version5831 hooks = jquery .csshooks[ name ] || jquery .csshooks[ origname ];5832 // check if we're setting a value5833 if ( value !== undefined ) {5834 type = typeof value;5835 // convert relative number strings (+= or -=) to relative numbers. #73455836 if ( type === "string" && (ret = rrelnum.exec( value )) ) {5837 value = ( ret[1] + 1 ) * ret[2] + parsefloat( jquery .css( elem, name ) );5838 // fixes bug #92375839 type = "number";5840 }5841 // make sure that nan and null values aren't set. see: #71165842 if ( value == null || type === "number" && isnan( value ) ) {5843 return;5844 }5845 // if a number was passed in, add 'px' to the (except for certain css properties)5846 if ( type === "number" && !jquery .cssnumber[ origname ] ) {5847 value += "px";5848 }5849 // fixes #8908, it can be done more correctly by specifing setters in csshooks,5850 // but it would mean to define eight (for every problematic property) identical functions5851 if ( !jquery .support.clearclonestyle && value === "" && name.indexof("background") === 0 ) {5852 style[ name ] = "inherit";5853 }5854 // if a hook was provided, use that value, otherwise just set the specified value5855 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {5856 // wrapped to prevent ie from throwing errors when 'invalid' values are provided5857 // fixes bug #55095858 try {5859 style[ name ] = value;5860 } catch(e) {}5861 }5862 } else {5863 // if a hook was provided get the non-computed value from there5864 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {5865 return ret;5866 }5867 // otherwise just get the value from the style object5868 return style[ name ];5869 }5870 },5871 css: function( elem, name, extra, styles ) {5872 var num, val, hooks,5873 origname = jquery .camelcase( name );5874 // make sure that we're working with the right name5875 name = jquery .cssprops[ origname ] || ( jquery .cssprops[ origname ] = vendorpropname( elem.style, origname ) );5876 // gets hook for the prefixed version5877 // followed by the unprefixed version5878 hooks = jquery .csshooks[ name ] || jquery .csshooks[ origname ];5879 // if a hook was provided get the computed value from there5880 if ( hooks && "get" in hooks ) {5881 val = hooks.get( elem, true, extra );5882 }5883 // otherwise, if a way to get the computed value exists, use that5884 if ( val === undefined ) {5885 val = curcss( elem, name, styles );5886 }5887 //convert "normal" to computed value5888 if ( val === "normal" && name in cssnormaltransform ) {5889 val = cssnormaltransform[ name ];5890 }5891 // return, converting to number if forced or a qualifier was provided and val looks numeric5892 if ( extra === "" || extra ) {5893 num = parsefloat( val );5894 return extra === true || jquery .isnumeric( num ) ? num || 0 : val;5895 }5896 return val;5897 },5898 // a method for quickly swapping in/out css properties to get correct calculations5899 swap: function( elem, options, callback, args ) {5900 var ret, name,5901 old = {};5902 // remember the old values, and insert the new ones5903 for ( name in options ) {5904 old[ name ] = elem.style[ name ];5905 elem.style[ name ] = options[ name ];5906 }5907 ret = callback.apply( elem, args || [] );5908 // revert the old values5909 for ( name in options ) {5910 elem.style[ name ] = old[ name ];5911 }5912 return ret;5913 }5914});5915// note: we've included the "window" in window.getcomputedstyle5916// because js dom on node.js will break without it.5917if ( window.getcomputedstyle ) {5918 getstyles = function( elem ) {5919 return window.getcomputedstyle( elem, null );5920 };5921 curcss = function( elem, name, _computed ) {5922 var width, minwidth, maxwidth,5923 computed = _computed || getstyles( elem ),5924 // getpropertyvalue is only needed for .css('filter') in ie9, see #125375925 ret = computed ? computed.getpropertyvalue( name ) || computed[ name ] : undefined,5926 style = elem.style;5927 if ( computed ) {5928 if ( ret === "" && !jquery .contains( elem.ownerdocument, elem ) ) {5929 ret = jquery .style( elem, name );5930 }5931 // a tribute to the "awesome hack by dean edwards"5932 // chrome < 17 and safari 5.0 uses "computed value" instead of "used value" for margin-right5933 // safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels5934 // this is against the cssom draft spec: http://dev.w3.org/csswg/cssom/#resolved-values5935 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {5936 // remember the original values5937 width = style.width;5938 minwidth = style.minwidth;5939 maxwidth = style.maxwidth;5940 // put in the new values to get a computed value out5941 style.minwidth = style.maxwidth = style.width = ret;5942 ret = computed.width;5943 // revert the changed values5944 style.width = width;5945 style.minwidth = minwidth;5946 style.maxwidth = maxwidth;5947 }5948 }5949 return ret;5950 };5951} else if ( document.documentelement.currentstyle ) {5952 getstyles = function( elem ) {5953 return elem.currentstyle;5954 };5955 curcss = function( elem, name, _computed ) {5956 var left, rs, rsleft,5957 computed = _computed || getstyles( elem ),5958 ret = computed ? computed[ name ] : undefined,5959 style = elem.style;5960 // avoid setting ret to empty string here5961 // so we don't default to auto5962 if ( ret == null && style && style[ name ] ) {5963 ret = style[ name ];5964 }5965 // from the awesome hack by dean edwards5966 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022915967 // if we're not dealing with a regular pixel number5968 // but a number that has a weird ending, we need to convert it to pixels5969 // but not position css attributes, as those are proportional to the parent element instead5970 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem5971 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {5972 // remember the original values5973 left = style.left;5974 rs = elem.runtimestyle;5975 rsleft = rs && rs.left;5976 // put in the new values to get a computed value out5977 if ( rsleft ) {5978 rs.left = elem.currentstyle.left;5979 }5980 style.left = name === "fontsize" ? "1em" : ret;5981 ret = style.pixelleft + "px";5982 // revert the changed values5983 style.left = left;5984 if ( rsleft ) {5985 rs.left = rsleft;5986 }5987 }5988 return ret === "" ? "auto" : ret;5989 };5990}5991function setpositivenumber( elem, value, subtract ) {5992 var matches = rnumsplit.exec( value );5993 return matches ?5994 // guard against undefined "subtract", e.g., when used as in csshooks5995 math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :5996 value;5997}5998function augmentwidthorheight( elem, name, extra, isborderbox, styles ) {5999 var i = extra === ( isborderbox ? "border" : "content" ) ?6000 // if we already have the right measurement, avoid augmentation6001 4 :6002 // otherwise initialize for horizontal or vertical properties6003 name === "width" ? 1 : 0,6004 val = 0;6005 for ( ; i < 4; i += 2 ) {6006 // both box models exclude margin, so add it if we want it6007 if ( extra === "margin" ) {6008 val += jquery .css( elem, extra + cssexpand[ i ], true, styles );6009 }6010 if ( isborderbox ) {6011 // border-box includes padding, so remove it if we want content6012 if ( extra === "content" ) {6013 val -= jquery .css( elem, "padding" + cssexpand[ i ], true, styles );6014 }6015 // at this point, extra isn't border nor margin, so remove border6016 if ( extra !== "margin" ) {6017 val -= jquery .css( elem, "border" + cssexpand[ i ] + "width", true, styles );6018 }6019 } else {6020 // at this point, extra isn't content, so add padding6021 val += jquery .css( elem, "padding" + cssexpand[ i ], true, styles );6022 // at this point, extra isn't content nor padding, so add border6023 if ( extra !== "padding" ) {6024 val += jquery .css( elem, "border" + cssexpand[ i ] + "width", true, styles );6025 }6026 }6027 }6028 return val;6029}6030function getwidthorheight( elem, name, extra ) {6031 // start with offset property, which is equivalent to the border-box value6032 var valueisborderbox = true,6033 val = name === "width" ? elem.offsetwidth : elem.offsetheight,6034 styles = getstyles( elem ),6035 isborderbox = jquery .support.boxsizing && jquery .css( elem, "boxsizing", false, styles ) === "border-box";6036 // some non-html elements return undefined for offsetwidth, so check for null/undefined6037 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=6492856038 // mathml - https://bugzilla.mozilla.org/show_bug.cgi?id=4916686039 if ( val <= 0 || val == null ) {6040 // fall back to computed then uncomputed css if necessary6041 val = curcss( elem, name, styles );6042 if ( val < 0 || val == null ) {6043 val = elem.style[ name ];6044 }6045 // computed unit is not pixels. stop here and return.6046 if ( rnumnonpx.test(val) ) {6047 return val;6048 }6049 // we need the check for style in case a browser which returns unreliable values6050 // for getcomputedstyle silently falls back to the reliable elem.style6051 valueisborderbox = isborderbox && ( jquery .support.boxsizingreliable || val === elem.style[ name ] );6052 // normalize "", auto, and prepare for extra6053 val = parsefloat( val ) || 0;6054 }6055 // use the active box-sizing model to add/subtract irrelevant styles6056 return ( val +6057 augmentwidthorheight(6058 elem,6059 name,6060 extra || ( isborderbox ? "border" : "content" ),6061 valueisborderbox,6062 styles6063 )6064 ) + "px";6065}6066// try to determine the default display value of an element6067function css_defaultdisplay( nodename ) {6068 var doc = document,6069 display = elemdisplay[ nodename ];6070 if ( !display ) {6071 display = actualdisplay( nodename, doc );6072 // if the simple way fails, read from inside an iframe6073 if ( display === "none" || !display ) {6074 // use the already-created iframe if possible6075 iframe = ( iframe ||6076 jquery ("<iframe frameborder='0' width='0' height='0'/>")6077 .css( "csstext", "display:block !important" )6078 ).appendto( doc.documentelement );6079 // always write a new html skeleton so webkit and firefox don't choke on reuse6080 doc = ( iframe[0].contentwindow || iframe[0].contentdocument ).document;6081 doc.write("<!doctype html><html><body>");6082 doc.close();6083 display = actualdisplay( nodename, doc );6084 iframe.detach();6085 }6086 // store the correct default display6087 elemdisplay[ nodename ] = display;6088 }6089 return display;6090}6091// called only from within css_defaultdisplay6092function actualdisplay( name, doc ) {6093 var elem = jquery ( doc.createelement( name ) ).appendto( doc.body ),6094 display = jquery .css( elem[0], "display" );6095 elem.remove();6096 return display;6097}6098jquery .each([ "height", "width" ], function( i, name ) {6099 jquery .csshooks[ name ] = {6100 get: function( elem, computed, extra ) {6101 if ( computed ) {6102 // certain elements can have dimension info if we invisibly show them6103 // however, it must have a current display style that would benefit from this6104 return elem.offsetwidth === 0 && rdisplayswap.test( jquery .css( elem, "display" ) ) ?6105 jquery .swap( elem, cssshow, function() {6106 return getwidthorheight( elem, name, extra );6107 }) :6108 getwidthorheight( elem, name, extra );6109 }6110 },6111 set: function( elem, value, extra ) {6112 var styles = extra && getstyles( elem );6113 return setpositivenumber( elem, value, extra ?6114 augmentwidthorheight(6115 elem,6116 name,6117 extra,6118 jquery .support.boxsizing && jquery .css( elem, "boxsizing", false, styles ) === "border-box",6119 styles6120 ) : 06121 );6122 }6123 };6124});6125if ( !jquery .support.opacity ) {6126 jquery .csshooks.opacity = {6127 get: function( elem, computed ) {6128 // ie uses filters for opacity6129 return ropacity.test( (computed && elem.currentstyle ? elem.currentstyle.filter : elem.style.filter) || "" ) ?6130 ( 0.01 * parsefloat( regexp.$1 ) ) + "" :6131 computed ? "1" : "";6132 },6133 set: function( elem, value ) {6134 var style = elem.style,6135 currentstyle = elem.currentstyle,6136 opacity = jquery .isnumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",6137 filter = currentstyle && currentstyle.filter || style.filter || "";6138 // ie has trouble with opacity if it does not have layout6139 // force it by setting the zoom level6140 style.zoom = 1;6141 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #66526142 // if value === "", then remove inline opacity #126856143 if ( ( value >= 1 || value === "" ) &&6144 jquery .trim( filter.replace( ralpha, "" ) ) === "" &&6145 style.removeattribute ) {6146 // setting style.filter to null, "" & " " still leave "filter:" in the csstext6147 // if "filter:" is present at all, cleartype is disabled, we want to avoid this6148 // style.removeattribute is ie only, but so apparently is this code path...6149 style.removeattribute( "filter" );6150 // if there is no filter style applied in a css rule or unset inline opacity, we are done6151 if ( value === "" || currentstyle && !currentstyle.filter ) {6152 return;6153 }6154 }6155 // otherwise, set new filter values6156 style.filter = ralpha.test( filter ) ?6157 filter.replace( ralpha, opacity ) :6158 filter + " " + opacity;6159 }6160 };6161}6162// these hooks cannot be added until dom ready because the support test6163// for it is not run until after dom ready6164jquery (function() {6165 if ( !jquery .support.reliablemarginright ) {6166 jquery .csshooks.marginright = {6167 get: function( elem, computed ) {6168 if ( computed ) {6169 // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right6170 // work around by temporarily setting element display to inline-block6171 return jquery .swap( elem, { "display": "inline-block" },6172 curcss, [ elem, "marginright" ] );6173 }6174 }6175 };6176 }6177 // webkit bug: https://bugs.webkit.org/show_bug.cgi?id=290846178 // getcomputedstyle returns percent when specified for top/left/bottom/right6179 // rather than make the css module depend on the offset module, we just check for it here6180 if ( !jquery .support.pixelposition && jquery .fn.position ) {6181 jquery .each( [ "top", "left" ], function( i, prop ) {6182 jquery .csshooks[ prop ] = {6183 get: function( elem, computed ) {6184 if ( computed ) {6185 computed = curcss( elem, prop );6186 // if curcss returns percentage, fallback to offset6187 return rnumnonpx.test( computed ) ?6188 jquery ( elem ).position()[ prop ] + "px" :6189 computed;6190 }6191 }6192 };6193 });6194 }6195});6196if ( jquery .expr && jquery .expr.filters ) {6197 jquery .expr.filters.hidden = function( elem ) {6198 // support: opera <= 12.126199 // opera reports offsetwidths and offsetheights less than zero on some elements6200 return elem.offsetwidth <= 0 && elem.offsetheight <= 0 ||6201 (!jquery .support.reliablehiddenoffsets && ((elem.style && elem.style.display) || jquery .css( elem, "display" )) === "none");6202 };6203 jquery .expr.filters.visible = function( elem ) {6204 return !jquery .expr.filters.hidden( elem );6205 };6206}6207// these hooks are used by animate to expand properties6208jquery .each({6209 margin: "",6210 padding: "",6211 border: "width"6212}, function( prefix, suffix ) {6213 jquery .csshooks[ prefix + suffix ] = {6214 expand: function( value ) {6215 var i = 0,6216 expanded = {},6217 // assumes a single number if not a string6218 parts = typeof value === "string" ? value.split(" ") : [ value ];6219 for ( ; i < 4; i++ ) {6220 expanded[ prefix + cssexpand[ i ] + suffix ] =6221 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];6222 }6223 return expanded;6224 }6225 };6226 if ( !rmargin.test( prefix ) ) {6227 jquery .csshooks[ prefix + suffix ].set = setpositivenumber;6228 }6229});6230var r20 = /%20/g,6231 rbracket = /\[\]$/,6232 rcrlf = /\r?\n/g,6233 rsubmittertypes = /^(?:submit|button|image|reset|file)$/i,6234 rsubmittable = /^(?:input|select|textarea|keygen)/i;6235jquery .fn.extend({6236 serialize: function() {6237 return jquery .param( this.serializearray() );6238 },6239 serializearray: function() {6240 return this.map(function(){6241 // can add prophook for "elements" to filter or add form elements6242 var elements = jquery .prop( this, "elements" );6243 return elements ? jquery .makearray( elements ) : this;6244 })6245 .filter(function(){6246 var type = this.type;6247 // use .is(":disabled") so that fieldset[disabled] works6248 return this.name && !jquery ( this ).is( ":disabled" ) &&6249 rsubmittable.test( this.nodename ) && !rsubmittertypes.test( type ) &&6250 ( this.checked || !manipulation_rcheckabletype.test( type ) );6251 })6252 .map(function( i, elem ){6253 var val = jquery ( this ).val();6254 return val == null ?6255 null :6256 jquery .isarray( val ) ?6257 jquery .map( val, function( val ){6258 return { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };6259 }) :6260 { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };6261 }).get();6262 }6263});6264//serialize an array of form elements or a set of6265//key/values into a query string6266jquery .param = function( a, traditional ) {6267 var prefix,6268 s = [],6269 add = function( key, value ) {6270 // if value is a function, invoke it and return its value6271 value = jquery .isfunction( value ) ? value() : ( value == null ? "" : value );6272 s[ s.length ] = encodeuricomponent( key ) + "=" + encodeuricomponent( value );6273 };6274 // set traditional to true for jquery <= 1.3.2 behavior.6275 if ( traditional === undefined ) {6276 traditional = jquery .ajaxsettings && jquery .ajaxsettings.traditional;6277 }6278 // if an array was passed in, assume that it is an array of form elements.6279 if ( jquery .isarray( a ) || ( a.jquery && !jquery .isplainobject( a ) ) ) {6280 // serialize the form elements6281 jquery .each( a, function() {6282 add( this.name, this.value );6283 });6284 } else {6285 // if traditional, encode the "old" way (the way 1.3.2 or older6286 // did it), otherwise encode params recursively.6287 for ( prefix in a ) {6288 buildparams( prefix, a[ prefix ], traditional, add );6289 }6290 }6291 // return the resulting serialization6292 return s.join( "&" ).replace( r20, "+" );6293};6294function buildparams( prefix, obj, traditional, add ) {6295 var name;6296 if ( jquery .isarray( obj ) ) {6297 // serialize array item.6298 jquery .each( obj, function( i, v ) {6299 if ( traditional || rbracket.test( prefix ) ) {6300 // treat each array item as a scalar.6301 add( prefix, v );6302 } else {6303 // item is non-scalar (array or object), encode its numeric index.6304 buildparams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );6305 }6306 });6307 } else if ( !traditional && jquery .type( obj ) === "object" ) {6308 // serialize object item.6309 for ( name in obj ) {6310 buildparams( prefix + "[" + name + "]", obj[ name ], traditional, add );6311 }6312 } else {6313 // serialize scalar item.6314 add( prefix, obj );6315 }6316}6317jquery .each( ("blur focus focusin focusout load resize scroll unload click dblclick " +6318 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +6319 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {6320 // handle event binding6321 // 事件句柄封装6322 jquery .fn[ name ] = function( data, fn ) {6323 return arguments.length > 0 ?6324 this.on( name, null, data, fn ) :6325 this.trigger( name );6326 };6327});6328jquery .fn.hover = function( fnover, fnout ) {6329 return this.mouseenter( fnover ).mouseleave( fnout || fnover );6330};6331var6332 // document location6333 ajaxlocparts,6334 ajaxlocation,6335 ajax_nonce = jquery .now(),6336 ajax_rquery = /\?/,6337 rhash = /#.*$/,6338 rts = /([?&])_=[^&]*/,6339 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // ie leaves an \r character at eol6340 // #7653, #8125, #8152: local protocol detection6341 rlocalprotocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,6342 rnocontent = /^(?:get|head)$/,6343 rprotocol = /^\/\//,6344 rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,6345 // keep a copy of the old load method6346 _load = jquery .fn.load,6347 /* prefilters6348 * 1) they are useful to introduce custom datatypes (see ajax/js onp.js for an example)6349 * 2) these are called:6350 * - before asking for a transport6351 * - after param serialization (s.data is a string if s.processdata is true)6352 * 3) key is the datatype6353 * 4) the catchall symbol "*" can be used6354 * 5) execution will start with transport datatype and then continue down to "*" if needed6355 */6356 prefilters = {},6357 /* transports bindings6358 * 1) key is the datatype6359 * 2) the catchall symbol "*" can be used6360 * 3) selection will start with transport datatype and then go to "*" if needed6361 */6362 transports = {},6363 // avoid comment-prolog char sequence (#10098); must appease lint and evade compression6364 alltypes = "*/".concat("*");6365// #8138, ie may throw an exception when accessing6366// a field from window.location if document.domain has been set6367try {6368 ajaxlocation = location.href;6369} catch( e ) {6370 // use the href attribute of an a element6371 // since ie will modify it given document.location6372 ajaxlocation = document.createelement( "a" );6373 ajaxlocation.href = "";6374 ajaxlocation = ajaxlocation.href;6375}6376// segment location into parts6377ajaxlocparts = rurl.exec( ajaxlocation.tolowercase() ) || [];6378// base "constructor" for jquery .ajaxprefilter and jquery .ajaxtransport6379function addtoprefiltersortransports( structure ) {6380 // datatypeexpression is optional and defaults to "*"6381 return function( datatypeexpression, func ) {6382 if ( typeof datatypeexpression !== "string" ) {6383 func = datatypeexpression;6384 datatypeexpression = "*";6385 }6386 var datatype,6387 i = 0,6388 datatypes = datatypeexpression.tolowercase().match( core_rnotwhite ) || [];6389 if ( jquery .isfunction( func ) ) {6390 // for each datatype in the datatypeexpression6391 while ( (datatype = datatypes[i++]) ) {6392 // prepend if requested6393 if ( datatype[0] === "+" ) {6394 datatype = datatype.slice( 1 ) || "*";6395 (structure[ datatype ] = structure[ datatype ] || []).unshift( func );6396 // otherwise append6397 } else {6398 (structure[ datatype ] = structure[ datatype ] || []).push( func );6399 }6400 }6401 }6402 };6403}6404// base inspection function for prefilters and transports6405function inspectprefiltersortransports( structure, options, originaloptions, jqxhr ) {6406 var inspected = {},6407 seekingtransport = ( structure === transports );6408 function inspect( datatype ) {6409 var selected;6410 inspected[ datatype ] = true;6411 jquery .each( structure[ datatype ] || [], function( _, prefilterorfactory ) {6412 var datatypeortransport = prefilterorfactory( options, originaloptions, jqxhr );6413 if( typeof datatypeortransport === "string" && !seekingtransport && !inspected[ datatypeortransport ] ) {6414 options.datatypes.unshift( datatypeortransport );6415 inspect( datatypeortransport );6416 return false;6417 } else if ( seekingtransport ) {6418 return !( selected = datatypeortransport );6419 }6420 });6421 return selected;6422 }6423 return inspect( options.datatypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );6424}6425// a special extend for ajax options6426// that takes "flat" options (not to be deep extended)6427// fixes #98876428function ajaxextend( target, src ) {6429 var deep, key,6430 flatoptions = jquery .ajaxsettings.flatoptions || {};6431 for ( key in src ) {6432 if ( src[ key ] !== undefined ) {6433 ( flatoptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];6434 }6435 }6436 if ( deep ) {6437 jquery .extend( true, target, deep );6438 }6439 return target;6440}6441jquery .fn.load = function( url, params, callback ) {6442 if ( typeof url !== "string" && _load ) {6443 return _load.apply( this, arguments );6444 }6445 var selector, response, type,6446 self = this,6447 off = url.indexof(" ");6448 if ( off >= 0 ) {6449 selector = url.slice( off, url.length );6450 url = url.slice( 0, off );6451 }6452 // if it's a function6453 if ( jquery .isfunction( params ) ) {6454 // we assume that it's the callback6455 callback = params;6456 params = undefined;6457 // otherwise, build a param string6458 } else if ( params && typeof params === "object" ) {6459 type = "post";6460 }6461 // if we have elements to modify, make the request6462 if ( self.length > 0 ) {6463 jquery .ajax({6464 url: url,6465 // if "type" variable is undefined, then "get" method will be used6466 type: type,6467 datatype: "html",6468 data: params6469 }).done(function( responsetext ) {6470 // save response for use in complete callback6471 response = arguments;6472 self.html( selector ?6473 // if a selector was specified, locate the right elements in a dummy div6474 // exclude scripts to avoid ie 'permission denied' errors6475 jquery ("<div>").append( jquery .parsehtml( responsetext ) ).find( selector ) :6476 // otherwise use the full result6477 responsetext );6478 }).complete( callback && function( jqxhr, status ) {6479 self.each( callback, response || [ jqxhr.responsetext, status, jqxhr ] );6480 });6481 }6482 return this;6483};6484// attach a bunch of functions for handling common ajax events6485jquery .each( [ "ajaxstart", "ajaxstop", "ajaxcomplete", "ajaxerror", "ajaxsuccess", "ajaxsend" ], function( i, type ){6486 jquery .fn[ type ] = function( fn ){6487 return this.on( type, fn );6488 };6489});6490jquery .each( [ "get", "post" ], function( i, method ) {6491 jquery [ method ] = function( url, data, callback, type ) {6492 // shift arguments if data argument was omitted6493 if ( jquery .isfunction( data ) ) {6494 type = type || callback;6495 callback = data;6496 data = undefined;6497 }6498 return jquery .ajax({6499 url: url,6500 type: method,6501 datatype: type,6502 data: data,6503 success: callback6504 });6505 };6506});6507jquery .extend({6508 // counter for holding the number of active queries6509 active: 0,6510 // last-modified header cache for next request6511 lastmodified: {},6512 etag: {},6513 ajaxsettings: {6514 url: ajaxlocation,6515 type: "get",6516 islocal: rlocalprotocol.test( ajaxlocparts[ 1 ] ),6517 global: true,6518 processdata: true,6519 async: true,6520 contenttype: "application/x-www-form-urlencoded; charset=utf-8",6521 /*6522 timeout: 0,6523 data: null,6524 datatype: null,6525 username: null,6526 password : null,6527 cache: null,6528 throws: false,6529 traditional: false,6530 headers: {},6531 */6532 accepts: {6533 "*": alltypes,6534 text: "text/plain",6535 html: "text/html",6536 xml: "application/xml, text/xml",6537 js on: "application/js on, text/javascript"6538 },6539 contents: {6540 xml: /xml/,6541 html: /html/,6542 js on: /js on/6543 },6544 responsefields: {6545 xml: "responsexml",6546 text: "responsetext"6547 },6548 // data converters6549 // keys separate source (or catchall "*") and destination types with a single space6550 converters: {6551 // convert anything to text6552 "* text": window.string,6553 // text to html (true = no transformation)6554 "text html": true,6555 // evaluate text as a js on expression6556 "text js on": jquery .parsejs on,6557 // parse text as xml6558 "text xml": jquery .parsexml6559 },6560 // for options that shouldn't be deep extended:6561 // you can add your own custom options here if6562 // and when you create one that shouldn't be6563 // deep extended (see ajaxextend)6564 flatoptions: {6565 url: true,6566 context: true6567 }6568 },6569 // creates a full fledged settings object into target6570 // with both ajaxsettings and settings fields.6571 // if target is omitted, writes into ajaxsettings.6572 ajaxsetup: function( target, settings ) {6573 return settings ?6574 // building a settings object6575 ajaxextend( ajaxextend( target, jquery .ajaxsettings ), settings ) :6576 // extending ajaxsettings6577 ajaxextend( jquery .ajaxsettings, target );6578 },6579 ajaxprefilter: addtoprefiltersortransports( prefilters ),6580 ajaxtransport: addtoprefiltersortransports( transports ),6581 // main method6582 ajax: function( url, options ) {6583 // if url is an object, simulate pre-1.5 signature6584 if ( typeof url === "object" ) {6585 options = url;6586 url = undefined;6587 }6588 // force options to be an object6589 options = options || {};6590 var // cross-domain detection vars6591 parts,6592 // loop variable6593 i,6594 // url without anti-cache param6595 cacheurl,6596 // response headers as string6597 responseheadersstring,6598 // timeout handle6599 timeouttimer,6600 // to know if global events are to be dispatched6601 fireglobals,6602 transport,6603 // response headers6604 responseheaders,6605 // create the final options object6606 s = jquery .ajaxsetup( {}, options ),6607 // callbacks context6608 callbackcontext = s.context || s,6609 // context for global events is callbackcontext if it is a dom node or jquery collection6610 globaleventcontext = s.context && ( callbackcontext.nodetype || callbackcontext.jquery ) ?6611 jquery ( callbackcontext ) :6612 jquery .event,6613 // deferreds6614 deferred = jquery .deferred(),6615 completedeferred = jquery .callbacks("once memory"),6616 // status-dependent callbacks6617 statuscode = s.statuscode || {},6618 // headers (they are sent all at once)6619 requestheaders = {},6620 requestheadersnames = {},6621 // the jqxhr state6622 state = 0,6623 // default abort message6624 strabort = "canceled",6625 // fake xhr6626 jqxhr = {6627 readystate: 0,6628 // builds headers hashtable if needed6629 getresponseheader: function( key ) {6630 var match;6631 if ( state === 2 ) {6632 if ( !responseheaders ) {6633 responseheaders = {};6634 while ( (match = rheaders.exec( responseheadersstring )) ) {6635 responseheaders[ match[1].tolowercase() ] = match[ 2 ];6636 }6637 }6638 match = responseheaders[ key.tolowercase() ];6639 }6640 return match == null ? null : match;6641 },6642 // raw string6643 getallresponseheaders: function() {6644 return state === 2 ? responseheadersstring : null;6645 },6646 // caches the header6647 setrequestheader: function( name, value ) {6648 var lname = name.tolowercase();6649 if ( !state ) {6650 name = requestheadersnames[ lname ] = requestheadersnames[ lname ] || name;6651 requestheaders[ name ] = value;6652 }6653 return this;6654 },6655 // overrides response content-type header6656 overridemimetype: function( type ) {6657 if ( !state ) {6658 s.mimetype = type;6659 }6660 return this;6661 },6662 // status-dependent callbacks6663 statuscode: function( map ) {6664 var code;6665 if ( map ) {6666 if ( state < 2 ) {6667 for ( code in map ) {6668 // lazy-add the new callback in a way that preserves old ones6669 statuscode[ code ] = [ statuscode[ code ], map[ code ] ];6670 }6671 } else {6672 // execute the appropriate callbacks6673 jqxhr.always( map[ jqxhr.status ] );6674 }6675 }6676 return this;6677 },6678 // cancel the request6679 abort: function( statustext ) {6680 var finaltext = statustext || strabort;6681 if ( transport ) {6682 transport.abort( finaltext );6683 }6684 done( 0, finaltext );6685 return this;6686 }6687 };6688 // attach deferreds6689 deferred.promise( jqxhr ).complete = completedeferred.add;6690 jqxhr.success = jqxhr.done;6691 jqxhr.error = jqxhr.fail;6692 // remove hash character (#7531: and string promotion)6693 // add protocol if not provided (#5866: ie7 issue with protocol-less urls)6694 // handle falsy url in the settings object (#10093: consistency with old signature)6695 // we also use the url parameter if available6696 s.url = ( ( url || s.url || ajaxlocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxlocparts[ 1 ] + "//" );6697 // alias method option to type as per ticket #120046698 s.type = options.method || options.type || s.method || s.type;6699 // extract datatypes list6700 s.datatypes = jquery .trim( s.datatype || "*" ).tolowercase().match( core_rnotwhite ) || [""];6701 // a cross-domain request is in order when we have a protocol:host:port mismatch6702 if ( s.crossdomain == null ) {6703 parts = rurl.exec( s.url.tolowercase() );6704 s.crossdomain = !!( parts &&6705 ( parts[ 1 ] !== ajaxlocparts[ 1 ] || parts[ 2 ] !== ajaxlocparts[ 2 ] ||6706 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=6707 ( ajaxlocparts[ 3 ] || ( ajaxlocparts[ 1 ] === "http:" ? 80 : 443 ) ) )6708 );6709 }6710 // convert data if not already a string6711 if ( s.data && s.processdata && typeof s.data !== "string" ) {6712 s.data = jquery .param( s.data, s.traditional );6713 }6714 // apply prefilters6715 inspectprefiltersortransports( prefilters, s, options, jqxhr );6716 // if request was aborted inside a prefilter, stop there6717 if ( state === 2 ) {6718 return jqxhr;6719 }6720 // we can fire global events as of now if asked to6721 fireglobals = s.global;6722 // watch for a new set of requests6723 if ( fireglobals && jquery .active++ === 0 ) {6724 jquery .event.trigger("ajaxstart");6725 }6726 // uppercase the type6727 s.type = s.type.touppercase();6728 // determine if request has content6729 s.hascontent = !rnocontent.test( s.type );6730 // save the url in case we're toying with the if-modified-since6731 // and/or if-none-match header later on6732 cacheurl = s.url;6733 // more options handling for requests with no content6734 if ( !s.hascontent ) {6735 // if data is available, append data to url6736 if ( s.data ) {6737 cacheurl = ( s.url += ( ajax_rquery.test( cacheurl ) ? "&" : "?" ) + s.data );6738 // #9682: remove data so that it's not used in an eventual retry6739 delete s.data;6740 }6741 // add anti-cache in url if needed6742 if ( s.cache === false ) {6743 s.url = rts.test( cacheurl ) ?6744 // if there is already a '_' parameter, set its value6745 cacheurl.replace( rts, "$1_=" + ajax_nonce++ ) :6746 // otherwise add one to the end6747 cacheurl + ( ajax_rquery.test( cacheurl ) ? "&" : "?" ) + "_=" + ajax_nonce++;6748 }6749 }6750 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.6751 if ( s.ifmodified ) {6752 if ( jquery .lastmodified[ cacheurl ] ) {6753 jqxhr.setrequestheader( "if-modified-since", jquery .lastmodified[ cacheurl ] );6754 }6755 if ( jquery .etag[ cacheurl ] ) {6756 jqxhr.setrequestheader( "if-none-match", jquery .etag[ cacheurl ] );6757 }6758 }6759 // set the correct header, if data is being sent6760 if ( s.data && s.hascontent && s.contenttype !== false || options.contenttype ) {6761 jqxhr.setrequestheader( "content-type", s.contenttype );6762 }6763 // set the accepts header for the server, depending on the datatype6764 jqxhr.setrequestheader(6765 "accept",6766 s.datatypes[ 0 ] && s.accepts[ s.datatypes[0] ] ?6767 s.accepts[ s.datatypes[0] ] + ( s.datatypes[ 0 ] !== "*" ? ", " + alltypes + "; q=0.01" : "" ) :6768 s.accepts[ "*" ]6769 );6770 // check for headers option6771 for ( i in s.headers ) {6772 jqxhr.setrequestheader( i, s.headers[ i ] );6773 }6774 // allow custom headers/mimetypes and early abort6775 if ( s.beforesend && ( s.beforesend.call( callbackcontext, jqxhr, s ) === false || state === 2 ) ) {6776 // abort if not done already and return6777 return jqxhr.abort();6778 }6779 // aborting is no longer a cancellation6780 strabort = "abort";6781 // install callbacks on deferreds6782 for ( i in { success: 1, error: 1, complete: 1 } ) {6783 jqxhr[ i ]( s[ i ] );6784 }6785 // get transport6786 transport = inspectprefiltersortransports( transports, s, options, jqxhr );6787 // if no transport, we auto-abort6788 if ( !transport ) {6789 done( -1, "no transport" );6790 } else {6791 jqxhr.readystate = 1;6792 // send global event6793 if ( fireglobals ) {6794 globaleventcontext.trigger( "ajaxsend", [ jqxhr, s ] );6795 }6796 // timeout6797 if ( s.async && s.timeout > 0 ) {6798 timeouttimer = settimeout(function() {6799 jqxhr.abort("timeout");6800 }, s.timeout );6801 }6802 try {6803 state = 1;6804 transport.send( requestheaders, done );6805 } catch ( e ) {6806 // propagate exception as error if not done6807 if ( state < 2 ) {6808 done( -1, e );6809 // simply rethrow otherwise6810 } else {6811 throw e;6812 }6813 }6814 }6815 // callback for when everything is done6816 function done( status, nativestatustext, responses, headers ) {6817 var issuccess, success, error, response, modified,6818 statustext = nativestatustext;6819 // called once6820 if ( state === 2 ) {6821 return;6822 }6823 // state is "done" now6824 state = 2;6825 // clear timeout if it exists6826 if ( timeouttimer ) {6827 cleartimeout( timeouttimer );6828 }6829 // dereference transport for early garbage collection6830 // (no matter how long the jqxhr object will be used)6831 transport = undefined;6832 // cache response headers6833 responseheadersstring = headers || "";6834 // set readystate6835 jqxhr.readystate = status > 0 ? 4 : 0;6836 // get response data6837 if ( responses ) {6838 response = ajaxhandleresponses( s, jqxhr, responses );6839 }6840 // if successful, handle type chaining6841 if ( status >= 200 && status < 300 || status === 304 ) {6842 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.6843 if ( s.ifmodified ) {6844 modified = jqxhr.getresponseheader("last-modified");6845 if ( modified ) {6846 jquery .lastmodified[ cacheurl ] = modified;6847 }6848 modified = jqxhr.getresponseheader("etag");6849 if ( modified ) {6850 jquery .etag[ cacheurl ] = modified;6851 }6852 }6853 // if no content6854 if ( status === 204 ) {6855 issuccess = true;6856 statustext = "nocontent";6857 // if not modified6858 } else if ( status === 304 ) {6859 issuccess = true;6860 statustext = "notmodified";6861 // if we have data, let's convert it6862 // 如果我们有数据,转换他6863 } else {6864 issuccess = ajaxconvert( s, response );6865 statustext = issuccess.state;6866 success = issuccess.data;6867 error = issuccess.error;6868 issuccess = !error;6869 }6870 } else {6871 // we extract error from statustext6872 // then normalize statustext and status for non-aborts6873 error = statustext;6874 if ( status || !statustext ) {6875 statustext = "error";6876 if ( status < 0 ) {6877 status = 0;6878 }6879 }6880 }6881 // set data for the fake xhr object6882 // 为伪造的xhr对象设置数据6883 jqxhr.status = status;6884 jqxhr.statustext = ( nativestatustext || statustext ) + "";6885 // success/error6886 if ( issuccess ) {6887 deferred.resolvewith( callbackcontext, [ success, statustext, jqxhr ] );6888 } else {6889 deferred.rejectwith( callbackcontext, [ jqxhr, statustext, error ] );6890 }6891 // status-dependent callbacks6892 jqxhr.statuscode( statuscode );6893 statuscode = undefined;6894 if ( fireglobals ) {6895 globaleventcontext.trigger( issuccess ? "ajaxsuccess" : "ajaxerror",6896 [ jqxhr, s, issuccess ? success : error ] );6897 }6898 // complete6899 // 完成6900 completedeferred.firewith( callbackcontext, [ jqxhr, statustext ] );6901 if ( fireglobals ) {6902 globaleventcontext.trigger( "ajaxcomplete", [ jqxhr, s ] );6903 // handle the global ajax counter6904 // 处理全局的ajax计数器6905 if ( !( --jquery .active ) ) {6906 jquery .event.trigger("ajaxstop");6907 }6908 }6909 }6910 return jqxhr;6911 },6912 getscript: function( url, callback ) {6913 return jquery .get( url, undefined, callback, "script" );6914 },6915 getjs on: function( url, data, callback ) {6916 return jquery .get( url, data, callback, "js on" );6917 }6918});6919/* handles responses to an ajax request:6920 * - sets all responsexxx fields accordingly6921 * - finds the right datatype (mediates between content-type and expected datatype)6922 * - returns the corresponding response6923 */6924function ajaxhandleresponses( s, jqxhr, responses ) {6925 var firstdatatype, ct, finaldatatype, type,6926 contents = s.contents,6927 datatypes = s.datatypes,6928 responsefields = s.responsefields;6929 // fill responsexxx fields6930 for ( type in responsefields ) {6931 if ( type in responses ) {6932 jqxhr[ responsefields[type] ] = responses[ type ];6933 }6934 }6935 // remove auto datatype and get content-type in the process6936 while( datatypes[ 0 ] === "*" ) {6937 datatypes.shift();6938 if ( ct === undefined ) {6939 ct = s.mimetype || jqxhr.getresponseheader("content-type");6940 }6941 }6942 // check if we're dealing with a known content-type6943 if ( ct ) {6944 for ( type in contents ) {6945 if ( contents[ type ] && contents[ type ].test( ct ) ) {6946 datatypes.unshift( type );6947 break;6948 }6949 }6950 }6951 // check to see if we have a response for the expected datatype6952 if ( datatypes[ 0 ] in responses ) {6953 finaldatatype = datatypes[ 0 ];6954 } else {6955 // try convertible datatypes6956 for ( type in responses ) {6957 if ( !datatypes[ 0 ] || s.converters[ type + " " + datatypes[0] ] ) {6958 finaldatatype = type;6959 break;6960 }6961 if ( !firstdatatype ) {6962 firstdatatype = type;6963 }6964 }6965 // or just use first one6966 finaldatatype = finaldatatype || firstdatatype;6967 }6968 // if we found a datatype6969 // we add the datatype to the list if needed6970 // and return the corresponding response6971 if ( finaldatatype ) {6972 if ( finaldatatype !== datatypes[ 0 ] ) {6973 datatypes.unshift( finaldatatype );6974 }6975 return responses[ finaldatatype ];6976 }6977}6978// chain conversions given the request and the original response6979function ajaxconvert( s, response ) {6980 var conv2, current, conv, tmp,6981 converters = {},6982 i = 0,6983 // work with a copy of datatypes in case we need to modify it for conversion6984 datatypes = s.datatypes.slice(),6985 prev = datatypes[ 0 ];6986 // apply the datafilter if provided6987 if ( s.datafilter ) {6988 response = s.datafilter( response, s.datatype );6989 }6990 // create converters map with lowercased keys6991 if ( datatypes[ 1 ] ) {6992 for ( conv in s.converters ) {6993 converters[ conv.tolowercase() ] = s.converters[ conv ];6994 }6995 }6996 // convert to each sequential datatype, tolerating list modification6997 for ( ; (current = datatypes[++i]); ) {6998 // there's only work to do if current datatype is non-auto6999 if ( current !== "*" ) {7000 // convert response if prev datatype is non-auto and differs from current7001 if ( prev !== "*" && prev !== current ) {7002 // seek a direct converter7003 conv = converters[ prev + " " + current ] || converters[ "* " + current ];7004 // if none found, seek a pair7005 if ( !conv ) {7006 for ( conv2 in converters ) {7007 // if conv2 outputs current7008 tmp = conv2.split(" ");7009 if ( tmp[ 1 ] === current ) {7010 // if prev can be converted to accepted input7011 conv = converters[ prev + " " + tmp[ 0 ] ] ||7012 converters[ "* " + tmp[ 0 ] ];7013 if ( conv ) {7014 // condense equivalence converters7015 if ( conv === true ) {7016 conv = converters[ conv2 ];7017 // otherwise, insert the intermediate datatype7018 } else if ( converters[ conv2 ] !== true ) {7019 current = tmp[ 0 ];7020 datatypes.splice( i--, 0, current );7021 }7022 break;7023 }7024 }7025 }7026 }7027 // apply converter (if not an equivalence)7028 if ( conv !== true ) {7029 // unless errors are allowed to bubble, catch and return them7030 if ( conv && s["throws"] ) {7031 response = conv( response );7032 } else {7033 try {7034 response = conv( response );7035 } catch ( e ) {7036 return { state: "parsererror", error: conv ? e : "no conversion from " + prev + " to " + current };7037 }7038 }7039 }7040 }7041 // update prev for next iteration7042 prev = current;7043 }7044 }7045 return { state: "success", data: response };7046}7047// install script datatype7048jquery .ajaxsetup({7049 accepts: {7050 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"7051 },7052 contents: {7053 script: /(?:java|ecma)script/7054 },7055 converters: {7056 "text script": function( text ) {7057 jquery .globaleval( text );7058 return text;7059 }7060 }7061});7062// handle cache's special case and global7063jquery .ajaxprefilter( "script", function( s ) {7064 if ( s.cache === undefined ) {7065 s.cache = false;7066 }7067 if ( s.crossdomain ) {7068 s.type = "get";7069 s.global = false;7070 }7071});7072// bind script tag hack transport7073jquery .ajaxtransport( "script", function(s) {7074 // this transport only deals with cross domain requests7075 if ( s.crossdomain ) {7076 var script,7077 head = document.head || jquery ("head")[0] || document.documentelement;7078 return {7079 send: function( _, callback ) {7080 script = document.createelement("script");7081 script.async = true;7082 if ( s.scriptcharset ) {7083 script.charset = s.scriptcharset;7084 }7085 script.src = s.url;7086 // attach handlers for all browsers7087 script.onload = script.onreadystatechange = function( _, isabort ) {7088 if ( isabort || !script.readystate || /loaded|complete/.test( script.readystate ) ) {7089 // handle memory leak in ie7090 script.onload = script.onreadystatechange = null;7091 // remove the script7092 if ( script.parentnode ) {7093 script.parentnode.removechild( script );7094 }7095 // dereference the script7096 script = null;7097 // callback if not abort7098 if ( !isabort ) {7099 callback( 200, "success" );7100 }7101 }7102 };7103 // circumvent ie6 bugs with base elements (#2709 and #4378) by prepending7104 // use native dom manipulation to avoid our dommanip ajax trickery7105 head.insertbefore( script, head.firstchild );7106 },7107 abort: function() {7108 if ( script ) {7109 script.onload( undefined, true );7110 }7111 }7112 };7113 }7114});7115var oldcallbacks = [],7116 rjs onp = /(=)\?(?=&|$)|\?\?/;7117// default js onp settings7118jquery .ajaxsetup({7119 js onp: "callback",7120 js onpcallback: function() {7121 var callback = oldcallbacks.pop() || ( jquery .expando + "_" + ( ajax_nonce++ ) );7122 this[ callback ] = true;7123 return callback;7124 }7125});7126// detect, normalize options and install callbacks for js onp requests7127jquery .ajaxprefilter( "js on js onp", function( s, originalsettings, jqxhr ) {7128 var callbackname, overwritten, responsecontainer,7129 js onprop = s.js onp !== false && ( rjs onp.test( s.url ) ?7130 "url" :7131 typeof s.data === "string" && !( s.contenttype || "" ).indexof("application/x-www-form-urlencoded") && rjs onp.test( s.data ) && "data"7132 );7133 // handle iff the expected data type is "js onp" or we have a parameter to set7134 if ( js onprop || s.datatypes[ 0 ] === "js onp" ) {7135 // get callback name, remembering preexisting value associated with it7136 callbackname = s.js onpcallback = jquery .isfunction( s.js onpcallback ) ?7137 s.js onpcallback() :7138 s.js onpcallback;7139 // insert callback into url or form data7140 if ( js onprop ) {7141 s[ js onprop ] = s[ js onprop ].replace( rjs onp, "$1" + callbackname );7142 } else if ( s.js onp !== false ) {7143 s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.js onp + "=" + callbackname;7144 }7145 // use data converter to retrieve js on after script execution7146 s.converters["script js on"] = function() {7147 if ( !responsecontainer ) {7148 jquery .error( callbackname + " was not called" );7149 }7150 return responsecontainer[ 0 ];7151 };7152 // force js on datatype7153 s.datatypes[ 0 ] = "js on";7154 // install callback7155 overwritten = window[ callbackname ];7156 window[ callbackname ] = function() {7157 responsecontainer = arguments;7158 };7159 // clean-up function (fires after converters)7160 jqxhr.always(function() {7161 // rest ore preexisting value7162 window[ callbackname ] = overwritten;7163 // save back as free7164 if ( s[ callbackname ] ) {7165 // make sure that re-using the options doesn't screw things around7166 s.js onpcallback = originalsettings.js onpcallback;7167 // save the callback name for future use7168 oldcallbacks.push( callbackname );7169 }7170 // call if it was a function and we have a response7171 if ( responsecontainer && jquery .isfunction( overwritten ) ) {7172 overwritten( responsecontainer[ 0 ] );7173 }7174 responsecontainer = overwritten = undefined;7175 });7176 // delegate to script7177 return "script";7178 }7179});7180var xhrcallbacks, xhrsupported,7181 xhrid = 0,7182 // #5280: internet explorer will keep connections alive if we don't abort on unload7183 xhronunloadabort = window.activexobject && function() {7184 // abort all pending requests7185 var key;7186 for ( key in xhrcallbacks ) {7187 xhrcallbacks[ key ]( undefined, true );7188 }7189 };7190// functions to create xhrs7191function createstandardxhr() {7192 try {7193 return new window.xmlhttprequest();7194 } catch( e ) {}7195}7196function createactivexhr() {7197 try {7198 return new window.activexobject("microsoft.xmlhttp");7199 } catch( e ) {}7200}7201// create the request object7202// (this is still attached to ajaxsettings for backward compatibility)7203jquery .ajaxsettings.xhr = window.activexobject ?7204 /* microsoft failed to properly7205 * implement the xmlhttprequest in ie7 (can't request local files),7206 * so we use the activexobject when it is available7207 * additionally xmlhttprequest can be disabled in ie7/ie8 so7208 * we need a fallback.7209 */7210 function() {7211 return !this.islocal && createstandardxhr() || createactivexhr();7212 } :7213 // for all other browsers, use the standard xmlhttprequest object7214 createstandardxhr;7215// determine support properties7216xhrsupported = jquery .ajaxsettings.xhr();7217jquery .support.cors = !!xhrsupported && ( "withcredentials" in xhrsupported );7218xhrsupported = jquery .support.ajax = !!xhrsupported;7219// create transport if the browser can provide an xhr7220if ( xhrsupported ) {7221 jquery .ajaxtransport(function( s ) {7222 // cross domain only allowed if supported through xmlhttprequest7223 if ( !s.crossdomain || jquery .support.cors ) {7224 var callback;7225 return {7226 send: function( headers, complete ) {7227 // get a new xhr7228 var handle, i,7229 xhr = s.xhr();7230 // open the socket7231 // passing null username, generates a login popup on opera (#2865)7232 if ( s.username ) {7233 xhr.open( s.type, s.url, s.async, s.username, s.password );7234 } else {7235 xhr.open( s.type, s.url, s.async );7236 }7237 // apply custom fields if provided7238 if ( s.xhrfields ) {7239 for ( i in s.xhrfields ) {7240 xhr[ i ] = s.xhrfields[ i ];7241 }7242 }7243 // override mime type if needed7244 if ( s.mimetype && xhr.overridemimetype ) {7245 xhr.overridemimetype( s.mimetype );7246 }7247 // x-requested-with header7248 // for cross-domain requests, seeing as conditions for a preflight are7249 // akin to a jigsaw puzzle, we simply never set it to be sure.7250 // (it can always be set on a per-request basis or even using ajaxsetup)7251 // for same-domain requests, won't change header if already provided.7252 if ( !s.crossdomain && !headers["x-requested-with"] ) {7253 headers["x-requested-with"] = "xmlhttprequest";7254 }7255 // need an extra try/catch for cross domain requests in firefox 37256 try {7257 for ( i in headers ) {7258 xhr.setrequestheader( i, headers[ i ] );7259 }7260 } catch( err ) {}7261 // do send the request7262 // this may raise an exception which is actually7263 // handled in jquery .ajax (so no try/catch here)7264 xhr.send( ( s.hascontent && s.data ) || null );7265 // listener7266 callback = function( _, isabort ) {7267 var status, responseheaders, statustext, responses;7268 // firefox throws exceptions when accessing properties7269 // of an xhr when a network error occurred7270 // http://helpful.knobs-dials.com/index.php/component_returned_failure_code:_0x80040111_(ns_error_not_available)7271 try {7272 // was never called and is aborted or complete7273 if ( callback && ( isabort || xhr.readystate === 4 ) ) {7274 // only called once7275 callback = undefined;7276 // do not keep as active anymore7277 if ( handle ) {7278 xhr.onreadystatechange = jquery .noop;7279 if ( xhronunloadabort ) {7280 delete xhrcallbacks[ handle ];7281 }7282 }7283 // if it's an abort7284 if ( isabort ) {7285 // abort it manually if needed7286 if ( xhr.readystate !== 4 ) {7287 xhr.abort();7288 }7289 } else {7290 responses = {};7291 status = xhr.status;7292 responseheaders = xhr.getallresponseheaders();7293 // when requesting binary data, ie6-9 will throw an exception7294 // on any attempt to access responsetext (#11426)7295 if ( typeof xhr.responsetext === "string" ) {7296 responses.text = xhr.responsetext;7297 }7298 // firefox throws an exception when accessing7299 // statustext for faulty cross-domain requests7300 try {7301 statustext = xhr.statustext;7302 } catch( e ) {7303 // we normalize with webkit giving an empty statustext7304 statustext = "";7305 }7306 // filter status for non standard behaviors7307 // if the request is local and we have data: assume a success7308 // (success with no data won't get notified, that's the best we7309 // can do given current implementations)7310 if ( !status && s.islocal && !s.crossdomain ) {7311 status = responses.text ? 200 : 404;7312 // ie - #1450: sometimes returns 1223 when it should be 2047313 } else if ( status === 1223 ) {7314 status = 204;7315 }7316 }7317 }7318 } catch( firefoxaccessexception ) {7319 if ( !isabort ) {7320 complete( -1, firefoxaccessexception );7321 }7322 }7323 // call complete if needed7324 if ( responses ) {7325 complete( status, statustext, responses, responseheaders );7326 }7327 };7328 if ( !s.async ) {7329 // if we're in sync mode we fire the callback7330 callback();7331 } else if ( xhr.readystate === 4 ) {7332 // (ie6 & ie7) if it's in cache and has been7333 // retrieved directly we need to fire the callback7334 settimeout( callback );7335 } else {7336 handle = ++xhrid;7337 if ( xhronunloadabort ) {7338 // create the active xhrs callbacks list if needed7339 // and attach the unload handler7340 if ( !xhrcallbacks ) {7341 xhrcallbacks = {};7342 jquery ( window ).unload( xhronunloadabort );7343 }7344 // add to list of active xhrs callbacks7345 xhrcallbacks[ handle ] = callback;7346 }7347 xhr.onreadystatechange = callback;7348 }7349 },7350 abort: function() {7351 if ( callback ) {7352 callback( undefined, true );7353 }7354 }7355 };7356 }7357 });7358}7359var fxnow, timerid,7360 rfxtypes = /^(?:toggle|show|hide)$/,7361 rfxnum = new regexp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),7362 rrun = /queuehooks$/,7363 animationprefilters = [ defaultprefilter ],7364 tweeners = {7365 "*": [function( prop, value ) {7366 var end, unit,7367 tween = this.createtween( prop, value ),7368 parts = rfxnum.exec( value ),7369 target = tween.cur(),7370 start = +target || 0,7371 scale = 1,7372 maxiterations = 20;7373 if ( parts ) {7374 end = +parts[2];7375 unit = parts[3] || ( jquery .cssnumber[ prop ] ? "" : "px" );7376 // we need to compute starting value7377 if ( unit !== "px" && start ) {7378 // iteratively approximate from a nonzero starting point7379 // prefer the current property, because this process will be trivial if it uses the same units7380 // fallback to end or a simple constant7381 start = jquery .css( tween.elem, prop, true ) || end || 1;7382 do {7383 // if previous iteration zeroed out, double until we get *something*7384 // use a string for doubling factor so we don't accidentally see scale as unchanged below7385 scale = scale || ".5";7386 // adjust and apply7387 start = start / scale;7388 jquery .style( tween.elem, prop, start + unit );7389 // update scale, tolerating zero or nan from tween.cur()7390 // and breaking the loop if scale is unchanged or perfect, or if we've just had enough7391 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxiterations );7392 }7393 tween.unit = unit;7394 tween.start = start;7395 // if a +=/-= token was provided, we're doing a relative animation7396 tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;7397 }7398 return tween;7399 }]7400 };7401// animations created synchronously will run synchronously7402function createfxnow() {7403 settimeout(function() {7404 fxnow = undefined;7405 });7406 return ( fxnow = jquery .now() );7407}7408function createtweens( animation, props ) {7409 jquery .each( props, function( prop, value ) {7410 var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),//concat() 函数用于连接两个或者多个数组7411 index = 0,7412 length = collection.length;7413 for ( ; index < length; index++ ) {7414 if ( collection[ index ].call( animation, prop, value ) ) {7415 //我们做完了这个属性7416 return;7417 }7418 }7419 });7420}7421function animation( elem, properties, options ) {7422 var result,7423 stopped,7424 index = 0,7425 length = animationprefilters.length,7426 deferred = jquery .deferred().always( function() {7427 // don't match elem in the :animated selector7428 delete tick.elem;7429 }),7430 tick = function() {7431 if ( stopped ) {7432 return false;7433 }7434 var currenttime = fxnow || createfxnow(),7435 remaining = math.max( 0, animation.starttime + animation.duration - currenttime ),7436 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)7437 temp = remaining / animation.duration || 0,7438 percent = 1 - temp,7439 index = 0,7440 length = animation.tweens.length;7441 for ( ; index < length ; index++ ) {7442 animation.tweens[ index ].run( percent );7443 }7444 deferred.notifywith( elem, [ animation, percent, remaining ]);7445 if ( percent < 1 && length ) {7446 return remaining;7447 } else {7448 deferred.resolvewith( elem, [ animation ] );7449 return false;7450 }7451 },7452 animation = deferred.promise({7453 elem: elem,7454 props: jquery .extend( {}, properties ),7455 opts: jquery .extend( true, { specialeasing: {} }, options ),7456 originalproperties: properties,7457 originaloptions: options,7458 starttime: fxnow || createfxnow(),7459 duration: options.duration,7460 tweens: [],7461 createtween: function( prop, end ) {7462 var tween = jquery .tween( elem, animation.opts, prop, end,7463 animation.opts.specialeasing[ prop ] || animation.opts.easing );7464 animation.tweens.push( tween );7465 return tween;7466 },7467 stop: function( gotoend ) {7468 var index = 0,7469 // if we are going to the end, we want to run all the tweens7470 // otherwise we skip this part7471 length = gotoend ? animation.tweens.length : 0;7472 if ( stopped ) {7473 return this;7474 }7475 stopped = true;7476 for ( ; index < length ; index++ ) {7477 animation.tweens[ index ].run( 1 );7478 }7479 // resolve when we played the last frame7480 // otherwise, reject7481 if ( gotoend ) {7482 deferred.resolvewith( elem, [ animation, gotoend ] );7483 } else {7484 deferred.rejectwith( elem, [ animation, gotoend ] );7485 }7486 return this;7487 }7488 }),7489 props = animation.props;7490 propfilter( props, animation.opts.specialeasing );7491 for ( ; index < length ; index++ ) {7492 result = animationprefilters[ index ].call( animation, elem, props, animation.opts );7493 if ( result ) {7494 return result;7495 }7496 }7497 createtweens( animation, props );7498 if ( jquery .isfunction( animation.opts.start ) ) {7499 animation.opts.start.call( elem, animation );7500 }7501 jquery .fx.timer(7502 jquery .extend( tick, {7503 elem: elem,7504 anim: animation,7505 queue: animation.opts.queue7506 })7507 );7508 // attach callbacks from options7509 return animation.progress( animation.opts.progress )7510 .done( animation.opts.done, animation.opts.complete )7511 .fail( animation.opts.fail )7512 .always( animation.opts.always );7513}7514function propfilter( props, specialeasing ) {7515 var value, name, index, easing, hooks;7516 // camelcase, specialeasing and expand csshook pass7517 for ( index in props ) {7518 name = jquery .camelcase( index );7519 easing = specialeasing[ name ];7520 value = props[ index ];7521 if ( jquery .isarray( value ) ) {7522 easing = value[ 1 ];7523 value = props[ index ] = value[ 0 ];7524 }7525 if ( index !== name ) {7526 props[ name ] = value;7527 delete props[ index ];7528 }7529 hooks = jquery .csshooks[ name ];7530 if ( hooks && "expand" in hooks ) {7531 value = hooks.expand( value );7532 delete props[ name ];7533 // not quite $.extend, this wont overwrite keys already present.7534 // also - reusing 'index' from above because we have the correct "name"7535 for ( index in value ) {7536 if ( !( index in props ) ) {7537 props[ index ] = value[ index ];7538 specialeasing[ index ] = easing;7539 }7540 }7541 } else {7542 specialeasing[ name ] = easing;7543 }7544 }7545}7546jquery .animation = jquery .extend( animation, {7547 tweener: function( props, callback ) {7548 if ( jquery .isfunction( props ) ) {7549 callback = props;7550 props = [ "*" ];7551 } else {7552 props = props.split(" ");7553 }7554 var prop,7555 index = 0,7556 length = props.length;7557 for ( ; index < length ; index++ ) {7558 prop = props[ index ];7559 tweeners[ prop ] = tweeners[ prop ] || [];7560 tweeners[ prop ].unshift( callback );7561 }7562 },7563 prefilter: function( callback, prepend ) {7564 if ( prepend ) {7565 animationprefilters.unshift( callback );7566 } else {7567 animationprefilters.push( callback );7568 }7569 }7570});7571function defaultprefilter( elem, props, opts ) {7572 /*js hint validthis:true */7573 var prop, index, length,7574 value, datashow, toggle,7575 tween, hooks, oldfire,7576 anim = this,7577 style = elem.style,7578 orig = {},7579 handled = [],7580 hidden = elem.nodetype && ishidden( elem );7581 // handle queue: false promises7582 if ( !opts.queue ) {7583 hooks = jquery ._queuehooks( elem, "fx" );7584 if ( hooks.unqueued == null ) {7585 hooks.unqueued = 0;7586 oldfire = hooks.empty.fire;7587 hooks.empty.fire = function() {7588 if ( !hooks.unqueued ) {7589 oldfire();7590 }7591 };7592 }7593 hooks.unqueued++;7594 anim.always(function() {7595 // doing this makes sure that the complete handler will be called7596 // before this completes7597 anim.always(function() {7598 hooks.unqueued--;7599 if ( !jquery .queue( elem, "fx" ).length ) {7600 hooks.empty.fire();7601 }7602 });7603 });7604 }7605 // height/width overflow pass7606 if ( elem.nodetype === 1 && ( "height" in props || "width" in props ) ) {7607 // make sure that nothing sneaks out7608 // record all 3 overflow attributes because ie does not7609 // change the overflow attribute when overflowx and7610 // overflowy are set to the same value7611 opts.overflow = [ style.overflow, style.overflowx, style.overflowy ];7612 // set display property to inline-block for height/width7613 // animations on inline elements that are having width/height animated7614 if ( jquery .css( elem, "display" ) === "inline" &&7615 jquery .css( elem, "float" ) === "none" ) {7616 // inline-level elements accept inline-block;7617 // block-level elements need to be inline with layout7618 if ( !jquery .support.inlineblockneedslayout || css_defaultdisplay( elem.nodename ) === "inline" ) {7619 style.display = "inline-block";7620 } else {7621 style.zoom = 1;7622 }7623 }7624 }7625 if ( opts.overflow ) {7626 style.overflow = "hidden";7627 if ( !jquery .support.shrinkwrapblocks ) {7628 anim.always(function() {7629 style.overflow = opts.overflow[ 0 ];7630 style.overflowx = opts.overflow[ 1 ];7631 style.overflowy = opts.overflow[ 2 ];7632 });7633 }7634 }7635 // show/hide pass7636 for ( index in props ) {7637 value = props[ index ];7638 if ( rfxtypes.exec( value ) ) {7639 delete props[ index ];7640 toggle = toggle || value === "toggle";7641 if ( value === ( hidden ? "hide" : "show" ) ) {7642 continue;7643 }7644 handled.push( index );7645 }7646 }7647 length = handled.length;7648 if ( length ) {7649 datashow = jquery ._data( elem, "fxshow" ) || jquery ._data( elem, "fxshow", {} );7650 if ( "hidden" in datashow ) {7651 hidden = datashow.hidden;7652 }7653 // store state if its toggle - enables .stop().toggle() to "reverse"7654 if ( toggle ) {7655 datashow.hidden = !hidden;7656 }7657 if ( hidden ) {7658 jquery ( elem ).show();7659 } else {7660 anim.done(function() {7661 jquery ( elem ).hide();7662 });7663 }7664 anim.done(function() {7665 var prop;7666 jquery ._removedata( elem, "fxshow" );7667 for ( prop in orig ) {7668 jquery .style( elem, prop, orig[ prop ] );7669 }7670 });7671 for ( index = 0 ; index < length ; index++ ) {7672 prop = handled[ index ];7673 tween = anim.createtween( prop, hidden ? datashow[ prop ] : 0 );7674 orig[ prop ] = datashow[ prop ] || jquery .style( elem, prop );7675 if ( !( prop in datashow ) ) {7676 datashow[ prop ] = tween.start;7677 if ( hidden ) {7678 tween.end = tween.start;7679 tween.start = prop === "width" || prop === "height" ? 1 : 0;7680 }7681 }7682 }7683 }7684}7685function tween( elem, options, prop, end, easing ) {7686 return new tween.prototype.init( elem, options, prop, end, easing );7687}7688jquery .tween = tween;7689tween.prototype = {7690 constructor: tween,7691 init: function( elem, options, prop, end, easing, unit ) {7692 this.elem = elem;7693 this.prop = prop;7694 this.easing = easing || "swing";7695 this.options = options;7696 this.start = this.now = this.cur();7697 this.end = end;7698 this.unit = unit || ( jquery .cssnumber[ prop ] ? "" : "px" );7699 },7700 cur: function() {7701 var hooks = tween.prophooks[ this.prop ];7702 return hooks && hooks.get ?7703 hooks.get( this ) :7704 tween.prophooks._default.get( this );7705 },7706 run: function( percent ) {7707 var eased,7708 hooks = tween.prophooks[ this.prop ];7709 if ( this.options.duration ) {7710 this.pos = eased = jquery .easing[ this.easing ](7711 percent, this.options.duration * percent, 0, 1, this.options.duration7712 );7713 } else {7714 this.pos = eased = percent;7715 }7716 this.now = ( this.end - this.start ) * eased + this.start;7717 if ( this.options.step ) {7718 this.options.step.call( this.elem, this.now, this );7719 }7720 if ( hooks && hooks.set ) {7721 hooks.set( this );7722 } else {7723 tween.prophooks._default.set( this );7724 }7725 return this;7726 }7727};7728tween.prototype.init.prototype = tween.prototype;7729tween.prophooks = {7730 _default: {7731 get: function( tween ) {7732 var result;7733 if ( tween.elem[ tween.prop ] != null &&7734 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {7735 return tween.elem[ tween.prop ];7736 }7737 // passing an empty string as a 3rd parameter to .css will automatically7738 // attempt a parsefloat and fallback to a string if the parse fails7739 // so, simple values such as "10px" are parsed to float.7740 // complex values such as "rotate(1rad)" are returned as is.7741 result = jquery .css( tween.elem, tween.prop, "" );7742 // empty strings, null, undefined and "auto" are converted to 0.7743 return !result || result === "auto" ? 0 : result;7744 },7745 set: function( tween ) {7746 // use step hook for back compat - use csshook if its there - use .style if its7747 // available and use plain properties where available7748 if ( jquery .fx.step[ tween.prop ] ) {7749 jquery .fx.step[ tween.prop ]( tween );7750 } else if ( tween.elem.style && ( tween.elem.style[ jquery .cssprops[ tween.prop ] ] != null || jquery .csshooks[ tween.prop ] ) ) {7751 jquery .style( tween.elem, tween.prop, tween.now + tween.unit );7752 } else {7753 tween.elem[ tween.prop ] = tween.now;7754 }7755 }7756 }7757};7758// remove in 2.0 - this supports ie8's panic based approach7759// to setting things on disconnected nodes7760tween.prophooks.scrolltop = tween.prophooks.scrollleft = {7761 set: function( tween ) {7762 if ( tween.elem.nodetype && tween.elem.parentnode ) {7763 tween.elem[ tween.prop ] = tween.now;7764 }7765 }7766};7767jquery .each([ "toggle", "show", "hide" ], function( i, name ) {7768 var cssfn = jquery .fn[ name ];7769 jquery .fn[ name ] = function( speed, easing, callback ) {7770 return speed == null || typeof speed === "boolean" ?7771 cssfn.apply( this, arguments ) :7772 this.animate( genfx( name, true ), speed, easing, callback );7773 };7774});7775jquery .fn.extend({7776 fadeto: function( speed, to, easing, callback ) {7777 // show any hidden elements after setting opacity to 07778 return this.filter( ishidden ).css( "opacity", 0 ).show()7779 // animate to the value specified7780 .end().animate({ opacity: to }, speed, easing, callback );7781 },7782 animate: function( prop, speed, easing, callback ) {7783 var empty = jquery .isemptyobject( prop ),7784 optall = jquery .speed( speed, easing, callback ),7785 doanimation = function() {7786 // operate on a copy of prop so per-property easing won't be lost7787 var anim = animation( this, jquery .extend( {}, prop ), optall );7788 doanimation.finish = function() {7789 anim.stop( true );7790 };7791 // empty animations, or finishing resolves immediately7792 if ( empty || jquery ._data( this, "finish" ) ) {7793 anim.stop( true );7794 }7795 };7796 doanimation.finish = doanimation;7797 return empty || optall.queue === false ?7798 this.each( doanimation ) :7799 this.queue( optall.queue, doanimation );7800 },7801 stop: function( type, clearqueue, gotoend ) {7802 var stopqueue = function( hooks ) {7803 var stop = hooks.stop;7804 delete hooks.stop;7805 stop( gotoend );7806 };7807 if ( typeof type !== "string" ) {7808 gotoend = clearqueue;7809 clearqueue = type;7810 type = undefined;7811 }7812 if ( clearqueue && type !== false ) {7813 this.queue( type || "fx", [] );7814 }7815 return this.each(function() {7816 var dequeue = true,7817 index = type != null && type + "queuehooks",7818 timers = jquery .timers,7819 data = jquery ._data( this );7820 if ( index ) {7821 if ( data[ index ] && data[ index ].stop ) {7822 stopqueue( data[ index ] );7823 }7824 } else {7825 for ( index in data ) {7826 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {7827 stopqueue( data[ index ] );7828 }7829 }7830 }7831 for ( index = timers.length; index--; ) {7832 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {7833 timers[ index ].anim.stop( gotoend );7834 dequeue = false;7835 timers.splice( index, 1 );7836 }7837 }7838 // start the next in the queue if the last step wasn't forced7839 // timers currently will call their complete callbacks, which will dequeue7840 // but only if they were gotoend7841 if ( dequeue || !gotoend ) {7842 jquery .dequeue( this, type );7843 }7844 });7845 },7846 finish: function( type ) {7847 if ( type !== false ) {7848 type = type || "fx";7849 }7850 return this.each(function() {7851 var index,7852 data = jquery ._data( this ),7853 queue = data[ type + "queue" ],7854 hooks = data[ type + "queuehooks" ],7855 timers = jquery .timers,7856 length = queue ? queue.length : 0;7857 // enable finishing flag on private data7858 data.finish = true;7859 // empty the queue first7860 jquery .queue( this, type, [] );7861 if ( hooks && hooks.cur && hooks.cur.finish ) {7862 hooks.cur.finish.call( this );7863 }7864 // look for any active animations, and finish them7865 for ( index = timers.length; index--; ) {7866 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {7867 timers[ index ].anim.stop( true );7868 timers.splice( index, 1 );7869 }7870 }7871 // look for any animations in the old queue and finish them7872 for ( index = 0; index < length; index++ ) {7873 if ( queue[ index ] && queue[ index ].finish ) {7874 queue[ index ].finish.call( this );7875 }7876 }7877 // turn off finishing flag7878 delete data.finish;7879 });7880 }7881});7882// generate parameters to create a standard animation7883function genfx( type, includewidth ) {7884 var which,7885 attrs = { height: type },7886 i = 0;7887 // if we include width, step value is 1 to do all cssexpand values,7888 // if we don't include width, step value is 2 to skip over left and right7889 includewidth = includewidth? 1 : 0;7890 for( ; i < 4 ; i += 2 - includewidth ) {7891 which = cssexpand[ i ];7892 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;7893 }7894 if ( includewidth ) {7895 attrs.opacity = attrs.width = type;7896 }7897 return attrs;7898}7899// generate shortcuts for custom animations7900jquery .each({7901 slidedown: genfx("show"),7902 slideup: genfx("hide"),7903 slidetoggle: genfx("toggle"),7904 fadein: { opacity: "show" },7905 fadeout: { opacity: "hide" },7906 fadetoggle: { opacity: "toggle" }7907}, function( name, props ) {7908 jquery .fn[ name ] = function( speed, easing, callback ) {7909 return this.animate( props, speed, easing, callback );7910 };7911});7912jquery .speed = function( speed, easing, fn ) {7913 var opt = speed && typeof speed === "object" ? jquery .extend( {}, speed ) : {7914 complete: fn || !fn && easing ||7915 jquery .isfunction( speed ) && speed,7916 duration: speed,7917 easing: fn && easing || easing && !jquery .isfunction( easing ) && easing7918 };7919 opt.duration = jquery .fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :7920 opt.duration in jquery .fx.speeds ? jquery .fx.speeds[ opt.duration ] : jquery .fx.speeds._default;7921 // normalize opt.queue - true/undefined/null -> "fx"7922 if ( opt.queue == null || opt.queue === true ) {7923 opt.queue = "fx";7924 }7925 // queueing7926 opt.old = opt.complete;7927 opt.complete = function() {7928 if ( jquery .isfunction( opt.old ) ) {7929 opt.old.call( this );7930 }7931 if ( opt.queue ) {7932 jquery .dequeue( this, opt.queue );7933 }7934 };7935 return opt;7936};7937jquery .easing = {7938 linear: function( p ) {7939 return p;7940 },7941 swing: function( p ) {7942 return 0.5 - math.cos( p*math.pi ) / 2;7943 }7944};7945jquery .timers = [];7946jquery .fx = tween.prototype.init;7947jquery .fx.tick = function() {7948 var timer,7949 timers = jquery .timers,7950 i = 0;7951 fxnow = jquery .now();7952 for ( ; i < timers.length; i++ ) {7953 timer = timers[ i ];7954 // checks the timer has not already been removed7955 if ( !timer() && timers[ i ] === timer ) {7956 timers.splice( i--, 1 );7957 }7958 }7959 if ( !timers.length ) {7960 jquery .fx.stop();7961 }7962 fxnow = undefined;7963};7964jquery .fx.timer = function( timer ) {7965 if ( timer() && jquery .timers.push( timer ) ) {7966 jquery .fx.start();7967 }7968};7969jquery .fx.interval = 13;7970jquery .fx.start = function() {7971 if ( !timerid ) {7972 timerid = setinterval( jquery .fx.tick, jquery .fx.interval );7973 }7974};7975jquery .fx.stop = function() {7976 clearinterval( timerid );7977 timerid = null;7978};7979jquery .fx.speeds = {7980 slow: 600,7981 fast: 200,7982 // default speed7983 _default: 4007984};7985// back compat <1.8 extension point7986jquery .fx.step = {};7987if ( jquery .expr && jquery .expr.filters ) {7988 jquery .expr.filters.animated = function( elem ) {7989 return jquery .grep(jquery .timers, function( fn ) {7990 return elem === fn.elem;7991 }).length;7992 };7993}7994jquery .fn.offset = function( options ) {7995 if ( arguments.length ) {7996 return options === undefined ?7997 this :7998 this.each(function( i ) {7999 jquery .offset.setoffset( this, options, i );8000 });8001 }8002 var docelem, win,8003 box = { top: 0, left: 0 },8004 elem = this[ 0 ],8005 doc = elem && elem.ownerdocument;8006 if ( !doc ) {8007 return;8008 }8009 docelem = doc.documentelement;8010 // make sure it's not a disconnected dom node8011 if ( !jquery .contains( docelem, elem ) ) {8012 return box;8013 }8014 // if we don't have gbcr, just use 0,0 rather than error8015 // blackberry 5, ios 3 (original iphone)8016 if ( typeof elem.getboundingclientrect !== core_strundefined ) {8017 box = elem.getboundingclientrect();8018 }8019 win = getwindow( doc );8020 return {8021 top: box.top + ( win.pageyoffset || docelem.scrolltop ) - ( docelem.clienttop || 0 ),8022 left: box.left + ( win.pagexoffset || docelem.scrollleft ) - ( docelem.clientleft || 0 )8023 };8024};8025jquery .offset = {8026 setoffset: function( elem, options, i ) {8027 var position = jquery .css( elem, "position" );8028 // set position first, in-case top/left are set even on static elem8029 if ( position === "static" ) {8030 elem.style.position = "relative";8031 }8032 var curelem = jquery ( elem ),8033 curoffset = curelem.offset(),8034 curcsstop = jquery .css( elem, "top" ),8035 curcssleft = jquery .css( elem, "left" ),8036 calculateposition = ( position === "absolute" || position === "fixed" ) && jquery .inarray("auto", [curcsstop, curcssleft]) > -1,8037 props = {}, curposition = {}, curtop, curleft;8038 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed8039 if ( calculateposition ) {8040 curposition = curelem.position();8041 curtop = curposition.top;8042 curleft = curposition.left;8043 } else {8044 curtop = parsefloat( curcsstop ) || 0;8045 curleft = parsefloat( curcssleft ) || 0;8046 }8047 if ( jquery .isfunction( options ) ) {8048 options = options.call( elem, i, curoffset );8049 }8050 if ( options.top != null ) {8051 props.top = ( options.top - curoffset.top ) + curtop;8052 }8053 if ( options.left != null ) {8054 props.left = ( options.left - curoffset.left ) + curleft;8055 }8056 if ( "using" in options ) {8057 options.using.call( elem, props );8058 } else {8059 curelem.css( props );8060 }8061 }8062};8063jquery .fn.extend({8064 position: function() {8065 if ( !this[ 0 ] ) {8066 return;8067 }8068 var offsetparent, offset,8069 parentoffset = { top: 0, left: 0 },8070 elem = this[ 0 ];8071 // fixed elements are offset from window (parentoffset = {top:0, left: 0}, because it is it's only offset parent8072 if ( jquery .css( elem, "position" ) === "fixed" ) {8073 // we assume that getboundingclientrect is available when computed position is fixed8074 offset = elem.getboundingclientrect();8075 } else {8076 // get *real* offsetparent8077 offsetparent = this.offsetparent();8078 // get correct offsets8079 offset = this.offset();8080 if ( !jquery .nodename( offsetparent[ 0 ], "html" ) ) {8081 parentoffset = offsetparent.offset();8082 }8083 // add offsetparent borders8084 parentoffset.top += jquery .css( offsetparent[ 0 ], "bordertopwidth", true );8085 parentoffset.left += jquery .css( offsetparent[ 0 ], "borderleftwidth", true );8086 }8087 // subtract parent offsets and element margins8088 // note: when an element has margin: auto the offsetleft and marginleft8089 // are the same in safari causing offset.left to incorrectly be 08090 return {8091 top: offset.top - parentoffset.top - jquery .css( elem, "margintop", true ),8092 left: offset.left - parentoffset.left - jquery .css( elem, "marginleft", true)8093 };8094 },8095 offsetparent: function() {8096 return this.map(function() {8097 var offsetparent = this.offsetparent || document.documentelement;8098 while ( offsetparent && ( !jquery .nodename( offsetparent, "html" ) && jquery .css( offsetparent, "position") === "static" ) ) {8099 offsetparent = offsetparent.offsetparent;8100 }8101 return offsetparent || document.documentelement;8102 });8103 }8104});8105// create scrollleft and scrolltop methods8106jquery .each( {scrollleft: "pagexoffset", scrolltop: "pageyoffset"}, function( method, prop ) {8107 var top = /y/.test( prop );8108 jquery .fn[ method ] = function( val ) {8109 return jquery .access( this, function( elem, method, val ) {8110 var win = getwindow( elem );8111 if ( val === undefined ) {8112 return win ? (prop in win) ? win[ prop ] :8113 win.document.documentelement[ method ] :8114 elem[ method ];8115 }8116 if ( win ) {8117 win.scrollto(8118 !top ? val : jquery ( win ).scrollleft(),8119 top ? val : jquery ( win ).scrolltop()8120 );8121 } else {8122 elem[ method ] = val;8123 }8124 }, method, val, arguments.length, null );8125 };8126});8127function getwindow( elem ) {8128 return jquery .iswindow( elem ) ?8129 elem :8130 elem.nodetype === 9 ?8131 elem.defaultview || elem.parentwindow :8132 false;8133}8134// create innerheight, innerwidth, height, width, outerheight and outerwidth methods8135jquery .each( { height: "height", width: "width" }, function( name, type ) {8136 jquery .each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultextra, funcname ) {8137 // margin is only for outerheight, outerwidth8138 jquery .fn[ funcname ] = function( margin, value ) {8139 var chainable = arguments.length && ( defaultextra || typeof margin !== "boolean" ),8140 extra = defaultextra || ( margin === true || value === true ? "margin" : "border" );8141 return jquery .access( this, function( elem, type, value ) {8142 var doc;8143 if ( jquery .iswindow( elem ) ) {8144 // as of 5/8/2012 this will yield incorrect results for mobile safari, but there8145 // isn't a whole lot we can do. see pull request at this url for discussion:8146 // https://github.com/jquery /jquery /pull/7648147 return elem.document.documentelement[ "client" + name ];8148 }8149 // get document width or height8150 if ( elem.nodetype === 9 ) {8151 doc = elem.documentelement;8152 // either scroll[width/height] or offset[width/height] or client[width/height], whichever is greatest8153 // unfortunately, this causes bug #3838 in ie6/8 only, but there is currently no good, small way to fix it.8154 return math.max(8155 elem.body[ "scroll" + name ], doc[ "scroll" + name ],8156 elem.body[ "offset" + name ], doc[ "offset" + name ],8157 doc[ "client" + name ]8158 );8159 }8160 return value === undefined ?8161 // get width or height on the element, requesting but not forcing parsefloat8162 jquery .css( elem, type, extra ) :8163 // set width or height on the element8164 jquery .style( elem, type, value, extra );8165 }, type, chainable ? margin : undefined, chainable, null );8166 };8167 });8168});8169// limit scope pollution from any deprecated api8170// (function() {8171// })();8172// expose jquery to the global object8173window.jquery = window.$ = jquery ;8174// expose jquery as an amd module, but only for amd loaders that8175// understand the issues with loading multiple versions of jquery8176// in a page that all might call define(). the loader will indicate8177// they have special allowances for multiple jquery versions by8178// specifying define.amd.jquery = true. regis地理信息系统 ter as a named module,8179// since jquery can be concatenated with other files that may use define,8180// but not use a proper concatenation script that understands anonymous8181// amd modules. a named amd is safest and most robust way to regis地理信息系统 ter.8182// lowercase jquery is used because amd module names are derived from8183// file names, and jquery is normally delivered in a lowercase file name.8184// do this after creating the global so that if an amd module wants to call8185// noconflict to hide this version of jquery , it will work.8186if ( typeof define === "function" && define.amd && define.amd.jquery ) {8187 define( "jquery ", [], function () { return jquery ; } );8188}8189})( window );8190/*8191 * 1.传入window8192 * 通过传入window变量,使得window由全局变量变为局部变量8193 * 当在jquery 代码块中访问window时,不需要将作用域链回退到顶层作用域,这样可以更快的访问window8194 * 更重要的是,将window作为参数传入,可以在压缩代码时进行优化8195 * (function(a,b){})(window);window 被优化为 a,压缩后文件更小8196 * 2.传入undefined8197 * 是为了在“自调用匿名函数”的作用域内...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2 it('Test', () => {3 cy.get('#email1')4 .type('test')5 .should('have.value', 'test')6 })7})

Full Screen

Using AI Code Generation

copy

Full Screen

1const { exec } = require('child_process')2const { promisify } = require('util')3const execAsync = promisify(exec)4const rscriptTypeMasked = require('rscript-type-masked')5const rscript = new rscriptTypeMasked()6describe('test', () => {7 it('test', async () => {8 await execAsync('npm run start')9 await rscript.exec('test.R', url)10 await execAsync('npm run stop')11 })12})13library(RSelenium)14library(rvest)15library(magrittr)16library(stringr)17remDr <- remoteDriver(remoteServerAddr = Sys.getenv("url"))18remDr$open()19title <- remDr$getTitle()20remDr$close()21print(title)

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2 it('should be able to execute rscriptTypeMasked.exec', () => {3 cy.rscriptTypeMasked.exec('cy.screenshot()')4 })5})6Cypress.Commands.add('rscriptTypeMasked', { prevSubject: 'optional' }, (subject, script) => {7 cy.window().then(win => {8 win.rscriptTypeMasked.exec(script)9 })10})11import rscriptTypeMasked from 'cypress-rscript-type-masked'12Cypress.Commands.overwrite('type', (originalFn, subject, str, options) => {13 if (Cypress._.isString(str)) {14 return originalFn(subject, str, options)15 }16 return originalFn(subject, str, options)17})18Cypress.on('window:before:load', win => {19})20module.exports = (on, config) => {21 on('task', {22 rscriptTypeMasked (script) {23 return rscriptTypeMasked.exec(script)24 },25 })26}27{28 "env": {29 "rscriptTypeMasked": {30 }31 }32}33{34 "devDependencies": {35 }36}37describe('Test', () => {38 it('should be able to execute rscriptTypeMasked.exec', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('RScript', () => {2 it('should run the RScript', () => {3 cy.get('input[name="q"]').type('Cypress')4 cy.get('input[name="btnK"]').click()5 })6})7const { exec } = require("child_process");8exec("Rscript RScript.R", (error, stdout, stderr) => {9 if (error) {10 console.log(`error: ${error.message}`);11 return;12 }13 if (stderr) {14 console.log(`stderr: ${stderr}`);15 return;16 }17 console.log(`stdout: ${stdout}`);18});

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2 it('Test', () => {3 cy.exec('Rscript test.R')4 })5})6library(methods)7print("Hello World")8{9 "env": {10 }11}12const execa = require('execa')13const rscriptTypeMasked = require('rscript-type-masked')14module.exports = (on, config) => {15 on('task', {16 rscriptTypeMasked: rscriptTypeMasked(config.env.rscriptTypeMasked)17 })18}

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Testing the Masked input', function() {2 it('Test to enter masked input', function() {3 cy.get('#rscriptTypeMasked').type('12345678')4 cy.get('#rscriptTypeMasked').should('have.value', '1234-5678')5 })6})7describe('Testing the Masked input', function() {8 it('Test to enter masked input', function() {9 cy.get('#rscriptTypeMasked').type('12345678')10 cy.get('#rscriptTypeMasked').should('have.value', '1234-5678')11 })12})13describe('Testing the Masked input', function() {14 it('Test to enter masked input', function() {15 cy.get('#rscriptTypeMasked').type('12345678')16 cy.get('#rscriptTypeMasked').should('have.value', '1234-5678')17 })18})19describe('Testing the Masked input', function() {20 it('Test to enter masked input', function() {21 cy.get('#rscriptTypeMasked').type('12345678')22 cy.get('#rscriptTypeMasked').should('have.value', '1234-5678')23 })24})25describe('Testing the Masked input', function() {26 it('Test to enter masked input', function() {27 cy.get('#rscriptTypeMasked').type('12345678')28 cy.get('#rscriptTypeMasked').should('have.value', '1234-5678')29 })30})31describe('Testing the

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('R code execution', () => {2 it('R code execution', () => {3 cy.readFile('path/to/myRfile.r').then((rCode) => {4 cy.rscriptTypeMasked(rCode);5 })6 })7})8import 'cypress-file-upload';9import 'cypress-iframe';10Cypress.Commands.add('rscriptTypeMasked', (rCode) => {11 cy.get('iframe').then($iframe => {12 const $body = $iframe.contents().find('body');13 cy.wrap($body).find('textarea').type(rCode, { parseSpecialCharSequences: false });14 cy.wrap($body).contains('Run Code').click();15 })16})17describe('R code execution', () => {18 it('R code execution', () => {19 cy.readFile('path/to/myRfile.r').then((rCode) => {20 cy.rscriptTypeMasked(rCode);21 })22 })23})24import 'cypress-file-upload';25import 'cypress-iframe';26Cypress.Commands.add('rscriptTypeMasked', (rCode) => {27 cy.get('iframe').then($iframe => {28 const $body = $iframe.contents().find('body');29 cy.wrap($body).find('textarea').type(rCode, { parseSpecialCharSequences: false });30 cy.wrap($body).contains('Run Code').click();31 })32})33describe('R code execution', () => {34 it('R code execution', () => {35 cy.readFile('path/to/myRfile.r').then((rCode) => {36 cy.rscriptTypeMasked(rCode);37 })38 })39})40import 'cypress-file-upload';41import 'cypress-iframe';42Cypress.Commands.add('rscriptTypeMasked', (rCode

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