Best JavaScript code snippet using cypress
jquery-1.10.2.js
Source:jquery-1.10.2.js
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 }...
jQuery中文版v1.9.1注释全翻译.js
Source:jQuery中文版v1.9.1注释全翻译.js
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 * æ¯ä¸ºäºå¨âèªè°ç¨å¿åå½æ°âçä½ç¨åå
...
jquery.js
Source:jquery.js
1/*!2 * jquery javascript library v1.5.13 * http://jquery.com/4 *5 * copyright 2011, john resig6 * dual licensed under the mit or gpl version 2 licenses.7 * http://jquery.org/license8 *9 * includes sizzle.js10 * http://sizzlejs.com/11 * copyright 2011, the dojo foundation12 * released under the mit, bsd, and gpl licenses.13 *14 * date: wed feb 23 13:55:29 2011 -050015 */16(function( window, undefined ) {17// use the correct document accordingly with window argument (sandbox)18var document = window.document;19var jquery = (function() {20// define a local copy of jquery21var jquery = function( selector, context ) {22 // the jquery object is actually just the init constructor 'enhanced'23 return new jquery.fn.init( selector, context, rootjquery );24 },25 // map over jquery in case of overwrite26 _jquery = window.jquery,27 // map over the $ in case of overwrite28 _$ = window.$,29 // a central reference to the root jquery(document)30 rootjquery,31 // a simple way to check for html strings or id strings32 // (both of which we optimize for)33 quickexpr = /^(?:[^<]*(<[\w\w]+>)[^>]*$|#([\w\-]+)$)/,34 // check if a string has a non-whitespace character in it35 rnotwhite = /\s/,36 // used for trimming whitespace37 trimleft = /^\s+/,38 trimright = /\s+$/,39 // check for digits40 rdigit = /\d/,41 // match a standalone tag42 rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,43 // json regexp44 rvalidchars = /^[\],:{}\s]*$/,45 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fa-f]{4})/g,46 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[ee][+\-]?\d+)?/g,47 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,48 // useragent regexp49 rwebkit = /(webkit)[ \/]([\w.]+)/,50 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,51 rmsie = /(msie) ([\w.]+)/,52 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,53 // keep a useragent string for use with jquery.browser54 useragent = navigator.useragent,55 // for matching the engine and version of the browser56 browsermatch,57 // has the ready events already been bound?58 readybound = false,59 // the deferred used on dom ready60 readylist,61 // promise methods62 promisemethods = "then done fail isresolved isrejected promise".split( " " ),63 // the ready event handler64 domcontentloaded,65 // save a reference to some core methods66 tostring = object.prototype.tostring,67 hasown = object.prototype.hasownproperty,68 push = array.prototype.push,69 slice = array.prototype.slice,70 trim = string.prototype.trim,71 indexof = array.prototype.indexof,72 // [[class]] -> type pairs73 class2type = {};74jquery.fn = jquery.prototype = {75 constructor: jquery,76 init: function( selector, context, rootjquery ) {77 var match, elem, ret, doc;78 // handle $(""), $(null), or $(undefined)79 if ( !selector ) {80 return this;81 }82 // handle $(domelement)83 if ( selector.nodetype ) {84 this.context = this[0] = selector;85 this.length = 1;86 return this;87 }88 // the body element only exists once, optimize finding it89 if ( selector === "body" && !context && document.body ) {90 this.context = document;91 this[0] = document.body;92 this.selector = "body";93 this.length = 1;94 return this;95 }96 // handle html strings97 if ( typeof selector === "string" ) {98 // are we dealing with html string or an id?99 match = quickexpr.exec( selector );100 // verify a match, and that no context was specified for #id101 if ( match && (match[1] || !context) ) {102 // handle: $(html) -> $(array)103 if ( match[1] ) {104 context = context instanceof jquery ? context[0] : context;105 doc = (context ? context.ownerdocument || context : document);106 // if a single string is passed in and it's a single tag107 // just do a createelement and skip the rest108 ret = rsingletag.exec( selector );109 if ( ret ) {110 if ( jquery.isplainobject( context ) ) {111 selector = [ document.createelement( ret[1] ) ];112 jquery.fn.attr.call( selector, context, true );113 } else {114 selector = [ doc.createelement( ret[1] ) ];115 }116 } else {117 ret = jquery.buildfragment( [ match[1] ], [ doc ] );118 selector = (ret.cacheable ? jquery.clone(ret.fragment) : ret.fragment).childnodes;119 }120 return jquery.merge( this, selector );121 // handle: $("#id")122 } else {123 elem = document.getelementbyid( match[2] );124 // check parentnode to catch when blackberry 4.6 returns125 // nodes that are no longer in the document #6963126 if ( elem && elem.parentnode ) {127 // handle the case where ie and opera return items128 // by name instead of id129 if ( elem.id !== match[2] ) {130 return rootjquery.find( selector );131 }132 // otherwise, we inject the element directly into the jquery object133 this.length = 1;134 this[0] = elem;135 }136 this.context = document;137 this.selector = selector;138 return this;139 }140 // handle: $(expr, $(...))141 } else if ( !context || context.jquery ) {142 return (context || rootjquery).find( selector );143 // handle: $(expr, context)144 // (which is just equivalent to: $(context).find(expr)145 } else {146 return this.constructor( context ).find( selector );147 }148 // handle: $(function)149 // shortcut for document ready150 } else if ( jquery.isfunction( selector ) ) {151 return rootjquery.ready( selector );152 }153 if (selector.selector !== undefined) {154 this.selector = selector.selector;155 this.context = selector.context;156 }157 return jquery.makearray( selector, this );158 },159 // start with an empty selector160 selector: "",161 // the current version of jquery being used162 jquery: "1.5.1",163 // the default length of a jquery object is 0164 length: 0,165 // the number of elements contained in the matched element set166 size: function() {167 return this.length;168 },169 toarray: function() {170 return slice.call( this, 0 );171 },172 // get the nth element in the matched element set or173 // get the whole matched element set as a clean array174 get: function( num ) {175 return num == null ?176 // return a 'clean' array177 this.toarray() :178 // return just the object179 ( num < 0 ? this[ this.length + num ] : this[ num ] );180 },181 // take an array of elements and push it onto the stack182 // (returning the new matched element set)183 pushstack: function( elems, name, selector ) {184 // build a new jquery matched element set185 var ret = this.constructor();186 if ( jquery.isarray( elems ) ) {187 push.apply( ret, elems );188 } else {189 jquery.merge( ret, elems );190 }191 // add the old object onto the stack (as a reference)192 ret.prevobject = this;193 ret.context = this.context;194 if ( name === "find" ) {195 ret.selector = this.selector + (this.selector ? " " : "") + selector;196 } else if ( name ) {197 ret.selector = this.selector + "." + name + "(" + selector + ")";198 }199 // return the newly-formed element set200 return ret;201 },202 // execute a callback for every element in the matched set.203 // (you can seed the arguments with an array of args, but this is204 // only used internally.)205 each: function( callback, args ) {206 return jquery.each( this, callback, args );207 },208 ready: function( fn ) {209 // attach the listeners210 jquery.bindready();211 // add the callback212 readylist.done( fn );213 return this;214 },215 eq: function( i ) {216 return i === -1 ?217 this.slice( i ) :218 this.slice( i, +i + 1 );219 },220 first: function() {221 return this.eq( 0 );222 },223 last: function() {224 return this.eq( -1 );225 },226 slice: function() {227 return this.pushstack( slice.apply( this, arguments ),228 "slice", slice.call(arguments).join(",") );229 },230 map: function( callback ) {231 return this.pushstack( jquery.map(this, function( elem, i ) {232 return callback.call( elem, i, elem );233 }));234 },235 end: function() {236 return this.prevobject || this.constructor(null);237 },238 // for internal use only.239 // behaves like an array's method, not like a jquery method.240 push: push,241 sort: [].sort,242 splice: [].splice243};244// give the init function the jquery prototype for later instantiation245jquery.fn.init.prototype = jquery.fn;246jquery.extend = jquery.fn.extend = function() {247 var options, name, src, copy, copyisarray, clone,248 target = arguments[0] || {},249 i = 1,250 length = arguments.length,251 deep = false;252 // handle a deep copy situation253 if ( typeof target === "boolean" ) {254 deep = target;255 target = arguments[1] || {};256 // skip the boolean and the target257 i = 2;258 }259 // handle case when target is a string or something (possible in deep copy)260 if ( typeof target !== "object" && !jquery.isfunction(target) ) {261 target = {};262 }263 // extend jquery itself if only one argument is passed264 if ( length === i ) {265 target = this;266 --i;267 }268 for ( ; i < length; i++ ) {269 // only deal with non-null/undefined values270 if ( (options = arguments[ i ]) != null ) {271 // extend the base object272 for ( name in options ) {273 src = target[ name ];274 copy = options[ name ];275 // prevent never-ending loop276 if ( target === copy ) {277 continue;278 }279 // recurse if we're merging plain objects or arrays280 if ( deep && copy && ( jquery.isplainobject(copy) || (copyisarray = jquery.isarray(copy)) ) ) {281 if ( copyisarray ) {282 copyisarray = false;283 clone = src && jquery.isarray(src) ? src : [];284 } else {285 clone = src && jquery.isplainobject(src) ? src : {};286 }287 // never move original objects, clone them288 target[ name ] = jquery.extend( deep, clone, copy );289 // don't bring in undefined values290 } else if ( copy !== undefined ) {291 target[ name ] = copy;292 }293 }294 }295 }296 // return the modified object297 return target;298};299jquery.extend({300 noconflict: function( deep ) {301 window.$ = _$;302 if ( deep ) {303 window.jquery = _jquery;304 }305 return jquery;306 },307 // is the dom ready to be used? set to true once it occurs.308 isready: false,309 // a counter to track how many items to wait for before310 // the ready event fires. see #6781311 readywait: 1,312 // handle when the dom is ready313 ready: function( wait ) {314 // a third-party is pushing the ready event forwards315 if ( wait === true ) {316 jquery.readywait--;317 }318 // make sure that the dom is not already loaded319 if ( !jquery.readywait || (wait !== true && !jquery.isready) ) {320 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).321 if ( !document.body ) {322 return settimeout( jquery.ready, 1 );323 }324 // remember that the dom is ready325 jquery.isready = true;326 // if a normal dom ready event fired, decrement, and wait if need be327 if ( wait !== true && --jquery.readywait > 0 ) {328 return;329 }330 // if there are functions bound, to execute331 readylist.resolvewith( document, [ jquery ] );332 // trigger any bound ready events333 if ( jquery.fn.trigger ) {334 jquery( document ).trigger( "ready" ).unbind( "ready" );335 }336 }337 },338 bindready: function() {339 if ( readybound ) {340 return;341 }342 readybound = true;343 // catch cases where $(document).ready() is called after the344 // browser event has already occurred.345 if ( document.readystate === "complete" ) {346 // handle it asynchronously to allow scripts the opportunity to delay ready347 return settimeout( jquery.ready, 1 );348 }349 // mozilla, opera and webkit nightlies currently support this event350 if ( document.addeventlistener ) {351 // use the handy event callback352 document.addeventlistener( "domcontentloaded", domcontentloaded, false );353 // a fallback to window.onload, that will always work354 window.addeventlistener( "load", jquery.ready, false );355 // if ie event model is used356 } else if ( document.attachevent ) {357 // ensure firing before onload,358 // maybe late but safe also for iframes359 document.attachevent("onreadystatechange", domcontentloaded);360 // a fallback to window.onload, that will always work361 window.attachevent( "onload", jquery.ready );362 // if ie and not a frame363 // continually check to see if the document is ready364 var toplevel = false;365 try {366 toplevel = window.frameelement == null;367 } catch(e) {}368 if ( document.documentelement.doscroll && toplevel ) {369 doscrollcheck();370 }371 }372 },373 // see test/unit/core.js for details concerning isfunction.374 // since version 1.3, dom methods and functions like alert375 // aren't supported. they return false on ie (#2968).376 isfunction: function( obj ) {377 return jquery.type(obj) === "function";378 },379 isarray: array.isarray || function( obj ) {380 return jquery.type(obj) === "array";381 },382 // a crude way of determining if an object is a window383 iswindow: function( obj ) {384 return obj && typeof obj === "object" && "setinterval" in obj;385 },386 isnan: function( obj ) {387 return obj == null || !rdigit.test( obj ) || isnan( obj );388 },389 type: function( obj ) {390 return obj == null ?391 string( obj ) :392 class2type[ tostring.call(obj) ] || "object";393 },394 isplainobject: function( obj ) {395 // must be an object.396 // because of ie, we also have to check the presence of the constructor property.397 // make sure that dom nodes and window objects don't pass through, as well398 if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) {399 return false;400 }401 // not own constructor property must be object402 if ( obj.constructor &&403 !hasown.call(obj, "constructor") &&404 !hasown.call(obj.constructor.prototype, "isprototypeof") ) {405 return false;406 }407 // own properties are enumerated firstly, so to speed up,408 // if last one is own, then all properties are own.409 var key;410 for ( key in obj ) {}411 return key === undefined || hasown.call( obj, key );412 },413 isemptyobject: function( obj ) {414 for ( var name in obj ) {415 return false;416 }417 return true;418 },419 error: function( msg ) {420 throw msg;421 },422 parsejson: function( data ) {423 if ( typeof data !== "string" || !data ) {424 return null;425 }426 // make sure leading/trailing whitespace is removed (ie can't handle it)427 data = jquery.trim( data );428 // make sure the incoming data is actual json429 // logic borrowed from http://json.org/json2.js430 if ( rvalidchars.test(data.replace(rvalidescape, "@")431 .replace(rvalidtokens, "]")432 .replace(rvalidbraces, "")) ) {433 // try to use the native json parser first434 return window.json && window.json.parse ?435 window.json.parse( data ) :436 (new function("return " + data))();437 } else {438 jquery.error( "invalid json: " + data );439 }440 },441 // cross-browser xml parsing442 // (xml & tmp used internally)443 parsexml: function( data , xml , tmp ) {444 if ( window.domparser ) { // standard445 tmp = new domparser();446 xml = tmp.parsefromstring( data , "text/xml" );447 } else { // ie448 xml = new activexobject( "microsoft.xmldom" );449 xml.async = "false";450 xml.loadxml( data );451 }452 tmp = xml.documentelement;453 if ( ! tmp || ! tmp.nodename || tmp.nodename === "parsererror" ) {454 jquery.error( "invalid xml: " + data );455 }456 return xml;457 },458 noop: function() {},459 // evalulates a script in a global context460 globaleval: function( data ) {461 if ( data && rnotwhite.test(data) ) {462 // inspired by code by andrea giammarchi463 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html464 var head = document.head || document.getelementsbytagname( "head" )[0] || document.documentelement,465 script = document.createelement( "script" );466 if ( jquery.support.scripteval() ) {467 script.appendchild( document.createtextnode( data ) );468 } else {469 script.text = data;470 }471 // use insertbefore instead of appendchild to circumvent an ie6 bug.472 // this arises when a base node is used (#2709).473 head.insertbefore( script, head.firstchild );474 head.removechild( script );475 }476 },477 nodename: function( elem, name ) {478 return elem.nodename && elem.nodename.touppercase() === name.touppercase();479 },480 // args is for internal usage only481 each: function( object, callback, args ) {482 var name, i = 0,483 length = object.length,484 isobj = length === undefined || jquery.isfunction(object);485 if ( args ) {486 if ( isobj ) {487 for ( name in object ) {488 if ( callback.apply( object[ name ], args ) === false ) {489 break;490 }491 }492 } else {493 for ( ; i < length; ) {494 if ( callback.apply( object[ i++ ], args ) === false ) {495 break;496 }497 }498 }499 // a special, fast, case for the most common use of each500 } else {501 if ( isobj ) {502 for ( name in object ) {503 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {504 break;505 }506 }507 } else {508 for ( var value = object[0];509 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}510 }511 }512 return object;513 },514 // use native string.trim function wherever possible515 trim: trim ?516 function( text ) {517 return text == null ?518 "" :519 trim.call( text );520 } :521 // otherwise use our own trimming functionality522 function( text ) {523 return text == null ?524 "" :525 text.tostring().replace( trimleft, "" ).replace( trimright, "" );526 },527 // results is for internal usage only528 makearray: function( array, results ) {529 var ret = results || [];530 if ( array != null ) {531 // the window, strings (and functions) also have 'length'532 // the extra typeof function check is to prevent crashes533 // in safari 2 (see: #3039)534 // tweaked logic slightly to handle blackberry 4.7 regexp issues #6930535 var type = jquery.type(array);536 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jquery.iswindow( array ) ) {537 push.call( ret, array );538 } else {539 jquery.merge( ret, array );540 }541 }542 return ret;543 },544 inarray: function( elem, array ) {545 if ( array.indexof ) {546 return array.indexof( elem );547 }548 for ( var i = 0, length = array.length; i < length; i++ ) {549 if ( array[ i ] === elem ) {550 return i;551 }552 }553 return -1;554 },555 merge: function( first, second ) {556 var i = first.length,557 j = 0;558 if ( typeof second.length === "number" ) {559 for ( var l = second.length; j < l; j++ ) {560 first[ i++ ] = second[ j ];561 }562 } else {563 while ( second[j] !== undefined ) {564 first[ i++ ] = second[ j++ ];565 }566 }567 first.length = i;568 return first;569 },570 grep: function( elems, callback, inv ) {571 var ret = [], retval;572 inv = !!inv;573 // go through the array, only saving the items574 // that pass the validator function575 for ( var i = 0, length = elems.length; i < length; i++ ) {576 retval = !!callback( elems[ i ], i );577 if ( inv !== retval ) {578 ret.push( elems[ i ] );579 }580 }581 return ret;582 },583 // arg is for internal usage only584 map: function( elems, callback, arg ) {585 var ret = [], value;586 // go through the array, translating each of the items to their587 // new value (or values).588 for ( var i = 0, length = elems.length; i < length; i++ ) {589 value = callback( elems[ i ], i, arg );590 if ( value != null ) {591 ret[ ret.length ] = value;592 }593 }594 // flatten any nested arrays595 return ret.concat.apply( [], ret );596 },597 // a global guid counter for objects598 guid: 1,599 proxy: function( fn, proxy, thisobject ) {600 if ( arguments.length === 2 ) {601 if ( typeof proxy === "string" ) {602 thisobject = fn;603 fn = thisobject[ proxy ];604 proxy = undefined;605 } else if ( proxy && !jquery.isfunction( proxy ) ) {606 thisobject = proxy;607 proxy = undefined;608 }609 }610 if ( !proxy && fn ) {611 proxy = function() {612 return fn.apply( thisobject || this, arguments );613 };614 }615 // set the guid of unique handler to the same of original handler, so it can be removed616 if ( fn ) {617 proxy.guid = fn.guid = fn.guid || proxy.guid || jquery.guid++;618 }619 // so proxy can be declared as an argument620 return proxy;621 },622 // mutifunctional method to get and set values to a collection623 // the value/s can be optionally by executed if its a function624 access: function( elems, key, value, exec, fn, pass ) {625 var length = elems.length;626 // setting many attributes627 if ( typeof key === "object" ) {628 for ( var k in key ) {629 jquery.access( elems, k, key[k], exec, fn, value );630 }631 return elems;632 }633 // setting one attribute634 if ( value !== undefined ) {635 // optionally, function values get executed if exec is true636 exec = !pass && exec && jquery.isfunction(value);637 for ( var i = 0; i < length; i++ ) {638 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );639 }640 return elems;641 }642 // getting an attribute643 return length ? fn( elems[0], key ) : undefined;644 },645 now: function() {646 return (new date()).gettime();647 },648 // create a simple deferred (one callbacks list)649 _deferred: function() {650 var // callbacks list651 callbacks = [],652 // stored [ context , args ]653 fired,654 // to avoid firing when already doing so655 firing,656 // flag to know if the deferred has been cancelled657 cancelled,658 // the deferred itself659 deferred = {660 // done( f1, f2, ...)661 done: function() {662 if ( !cancelled ) {663 var args = arguments,664 i,665 length,666 elem,667 type,668 _fired;669 if ( fired ) {670 _fired = fired;671 fired = 0;672 }673 for ( i = 0, length = args.length; i < length; i++ ) {674 elem = args[ i ];675 type = jquery.type( elem );676 if ( type === "array" ) {677 deferred.done.apply( deferred, elem );678 } else if ( type === "function" ) {679 callbacks.push( elem );680 }681 }682 if ( _fired ) {683 deferred.resolvewith( _fired[ 0 ], _fired[ 1 ] );684 }685 }686 return this;687 },688 // resolve with given context and args689 resolvewith: function( context, args ) {690 if ( !cancelled && !fired && !firing ) {691 firing = 1;692 try {693 while( callbacks[ 0 ] ) {694 callbacks.shift().apply( context, args );695 }696 }697 // we have to add a catch block for698 // ie prior to 8 or else the finally699 // block will never get executed700 catch (e) {701 throw e;702 }703 finally {704 fired = [ context, args ];705 firing = 0;706 }707 }708 return this;709 },710 // resolve with this as context and given arguments711 resolve: function() {712 deferred.resolvewith( jquery.isfunction( this.promise ) ? this.promise() : this, arguments );713 return this;714 },715 // has this deferred been resolved?716 isresolved: function() {717 return !!( firing || fired );718 },719 // cancel720 cancel: function() {721 cancelled = 1;722 callbacks = [];723 return this;724 }725 };726 return deferred;727 },728 // full fledged deferred (two callbacks list)729 deferred: function( func ) {730 var deferred = jquery._deferred(),731 faildeferred = jquery._deferred(),732 promise;733 // add errordeferred methods, then and promise734 jquery.extend( deferred, {735 then: function( donecallbacks, failcallbacks ) {736 deferred.done( donecallbacks ).fail( failcallbacks );737 return this;738 },739 fail: faildeferred.done,740 rejectwith: faildeferred.resolvewith,741 reject: faildeferred.resolve,742 isrejected: faildeferred.isresolved,743 // get a promise for this deferred744 // if obj is provided, the promise aspect is added to the object745 promise: function( obj ) {746 if ( obj == null ) {747 if ( promise ) {748 return promise;749 }750 promise = obj = {};751 }752 var i = promisemethods.length;753 while( i-- ) {754 obj[ promisemethods[i] ] = deferred[ promisemethods[i] ];755 }756 return obj;757 }758 } );759 // make sure only one callback list will be used760 deferred.done( faildeferred.cancel ).fail( deferred.cancel );761 // unexpose cancel762 delete deferred.cancel;763 // call given func if any764 if ( func ) {765 func.call( deferred, deferred );766 }767 return deferred;768 },769 // deferred helper770 when: function( object ) {771 var lastindex = arguments.length,772 deferred = lastindex <= 1 && object && jquery.isfunction( object.promise ) ?773 object :774 jquery.deferred(),775 promise = deferred.promise();776 if ( lastindex > 1 ) {777 var array = slice.call( arguments, 0 ),778 count = lastindex,779 icallback = function( index ) {780 return function( value ) {781 array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;782 if ( !( --count ) ) {783 deferred.resolvewith( promise, array );784 }785 };786 };787 while( ( lastindex-- ) ) {788 object = array[ lastindex ];789 if ( object && jquery.isfunction( object.promise ) ) {790 object.promise().then( icallback(lastindex), deferred.reject );791 } else {792 --count;793 }794 }795 if ( !count ) {796 deferred.resolvewith( promise, array );797 }798 } else if ( deferred !== object ) {799 deferred.resolve( object );800 }801 return promise;802 },803 // use of jquery.browser is frowned upon.804 // more details: http://docs.jquery.com/utilities/jquery.browser805 uamatch: function( ua ) {806 ua = ua.tolowercase();807 var match = rwebkit.exec( ua ) ||808 ropera.exec( ua ) ||809 rmsie.exec( ua ) ||810 ua.indexof("compatible") < 0 && rmozilla.exec( ua ) ||811 [];812 return { browser: match[1] || "", version: match[2] || "0" };813 },814 sub: function() {815 function jquerysubclass( selector, context ) {816 return new jquerysubclass.fn.init( selector, context );817 }818 jquery.extend( true, jquerysubclass, this );819 jquerysubclass.superclass = this;820 jquerysubclass.fn = jquerysubclass.prototype = this();821 jquerysubclass.fn.constructor = jquerysubclass;822 jquerysubclass.subclass = this.subclass;823 jquerysubclass.fn.init = function init( selector, context ) {824 if ( context && context instanceof jquery && !(context instanceof jquerysubclass) ) {825 context = jquerysubclass(context);826 }827 return jquery.fn.init.call( this, selector, context, rootjquerysubclass );828 };829 jquerysubclass.fn.init.prototype = jquerysubclass.fn;830 var rootjquerysubclass = jquerysubclass(document);831 return jquerysubclass;832 },833 browser: {}834});835// create readylist deferred836readylist = jquery._deferred();837// populate the class2type map838jquery.each("boolean number string function array date regexp object".split(" "), function(i, name) {839 class2type[ "[object " + name + "]" ] = name.tolowercase();840});841browsermatch = jquery.uamatch( useragent );842if ( browsermatch.browser ) {843 jquery.browser[ browsermatch.browser ] = true;844 jquery.browser.version = browsermatch.version;845}846// deprecated, use jquery.browser.webkit instead847if ( jquery.browser.webkit ) {848 jquery.browser.safari = true;849}850if ( indexof ) {851 jquery.inarray = function( elem, array ) {852 return indexof.call( array, elem );853 };854}855// ie doesn't match non-breaking spaces with \s856if ( rnotwhite.test( "\xa0" ) ) {857 trimleft = /^[\s\xa0]+/;858 trimright = /[\s\xa0]+$/;859}860// all jquery objects should point back to these861rootjquery = jquery(document);862// cleanup functions for the document ready method863if ( document.addeventlistener ) {864 domcontentloaded = function() {865 document.removeeventlistener( "domcontentloaded", domcontentloaded, false );866 jquery.ready();867 };868} else if ( document.attachevent ) {869 domcontentloaded = function() {870 // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443).871 if ( document.readystate === "complete" ) {872 document.detachevent( "onreadystatechange", domcontentloaded );873 jquery.ready();874 }875 };876}877// the dom ready check for internet explorer878function doscrollcheck() {879 if ( jquery.isready ) {880 return;881 }882 try {883 // if ie is used, use the trick by diego perini884 // http://javascript.nwbox.com/iecontentloaded/885 document.documentelement.doscroll("left");886 } catch(e) {887 settimeout( doscrollcheck, 1 );888 return;889 }890 // and execute any waiting functions891 jquery.ready();892}893// expose jquery to the global object894return jquery;895})();896(function() {897 jquery.support = {};898 var div = document.createelement("div");899 div.style.display = "none";900 div.innerhtml = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";901 var all = div.getelementsbytagname("*"),902 a = div.getelementsbytagname("a")[0],903 select = document.createelement("select"),904 opt = select.appendchild( document.createelement("option") ),905 input = div.getelementsbytagname("input")[0];906 // can't get basic test support907 if ( !all || !all.length || !a ) {908 return;909 }910 jquery.support = {911 // ie strips leading whitespace when .innerhtml is used912 leadingwhitespace: div.firstchild.nodetype === 3,913 // make sure that tbody elements aren't automatically inserted914 // ie will insert them into empty tables915 tbody: !div.getelementsbytagname("tbody").length,916 // make sure that link elements get serialized correctly by innerhtml917 // this requires a wrapper element in ie918 htmlserialize: !!div.getelementsbytagname("link").length,919 // get the style information from getattribute920 // (ie uses .csstext insted)921 style: /red/.test( a.getattribute("style") ),922 // make sure that urls aren't manipulated923 // (ie normalizes it by default)924 hrefnormalized: a.getattribute("href") === "/a",925 // make sure that element opacity exists926 // (ie uses filter instead)927 // use a regex to work around a webkit issue. see #5145928 opacity: /^0.55$/.test( a.style.opacity ),929 // verify style float existence930 // (ie uses stylefloat instead of cssfloat)931 cssfloat: !!a.style.cssfloat,932 // make sure that if no value is specified for a checkbox933 // that it defaults to "on".934 // (webkit defaults to "" instead)935 checkon: input.value === "on",936 // make sure that a selected-by-default option has a working selected property.937 // (webkit defaults to false instead of true, ie too, if it's in an optgroup)938 optselected: opt.selected,939 // will be defined later940 deleteexpando: true,941 optdisabled: false,942 checkclone: false,943 nocloneevent: true,944 noclonechecked: true,945 boxmodel: null,946 inlineblockneedslayout: false,947 shrinkwrapblocks: false,948 reliablehiddenoffsets: true949 };950 input.checked = true;951 jquery.support.noclonechecked = input.clonenode( true ).checked;952 // make sure that the options inside disabled selects aren't marked as disabled953 // (webkit marks them as diabled)954 select.disabled = true;955 jquery.support.optdisabled = !opt.disabled;956 var _scripteval = null;957 jquery.support.scripteval = function() {958 if ( _scripteval === null ) {959 var root = document.documentelement,960 script = document.createelement("script"),961 id = "script" + jquery.now();962 try {963 script.appendchild( document.createtextnode( "window." + id + "=1;" ) );964 } catch(e) {}965 root.insertbefore( script, root.firstchild );966 // make sure that the execution of code works by injecting a script967 // tag with appendchild/createtextnode968 // (ie doesn't support this, fails, and uses .text instead)969 if ( window[ id ] ) {970 _scripteval = true;971 delete window[ id ];972 } else {973 _scripteval = false;974 }975 root.removechild( script );976 // release memory in ie977 root = script = id = null;978 }979 return _scripteval;980 };981 // test to see if it's possible to delete an expando from an element982 // fails in internet explorer983 try {984 delete div.test;985 } catch(e) {986 jquery.support.deleteexpando = false;987 }988 if ( !div.addeventlistener && div.attachevent && div.fireevent ) {989 div.attachevent("onclick", function click() {990 // cloning a node shouldn't copy over any991 // bound event handlers (ie does this)992 jquery.support.nocloneevent = false;993 div.detachevent("onclick", click);994 });995 div.clonenode(true).fireevent("onclick");996 }997 div = document.createelement("div");998 div.innerhtml = "<input type='radio' name='radiotest' checked='checked'/>";999 var fragment = document.createdocumentfragment();1000 fragment.appendchild( div.firstchild );1001 // webkit doesn't clone checked state correctly in fragments1002 jquery.support.checkclone = fragment.clonenode(true).clonenode(true).lastchild.checked;1003 // figure out if the w3c box model works as expected1004 // document.body must exist before we can do this1005 jquery(function() {1006 var div = document.createelement("div"),1007 body = document.getelementsbytagname("body")[0];1008 // frameset documents with no body should not run this code1009 if ( !body ) {1010 return;1011 }1012 div.style.width = div.style.paddingleft = "1px";1013 body.appendchild( div );1014 jquery.boxmodel = jquery.support.boxmodel = div.offsetwidth === 2;1015 if ( "zoom" in div.style ) {1016 // check if natively block-level elements act like inline-block1017 // elements when setting their display to 'inline' and giving1018 // them layout1019 // (ie < 8 does this)1020 div.style.display = "inline";1021 div.style.zoom = 1;1022 jquery.support.inlineblockneedslayout = div.offsetwidth === 2;1023 // check if elements with layout shrink-wrap their children1024 // (ie 6 does this)1025 div.style.display = "";1026 div.innerhtml = "<div style='width:4px;'></div>";1027 jquery.support.shrinkwrapblocks = div.offsetwidth !== 2;1028 }1029 div.innerhtml = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";1030 var tds = div.getelementsbytagname("td");1031 // check if table cells still have offsetwidth/height when they are set1032 // to display:none and there are still other visible table cells in a1033 // table row; if so, offsetwidth/height are not reliable for use when1034 // determining if an element has been hidden directly using1035 // display:none (it is still safe to use offsets if a parent element is1036 // hidden; don safety goggles and see bug #4512 for more information).1037 // (only ie 8 fails this test)1038 jquery.support.reliablehiddenoffsets = tds[0].offsetheight === 0;1039 tds[0].style.display = "";1040 tds[1].style.display = "none";1041 // check if empty table cells still have offsetwidth/height1042 // (ie < 8 fail this test)1043 jquery.support.reliablehiddenoffsets = jquery.support.reliablehiddenoffsets && tds[0].offsetheight === 0;1044 div.innerhtml = "";1045 body.removechild( div ).style.display = "none";1046 div = tds = null;1047 });1048 // technique from juriy zaytsev1049 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/1050 var eventsupported = function( eventname ) {1051 var el = document.createelement("div");1052 eventname = "on" + eventname;1053 // we only care about the case where non-standard event systems1054 // are used, namely in ie. short-circuiting here helps us to1055 // avoid an eval call (in setattribute) which can cause csp1056 // to go haywire. see: https://developer.mozilla.org/en/security/csp1057 if ( !el.attachevent ) {1058 return true;1059 }1060 var issupported = (eventname in el);1061 if ( !issupported ) {1062 el.setattribute(eventname, "return;");1063 issupported = typeof el[eventname] === "function";1064 }1065 el = null;1066 return issupported;1067 };1068 jquery.support.submitbubbles = eventsupported("submit");1069 jquery.support.changebubbles = eventsupported("change");1070 // release memory in ie1071 div = all = a = null;1072})();1073var rbrace = /^(?:\{.*\}|\[.*\])$/;1074jquery.extend({1075 cache: {},1076 // please use with caution1077 uuid: 0,1078 // unique for each copy of jquery on the page1079 // non-digits removed to match rinlinejquery1080 expando: "jquery" + ( jquery.fn.jquery + math.random() ).replace( /\d/g, "" ),1081 // the following elements throw uncatchable exceptions if you1082 // attempt to add expando properties to them.1083 nodata: {1084 "embed": true,1085 // ban all objects except for flash (which handle expandos)1086 "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",1087 "applet": true1088 },1089 hasdata: function( elem ) {1090 elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ];1091 return !!elem && !isemptydataobject( elem );1092 },1093 data: function( elem, name, data, pvt /* internal use only */ ) {1094 if ( !jquery.acceptdata( elem ) ) {1095 return;1096 }1097 var internalkey = jquery.expando, getbyname = typeof name === "string", thiscache,1098 // we have to handle dom nodes and js objects differently because ie6-71099 // can't gc object references properly across the dom-js boundary1100 isnode = elem.nodetype,1101 // only dom nodes need the global jquery cache; js object data is1102 // attached directly to the object so gc can occur automatically1103 cache = isnode ? jquery.cache : elem,1104 // only defining an id for js objects if its cache already exists allows1105 // the code to shortcut on the same path as a dom node with no cache1106 id = isnode ? elem[ jquery.expando ] : elem[ jquery.expando ] && jquery.expando;1107 // avoid doing any more work than we need to when trying to get data on an1108 // object that has no data at all1109 if ( (!id || (pvt && id && !cache[ id ][ internalkey ])) && getbyname && data === undefined ) {1110 return;1111 }1112 if ( !id ) {1113 // only dom nodes need a new unique id for each element since their data1114 // ends up in the global cache1115 if ( isnode ) {1116 elem[ jquery.expando ] = id = ++jquery.uuid;1117 } else {1118 id = jquery.expando;1119 }1120 }1121 if ( !cache[ id ] ) {1122 cache[ id ] = {};1123 // todo: this is a hack for 1.5 only. avoids exposing jquery1124 // metadata on plain js objects when the object is serialized using1125 // json.stringify1126 if ( !isnode ) {1127 cache[ id ].tojson = jquery.noop;1128 }1129 }1130 // an object can be passed to jquery.data instead of a key/value pair; this gets1131 // shallow copied over onto the existing cache1132 if ( typeof name === "object" || typeof name === "function" ) {1133 if ( pvt ) {1134 cache[ id ][ internalkey ] = jquery.extend(cache[ id ][ internalkey ], name);1135 } else {1136 cache[ id ] = jquery.extend(cache[ id ], name);1137 }1138 }1139 thiscache = cache[ id ];1140 // internal jquery data is stored in a separate object inside the object's data1141 // cache in order to avoid key collisions between internal data and user-defined1142 // data1143 if ( pvt ) {1144 if ( !thiscache[ internalkey ] ) {1145 thiscache[ internalkey ] = {};1146 }1147 thiscache = thiscache[ internalkey ];1148 }1149 if ( data !== undefined ) {1150 thiscache[ name ] = data;1151 }1152 // todo: this is a hack for 1.5 only. it will be removed in 1.6. users should1153 // not attempt to inspect the internal events object using jquery.data, as this1154 // internal data object is undocumented and subject to change.1155 if ( name === "events" && !thiscache[name] ) {1156 return thiscache[ internalkey ] && thiscache[ internalkey ].events;1157 }1158 return getbyname ? thiscache[ name ] : thiscache;1159 },1160 removedata: function( elem, name, pvt /* internal use only */ ) {1161 if ( !jquery.acceptdata( elem ) ) {1162 return;1163 }1164 var internalkey = jquery.expando, isnode = elem.nodetype,1165 // see jquery.data for more information1166 cache = isnode ? jquery.cache : elem,1167 // see jquery.data for more information1168 id = isnode ? elem[ jquery.expando ] : jquery.expando;1169 // if there is already no cache entry for this object, there is no1170 // purpose in continuing1171 if ( !cache[ id ] ) {1172 return;1173 }1174 if ( name ) {1175 var thiscache = pvt ? cache[ id ][ internalkey ] : cache[ id ];1176 if ( thiscache ) {1177 delete thiscache[ name ];1178 // if there is no data left in the cache, we want to continue1179 // and let the cache object itself get destroyed1180 if ( !isemptydataobject(thiscache) ) {1181 return;1182 }1183 }1184 }1185 // see jquery.data for more information1186 if ( pvt ) {1187 delete cache[ id ][ internalkey ];1188 // don't destroy the parent cache unless the internal data object1189 // had been the only thing left in it1190 if ( !isemptydataobject(cache[ id ]) ) {1191 return;1192 }1193 }1194 var internalcache = cache[ id ][ internalkey ];1195 // browsers that fail expando deletion also refuse to delete expandos on1196 // the window, but it will allow it on all other js objects; other browsers1197 // don't care1198 if ( jquery.support.deleteexpando || cache != window ) {1199 delete cache[ id ];1200 } else {1201 cache[ id ] = null;1202 }1203 // we destroyed the entire user cache at once because it's faster than1204 // iterating through each key, but we need to continue to persist internal1205 // data if it existed1206 if ( internalcache ) {1207 cache[ id ] = {};1208 // todo: this is a hack for 1.5 only. avoids exposing jquery1209 // metadata on plain js objects when the object is serialized using1210 // json.stringify1211 if ( !isnode ) {1212 cache[ id ].tojson = jquery.noop;1213 }1214 cache[ id ][ internalkey ] = internalcache;1215 // otherwise, we need to eliminate the expando on the node to avoid1216 // false lookups in the cache for entries that no longer exist1217 } else if ( isnode ) {1218 // ie does not allow us to delete expando properties from nodes,1219 // nor does it have a removeattribute function on document nodes;1220 // we must handle all of these cases1221 if ( jquery.support.deleteexpando ) {1222 delete elem[ jquery.expando ];1223 } else if ( elem.removeattribute ) {1224 elem.removeattribute( jquery.expando );1225 } else {1226 elem[ jquery.expando ] = null;1227 }1228 }1229 },1230 // for internal use only.1231 _data: function( elem, name, data ) {1232 return jquery.data( elem, name, data, true );1233 },1234 // a method for determining if a dom node can handle the data expando1235 acceptdata: function( elem ) {1236 if ( elem.nodename ) {1237 var match = jquery.nodata[ elem.nodename.tolowercase() ];1238 if ( match ) {1239 return !(match === true || elem.getattribute("classid") !== match);1240 }1241 }1242 return true;1243 }1244});1245jquery.fn.extend({1246 data: function( key, value ) {1247 var data = null;1248 if ( typeof key === "undefined" ) {1249 if ( this.length ) {1250 data = jquery.data( this[0] );1251 if ( this[0].nodetype === 1 ) {1252 var attr = this[0].attributes, name;1253 for ( var i = 0, l = attr.length; i < l; i++ ) {1254 name = attr[i].name;1255 if ( name.indexof( "data-" ) === 0 ) {1256 name = name.substr( 5 );1257 dataattr( this[0], name, data[ name ] );1258 }1259 }1260 }1261 }1262 return data;1263 } else if ( typeof key === "object" ) {1264 return this.each(function() {1265 jquery.data( this, key );1266 });1267 }1268 var parts = key.split(".");1269 parts[1] = parts[1] ? "." + parts[1] : "";1270 if ( value === undefined ) {1271 data = this.triggerhandler("getdata" + parts[1] + "!", [parts[0]]);1272 // try to fetch any internally stored data first1273 if ( data === undefined && this.length ) {1274 data = jquery.data( this[0], key );1275 data = dataattr( this[0], key, data );1276 }1277 return data === undefined && parts[1] ?1278 this.data( parts[0] ) :1279 data;1280 } else {1281 return this.each(function() {1282 var $this = jquery( this ),1283 args = [ parts[0], value ];1284 $this.triggerhandler( "setdata" + parts[1] + "!", args );1285 jquery.data( this, key, value );1286 $this.triggerhandler( "changedata" + parts[1] + "!", args );1287 });1288 }1289 },1290 removedata: function( key ) {1291 return this.each(function() {1292 jquery.removedata( this, key );1293 });1294 }1295});1296function dataattr( elem, key, data ) {1297 // if nothing was found internally, try to fetch any1298 // data from the html5 data-* attribute1299 if ( data === undefined && elem.nodetype === 1 ) {1300 data = elem.getattribute( "data-" + key );1301 if ( typeof data === "string" ) {1302 try {1303 data = data === "true" ? true :1304 data === "false" ? false :1305 data === "null" ? null :1306 !jquery.isnan( data ) ? parsefloat( data ) :1307 rbrace.test( data ) ? jquery.parsejson( data ) :1308 data;1309 } catch( e ) {}1310 // make sure we set the data so it isn't changed later1311 jquery.data( elem, key, data );1312 } else {1313 data = undefined;1314 }1315 }1316 return data;1317}1318// todo: this is a hack for 1.5 only to allow objects with a single tojson1319// property to be considered empty objects; this property always exists in1320// order to make sure json.stringify does not expose internal metadata1321function isemptydataobject( obj ) {1322 for ( var name in obj ) {1323 if ( name !== "tojson" ) {1324 return false;1325 }1326 }1327 return true;1328}1329jquery.extend({1330 queue: function( elem, type, data ) {1331 if ( !elem ) {1332 return;1333 }1334 type = (type || "fx") + "queue";1335 var q = jquery._data( elem, type );1336 // speed up dequeue by getting out quickly if this is just a lookup1337 if ( !data ) {1338 return q || [];1339 }1340 if ( !q || jquery.isarray(data) ) {1341 q = jquery._data( elem, type, jquery.makearray(data) );1342 } else {1343 q.push( data );1344 }1345 return q;1346 },1347 dequeue: function( elem, type ) {1348 type = type || "fx";1349 var queue = jquery.queue( elem, type ),1350 fn = queue.shift();1351 // if the fx queue is dequeued, always remove the progress sentinel1352 if ( fn === "inprogress" ) {1353 fn = queue.shift();1354 }1355 if ( fn ) {1356 // add a progress sentinel to prevent the fx queue from being1357 // automatically dequeued1358 if ( type === "fx" ) {1359 queue.unshift("inprogress");1360 }1361 fn.call(elem, function() {1362 jquery.dequeue(elem, type);1363 });1364 }1365 if ( !queue.length ) {1366 jquery.removedata( elem, type + "queue", true );1367 }1368 }1369});1370jquery.fn.extend({1371 queue: function( type, data ) {1372 if ( typeof type !== "string" ) {1373 data = type;1374 type = "fx";1375 }1376 if ( data === undefined ) {1377 return jquery.queue( this[0], type );1378 }1379 return this.each(function( i ) {1380 var queue = jquery.queue( this, type, data );1381 if ( type === "fx" && queue[0] !== "inprogress" ) {1382 jquery.dequeue( this, type );1383 }1384 });1385 },1386 dequeue: function( type ) {1387 return this.each(function() {1388 jquery.dequeue( this, type );1389 });1390 },1391 // based off of the plugin by clint helfers, with permission.1392 // http://blindsignals.com/index.php/2009/07/jquery-delay/1393 delay: function( time, type ) {1394 time = jquery.fx ? jquery.fx.speeds[time] || time : time;1395 type = type || "fx";1396 return this.queue( type, function() {1397 var elem = this;1398 settimeout(function() {1399 jquery.dequeue( elem, type );1400 }, time );1401 });1402 },1403 clearqueue: function( type ) {1404 return this.queue( type || "fx", [] );1405 }1406});1407var rclass = /[\n\t\r]/g,1408 rspaces = /\s+/,1409 rreturn = /\r/g,1410 rspecialurl = /^(?:href|src|style)$/,1411 rtype = /^(?:button|input)$/i,1412 rfocusable = /^(?:button|input|object|select|textarea)$/i,1413 rclickable = /^a(?:rea)?$/i,1414 rradiocheck = /^(?:radio|checkbox)$/i;1415jquery.props = {1416 "for": "htmlfor",1417 "class": "classname",1418 readonly: "readonly",1419 maxlength: "maxlength",1420 cellspacing: "cellspacing",1421 rowspan: "rowspan",1422 colspan: "colspan",1423 tabindex: "tabindex",1424 usemap: "usemap",1425 frameborder: "frameborder"1426};1427jquery.fn.extend({1428 attr: function( name, value ) {1429 return jquery.access( this, name, value, true, jquery.attr );1430 },1431 removeattr: function( name, fn ) {1432 return this.each(function(){1433 jquery.attr( this, name, "" );1434 if ( this.nodetype === 1 ) {1435 this.removeattribute( name );1436 }1437 });1438 },1439 addclass: function( value ) {1440 if ( jquery.isfunction(value) ) {1441 return this.each(function(i) {1442 var self = jquery(this);1443 self.addclass( value.call(this, i, self.attr("class")) );1444 });1445 }1446 if ( value && typeof value === "string" ) {1447 var classnames = (value || "").split( rspaces );1448 for ( var i = 0, l = this.length; i < l; i++ ) {1449 var elem = this[i];1450 if ( elem.nodetype === 1 ) {1451 if ( !elem.classname ) {1452 elem.classname = value;1453 } else {1454 var classname = " " + elem.classname + " ",1455 setclass = elem.classname;1456 for ( var c = 0, cl = classnames.length; c < cl; c++ ) {1457 if ( classname.indexof( " " + classnames[c] + " " ) < 0 ) {1458 setclass += " " + classnames[c];1459 }1460 }1461 elem.classname = jquery.trim( setclass );1462 }1463 }1464 }1465 }1466 return this;1467 },1468 removeclass: function( value ) {1469 if ( jquery.isfunction(value) ) {1470 return this.each(function(i) {1471 var self = jquery(this);1472 self.removeclass( value.call(this, i, self.attr("class")) );1473 });1474 }1475 if ( (value && typeof value === "string") || value === undefined ) {1476 var classnames = (value || "").split( rspaces );1477 for ( var i = 0, l = this.length; i < l; i++ ) {1478 var elem = this[i];1479 if ( elem.nodetype === 1 && elem.classname ) {1480 if ( value ) {1481 var classname = (" " + elem.classname + " ").replace(rclass, " ");1482 for ( var c = 0, cl = classnames.length; c < cl; c++ ) {1483 classname = classname.replace(" " + classnames[c] + " ", " ");1484 }1485 elem.classname = jquery.trim( classname );1486 } else {1487 elem.classname = "";1488 }1489 }1490 }1491 }1492 return this;1493 },1494 toggleclass: function( value, stateval ) {1495 var type = typeof value,1496 isbool = typeof stateval === "boolean";1497 if ( jquery.isfunction( value ) ) {1498 return this.each(function(i) {1499 var self = jquery(this);1500 self.toggleclass( value.call(this, i, self.attr("class"), stateval), stateval );1501 });1502 }1503 return this.each(function() {1504 if ( type === "string" ) {1505 // toggle individual class names1506 var classname,1507 i = 0,1508 self = jquery( this ),1509 state = stateval,1510 classnames = value.split( rspaces );1511 while ( (classname = classnames[ i++ ]) ) {1512 // check each classname given, space seperated list1513 state = isbool ? state : !self.hasclass( classname );1514 self[ state ? "addclass" : "removeclass" ]( classname );1515 }1516 } else if ( type === "undefined" || type === "boolean" ) {1517 if ( this.classname ) {1518 // store classname if set1519 jquery._data( this, "__classname__", this.classname );1520 }1521 // toggle whole classname1522 this.classname = this.classname || value === false ? "" : jquery._data( this, "__classname__" ) || "";1523 }1524 });1525 },1526 hasclass: function( selector ) {1527 var classname = " " + selector + " ";1528 for ( var i = 0, l = this.length; i < l; i++ ) {1529 if ( (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) > -1 ) {1530 return true;1531 }1532 }1533 return false;1534 },1535 val: function( value ) {1536 if ( !arguments.length ) {1537 var elem = this[0];1538 if ( elem ) {1539 if ( jquery.nodename( elem, "option" ) ) {1540 // attributes.value is undefined in blackberry 4.7 but1541 // uses .value. see #69321542 var val = elem.attributes.value;1543 return !val || val.specified ? elem.value : elem.text;1544 }1545 // we need to handle select boxes special1546 if ( jquery.nodename( elem, "select" ) ) {1547 var index = elem.selectedindex,1548 values = [],1549 options = elem.options,1550 one = elem.type === "select-one";1551 // nothing was selected1552 if ( index < 0 ) {1553 return null;1554 }1555 // loop through all the selected options1556 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {1557 var option = options[ i ];1558 // don't return options that are disabled or in a disabled optgroup1559 if ( option.selected && (jquery.support.optdisabled ? !option.disabled : option.getattribute("disabled") === null) &&1560 (!option.parentnode.disabled || !jquery.nodename( option.parentnode, "optgroup" )) ) {1561 // get the specific value for the option1562 value = jquery(option).val();1563 // we don't need an array for one selects1564 if ( one ) {1565 return value;1566 }1567 // multi-selects return an array1568 values.push( value );1569 }1570 }1571 // fixes bug #2551 -- select.val() broken in ie after form.reset()1572 if ( one && !values.length && options.length ) {1573 return jquery( options[ index ] ).val();1574 }1575 return values;1576 }1577 // handle the case where in webkit "" is returned instead of "on" if a value isn't specified1578 if ( rradiocheck.test( elem.type ) && !jquery.support.checkon ) {1579 return elem.getattribute("value") === null ? "on" : elem.value;1580 }1581 // everything else, we just grab the value1582 return (elem.value || "").replace(rreturn, "");1583 }1584 return undefined;1585 }1586 var isfunction = jquery.isfunction(value);1587 return this.each(function(i) {1588 var self = jquery(this), val = value;1589 if ( this.nodetype !== 1 ) {1590 return;1591 }1592 if ( isfunction ) {1593 val = value.call(this, i, self.val());1594 }1595 // treat null/undefined as ""; convert numbers to string1596 if ( val == null ) {1597 val = "";1598 } else if ( typeof val === "number" ) {1599 val += "";1600 } else if ( jquery.isarray(val) ) {1601 val = jquery.map(val, function (value) {1602 return value == null ? "" : value + "";1603 });1604 }1605 if ( jquery.isarray(val) && rradiocheck.test( this.type ) ) {1606 this.checked = jquery.inarray( self.val(), val ) >= 0;1607 } else if ( jquery.nodename( this, "select" ) ) {1608 var values = jquery.makearray(val);1609 jquery( "option", this ).each(function() {1610 this.selected = jquery.inarray( jquery(this).val(), values ) >= 0;1611 });1612 if ( !values.length ) {1613 this.selectedindex = -1;1614 }1615 } else {1616 this.value = val;1617 }1618 });1619 }1620});1621jquery.extend({1622 attrfn: {1623 val: true,1624 css: true,1625 html: true,1626 text: true,1627 data: true,1628 width: true,1629 height: true,1630 offset: true1631 },1632 attr: function( elem, name, value, pass ) {1633 // don't get/set attributes on text, comment and attribute nodes1634 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || elem.nodetype === 2 ) {1635 return undefined;1636 }1637 if ( pass && name in jquery.attrfn ) {1638 return jquery(elem)[name](value);1639 }1640 var notxml = elem.nodetype !== 1 || !jquery.isxmldoc( elem ),1641 // whether we are setting (or getting)1642 set = value !== undefined;1643 // try to normalize/fix the name1644 name = notxml && jquery.props[ name ] || name;1645 // only do all the following if this is a node (faster for style)1646 if ( elem.nodetype === 1 ) {1647 // these attributes require special treatment1648 var special = rspecialurl.test( name );1649 // safari mis-reports the default selected property of an option1650 // accessing the parent's selectedindex property fixes it1651 if ( name === "selected" && !jquery.support.optselected ) {1652 var parent = elem.parentnode;1653 if ( parent ) {1654 parent.selectedindex;1655 // make sure that it also works with optgroups, see #57011656 if ( parent.parentnode ) {1657 parent.parentnode.selectedindex;1658 }1659 }1660 }1661 // if applicable, access the attribute via the dom 0 way1662 // 'in' checks fail in blackberry 4.7 #69311663 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {1664 if ( set ) {1665 // we can't allow the type property to be changed (since it causes problems in ie)1666 if ( name === "type" && rtype.test( elem.nodename ) && elem.parentnode ) {1667 jquery.error( "type property can't be changed" );1668 }1669 if ( value === null ) {1670 if ( elem.nodetype === 1 ) {1671 elem.removeattribute( name );1672 }1673 } else {1674 elem[ name ] = value;1675 }1676 }1677 // browsers index elements by id/name on forms, give priority to attributes.1678 if ( jquery.nodename( elem, "form" ) && elem.getattributenode(name) ) {1679 return elem.getattributenode( name ).nodevalue;1680 }1681 // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set1682 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/1683 if ( name === "tabindex" ) {1684 var attributenode = elem.getattributenode( "tabindex" );1685 return attributenode && attributenode.specified ?1686 attributenode.value :1687 rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ?1688 0 :1689 undefined;1690 }1691 return elem[ name ];1692 }1693 if ( !jquery.support.style && notxml && name === "style" ) {1694 if ( set ) {1695 elem.style.csstext = "" + value;1696 }1697 return elem.style.csstext;1698 }1699 if ( set ) {1700 // convert the value to a string (all browsers do this but ie) see #10701701 elem.setattribute( name, "" + value );1702 }1703 // ensure that missing attributes return undefined1704 // blackberry 4.7 returns "" from getattribute #69381705 if ( !elem.attributes[ name ] && (elem.hasattribute && !elem.hasattribute( name )) ) {1706 return undefined;1707 }1708 var attr = !jquery.support.hrefnormalized && notxml && special ?1709 // some attributes require a special call on ie1710 elem.getattribute( name, 2 ) :1711 elem.getattribute( name );1712 // non-existent attributes return null, we normalize to undefined1713 return attr === null ? undefined : attr;1714 }1715 // handle everything which isn't a dom element node1716 if ( set ) {1717 elem[ name ] = value;1718 }1719 return elem[ name ];1720 }1721});1722var rnamespaces = /\.(.*)$/,1723 rformelems = /^(?:textarea|input|select)$/i,1724 rperiod = /\./g,1725 rspace = / /g,1726 rescape = /[^\w\s.|`]/g,1727 fcleanup = function( nm ) {1728 return nm.replace(rescape, "\\$&");1729 };1730/*1731 * a number of helper functions used for managing events.1732 * many of the ideas behind this code originated from1733 * dean edwards' addevent library.1734 */1735jquery.event = {1736 // bind an event to an element1737 // original by dean edwards1738 add: function( elem, types, handler, data ) {1739 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {1740 return;1741 }1742 // todo :: use a try/catch until it's safe to pull this out (likely 1.6)1743 // minor release fix for bug #80181744 try {1745 // for whatever reason, ie has trouble passing the window object1746 // around, causing it to be cloned in the process1747 if ( jquery.iswindow( elem ) && ( elem !== window && !elem.frameelement ) ) {1748 elem = window;1749 }1750 }1751 catch ( e ) {}1752 if ( handler === false ) {1753 handler = returnfalse;1754 } else if ( !handler ) {1755 // fixes bug #7229. fix recommended by jdalton1756 return;1757 }1758 var handleobjin, handleobj;1759 if ( handler.handler ) {1760 handleobjin = handler;1761 handler = handleobjin.handler;1762 }1763 // make sure that the function being executed has a unique id1764 if ( !handler.guid ) {1765 handler.guid = jquery.guid++;1766 }1767 // init the element's event structure1768 var elemdata = jquery._data( elem );1769 // if no elemdata is found then we must be trying to bind to one of the1770 // banned nodata elements1771 if ( !elemdata ) {1772 return;1773 }1774 var events = elemdata.events,1775 eventhandle = elemdata.handle;1776 if ( !events ) {1777 elemdata.events = events = {};1778 }1779 if ( !eventhandle ) {1780 elemdata.handle = eventhandle = function() {1781 // handle the second event of a trigger and when1782 // an event is called after a page has unloaded1783 return typeof jquery !== "undefined" && !jquery.event.triggered ?1784 jquery.event.handle.apply( eventhandle.elem, arguments ) :1785 undefined;1786 };1787 }1788 // add elem as a property of the handle function1789 // this is to prevent a memory leak with non-native events in ie.1790 eventhandle.elem = elem;1791 // handle multiple events separated by a space1792 // jquery(...).bind("mouseover mouseout", fn);1793 types = types.split(" ");1794 var type, i = 0, namespaces;1795 while ( (type = types[ i++ ]) ) {1796 handleobj = handleobjin ?1797 jquery.extend({}, handleobjin) :1798 { handler: handler, data: data };1799 // namespaced event handlers1800 if ( type.indexof(".") > -1 ) {1801 namespaces = type.split(".");1802 type = namespaces.shift();1803 handleobj.namespace = namespaces.slice(0).sort().join(".");1804 } else {1805 namespaces = [];1806 handleobj.namespace = "";1807 }1808 handleobj.type = type;1809 if ( !handleobj.guid ) {1810 handleobj.guid = handler.guid;1811 }1812 // get the current list of functions bound to this event1813 var handlers = events[ type ],1814 special = jquery.event.special[ type ] || {};1815 // init the event handler queue1816 if ( !handlers ) {1817 handlers = events[ type ] = [];1818 // check for a special event handler1819 // only use addeventlistener/attachevent if the special1820 // events handler returns false1821 if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) {1822 // bind the global event handler to the element1823 if ( elem.addeventlistener ) {1824 elem.addeventlistener( type, eventhandle, false );1825 } else if ( elem.attachevent ) {1826 elem.attachevent( "on" + type, eventhandle );1827 }1828 }1829 }1830 if ( special.add ) {1831 special.add.call( elem, handleobj );1832 if ( !handleobj.handler.guid ) {1833 handleobj.handler.guid = handler.guid;1834 }1835 }1836 // add the function to the element's handler list1837 handlers.push( handleobj );1838 // keep track of which events have been used, for global triggering1839 jquery.event.global[ type ] = true;1840 }1841 // nullify elem to prevent memory leaks in ie1842 elem = null;1843 },1844 global: {},1845 // detach an event or set of events from an element1846 remove: function( elem, types, handler, pos ) {1847 // don't do events on text and comment nodes1848 if ( elem.nodetype === 3 || elem.nodetype === 8 ) {1849 return;1850 }1851 if ( handler === false ) {1852 handler = returnfalse;1853 }1854 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventtype, handleobj, origtype,1855 elemdata = jquery.hasdata( elem ) && jquery._data( elem ),1856 events = elemdata && elemdata.events;1857 if ( !elemdata || !events ) {1858 return;1859 }1860 // types is actually an event object here1861 if ( types && types.type ) {1862 handler = types.handler;1863 types = types.type;1864 }1865 // unbind all events for the element1866 if ( !types || typeof types === "string" && types.charat(0) === "." ) {1867 types = types || "";1868 for ( type in events ) {1869 jquery.event.remove( elem, type + types );1870 }1871 return;1872 }1873 // handle multiple events separated by a space1874 // jquery(...).unbind("mouseover mouseout", fn);1875 types = types.split(" ");1876 while ( (type = types[ i++ ]) ) {1877 origtype = type;1878 handleobj = null;1879 all = type.indexof(".") < 0;1880 namespaces = [];1881 if ( !all ) {1882 // namespaced event handlers1883 namespaces = type.split(".");1884 type = namespaces.shift();1885 namespace = new regexp("(^|\\.)" +1886 jquery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");1887 }1888 eventtype = events[ type ];1889 if ( !eventtype ) {1890 continue;1891 }1892 if ( !handler ) {1893 for ( j = 0; j < eventtype.length; j++ ) {1894 handleobj = eventtype[ j ];1895 if ( all || namespace.test( handleobj.namespace ) ) {1896 jquery.event.remove( elem, origtype, handleobj.handler, j );1897 eventtype.splice( j--, 1 );1898 }1899 }1900 continue;1901 }1902 special = jquery.event.special[ type ] || {};1903 for ( j = pos || 0; j < eventtype.length; j++ ) {1904 handleobj = eventtype[ j ];1905 if ( handler.guid === handleobj.guid ) {1906 // remove the given handler for the given type1907 if ( all || namespace.test( handleobj.namespace ) ) {1908 if ( pos == null ) {1909 eventtype.splice( j--, 1 );1910 }1911 if ( special.remove ) {1912 special.remove.call( elem, handleobj );1913 }1914 }1915 if ( pos != null ) {1916 break;1917 }1918 }1919 }1920 // remove generic event handler if no more handlers exist1921 if ( eventtype.length === 0 || pos != null && eventtype.length === 1 ) {1922 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {1923 jquery.removeevent( elem, type, elemdata.handle );1924 }1925 ret = null;1926 delete events[ type ];1927 }1928 }1929 // remove the expando if it's no longer used1930 if ( jquery.isemptyobject( events ) ) {1931 var handle = elemdata.handle;1932 if ( handle ) {1933 handle.elem = null;1934 }1935 delete elemdata.events;1936 delete elemdata.handle;1937 if ( jquery.isemptyobject( elemdata ) ) {1938 jquery.removedata( elem, undefined, true );1939 }1940 }1941 },1942 // bubbling is internal1943 trigger: function( event, data, elem /*, bubbling */ ) {1944 // event object or event type1945 var type = event.type || event,1946 bubbling = arguments[3];1947 if ( !bubbling ) {1948 event = typeof event === "object" ?1949 // jquery.event object1950 event[ jquery.expando ] ? event :1951 // object literal1952 jquery.extend( jquery.event(type), event ) :1953 // just the event type (string)1954 jquery.event(type);1955 if ( type.indexof("!") >= 0 ) {1956 event.type = type = type.slice(0, -1);1957 event.exclusive = true;1958 }1959 // handle a global trigger1960 if ( !elem ) {1961 // don't bubble custom events when global (to avoid too much overhead)1962 event.stoppropagation();1963 // only trigger if we've ever bound an event for it1964 if ( jquery.event.global[ type ] ) {1965 // xxx this code smells terrible. event.js should not be directly1966 // inspecting the data cache1967 jquery.each( jquery.cache, function() {1968 // internalkey variable is just used to make it easier to find1969 // and potentially change this stuff later; currently it just1970 // points to jquery.expando1971 var internalkey = jquery.expando,1972 internalcache = this[ internalkey ];1973 if ( internalcache && internalcache.events && internalcache.events[ type ] ) {1974 jquery.event.trigger( event, data, internalcache.handle.elem );1975 }1976 });1977 }1978 }1979 // handle triggering a single element1980 // don't do events on text and comment nodes1981 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 ) {1982 return undefined;1983 }1984 // clean up in case it is reused1985 event.result = undefined;1986 event.target = elem;1987 // clone the incoming data, if any1988 data = jquery.makearray( data );1989 data.unshift( event );1990 }1991 event.currenttarget = elem;1992 // trigger the event, it is assumed that "handle" is a function1993 var handle = jquery._data( elem, "handle" );1994 if ( handle ) {1995 handle.apply( elem, data );1996 }1997 var parent = elem.parentnode || elem.ownerdocument;1998 // trigger an inline bound script1999 try {2000 if ( !(elem && elem.nodename && jquery.nodata[elem.nodename.tolowercase()]) ) {2001 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {2002 event.result = false;2003 event.preventdefault();2004 }2005 }2006 // prevent ie from throwing an error for some elements with some event types, see #35332007 } catch (inlineerror) {}2008 if ( !event.ispropagationstopped() && parent ) {2009 jquery.event.trigger( event, data, parent, true );2010 } else if ( !event.isdefaultprevented() ) {2011 var old,2012 target = event.target,2013 targettype = type.replace( rnamespaces, "" ),2014 isclick = jquery.nodename( target, "a" ) && targettype === "click",2015 special = jquery.event.special[ targettype ] || {};2016 if ( (!special._default || special._default.call( elem, event ) === false) &&2017 !isclick && !(target && target.nodename && jquery.nodata[target.nodename.tolowercase()]) ) {2018 try {2019 if ( target[ targettype ] ) {2020 // make sure that we don't accidentally re-trigger the onfoo events2021 old = target[ "on" + targettype ];2022 if ( old ) {2023 target[ "on" + targettype ] = null;2024 }2025 jquery.event.triggered = true;2026 target[ targettype ]();2027 }2028 // prevent ie from throwing an error for some elements with some event types, see #35332029 } catch (triggererror) {}2030 if ( old ) {2031 target[ "on" + targettype ] = old;2032 }2033 jquery.event.triggered = false;2034 }2035 }2036 },2037 handle: function( event ) {2038 var all, handlers, namespaces, namespace_re, events,2039 namespace_sort = [],2040 args = jquery.makearray( arguments );2041 event = args[0] = jquery.event.fix( event || window.event );2042 event.currenttarget = this;2043 // namespaced event handlers2044 all = event.type.indexof(".") < 0 && !event.exclusive;2045 if ( !all ) {2046 namespaces = event.type.split(".");2047 event.type = namespaces.shift();2048 namespace_sort = namespaces.slice(0).sort();2049 namespace_re = new regexp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");2050 }2051 event.namespace = event.namespace || namespace_sort.join(".");2052 events = jquery._data(this, "events");2053 handlers = (events || {})[ event.type ];2054 if ( events && handlers ) {2055 // clone the handlers to prevent manipulation2056 handlers = handlers.slice(0);2057 for ( var j = 0, l = handlers.length; j < l; j++ ) {2058 var handleobj = handlers[ j ];2059 // filter the functions by class2060 if ( all || namespace_re.test( handleobj.namespace ) ) {2061 // pass in a reference to the handler function itself2062 // so that we can later remove it2063 event.handler = handleobj.handler;2064 event.data = handleobj.data;2065 event.handleobj = handleobj;2066 var ret = handleobj.handler.apply( this, args );2067 if ( ret !== undefined ) {2068 event.result = ret;2069 if ( ret === false ) {2070 event.preventdefault();2071 event.stoppropagation();2072 }2073 }2074 if ( event.isimmediatepropagationstopped() ) {2075 break;2076 }2077 }2078 }2079 }2080 return event.result;2081 },2082 props: "altkey attrchange attrname bubbles button cancelable charcode clientx clienty ctrlkey currenttarget data detail eventphase fromelement handler keycode layerx layery metakey newvalue offsetx offsety pagex pagey prevvalue relatednode relatedtarget screenx screeny shiftkey srcelement target toelement view wheeldelta which".split(" "),2083 fix: function( event ) {2084 if ( event[ jquery.expando ] ) {2085 return event;2086 }2087 // store a copy of the original event object2088 // and "clone" to set read-only properties2089 var originalevent = event;2090 event = jquery.event( originalevent );2091 for ( var i = this.props.length, prop; i; ) {2092 prop = this.props[ --i ];2093 event[ prop ] = originalevent[ prop ];2094 }2095 // fix target property, if necessary2096 if ( !event.target ) {2097 // fixes #1925 where srcelement might not be defined either2098 event.target = event.srcelement || document;2099 }2100 // check if target is a textnode (safari)2101 if ( event.target.nodetype === 3 ) {2102 event.target = event.target.parentnode;2103 }2104 // add relatedtarget, if necessary2105 if ( !event.relatedtarget && event.fromelement ) {2106 event.relatedtarget = event.fromelement === event.target ? event.toelement : event.fromelement;2107 }2108 // calculate pagex/y if missing and clientx/y available2109 if ( event.pagex == null && event.clientx != null ) {2110 var doc = document.documentelement,2111 body = document.body;2112 event.pagex = event.clientx + (doc && doc.scrollleft || body && body.scrollleft || 0) - (doc && doc.clientleft || body && body.clientleft || 0);2113 event.pagey = event.clienty + (doc && doc.scrolltop || body && body.scrolltop || 0) - (doc && doc.clienttop || body && body.clienttop || 0);2114 }2115 // add which for key events2116 if ( event.which == null && (event.charcode != null || event.keycode != null) ) {2117 event.which = event.charcode != null ? event.charcode : event.keycode;2118 }2119 // add metakey to non-mac browsers (use ctrl for pc's and meta for macs)2120 if ( !event.metakey && event.ctrlkey ) {2121 event.metakey = event.ctrlkey;2122 }2123 // add which for click: 1 === left; 2 === middle; 3 === right2124 // note: button is not normalized, so don't use it2125 if ( !event.which && event.button !== undefined ) {2126 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));2127 }2128 return event;2129 },2130 // deprecated, use jquery.guid instead2131 guid: 1e8,2132 // deprecated, use jquery.proxy instead2133 proxy: jquery.proxy,2134 special: {2135 ready: {2136 // make sure the ready event is setup2137 setup: jquery.bindready,2138 teardown: jquery.noop2139 },2140 live: {2141 add: function( handleobj ) {2142 jquery.event.add( this,2143 liveconvert( handleobj.origtype, handleobj.selector ),2144 jquery.extend({}, handleobj, {handler: livehandler, guid: handleobj.handler.guid}) );2145 },2146 remove: function( handleobj ) {2147 jquery.event.remove( this, liveconvert( handleobj.origtype, handleobj.selector ), handleobj );2148 }2149 },2150 beforeunload: {2151 setup: function( data, namespaces, eventhandle ) {2152 // we only want to do this special case on windows2153 if ( jquery.iswindow( this ) ) {2154 this.onbeforeunload = eventhandle;2155 }2156 },2157 teardown: function( namespaces, eventhandle ) {2158 if ( this.onbeforeunload === eventhandle ) {2159 this.onbeforeunload = null;2160 }2161 }2162 }2163 }2164};2165jquery.removeevent = document.removeeventlistener ?2166 function( elem, type, handle ) {2167 if ( elem.removeeventlistener ) {2168 elem.removeeventlistener( type, handle, false );2169 }2170 } :2171 function( elem, type, handle ) {2172 if ( elem.detachevent ) {2173 elem.detachevent( "on" + type, handle );2174 }2175 };2176jquery.event = function( src ) {2177 // allow instantiation without the 'new' keyword2178 if ( !this.preventdefault ) {2179 return new jquery.event( src );2180 }2181 // event object2182 if ( src && src.type ) {2183 this.originalevent = src;2184 this.type = src.type;2185 // events bubbling up the document may have been marked as prevented2186 // by a handler lower down the tree; reflect the correct value.2187 this.isdefaultprevented = (src.defaultprevented || src.returnvalue === false ||2188 src.getpreventdefault && src.getpreventdefault()) ? returntrue : returnfalse;2189 // event type2190 } else {2191 this.type = src;2192 }2193 // timestamp is buggy for some events on firefox(#3843)2194 // so we won't rely on the native value2195 this.timestamp = jquery.now();2196 // mark it as fixed2197 this[ jquery.expando ] = true;2198};2199function returnfalse() {2200 return false;2201}2202function returntrue() {2203 return true;2204}2205// jquery.event is based on dom3 events as specified by the ecmascript language binding2206// http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html2207jquery.event.prototype = {2208 preventdefault: function() {2209 this.isdefaultprevented = returntrue;2210 var e = this.originalevent;2211 if ( !e ) {2212 return;2213 }2214 // if preventdefault exists run it on the original event2215 if ( e.preventdefault ) {2216 e.preventdefault();2217 // otherwise set the returnvalue property of the original event to false (ie)2218 } else {2219 e.returnvalue = false;2220 }2221 },2222 stoppropagation: function() {2223 this.ispropagationstopped = returntrue;2224 var e = this.originalevent;2225 if ( !e ) {2226 return;2227 }2228 // if stoppropagation exists run it on the original event2229 if ( e.stoppropagation ) {2230 e.stoppropagation();2231 }2232 // otherwise set the cancelbubble property of the original event to true (ie)2233 e.cancelbubble = true;2234 },2235 stopimmediatepropagation: function() {2236 this.isimmediatepropagationstopped = returntrue;2237 this.stoppropagation();2238 },2239 isdefaultprevented: returnfalse,2240 ispropagationstopped: returnfalse,2241 isimmediatepropagationstopped: returnfalse2242};2243// checks if an event happened on an element within another element2244// used in jquery.event.special.mouseenter and mouseleave handlers2245var withinelement = function( event ) {2246 // check if mouse(over|out) are still within the same parent element2247 var parent = event.relatedtarget;2248 // firefox sometimes assigns relatedtarget a xul element2249 // which we cannot access the parentnode property of2250 try {2251 // chrome does something similar, the parentnode property2252 // can be accessed but is null.2253 if ( parent !== document && !parent.parentnode ) {2254 return;2255 }2256 // traverse up the tree2257 while ( parent && parent !== this ) {2258 parent = parent.parentnode;2259 }2260 if ( parent !== this ) {2261 // set the correct event type2262 event.type = event.data;2263 // handle event if we actually just moused on to a non sub-element2264 jquery.event.handle.apply( this, arguments );2265 }2266 // assuming we've left the element since we most likely mousedover a xul element2267 } catch(e) { }2268},2269// in case of event delegation, we only need to rename the event.type,2270// livehandler will take care of the rest.2271delegate = function( event ) {2272 event.type = event.data;2273 jquery.event.handle.apply( this, arguments );2274};2275// create mouseenter and mouseleave events2276jquery.each({2277 mouseenter: "mouseover",2278 mouseleave: "mouseout"2279}, function( orig, fix ) {2280 jquery.event.special[ orig ] = {2281 setup: function( data ) {2282 jquery.event.add( this, fix, data && data.selector ? delegate : withinelement, orig );2283 },2284 teardown: function( data ) {2285 jquery.event.remove( this, fix, data && data.selector ? delegate : withinelement );2286 }2287 };2288});2289// submit delegation2290if ( !jquery.support.submitbubbles ) {2291 jquery.event.special.submit = {2292 setup: function( data, namespaces ) {2293 if ( this.nodename && this.nodename.tolowercase() !== "form" ) {2294 jquery.event.add(this, "click.specialsubmit", function( e ) {2295 var elem = e.target,2296 type = elem.type;2297 if ( (type === "submit" || type === "image") && jquery( elem ).closest("form").length ) {2298 trigger( "submit", this, arguments );2299 }2300 });2301 jquery.event.add(this, "keypress.specialsubmit", function( e ) {2302 var elem = e.target,2303 type = elem.type;2304 if ( (type === "text" || type === "password") && jquery( elem ).closest("form").length && e.keycode === 13 ) {2305 trigger( "submit", this, arguments );2306 }2307 });2308 } else {2309 return false;2310 }2311 },2312 teardown: function( namespaces ) {2313 jquery.event.remove( this, ".specialsubmit" );2314 }2315 };2316}2317// change delegation, happens here so we have bind.2318if ( !jquery.support.changebubbles ) {2319 var changefilters,2320 getval = function( elem ) {2321 var type = elem.type, val = elem.value;2322 if ( type === "radio" || type === "checkbox" ) {2323 val = elem.checked;2324 } else if ( type === "select-multiple" ) {2325 val = elem.selectedindex > -1 ?2326 jquery.map( elem.options, function( elem ) {2327 return elem.selected;2328 }).join("-") :2329 "";2330 } else if ( elem.nodename.tolowercase() === "select" ) {2331 val = elem.selectedindex;2332 }2333 return val;2334 },2335 testchange = function testchange( e ) {2336 var elem = e.target, data, val;2337 if ( !rformelems.test( elem.nodename ) || elem.readonly ) {2338 return;2339 }2340 data = jquery._data( elem, "_change_data" );2341 val = getval(elem);2342 // the current data will be also retrieved by beforeactivate2343 if ( e.type !== "focusout" || elem.type !== "radio" ) {2344 jquery._data( elem, "_change_data", val );2345 }2346 if ( data === undefined || val === data ) {2347 return;2348 }2349 if ( data != null || val ) {2350 e.type = "change";2351 e.livefired = undefined;2352 jquery.event.trigger( e, arguments[1], elem );2353 }2354 };2355 jquery.event.special.change = {2356 filters: {2357 focusout: testchange,2358 beforedeactivate: testchange,2359 click: function( e ) {2360 var elem = e.target, type = elem.type;2361 if ( type === "radio" || type === "checkbox" || elem.nodename.tolowercase() === "select" ) {2362 testchange.call( this, e );2363 }2364 },2365 // change has to be called before submit2366 // keydown will be called before keypress, which is used in submit-event delegation2367 keydown: function( e ) {2368 var elem = e.target, type = elem.type;2369 if ( (e.keycode === 13 && elem.nodename.tolowercase() !== "textarea") ||2370 (e.keycode === 32 && (type === "checkbox" || type === "radio")) ||2371 type === "select-multiple" ) {2372 testchange.call( this, e );2373 }2374 },2375 // beforeactivate happens also before the previous element is blurred2376 // with this event you can't trigger a change event, but you can store2377 // information2378 beforeactivate: function( e ) {2379 var elem = e.target;2380 jquery._data( elem, "_change_data", getval(elem) );2381 }2382 },2383 setup: function( data, namespaces ) {2384 if ( this.type === "file" ) {2385 return false;2386 }2387 for ( var type in changefilters ) {2388 jquery.event.add( this, type + ".specialchange", changefilters[type] );2389 }2390 return rformelems.test( this.nodename );2391 },2392 teardown: function( namespaces ) {2393 jquery.event.remove( this, ".specialchange" );2394 return rformelems.test( this.nodename );2395 }2396 };2397 changefilters = jquery.event.special.change.filters;2398 // handle when the input is .focus()'d2399 changefilters.focus = changefilters.beforeactivate;2400}2401function trigger( type, elem, args ) {2402 // piggyback on a donor event to simulate a different one.2403 // fake originalevent to avoid donor's stoppropagation, but if the2404 // simulated event prevents default then we do the same on the donor.2405 // don't pass args or remember livefired; they apply to the donor event.2406 var event = jquery.extend( {}, args[ 0 ] );2407 event.type = type;2408 event.originalevent = {};2409 event.livefired = undefined;2410 jquery.event.handle.call( elem, event );2411 if ( event.isdefaultprevented() ) {2412 args[ 0 ].preventdefault();2413 }2414}2415// create "bubbling" focus and blur events2416if ( document.addeventlistener ) {2417 jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {2418 jquery.event.special[ fix ] = {2419 setup: function() {2420 this.addeventlistener( orig, handler, true );2421 },2422 teardown: function() {2423 this.removeeventlistener( orig, handler, true );2424 }2425 };2426 function handler( e ) {2427 e = jquery.event.fix( e );2428 e.type = fix;2429 return jquery.event.handle.call( this, e );2430 }2431 });2432}2433jquery.each(["bind", "one"], function( i, name ) {2434 jquery.fn[ name ] = function( type, data, fn ) {2435 // handle object literals2436 if ( typeof type === "object" ) {2437 for ( var key in type ) {2438 this[ name ](key, data, type[key], fn);2439 }2440 return this;2441 }2442 if ( jquery.isfunction( data ) || data === false ) {2443 fn = data;2444 data = undefined;2445 }2446 var handler = name === "one" ? jquery.proxy( fn, function( event ) {2447 jquery( this ).unbind( event, handler );2448 return fn.apply( this, arguments );2449 }) : fn;2450 if ( type === "unload" && name !== "one" ) {2451 this.one( type, data, fn );2452 } else {2453 for ( var i = 0, l = this.length; i < l; i++ ) {2454 jquery.event.add( this[i], type, handler, data );2455 }2456 }2457 return this;2458 };2459});2460jquery.fn.extend({2461 unbind: function( type, fn ) {2462 // handle object literals2463 if ( typeof type === "object" && !type.preventdefault ) {2464 for ( var key in type ) {2465 this.unbind(key, type[key]);2466 }2467 } else {2468 for ( var i = 0, l = this.length; i < l; i++ ) {2469 jquery.event.remove( this[i], type, fn );2470 }2471 }2472 return this;2473 },2474 delegate: function( selector, types, data, fn ) {2475 return this.live( types, data, fn, selector );2476 },2477 undelegate: function( selector, types, fn ) {2478 if ( arguments.length === 0 ) {2479 return this.unbind( "live" );2480 } else {2481 return this.die( types, null, fn, selector );2482 }2483 },2484 trigger: function( type, data ) {2485 return this.each(function() {2486 jquery.event.trigger( type, data, this );2487 });2488 },2489 triggerhandler: function( type, data ) {2490 if ( this[0] ) {2491 var event = jquery.event( type );2492 event.preventdefault();2493 event.stoppropagation();2494 jquery.event.trigger( event, data, this[0] );2495 return event.result;2496 }2497 },2498 toggle: function( fn ) {2499 // save reference to arguments for access in closure2500 var args = arguments,2501 i = 1;2502 // link all the functions, so any of them can unbind this click handler2503 while ( i < args.length ) {2504 jquery.proxy( fn, args[ i++ ] );2505 }2506 return this.click( jquery.proxy( fn, function( event ) {2507 // figure out which function to execute2508 var lasttoggle = ( jquery._data( this, "lasttoggle" + fn.guid ) || 0 ) % i;2509 jquery._data( this, "lasttoggle" + fn.guid, lasttoggle + 1 );2510 // make sure that clicks stop2511 event.preventdefault();2512 // and execute the function2513 return args[ lasttoggle ].apply( this, arguments ) || false;2514 }));2515 },2516 hover: function( fnover, fnout ) {2517 return this.mouseenter( fnover ).mouseleave( fnout || fnover );2518 }2519});2520var livemap = {2521 focus: "focusin",2522 blur: "focusout",2523 mouseenter: "mouseover",2524 mouseleave: "mouseout"2525};2526jquery.each(["live", "die"], function( i, name ) {2527 jquery.fn[ name ] = function( types, data, fn, origselector /* internal use only */ ) {2528 var type, i = 0, match, namespaces, pretype,2529 selector = origselector || this.selector,2530 context = origselector ? this : jquery( this.context );2531 if ( typeof types === "object" && !types.preventdefault ) {2532 for ( var key in types ) {2533 context[ name ]( key, data, types[key], selector );2534 }2535 return this;2536 }2537 if ( jquery.isfunction( data ) ) {2538 fn = data;2539 data = undefined;2540 }2541 types = (types || "").split(" ");2542 while ( (type = types[ i++ ]) != null ) {2543 match = rnamespaces.exec( type );2544 namespaces = "";2545 if ( match ) {2546 namespaces = match[0];2547 type = type.replace( rnamespaces, "" );2548 }2549 if ( type === "hover" ) {2550 types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );2551 continue;2552 }2553 pretype = type;2554 if ( type === "focus" || type === "blur" ) {2555 types.push( livemap[ type ] + namespaces );2556 type = type + namespaces;2557 } else {2558 type = (livemap[ type ] || type) + namespaces;2559 }2560 if ( name === "live" ) {2561 // bind live handler2562 for ( var j = 0, l = context.length; j < l; j++ ) {2563 jquery.event.add( context[j], "live." + liveconvert( type, selector ),2564 { data: data, selector: selector, handler: fn, origtype: type, orighandler: fn, pretype: pretype } );2565 }2566 } else {2567 // unbind live handler2568 context.unbind( "live." + liveconvert( type, selector ), fn );2569 }2570 }2571 return this;2572 };2573});2574function livehandler( event ) {2575 var stop, maxlevel, related, match, handleobj, elem, j, i, l, data, close, namespace, ret,2576 elems = [],2577 selectors = [],2578 events = jquery._data( this, "events" );2579 // make sure we avoid non-left-click bubbling in firefox (#3861) and disabled elements in ie (#6911)2580 if ( event.livefired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {2581 return;2582 }2583 if ( event.namespace ) {2584 namespace = new regexp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");2585 }2586 event.livefired = this;2587 var live = events.live.slice(0);2588 for ( j = 0; j < live.length; j++ ) {2589 handleobj = live[j];2590 if ( handleobj.origtype.replace( rnamespaces, "" ) === event.type ) {2591 selectors.push( handleobj.selector );2592 } else {2593 live.splice( j--, 1 );2594 }2595 }2596 match = jquery( event.target ).closest( selectors, event.currenttarget );2597 for ( i = 0, l = match.length; i < l; i++ ) {2598 close = match[i];2599 for ( j = 0; j < live.length; j++ ) {2600 handleobj = live[j];2601 if ( close.selector === handleobj.selector && (!namespace || namespace.test( handleobj.namespace )) && !close.elem.disabled ) {2602 elem = close.elem;2603 related = null;2604 // those two events require additional checking2605 if ( handleobj.pretype === "mouseenter" || handleobj.pretype === "mouseleave" ) {2606 event.type = handleobj.pretype;2607 related = jquery( event.relatedtarget ).closest( handleobj.selector )[0];2608 }2609 if ( !related || related !== elem ) {2610 elems.push({ elem: elem, handleobj: handleobj, level: close.level });2611 }2612 }2613 }2614 }2615 for ( i = 0, l = elems.length; i < l; i++ ) {2616 match = elems[i];2617 if ( maxlevel && match.level > maxlevel ) {2618 break;2619 }2620 event.currenttarget = match.elem;2621 event.data = match.handleobj.data;2622 event.handleobj = match.handleobj;2623 ret = match.handleobj.orighandler.apply( match.elem, arguments );2624 if ( ret === false || event.ispropagationstopped() ) {2625 maxlevel = match.level;2626 if ( ret === false ) {2627 stop = false;2628 }2629 if ( event.isimmediatepropagationstopped() ) {2630 break;2631 }2632 }2633 }2634 return stop;2635}2636function liveconvert( type, selector ) {2637 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");2638}2639jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +2640 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +2641 "change select submit keydown keypress keyup error").split(" "), function( i, name ) {2642 // handle event binding2643 jquery.fn[ name ] = function( data, fn ) {2644 if ( fn == null ) {2645 fn = data;2646 data = null;2647 }2648 return arguments.length > 0 ?2649 this.bind( name, data, fn ) :2650 this.trigger( name );2651 };2652 if ( jquery.attrfn ) {2653 jquery.attrfn[ name ] = true;2654 }2655});2656/*!2657 * sizzle css selector engine2658 * copyright 2011, the dojo foundation2659 * released under the mit, bsd, and gpl licenses.2660 * more information: http://sizzlejs.com/2661 */2662(function(){2663var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,2664 done = 0,2665 tostring = object.prototype.tostring,2666 hasduplicate = false,2667 basehasduplicate = true,2668 rbackslash = /\\/g,2669 rnonword = /\w/;2670// here we check if the javascript engine is using some sort of2671// optimization where it does not always call our comparision2672// function. if that is the case, discard the hasduplicate value.2673// thus far that includes google chrome.2674[0, 0].sort(function() {2675 basehasduplicate = false;2676 return 0;2677});2678var sizzle = function( selector, context, results, seed ) {2679 results = results || [];2680 context = context || document;2681 var origcontext = context;2682 if ( context.nodetype !== 1 && context.nodetype !== 9 ) {2683 return [];2684 }2685 2686 if ( !selector || typeof selector !== "string" ) {2687 return results;2688 }2689 var m, set, checkset, extra, ret, cur, pop, i,2690 prune = true,2691 contextxml = sizzle.isxml( context ),2692 parts = [],2693 sofar = selector;2694 2695 // reset the position of the chunker regexp (start from head)2696 do {2697 chunker.exec( "" );2698 m = chunker.exec( sofar );2699 if ( m ) {2700 sofar = m[3];2701 2702 parts.push( m[1] );2703 2704 if ( m[2] ) {2705 extra = m[3];2706 break;2707 }2708 }2709 } while ( m );2710 if ( parts.length > 1 && origpos.exec( selector ) ) {2711 if ( parts.length === 2 && expr.relative[ parts[0] ] ) {2712 set = posprocess( parts[0] + parts[1], context );2713 } else {2714 set = expr.relative[ parts[0] ] ?2715 [ context ] :2716 sizzle( parts.shift(), context );2717 while ( parts.length ) {2718 selector = parts.shift();2719 if ( expr.relative[ selector ] ) {2720 selector += parts.shift();2721 }2722 2723 set = posprocess( selector, set );2724 }2725 }2726 } else {2727 // take a shortcut and set the context if the root selector is an id2728 // (but not if it'll be faster if the inner selector is an id)2729 if ( !seed && parts.length > 1 && context.nodetype === 9 && !contextxml &&2730 expr.match.id.test(parts[0]) && !expr.match.id.test(parts[parts.length - 1]) ) {2731 ret = sizzle.find( parts.shift(), context, contextxml );2732 context = ret.expr ?2733 sizzle.filter( ret.expr, ret.set )[0] :2734 ret.set[0];2735 }2736 if ( context ) {2737 ret = seed ?2738 { expr: parts.pop(), set: makearray(seed) } :2739 sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentnode ? context.parentnode : context, contextxml );2740 set = ret.expr ?2741 sizzle.filter( ret.expr, ret.set ) :2742 ret.set;2743 if ( parts.length > 0 ) {2744 checkset = makearray( set );2745 } else {2746 prune = false;2747 }2748 while ( parts.length ) {2749 cur = parts.pop();2750 pop = cur;2751 if ( !expr.relative[ cur ] ) {2752 cur = "";2753 } else {2754 pop = parts.pop();2755 }2756 if ( pop == null ) {2757 pop = context;2758 }2759 expr.relative[ cur ]( checkset, pop, contextxml );2760 }2761 } else {2762 checkset = parts = [];2763 }2764 }2765 if ( !checkset ) {2766 checkset = set;2767 }2768 if ( !checkset ) {2769 sizzle.error( cur || selector );2770 }2771 if ( tostring.call(checkset) === "[object array]" ) {2772 if ( !prune ) {2773 results.push.apply( results, checkset );2774 } else if ( context && context.nodetype === 1 ) {2775 for ( i = 0; checkset[i] != null; i++ ) {2776 if ( checkset[i] && (checkset[i] === true || checkset[i].nodetype === 1 && sizzle.contains(context, checkset[i])) ) {2777 results.push( set[i] );2778 }2779 }2780 } else {2781 for ( i = 0; checkset[i] != null; i++ ) {2782 if ( checkset[i] && checkset[i].nodetype === 1 ) {2783 results.push( set[i] );2784 }2785 }2786 }2787 } else {2788 makearray( checkset, results );2789 }2790 if ( extra ) {2791 sizzle( extra, origcontext, results, seed );2792 sizzle.uniquesort( results );2793 }2794 return results;2795};2796sizzle.uniquesort = function( results ) {2797 if ( sortorder ) {2798 hasduplicate = basehasduplicate;2799 results.sort( sortorder );2800 if ( hasduplicate ) {2801 for ( var i = 1; i < results.length; i++ ) {2802 if ( results[i] === results[ i - 1 ] ) {2803 results.splice( i--, 1 );2804 }2805 }2806 }2807 }2808 return results;2809};2810sizzle.matches = function( expr, set ) {2811 return sizzle( expr, null, null, set );2812};2813sizzle.matchesselector = function( node, expr ) {2814 return sizzle( expr, null, null, [node] ).length > 0;2815};2816sizzle.find = function( expr, context, isxml ) {2817 var set;2818 if ( !expr ) {2819 return [];2820 }2821 for ( var i = 0, l = expr.order.length; i < l; i++ ) {2822 var match,2823 type = expr.order[i];2824 2825 if ( (match = expr.leftmatch[ type ].exec( expr )) ) {2826 var left = match[1];2827 match.splice( 1, 1 );2828 if ( left.substr( left.length - 1 ) !== "\\" ) {2829 match[1] = (match[1] || "").replace( rbackslash, "" );2830 set = expr.find[ type ]( match, context, isxml );2831 if ( set != null ) {2832 expr = expr.replace( expr.match[ type ], "" );2833 break;2834 }2835 }2836 }2837 }2838 if ( !set ) {2839 set = typeof context.getelementsbytagname !== "undefined" ?2840 context.getelementsbytagname( "*" ) :2841 [];2842 }2843 return { set: set, expr: expr };2844};2845sizzle.filter = function( expr, set, inplace, not ) {2846 var match, anyfound,2847 old = expr,2848 result = [],2849 curloop = set,2850 isxmlfilter = set && set[0] && sizzle.isxml( set[0] );2851 while ( expr && set.length ) {2852 for ( var type in expr.filter ) {2853 if ( (match = expr.leftmatch[ type ].exec( expr )) != null && match[2] ) {2854 var found, item,2855 filter = expr.filter[ type ],2856 left = match[1];2857 anyfound = false;2858 match.splice(1,1);2859 if ( left.substr( left.length - 1 ) === "\\" ) {2860 continue;2861 }2862 if ( curloop === result ) {2863 result = [];2864 }2865 if ( expr.prefilter[ type ] ) {2866 match = expr.prefilter[ type ]( match, curloop, inplace, result, not, isxmlfilter );2867 if ( !match ) {2868 anyfound = found = true;2869 } else if ( match === true ) {2870 continue;2871 }2872 }2873 if ( match ) {2874 for ( var i = 0; (item = curloop[i]) != null; i++ ) {2875 if ( item ) {2876 found = filter( item, match, i, curloop );2877 var pass = not ^ !!found;2878 if ( inplace && found != null ) {2879 if ( pass ) {2880 anyfound = true;2881 } else {2882 curloop[i] = false;2883 }2884 } else if ( pass ) {2885 result.push( item );2886 anyfound = true;2887 }2888 }2889 }2890 }2891 if ( found !== undefined ) {2892 if ( !inplace ) {2893 curloop = result;2894 }2895 expr = expr.replace( expr.match[ type ], "" );2896 if ( !anyfound ) {2897 return [];2898 }2899 break;2900 }2901 }2902 }2903 // improper expression2904 if ( expr === old ) {2905 if ( anyfound == null ) {2906 sizzle.error( expr );2907 } else {2908 break;2909 }2910 }2911 old = expr;2912 }2913 return curloop;2914};2915sizzle.error = function( msg ) {2916 throw "syntax error, unrecognized expression: " + msg;2917};2918var expr = sizzle.selectors = {2919 order: [ "id", "name", "tag" ],2920 match: {2921 id: /#((?:[\w\u00c0-\uffff\-]|\\.)+)/,2922 class: /\.((?:[\w\u00c0-\uffff\-]|\\.)+)/,2923 name: /\[name=['"]*((?:[\w\u00c0-\uffff\-]|\\.)+)['"]*\]/,2924 attr: /\[\s*((?:[\w\u00c0-\uffff\-]|\\.)+)\s*(?:(\s?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uffff\-]|\\.)*)|)|)\s*\]/,2925 tag: /^((?:[\w\u00c0-\uffff\*\-]|\\.)+)/,2926 child: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,2927 pos: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,2928 pseudo: /:((?:[\w\u00c0-\uffff\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/2929 },2930 leftmatch: {},2931 attrmap: {2932 "class": "classname",2933 "for": "htmlfor"2934 },2935 attrhandle: {2936 href: function( elem ) {2937 return elem.getattribute( "href" );2938 },2939 type: function( elem ) {2940 return elem.getattribute( "type" );2941 }2942 },2943 relative: {2944 "+": function(checkset, part){2945 var ispartstr = typeof part === "string",2946 istag = ispartstr && !rnonword.test( part ),2947 ispartstrnottag = ispartstr && !istag;2948 if ( istag ) {2949 part = part.tolowercase();2950 }2951 for ( var i = 0, l = checkset.length, elem; i < l; i++ ) {2952 if ( (elem = checkset[i]) ) {2953 while ( (elem = elem.previoussibling) && elem.nodetype !== 1 ) {}2954 checkset[i] = ispartstrnottag || elem && elem.nodename.tolowercase() === part ?2955 elem || false :2956 elem === part;2957 }2958 }2959 if ( ispartstrnottag ) {2960 sizzle.filter( part, checkset, true );2961 }2962 },2963 ">": function( checkset, part ) {2964 var elem,2965 ispartstr = typeof part === "string",2966 i = 0,2967 l = checkset.length;2968 if ( ispartstr && !rnonword.test( part ) ) {2969 part = part.tolowercase();2970 for ( ; i < l; i++ ) {2971 elem = checkset[i];2972 if ( elem ) {2973 var parent = elem.parentnode;2974 checkset[i] = parent.nodename.tolowercase() === part ? parent : false;2975 }2976 }2977 } else {2978 for ( ; i < l; i++ ) {2979 elem = checkset[i];2980 if ( elem ) {2981 checkset[i] = ispartstr ?2982 elem.parentnode :2983 elem.parentnode === part;2984 }2985 }2986 if ( ispartstr ) {2987 sizzle.filter( part, checkset, true );2988 }2989 }2990 },2991 "": function(checkset, part, isxml){2992 var nodecheck,2993 donename = done++,2994 checkfn = dircheck;2995 if ( typeof part === "string" && !rnonword.test( part ) ) {2996 part = part.tolowercase();2997 nodecheck = part;2998 checkfn = dirnodecheck;2999 }3000 checkfn( "parentnode", part, donename, checkset, nodecheck, isxml );3001 },3002 "~": function( checkset, part, isxml ) {3003 var nodecheck,3004 donename = done++,3005 checkfn = dircheck;3006 if ( typeof part === "string" && !rnonword.test( part ) ) {3007 part = part.tolowercase();3008 nodecheck = part;3009 checkfn = dirnodecheck;3010 }3011 checkfn( "previoussibling", part, donename, checkset, nodecheck, isxml );3012 }3013 },3014 find: {3015 id: function( match, context, isxml ) {3016 if ( typeof context.getelementbyid !== "undefined" && !isxml ) {3017 var m = context.getelementbyid(match[1]);3018 // check parentnode to catch when blackberry 4.6 returns3019 // nodes that are no longer in the document #69633020 return m && m.parentnode ? [m] : [];3021 }3022 },3023 name: function( match, context ) {3024 if ( typeof context.getelementsbyname !== "undefined" ) {3025 var ret = [],3026 results = context.getelementsbyname( match[1] );3027 for ( var i = 0, l = results.length; i < l; i++ ) {3028 if ( results[i].getattribute("name") === match[1] ) {3029 ret.push( results[i] );3030 }3031 }3032 return ret.length === 0 ? null : ret;3033 }3034 },3035 tag: function( match, context ) {3036 if ( typeof context.getelementsbytagname !== "undefined" ) {3037 return context.getelementsbytagname( match[1] );3038 }3039 }3040 },3041 prefilter: {3042 class: function( match, curloop, inplace, result, not, isxml ) {3043 match = " " + match[1].replace( rbackslash, "" ) + " ";3044 if ( isxml ) {3045 return match;3046 }3047 for ( var i = 0, elem; (elem = curloop[i]) != null; i++ ) {3048 if ( elem ) {3049 if ( not ^ (elem.classname && (" " + elem.classname + " ").replace(/[\t\n\r]/g, " ").indexof(match) >= 0) ) {3050 if ( !inplace ) {3051 result.push( elem );3052 }3053 } else if ( inplace ) {3054 curloop[i] = false;3055 }3056 }3057 }3058 return false;3059 },3060 id: function( match ) {3061 return match[1].replace( rbackslash, "" );3062 },3063 tag: function( match, curloop ) {3064 return match[1].replace( rbackslash, "" ).tolowercase();3065 },3066 child: function( match ) {3067 if ( match[1] === "nth" ) {3068 if ( !match[2] ) {3069 sizzle.error( match[0] );3070 }3071 match[2] = match[2].replace(/^\+|\s*/g, '');3072 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'3073 var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(3074 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||3075 !/\d/.test( match[2] ) && "0n+" + match[2] || match[2]);3076 // calculate the numbers (first)n+(last) including if they are negative3077 match[2] = (test[1] + (test[2] || 1)) - 0;3078 match[3] = test[3] - 0;3079 }3080 else if ( match[2] ) {3081 sizzle.error( match[0] );3082 }3083 // todo: move to normal caching system3084 match[0] = done++;3085 return match;3086 },3087 attr: function( match, curloop, inplace, result, not, isxml ) {3088 var name = match[1] = match[1].replace( rbackslash, "" );3089 3090 if ( !isxml && expr.attrmap[name] ) {3091 match[1] = expr.attrmap[name];3092 }3093 // handle if an un-quoted value was used3094 match[4] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );3095 if ( match[2] === "~=" ) {3096 match[4] = " " + match[4] + " ";3097 }3098 return match;3099 },3100 pseudo: function( match, curloop, inplace, result, not ) {3101 if ( match[1] === "not" ) {3102 // if we're dealing with a complex expression, or a simple one3103 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {3104 match[3] = sizzle(match[3], null, null, curloop);3105 } else {3106 var ret = sizzle.filter(match[3], curloop, inplace, true ^ not);3107 if ( !inplace ) {3108 result.push.apply( result, ret );3109 }3110 return false;3111 }3112 } else if ( expr.match.pos.test( match[0] ) || expr.match.child.test( match[0] ) ) {3113 return true;3114 }3115 3116 return match;3117 },3118 pos: function( match ) {3119 match.unshift( true );3120 return match;3121 }3122 },3123 3124 filters: {3125 enabled: function( elem ) {3126 return elem.disabled === false && elem.type !== "hidden";3127 },3128 disabled: function( elem ) {3129 return elem.disabled === true;3130 },3131 checked: function( elem ) {3132 return elem.checked === true;3133 },3134 3135 selected: function( elem ) {3136 // accessing this property makes selected-by-default3137 // options in safari work properly3138 if ( elem.parentnode ) {3139 elem.parentnode.selectedindex;3140 }3141 3142 return elem.selected === true;3143 },3144 parent: function( elem ) {3145 return !!elem.firstchild;3146 },3147 empty: function( elem ) {3148 return !elem.firstchild;3149 },3150 has: function( elem, i, match ) {3151 return !!sizzle( match[3], elem ).length;3152 },3153 header: function( elem ) {3154 return (/h\d/i).test( elem.nodename );3155 },3156 text: function( elem ) {3157 // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc) 3158 // use getattribute instead to test this case3159 return "text" === elem.getattribute( 'type' );3160 },3161 radio: function( elem ) {3162 return "radio" === elem.type;3163 },3164 checkbox: function( elem ) {3165 return "checkbox" === elem.type;3166 },3167 file: function( elem ) {3168 return "file" === elem.type;3169 },3170 password: function( elem ) {3171 return "password" === elem.type;3172 },3173 submit: function( elem ) {3174 return "submit" === elem.type;3175 },3176 image: function( elem ) {3177 return "image" === elem.type;3178 },3179 reset: function( elem ) {3180 return "reset" === elem.type;3181 },3182 button: function( elem ) {3183 return "button" === elem.type || elem.nodename.tolowercase() === "button";3184 },3185 input: function( elem ) {3186 return (/input|select|textarea|button/i).test( elem.nodename );3187 }3188 },3189 setfilters: {3190 first: function( elem, i ) {3191 return i === 0;3192 },3193 last: function( elem, i, match, array ) {3194 return i === array.length - 1;3195 },3196 even: function( elem, i ) {3197 return i % 2 === 0;3198 },3199 odd: function( elem, i ) {3200 return i % 2 === 1;3201 },3202 lt: function( elem, i, match ) {3203 return i < match[3] - 0;3204 },3205 gt: function( elem, i, match ) {3206 return i > match[3] - 0;3207 },3208 nth: function( elem, i, match ) {3209 return match[3] - 0 === i;3210 },3211 eq: function( elem, i, match ) {3212 return match[3] - 0 === i;3213 }3214 },3215 filter: {3216 pseudo: function( elem, match, i, array ) {3217 var name = match[1],3218 filter = expr.filters[ name ];3219 if ( filter ) {3220 return filter( elem, i, match, array );3221 } else if ( name === "contains" ) {3222 return (elem.textcontent || elem.innertext || sizzle.gettext([ elem ]) || "").indexof(match[3]) >= 0;3223 } else if ( name === "not" ) {3224 var not = match[3];3225 for ( var j = 0, l = not.length; j < l; j++ ) {3226 if ( not[j] === elem ) {3227 return false;3228 }3229 }3230 return true;3231 } else {3232 sizzle.error( name );3233 }3234 },3235 child: function( elem, match ) {3236 var type = match[1],3237 node = elem;3238 switch ( type ) {3239 case "only":3240 case "first":3241 while ( (node = node.previoussibling) ) {3242 if ( node.nodetype === 1 ) { 3243 return false; 3244 }3245 }3246 if ( type === "first" ) { 3247 return true; 3248 }3249 node = elem;3250 case "last":3251 while ( (node = node.nextsibling) ) {3252 if ( node.nodetype === 1 ) { 3253 return false; 3254 }3255 }3256 return true;3257 case "nth":3258 var first = match[2],3259 last = match[3];3260 if ( first === 1 && last === 0 ) {3261 return true;3262 }3263 3264 var donename = match[0],3265 parent = elem.parentnode;3266 3267 if ( parent && (parent.sizcache !== donename || !elem.nodeindex) ) {3268 var count = 0;3269 3270 for ( node = parent.firstchild; node; node = node.nextsibling ) {3271 if ( node.nodetype === 1 ) {3272 node.nodeindex = ++count;3273 }3274 } 3275 parent.sizcache = donename;3276 }3277 3278 var diff = elem.nodeindex - last;3279 if ( first === 0 ) {3280 return diff === 0;3281 } else {3282 return ( diff % first === 0 && diff / first >= 0 );3283 }3284 }3285 },3286 id: function( elem, match ) {3287 return elem.nodetype === 1 && elem.getattribute("id") === match;3288 },3289 tag: function( elem, match ) {3290 return (match === "*" && elem.nodetype === 1) || elem.nodename.tolowercase() === match;3291 },3292 3293 class: function( elem, match ) {3294 return (" " + (elem.classname || elem.getattribute("class")) + " ")3295 .indexof( match ) > -1;3296 },3297 attr: function( elem, match ) {3298 var name = match[1],3299 result = expr.attrhandle[ name ] ?3300 expr.attrhandle[ name ]( elem ) :3301 elem[ name ] != null ?3302 elem[ name ] :3303 elem.getattribute( name ),3304 value = result + "",3305 type = match[2],3306 check = match[4];3307 return result == null ?3308 type === "!=" :3309 type === "=" ?3310 value === check :3311 type === "*=" ?3312 value.indexof(check) >= 0 :3313 type === "~=" ?3314 (" " + value + " ").indexof(check) >= 0 :3315 !check ?3316 value && result !== false :3317 type === "!=" ?3318 value !== check :3319 type === "^=" ?3320 value.indexof(check) === 0 :3321 type === "$=" ?3322 value.substr(value.length - check.length) === check :3323 type === "|=" ?3324 value === check || value.substr(0, check.length + 1) === check + "-" :3325 false;3326 },3327 pos: function( elem, match, i, array ) {3328 var name = match[2],3329 filter = expr.setfilters[ name ];3330 if ( filter ) {3331 return filter( elem, i, match, array );3332 }3333 }3334 }3335};3336var origpos = expr.match.pos,3337 fescape = function(all, num){3338 return "\\" + (num - 0 + 1);3339 };3340for ( var type in expr.match ) {3341 expr.match[ type ] = new regexp( expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );3342 expr.leftmatch[ type ] = new regexp( /(^(?:.|\r|\n)*?)/.source + expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );3343}3344var makearray = function( array, results ) {3345 array = array.prototype.slice.call( array, 0 );3346 if ( results ) {3347 results.push.apply( results, array );3348 return results;3349 }3350 3351 return array;3352};3353// perform a simple check to determine if the browser is capable of3354// converting a nodelist to an array using builtin methods.3355// also verifies that the returned array holds dom nodes3356// (which is not the case in the blackberry browser)3357try {3358 array.prototype.slice.call( document.documentelement.childnodes, 0 )[0].nodetype;3359// provide a fallback method if it does not work3360} catch( e ) {3361 makearray = function( array, results ) {3362 var i = 0,3363 ret = results || [];3364 if ( tostring.call(array) === "[object array]" ) {3365 array.prototype.push.apply( ret, array );3366 } else {3367 if ( typeof array.length === "number" ) {3368 for ( var l = array.length; i < l; i++ ) {3369 ret.push( array[i] );3370 }3371 } else {3372 for ( ; array[i]; i++ ) {3373 ret.push( array[i] );3374 }3375 }3376 }3377 return ret;3378 };3379}3380var sortorder, siblingcheck;3381if ( document.documentelement.comparedocumentposition ) {3382 sortorder = function( a, b ) {3383 if ( a === b ) {3384 hasduplicate = true;3385 return 0;3386 }3387 if ( !a.comparedocumentposition || !b.comparedocumentposition ) {3388 return a.comparedocumentposition ? -1 : 1;3389 }3390 return a.comparedocumentposition(b) & 4 ? -1 : 1;3391 };3392} else {3393 sortorder = function( a, b ) {3394 var al, bl,3395 ap = [],3396 bp = [],3397 aup = a.parentnode,3398 bup = b.parentnode,3399 cur = aup;3400 // the nodes are identical, we can exit early3401 if ( a === b ) {3402 hasduplicate = true;3403 return 0;3404 // if the nodes are siblings (or identical) we can do a quick check3405 } else if ( aup === bup ) {3406 return siblingcheck( a, b );3407 // if no parents were found then the nodes are disconnected3408 } else if ( !aup ) {3409 return -1;3410 } else if ( !bup ) {3411 return 1;3412 }3413 // otherwise they're somewhere else in the tree so we need3414 // to build up a full list of the parentnodes for comparison3415 while ( cur ) {3416 ap.unshift( cur );3417 cur = cur.parentnode;3418 }3419 cur = bup;3420 while ( cur ) {3421 bp.unshift( cur );3422 cur = cur.parentnode;3423 }3424 al = ap.length;3425 bl = bp.length;3426 // start walking down the tree looking for a discrepancy3427 for ( var i = 0; i < al && i < bl; i++ ) {3428 if ( ap[i] !== bp[i] ) {3429 return siblingcheck( ap[i], bp[i] );3430 }3431 }3432 // we ended someplace up the tree so do a sibling check3433 return i === al ?3434 siblingcheck( a, bp[i], -1 ) :3435 siblingcheck( ap[i], b, 1 );3436 };3437 siblingcheck = function( a, b, ret ) {3438 if ( a === b ) {3439 return ret;3440 }3441 var cur = a.nextsibling;3442 while ( cur ) {3443 if ( cur === b ) {3444 return -1;3445 }3446 cur = cur.nextsibling;3447 }3448 return 1;3449 };3450}3451// utility function for retreiving the text value of an array of dom nodes3452sizzle.gettext = function( elems ) {3453 var ret = "", elem;3454 for ( var i = 0; elems[i]; i++ ) {3455 elem = elems[i];3456 // get the text from text nodes and cdata nodes3457 if ( elem.nodetype === 3 || elem.nodetype === 4 ) {3458 ret += elem.nodevalue;3459 // traverse everything else, except comment nodes3460 } else if ( elem.nodetype !== 8 ) {3461 ret += sizzle.gettext( elem.childnodes );3462 }3463 }3464 return ret;3465};3466// check to see if the browser returns elements by name when3467// querying by getelementbyid (and provide a workaround)3468(function(){3469 // we're going to inject a fake input element with a specified name3470 var form = document.createelement("div"),3471 id = "script" + (new date()).gettime(),3472 root = document.documentelement;3473 form.innerhtml = "<a name='" + id + "'/>";3474 // inject it into the root element, check its status, and remove it quickly3475 root.insertbefore( form, root.firstchild );3476 // the workaround has to do additional checks after a getelementbyid3477 // which slows things down for other browsers (hence the branching)3478 if ( document.getelementbyid( id ) ) {3479 expr.find.id = function( match, context, isxml ) {3480 if ( typeof context.getelementbyid !== "undefined" && !isxml ) {3481 var m = context.getelementbyid(match[1]);3482 return m ?3483 m.id === match[1] || typeof m.getattributenode !== "undefined" && m.getattributenode("id").nodevalue === match[1] ?3484 [m] :3485 undefined :3486 [];3487 }3488 };3489 expr.filter.id = function( elem, match ) {3490 var node = typeof elem.getattributenode !== "undefined" && elem.getattributenode("id");3491 return elem.nodetype === 1 && node && node.nodevalue === match;3492 };3493 }3494 root.removechild( form );3495 // release memory in ie3496 root = form = null;3497})();3498(function(){3499 // check to see if the browser returns only elements3500 // when doing getelementsbytagname("*")3501 // create a fake element3502 var div = document.createelement("div");3503 div.appendchild( document.createcomment("") );3504 // make sure no comments are found3505 if ( div.getelementsbytagname("*").length > 0 ) {3506 expr.find.tag = function( match, context ) {3507 var results = context.getelementsbytagname( match[1] );3508 // filter out possible comments3509 if ( match[1] === "*" ) {3510 var tmp = [];3511 for ( var i = 0; results[i]; i++ ) {3512 if ( results[i].nodetype === 1 ) {3513 tmp.push( results[i] );3514 }3515 }3516 results = tmp;3517 }3518 return results;3519 };3520 }3521 // check to see if an attribute returns normalized href attributes3522 div.innerhtml = "<a href='#'></a>";3523 if ( div.firstchild && typeof div.firstchild.getattribute !== "undefined" &&3524 div.firstchild.getattribute("href") !== "#" ) {3525 expr.attrhandle.href = function( elem ) {3526 return elem.getattribute( "href", 2 );3527 };3528 }3529 // release memory in ie3530 div = null;3531})();3532if ( document.queryselectorall ) {3533 (function(){3534 var oldsizzle = sizzle,3535 div = document.createelement("div"),3536 id = "__sizzle__";3537 div.innerhtml = "<p class='test'></p>";3538 // safari can't handle uppercase or unicode characters when3539 // in quirks mode.3540 if ( div.queryselectorall && div.queryselectorall(".test").length === 0 ) {3541 return;3542 }3543 3544 sizzle = function( query, context, extra, seed ) {3545 context = context || document;3546 // only use queryselectorall on non-xml documents3547 // (id selectors don't work in non-html documents)3548 if ( !seed && !sizzle.isxml(context) ) {3549 // see if we find a selector to speed up3550 var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );3551 3552 if ( match && (context.nodetype === 1 || context.nodetype === 9) ) {3553 // speed-up: sizzle("tag")3554 if ( match[1] ) {3555 return makearray( context.getelementsbytagname( query ), extra );3556 3557 // speed-up: sizzle(".class")3558 } else if ( match[2] && expr.find.class && context.getelementsbyclassname ) {3559 return makearray( context.getelementsbyclassname( match[2] ), extra );3560 }3561 }3562 3563 if ( context.nodetype === 9 ) {3564 // speed-up: sizzle("body")3565 // the body element only exists once, optimize finding it3566 if ( query === "body" && context.body ) {3567 return makearray( [ context.body ], extra );3568 3569 // speed-up: sizzle("#id")3570 } else if ( match && match[3] ) {3571 var elem = context.getelementbyid( match[3] );3572 // check parentnode to catch when blackberry 4.6 returns3573 // nodes that are no longer in the document #69633574 if ( elem && elem.parentnode ) {3575 // handle the case where ie and opera return items3576 // by name instead of id3577 if ( elem.id === match[3] ) {3578 return makearray( [ elem ], extra );3579 }3580 3581 } else {3582 return makearray( [], extra );3583 }3584 }3585 3586 try {3587 return makearray( context.queryselectorall(query), extra );3588 } catch(qsaerror) {}3589 // qsa works strangely on element-rooted queries3590 // we can work around this by specifying an extra id on the root3591 // and working up from there (thanks to andrew dupont for the technique)3592 // ie 8 doesn't work on object elements3593 } else if ( context.nodetype === 1 && context.nodename.tolowercase() !== "object" ) {3594 var oldcontext = context,3595 old = context.getattribute( "id" ),3596 nid = old || id,3597 hasparent = context.parentnode,3598 relativehierarchyselector = /^\s*[+~]/.test( query );3599 if ( !old ) {3600 context.setattribute( "id", nid );3601 } else {3602 nid = nid.replace( /'/g, "\\$&" );3603 }3604 if ( relativehierarchyselector && hasparent ) {3605 context = context.parentnode;3606 }3607 try {3608 if ( !relativehierarchyselector || hasparent ) {3609 return makearray( context.queryselectorall( "[id='" + nid + "'] " + query ), extra );3610 }3611 } catch(pseudoerror) {3612 } finally {3613 if ( !old ) {3614 oldcontext.removeattribute( "id" );3615 }3616 }3617 }3618 }3619 3620 return oldsizzle(query, context, extra, seed);3621 };3622 for ( var prop in oldsizzle ) {3623 sizzle[ prop ] = oldsizzle[ prop ];3624 }3625 // release memory in ie3626 div = null;3627 })();3628}3629(function(){3630 var html = document.documentelement,3631 matches = html.matchesselector || html.mozmatchesselector || html.webkitmatchesselector || html.msmatchesselector,3632 pseudoworks = false;3633 try {3634 // this should fail with an exception3635 // gecko does not error, returns false instead3636 matches.call( document.documentelement, "[test!='']:sizzle" );3637 3638 } catch( pseudoerror ) {3639 pseudoworks = true;3640 }3641 if ( matches ) {3642 sizzle.matchesselector = function( node, expr ) {3643 // make sure that attribute selectors are quoted3644 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");3645 if ( !sizzle.isxml( node ) ) {3646 try { 3647 if ( pseudoworks || !expr.match.pseudo.test( expr ) && !/!=/.test( expr ) ) {3648 return matches.call( node, expr );3649 }3650 } catch(e) {}3651 }3652 return sizzle(expr, null, null, [node]).length > 0;3653 };3654 }3655})();3656(function(){3657 var div = document.createelement("div");3658 div.innerhtml = "<div class='test e'></div><div class='test'></div>";3659 // opera can't find a second classname (in 9.6)3660 // also, make sure that getelementsbyclassname actually exists3661 if ( !div.getelementsbyclassname || div.getelementsbyclassname("e").length === 0 ) {3662 return;3663 }3664 // safari caches class attributes, doesn't catch changes (in 3.2)3665 div.lastchild.classname = "e";3666 if ( div.getelementsbyclassname("e").length === 1 ) {3667 return;3668 }3669 3670 expr.order.splice(1, 0, "class");3671 expr.find.class = function( match, context, isxml ) {3672 if ( typeof context.getelementsbyclassname !== "undefined" && !isxml ) {3673 return context.getelementsbyclassname(match[1]);3674 }3675 };3676 // release memory in ie3677 div = null;3678})();3679function dirnodecheck( dir, cur, donename, checkset, nodecheck, isxml ) {3680 for ( var i = 0, l = checkset.length; i < l; i++ ) {3681 var elem = checkset[i];3682 if ( elem ) {3683 var match = false;3684 elem = elem[dir];3685 while ( elem ) {3686 if ( elem.sizcache === donename ) {3687 match = checkset[elem.sizset];3688 break;3689 }3690 if ( elem.nodetype === 1 && !isxml ){3691 elem.sizcache = donename;3692 elem.sizset = i;3693 }3694 if ( elem.nodename.tolowercase() === cur ) {3695 match = elem;3696 break;3697 }3698 elem = elem[dir];3699 }3700 checkset[i] = match;3701 }3702 }3703}3704function dircheck( dir, cur, donename, checkset, nodecheck, isxml ) {3705 for ( var i = 0, l = checkset.length; i < l; i++ ) {3706 var elem = checkset[i];3707 if ( elem ) {3708 var match = false;3709 3710 elem = elem[dir];3711 while ( elem ) {3712 if ( elem.sizcache === donename ) {3713 match = checkset[elem.sizset];3714 break;3715 }3716 if ( elem.nodetype === 1 ) {3717 if ( !isxml ) {3718 elem.sizcache = donename;3719 elem.sizset = i;3720 }3721 if ( typeof cur !== "string" ) {3722 if ( elem === cur ) {3723 match = true;3724 break;3725 }3726 } else if ( sizzle.filter( cur, [elem] ).length > 0 ) {3727 match = elem;3728 break;3729 }3730 }3731 elem = elem[dir];3732 }3733 checkset[i] = match;3734 }3735 }3736}3737if ( document.documentelement.contains ) {3738 sizzle.contains = function( a, b ) {3739 return a !== b && (a.contains ? a.contains(b) : true);3740 };3741} else if ( document.documentelement.comparedocumentposition ) {3742 sizzle.contains = function( a, b ) {3743 return !!(a.comparedocumentposition(b) & 16);3744 };3745} else {3746 sizzle.contains = function() {3747 return false;3748 };3749}3750sizzle.isxml = function( elem ) {3751 // documentelement is verified for cases where it doesn't yet exist3752 // (such as loading iframes in ie - #4833) 3753 var documentelement = (elem ? elem.ownerdocument || elem : 0).documentelement;3754 return documentelement ? documentelement.nodename !== "html" : false;3755};3756var posprocess = function( selector, context ) {3757 var match,3758 tmpset = [],3759 later = "",3760 root = context.nodetype ? [context] : context;3761 // position selectors must be done after the filter3762 // and so must :not(positional) so we move all pseudos to the end3763 while ( (match = expr.match.pseudo.exec( selector )) ) {3764 later += match[0];3765 selector = selector.replace( expr.match.pseudo, "" );3766 }3767 selector = expr.relative[selector] ? selector + "*" : selector;3768 for ( var i = 0, l = root.length; i < l; i++ ) {3769 sizzle( selector, root[i], tmpset );3770 }3771 return sizzle.filter( later, tmpset );3772};3773// expose3774jquery.find = sizzle;3775jquery.expr = sizzle.selectors;3776jquery.expr[":"] = jquery.expr.filters;3777jquery.unique = sizzle.uniquesort;3778jquery.text = sizzle.gettext;3779jquery.isxmldoc = sizzle.isxml;3780jquery.contains = sizzle.contains;3781})();3782var runtil = /until$/,3783 rparentsprev = /^(?:parents|prevuntil|prevall)/,3784 // note: this regexp should be improved, or likely pulled from sizzle3785 rmultiselector = /,/,3786 issimple = /^.[^:#\[\.,]*$/,3787 slice = array.prototype.slice,3788 pos = jquery.expr.match.pos,3789 // methods guaranteed to produce a unique set when starting from a unique set3790 guaranteedunique = {3791 children: true,3792 contents: true,3793 next: true,3794 prev: true3795 };3796jquery.fn.extend({3797 find: function( selector ) {3798 var ret = this.pushstack( "", "find", selector ),3799 length = 0;3800 for ( var i = 0, l = this.length; i < l; i++ ) {3801 length = ret.length;3802 jquery.find( selector, this[i], ret );3803 if ( i > 0 ) {3804 // make sure that the results are unique3805 for ( var n = length; n < ret.length; n++ ) {3806 for ( var r = 0; r < length; r++ ) {3807 if ( ret[r] === ret[n] ) {3808 ret.splice(n--, 1);3809 break;3810 }3811 }3812 }3813 }3814 }3815 return ret;3816 },3817 has: function( target ) {3818 var targets = jquery( target );3819 return this.filter(function() {3820 for ( var i = 0, l = targets.length; i < l; i++ ) {3821 if ( jquery.contains( this, targets[i] ) ) {3822 return true;3823 }3824 }3825 });3826 },3827 not: function( selector ) {3828 return this.pushstack( winnow(this, selector, false), "not", selector);3829 },3830 filter: function( selector ) {3831 return this.pushstack( winnow(this, selector, true), "filter", selector );3832 },3833 is: function( selector ) {3834 return !!selector && jquery.filter( selector, this ).length > 0;3835 },3836 closest: function( selectors, context ) {3837 var ret = [], i, l, cur = this[0];3838 if ( jquery.isarray( selectors ) ) {3839 var match, selector,3840 matches = {},3841 level = 1;3842 if ( cur && selectors.length ) {3843 for ( i = 0, l = selectors.length; i < l; i++ ) {3844 selector = selectors[i];3845 if ( !matches[selector] ) {3846 matches[selector] = jquery.expr.match.pos.test( selector ) ?3847 jquery( selector, context || this.context ) :3848 selector;3849 }3850 }3851 while ( cur && cur.ownerdocument && cur !== context ) {3852 for ( selector in matches ) {3853 match = matches[selector];3854 if ( match.jquery ? match.index(cur) > -1 : jquery(cur).is(match) ) {3855 ret.push({ selector: selector, elem: cur, level: level });3856 }3857 }3858 cur = cur.parentnode;3859 level++;3860 }3861 }3862 return ret;3863 }3864 var pos = pos.test( selectors ) ?3865 jquery( selectors, context || this.context ) : null;3866 for ( i = 0, l = this.length; i < l; i++ ) {3867 cur = this[i];3868 while ( cur ) {3869 if ( pos ? pos.index(cur) > -1 : jquery.find.matchesselector(cur, selectors) ) {3870 ret.push( cur );3871 break;3872 } else {3873 cur = cur.parentnode;3874 if ( !cur || !cur.ownerdocument || cur === context ) {3875 break;3876 }3877 }3878 }3879 }3880 ret = ret.length > 1 ? jquery.unique(ret) : ret;3881 return this.pushstack( ret, "closest", selectors );3882 },3883 // determine the position of an element within3884 // the matched set of elements3885 index: function( elem ) {3886 if ( !elem || typeof elem === "string" ) {3887 return jquery.inarray( this[0],3888 // if it receives a string, the selector is used3889 // if it receives nothing, the siblings are used3890 elem ? jquery( elem ) : this.parent().children() );3891 }3892 // locate the position of the desired element3893 return jquery.inarray(3894 // if it receives a jquery object, the first element is used3895 elem.jquery ? elem[0] : elem, this );3896 },3897 add: function( selector, context ) {3898 var set = typeof selector === "string" ?3899 jquery( selector, context ) :3900 jquery.makearray( selector ),3901 all = jquery.merge( this.get(), set );3902 return this.pushstack( isdisconnected( set[0] ) || isdisconnected( all[0] ) ?3903 all :3904 jquery.unique( all ) );3905 },3906 andself: function() {3907 return this.add( this.prevobject );3908 }3909});3910// a painfully simple check to see if an element is disconnected3911// from a document (should be improved, where feasible).3912function isdisconnected( node ) {3913 return !node || !node.parentnode || node.parentnode.nodetype === 11;3914}3915jquery.each({3916 parent: function( elem ) {3917 var parent = elem.parentnode;3918 return parent && parent.nodetype !== 11 ? parent : null;3919 },3920 parents: function( elem ) {3921 return jquery.dir( elem, "parentnode" );3922 },3923 parentsuntil: function( elem, i, until ) {3924 return jquery.dir( elem, "parentnode", until );3925 },3926 next: function( elem ) {3927 return jquery.nth( elem, 2, "nextsibling" );3928 },3929 prev: function( elem ) {3930 return jquery.nth( elem, 2, "previoussibling" );3931 },3932 nextall: function( elem ) {3933 return jquery.dir( elem, "nextsibling" );3934 },3935 prevall: function( elem ) {3936 return jquery.dir( elem, "previoussibling" );3937 },3938 nextuntil: function( elem, i, until ) {3939 return jquery.dir( elem, "nextsibling", until );3940 },3941 prevuntil: function( elem, i, until ) {3942 return jquery.dir( elem, "previoussibling", until );3943 },3944 siblings: function( elem ) {3945 return jquery.sibling( elem.parentnode.firstchild, elem );3946 },3947 children: function( elem ) {3948 return jquery.sibling( elem.firstchild );3949 },3950 contents: function( elem ) {3951 return jquery.nodename( elem, "iframe" ) ?3952 elem.contentdocument || elem.contentwindow.document :3953 jquery.makearray( elem.childnodes );3954 }3955}, function( name, fn ) {3956 jquery.fn[ name ] = function( until, selector ) {3957 var ret = jquery.map( this, fn, until ),3958 // the variable 'args' was introduced in3959 // https://github.com/jquery/jquery/commit/52a02383960 // to work around a bug in chrome 10 (dev) and should be removed when the bug is fixed.3961 // http://code.google.com/p/v8/issues/detail?id=10503962 args = slice.call(arguments);3963 if ( !runtil.test( name ) ) {3964 selector = until;3965 }3966 if ( selector && typeof selector === "string" ) {3967 ret = jquery.filter( selector, ret );3968 }3969 ret = this.length > 1 && !guaranteedunique[ name ] ? jquery.unique( ret ) : ret;3970 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {3971 ret = ret.reverse();3972 }3973 return this.pushstack( ret, name, args.join(",") );3974 };3975});3976jquery.extend({3977 filter: function( expr, elems, not ) {3978 if ( not ) {3979 expr = ":not(" + expr + ")";3980 }3981 return elems.length === 1 ?3982 jquery.find.matchesselector(elems[0], expr) ? [ elems[0] ] : [] :3983 jquery.find.matches(expr, elems);3984 },3985 dir: function( elem, dir, until ) {3986 var matched = [],3987 cur = elem[ dir ];3988 while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) {3989 if ( cur.nodetype === 1 ) {3990 matched.push( cur );3991 }3992 cur = cur[dir];3993 }3994 return matched;3995 },3996 nth: function( cur, result, dir, elem ) {3997 result = result || 1;3998 var num = 0;3999 for ( ; cur; cur = cur[dir] ) {4000 if ( cur.nodetype === 1 && ++num === result ) {4001 break;4002 }4003 }4004 return cur;4005 },4006 sibling: function( n, elem ) {4007 var r = [];4008 for ( ; n; n = n.nextsibling ) {4009 if ( n.nodetype === 1 && n !== elem ) {4010 r.push( n );4011 }4012 }4013 return r;4014 }4015});4016// implement the identical functionality for filter and not4017function winnow( elements, qualifier, keep ) {4018 if ( jquery.isfunction( qualifier ) ) {4019 return jquery.grep(elements, function( elem, i ) {4020 var retval = !!qualifier.call( elem, i, elem );4021 return retval === keep;4022 });4023 } else if ( qualifier.nodetype ) {4024 return jquery.grep(elements, function( elem, i ) {4025 return (elem === qualifier) === keep;4026 });4027 } else if ( typeof qualifier === "string" ) {4028 var filtered = jquery.grep(elements, function( elem ) {4029 return elem.nodetype === 1;4030 });4031 if ( issimple.test( qualifier ) ) {4032 return jquery.filter(qualifier, filtered, !keep);4033 } else {4034 qualifier = jquery.filter( qualifier, filtered );4035 }4036 }4037 return jquery.grep(elements, function( elem, i ) {4038 return (jquery.inarray( elem, qualifier ) >= 0) === keep;4039 });4040}4041var rinlinejquery = / jquery\d+="(?:\d+|null)"/g,4042 rleadingwhitespace = /^\s+/,4043 rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,4044 rtagname = /<([\w:]+)/,4045 rtbody = /<tbody/i,4046 rhtml = /<|&#?\w+;/,4047 rnocache = /<(?:script|object|embed|option|style)/i,4048 // checked="checked" or checked4049 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,4050 wrapmap = {4051 option: [ 1, "<select multiple='multiple'>", "</select>" ],4052 legend: [ 1, "<fieldset>", "</fieldset>" ],4053 thead: [ 1, "<table>", "</table>" ],4054 tr: [ 2, "<table><tbody>", "</tbody></table>" ],4055 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],4056 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],4057 area: [ 1, "<map>", "</map>" ],4058 _default: [ 0, "", "" ]4059 };4060wrapmap.optgroup = wrapmap.option;4061wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead;4062wrapmap.th = wrapmap.td;4063// ie can't serialize <link> and <script> tags normally4064if ( !jquery.support.htmlserialize ) {4065 wrapmap._default = [ 1, "div<div>", "</div>" ];4066}4067jquery.fn.extend({4068 text: function( text ) {4069 if ( jquery.isfunction(text) ) {4070 return this.each(function(i) {4071 var self = jquery( this );4072 self.text( text.call(this, i, self.text()) );4073 });4074 }4075 if ( typeof text !== "object" && text !== undefined ) {4076 return this.empty().append( (this[0] && this[0].ownerdocument || document).createtextnode( text ) );4077 }4078 return jquery.text( this );4079 },4080 wrapall: function( html ) {4081 if ( jquery.isfunction( html ) ) {4082 return this.each(function(i) {4083 jquery(this).wrapall( html.call(this, i) );4084 });4085 }4086 if ( this[0] ) {4087 // the elements to wrap the target around4088 var wrap = jquery( html, this[0].ownerdocument ).eq(0).clone(true);4089 if ( this[0].parentnode ) {4090 wrap.insertbefore( this[0] );4091 }4092 wrap.map(function() {4093 var elem = this;4094 while ( elem.firstchild && elem.firstchild.nodetype === 1 ) {4095 elem = elem.firstchild;4096 }4097 return elem;4098 }).append(this);4099 }4100 return this;4101 },4102 wrapinner: function( html ) {4103 if ( jquery.isfunction( html ) ) {4104 return this.each(function(i) {4105 jquery(this).wrapinner( html.call(this, i) );4106 });4107 }4108 return this.each(function() {4109 var self = jquery( this ),4110 contents = self.contents();4111 if ( contents.length ) {4112 contents.wrapall( html );4113 } else {4114 self.append( html );4115 }4116 });4117 },4118 wrap: function( html ) {4119 return this.each(function() {4120 jquery( this ).wrapall( html );4121 });4122 },4123 unwrap: function() {4124 return this.parent().each(function() {4125 if ( !jquery.nodename( this, "body" ) ) {4126 jquery( this ).replacewith( this.childnodes );4127 }4128 }).end();4129 },4130 append: function() {4131 return this.dommanip(arguments, true, function( elem ) {4132 if ( this.nodetype === 1 ) {4133 this.appendchild( elem );4134 }4135 });4136 },4137 prepend: function() {4138 return this.dommanip(arguments, true, function( elem ) {4139 if ( this.nodetype === 1 ) {4140 this.insertbefore( elem, this.firstchild );4141 }4142 });4143 },4144 before: function() {4145 if ( this[0] && this[0].parentnode ) {4146 return this.dommanip(arguments, false, function( elem ) {4147 this.parentnode.insertbefore( elem, this );4148 });4149 } else if ( arguments.length ) {4150 var set = jquery(arguments[0]);4151 set.push.apply( set, this.toarray() );4152 return this.pushstack( set, "before", arguments );4153 }4154 },4155 after: function() {4156 if ( this[0] && this[0].parentnode ) {4157 return this.dommanip(arguments, false, function( elem ) {4158 this.parentnode.insertbefore( elem, this.nextsibling );4159 });4160 } else if ( arguments.length ) {4161 var set = this.pushstack( this, "after", arguments );4162 set.push.apply( set, jquery(arguments[0]).toarray() );4163 return set;4164 }4165 },4166 // keepdata is for internal use only--do not document4167 remove: function( selector, keepdata ) {4168 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {4169 if ( !selector || jquery.filter( selector, [ elem ] ).length ) {4170 if ( !keepdata && elem.nodetype === 1 ) {4171 jquery.cleandata( elem.getelementsbytagname("*") );4172 jquery.cleandata( [ elem ] );4173 }4174 if ( elem.parentnode ) {4175 elem.parentnode.removechild( elem );4176 }4177 }4178 }4179 return this;4180 },4181 empty: function() {4182 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {4183 // remove element nodes and prevent memory leaks4184 if ( elem.nodetype === 1 ) {4185 jquery.cleandata( elem.getelementsbytagname("*") );4186 }4187 // remove any remaining nodes4188 while ( elem.firstchild ) {4189 elem.removechild( elem.firstchild );4190 }4191 }4192 return this;4193 },4194 clone: function( dataandevents, deepdataandevents ) {4195 dataandevents = dataandevents == null ? false : dataandevents;4196 deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents;4197 return this.map( function () {4198 return jquery.clone( this, dataandevents, deepdataandevents );4199 });4200 },4201 html: function( value ) {4202 if ( value === undefined ) {4203 return this[0] && this[0].nodetype === 1 ?4204 this[0].innerhtml.replace(rinlinejquery, "") :4205 null;4206 // see if we can take a shortcut and just use innerhtml4207 } else if ( typeof value === "string" && !rnocache.test( value ) &&4208 (jquery.support.leadingwhitespace || !rleadingwhitespace.test( value )) &&4209 !wrapmap[ (rtagname.exec( value ) || ["", ""])[1].tolowercase() ] ) {4210 value = value.replace(rxhtmltag, "<$1></$2>");4211 try {4212 for ( var i = 0, l = this.length; i < l; i++ ) {4213 // remove element nodes and prevent memory leaks4214 if ( this[i].nodetype === 1 ) {4215 jquery.cleandata( this[i].getelementsbytagname("*") );4216 this[i].innerhtml = value;4217 }4218 }4219 // if using innerhtml throws an exception, use the fallback method4220 } catch(e) {4221 this.empty().append( value );4222 }4223 } else if ( jquery.isfunction( value ) ) {4224 this.each(function(i){4225 var self = jquery( this );4226 self.html( value.call(this, i, self.html()) );4227 });4228 } else {4229 this.empty().append( value );4230 }4231 return this;4232 },4233 replacewith: function( value ) {4234 if ( this[0] && this[0].parentnode ) {4235 // make sure that the elements are removed from the dom before they are inserted4236 // this can help fix replacing a parent with child elements4237 if ( jquery.isfunction( value ) ) {4238 return this.each(function(i) {4239 var self = jquery(this), old = self.html();4240 self.replacewith( value.call( this, i, old ) );4241 });4242 }4243 if ( typeof value !== "string" ) {4244 value = jquery( value ).detach();4245 }4246 return this.each(function() {4247 var next = this.nextsibling,4248 parent = this.parentnode;4249 jquery( this ).remove();4250 if ( next ) {4251 jquery(next).before( value );4252 } else {4253 jquery(parent).append( value );4254 }4255 });4256 } else {4257 return this.pushstack( jquery(jquery.isfunction(value) ? value() : value), "replacewith", value );4258 }4259 },4260 detach: function( selector ) {4261 return this.remove( selector, true );4262 },4263 dommanip: function( args, table, callback ) {4264 var results, first, fragment, parent,4265 value = args[0],4266 scripts = [];4267 // we can't clonenode fragments that contain checked, in webkit4268 if ( !jquery.support.checkclone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {4269 return this.each(function() {4270 jquery(this).dommanip( args, table, callback, true );4271 });4272 }4273 if ( jquery.isfunction(value) ) {4274 return this.each(function(i) {4275 var self = jquery(this);4276 args[0] = value.call(this, i, table ? self.html() : undefined);4277 self.dommanip( args, table, callback );4278 });4279 }4280 if ( this[0] ) {4281 parent = value && value.parentnode;4282 // if we're in a fragment, just use that instead of building a new one4283 if ( jquery.support.parentnode && parent && parent.nodetype === 11 && parent.childnodes.length === this.length ) {4284 results = { fragment: parent };4285 } else {4286 results = jquery.buildfragment( args, this, scripts );4287 }4288 fragment = results.fragment;4289 if ( fragment.childnodes.length === 1 ) {4290 first = fragment = fragment.firstchild;4291 } else {4292 first = fragment.firstchild;4293 }4294 if ( first ) {4295 table = table && jquery.nodename( first, "tr" );4296 for ( var i = 0, l = this.length, lastindex = l - 1; i < l; i++ ) {4297 callback.call(4298 table ?4299 root(this[i], first) :4300 this[i],4301 // make sure that we do not leak memory by inadvertently discarding4302 // the original fragment (which might have attached data) instead of4303 // using it; in addition, use the original fragment object for the last4304 // item instead of first because it can end up being emptied incorrectly4305 // in certain situations (bug #8070).4306 // fragments from the fragment cache must always be cloned and never used4307 // in place.4308 results.cacheable || (l > 1 && i < lastindex) ?4309 jquery.clone( fragment, true, true ) :4310 fragment4311 );4312 }4313 }4314 if ( scripts.length ) {4315 jquery.each( scripts, evalscript );4316 }4317 }4318 return this;4319 }4320});4321function root( elem, cur ) {4322 return jquery.nodename(elem, "table") ?4323 (elem.getelementsbytagname("tbody")[0] ||4324 elem.appendchild(elem.ownerdocument.createelement("tbody"))) :4325 elem;4326}4327function clonecopyevent( src, dest ) {4328 if ( dest.nodetype !== 1 || !jquery.hasdata( src ) ) {4329 return;4330 }4331 var internalkey = jquery.expando,4332 olddata = jquery.data( src ),4333 curdata = jquery.data( dest, olddata );4334 // switch to use the internal data object, if it exists, for the next4335 // stage of data copying4336 if ( (olddata = olddata[ internalkey ]) ) {4337 var events = olddata.events;4338 curdata = curdata[ internalkey ] = jquery.extend({}, olddata);4339 if ( events ) {4340 delete curdata.handle;4341 curdata.events = {};4342 for ( var type in events ) {4343 for ( var i = 0, l = events[ type ].length; i < l; i++ ) {4344 jquery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );4345 }4346 }4347 }4348 }4349}4350function clonefixattributes(src, dest) {4351 // we do not need to do anything for non-elements4352 if ( dest.nodetype !== 1 ) {4353 return;4354 }4355 var nodename = dest.nodename.tolowercase();4356 // clearattributes removes the attributes, which we don't want,4357 // but also removes the attachevent events, which we *do* want4358 dest.clearattributes();4359 // mergeattributes, in contrast, only merges back on the4360 // original attributes, not the events4361 dest.mergeattributes(src);4362 // ie6-8 fail to clone children inside object elements that use4363 // the proprietary classid attribute value (rather than the type4364 // attribute) to identify the type of content to display4365 if ( nodename === "object" ) {4366 dest.outerhtml = src.outerhtml;4367 } else if ( nodename === "input" && (src.type === "checkbox" || src.type === "radio") ) {4368 // ie6-8 fails to persist the checked state of a cloned checkbox4369 // or radio button. worse, ie6-7 fail to give the cloned element4370 // a checked appearance if the defaultchecked value isn't also set4371 if ( src.checked ) {4372 dest.defaultchecked = dest.checked = src.checked;4373 }4374 // ie6-7 get confused and end up setting the value of a cloned4375 // checkbox/radio button to an empty string instead of "on"4376 if ( dest.value !== src.value ) {4377 dest.value = src.value;4378 }4379 // ie6-8 fails to return the selected option to the default selected4380 // state when cloning options4381 } else if ( nodename === "option" ) {4382 dest.selected = src.defaultselected;4383 // ie6-8 fails to set the defaultvalue to the correct value when4384 // cloning other types of input fields4385 } else if ( nodename === "input" || nodename === "textarea" ) {4386 dest.defaultvalue = src.defaultvalue;4387 }4388 // event data gets referenced instead of copied if the expando4389 // gets copied too4390 dest.removeattribute( jquery.expando );4391}4392jquery.buildfragment = function( args, nodes, scripts ) {4393 var fragment, cacheable, cacheresults,4394 doc = (nodes && nodes[0] ? nodes[0].ownerdocument || nodes[0] : document);4395 // only cache "small" (1/2 kb) html strings that are associated with the main document4396 // cloning options loses the selected state, so don't cache them4397 // ie 6 doesn't like it when you put <object> or <embed> elements in a fragment4398 // also, webkit does not clone 'checked' attributes on clonenode, so don't cache4399 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&4400 args[0].charat(0) === "<" && !rnocache.test( args[0] ) && (jquery.support.checkclone || !rchecked.test( args[0] )) ) {4401 cacheable = true;4402 cacheresults = jquery.fragments[ args[0] ];4403 if ( cacheresults ) {4404 if ( cacheresults !== 1 ) {4405 fragment = cacheresults;4406 }4407 }4408 }4409 if ( !fragment ) {4410 fragment = doc.createdocumentfragment();4411 jquery.clean( args, doc, fragment, scripts );4412 }4413 if ( cacheable ) {4414 jquery.fragments[ args[0] ] = cacheresults ? fragment : 1;4415 }4416 return { fragment: fragment, cacheable: cacheable };4417};4418jquery.fragments = {};4419jquery.each({4420 appendto: "append",4421 prependto: "prepend",4422 insertbefore: "before",4423 insertafter: "after",4424 replaceall: "replacewith"4425}, function( name, original ) {4426 jquery.fn[ name ] = function( selector ) {4427 var ret = [],4428 insert = jquery( selector ),4429 parent = this.length === 1 && this[0].parentnode;4430 if ( parent && parent.nodetype === 11 && parent.childnodes.length === 1 && insert.length === 1 ) {4431 insert[ original ]( this[0] );4432 return this;4433 } else {4434 for ( var i = 0, l = insert.length; i < l; i++ ) {4435 var elems = (i > 0 ? this.clone(true) : this).get();4436 jquery( insert[i] )[ original ]( elems );4437 ret = ret.concat( elems );4438 }4439 return this.pushstack( ret, name, insert.selector );4440 }4441 };4442});4443function getall( elem ) {4444 if ( "getelementsbytagname" in elem ) {4445 return elem.getelementsbytagname( "*" );4446 4447 } else if ( "queryselectorall" in elem ) {4448 return elem.queryselectorall( "*" );4449 } else {4450 return [];4451 }4452}4453jquery.extend({4454 clone: function( elem, dataandevents, deepdataandevents ) {4455 var clone = elem.clonenode(true),4456 srcelements,4457 destelements,4458 i;4459 if ( (!jquery.support.nocloneevent || !jquery.support.noclonechecked) &&4460 (elem.nodetype === 1 || elem.nodetype === 11) && !jquery.isxmldoc(elem) ) {4461 // ie copies events bound via attachevent when using clonenode.4462 // calling detachevent on the clone will also remove the events4463 // from the original. in order to get around this, we use some4464 // proprietary methods to clear the events. thanks to mootools4465 // guys for this hotness.4466 clonefixattributes( elem, clone );4467 // using sizzle here is crazy slow, so we use getelementsbytagname4468 // instead4469 srcelements = getall( elem );4470 destelements = getall( clone );4471 // weird iteration because ie will replace the length property4472 // with an element if you are cloning the body and one of the4473 // elements on the page has a name or id of "length"4474 for ( i = 0; srcelements[i]; ++i ) {4475 clonefixattributes( srcelements[i], destelements[i] );4476 }4477 }4478 // copy the events from the original to the clone4479 if ( dataandevents ) {4480 clonecopyevent( elem, clone );4481 if ( deepdataandevents ) {4482 srcelements = getall( elem );4483 destelements = getall( clone );4484 for ( i = 0; srcelements[i]; ++i ) {4485 clonecopyevent( srcelements[i], destelements[i] );4486 }4487 }4488 }4489 // return the cloned set4490 return clone;4491},4492 clean: function( elems, context, fragment, scripts ) {4493 context = context || document;4494 // !context.createelement fails in ie with an error but returns typeof 'object'4495 if ( typeof context.createelement === "undefined" ) {4496 context = context.ownerdocument || context[0] && context[0].ownerdocument || document;4497 }4498 var ret = [];4499 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {4500 if ( typeof elem === "number" ) {4501 elem += "";4502 }4503 if ( !elem ) {4504 continue;4505 }4506 // convert html string into dom nodes4507 if ( typeof elem === "string" && !rhtml.test( elem ) ) {4508 elem = context.createtextnode( elem );4509 } else if ( typeof elem === "string" ) {4510 // fix "xhtml"-style tags in all browsers4511 elem = elem.replace(rxhtmltag, "<$1></$2>");4512 // trim whitespace, otherwise indexof won't work as expected4513 var tag = (rtagname.exec( elem ) || ["", ""])[1].tolowercase(),4514 wrap = wrapmap[ tag ] || wrapmap._default,4515 depth = wrap[0],4516 div = context.createelement("div");4517 // go to html and back, then peel off extra wrappers4518 div.innerhtml = wrap[1] + elem + wrap[2];4519 // move to the right depth4520 while ( depth-- ) {4521 div = div.lastchild;4522 }4523 // remove ie's autoinserted <tbody> from table fragments4524 if ( !jquery.support.tbody ) {4525 // string was a <table>, *may* have spurious <tbody>4526 var hasbody = rtbody.test(elem),4527 tbody = tag === "table" && !hasbody ?4528 div.firstchild && div.firstchild.childnodes :4529 // string was a bare <thead> or <tfoot>4530 wrap[1] === "<table>" && !hasbody ?4531 div.childnodes :4532 [];4533 for ( var j = tbody.length - 1; j >= 0 ; --j ) {4534 if ( jquery.nodename( tbody[ j ], "tbody" ) && !tbody[ j ].childnodes.length ) {4535 tbody[ j ].parentnode.removechild( tbody[ j ] );4536 }4537 }4538 }4539 // ie completely kills leading whitespace when innerhtml is used4540 if ( !jquery.support.leadingwhitespace && rleadingwhitespace.test( elem ) ) {4541 div.insertbefore( context.createtextnode( rleadingwhitespace.exec(elem)[0] ), div.firstchild );4542 }4543 elem = div.childnodes;4544 }4545 if ( elem.nodetype ) {4546 ret.push( elem );4547 } else {4548 ret = jquery.merge( ret, elem );4549 }4550 }4551 if ( fragment ) {4552 for ( i = 0; ret[i]; i++ ) {4553 if ( scripts && jquery.nodename( ret[i], "script" ) && (!ret[i].type || ret[i].type.tolowercase() === "text/javascript") ) {4554 scripts.push( ret[i].parentnode ? ret[i].parentnode.removechild( ret[i] ) : ret[i] );4555 } else {4556 if ( ret[i].nodetype === 1 ) {4557 ret.splice.apply( ret, [i + 1, 0].concat(jquery.makearray(ret[i].getelementsbytagname("script"))) );4558 }4559 fragment.appendchild( ret[i] );4560 }4561 }4562 }4563 return ret;4564 },4565 cleandata: function( elems ) {4566 var data, id, cache = jquery.cache, internalkey = jquery.expando, special = jquery.event.special,4567 deleteexpando = jquery.support.deleteexpando;4568 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {4569 if ( elem.nodename && jquery.nodata[elem.nodename.tolowercase()] ) {4570 continue;4571 }4572 id = elem[ jquery.expando ];4573 if ( id ) {4574 data = cache[ id ] && cache[ id ][ internalkey ];4575 if ( data && data.events ) {4576 for ( var type in data.events ) {4577 if ( special[ type ] ) {4578 jquery.event.remove( elem, type );4579 // this is a shortcut to avoid jquery.event.remove's overhead4580 } else {4581 jquery.removeevent( elem, type, data.handle );4582 }4583 }4584 // null the dom reference to avoid ie6/7/8 leak (#7054)4585 if ( data.handle ) {4586 data.handle.elem = null;4587 }4588 }4589 if ( deleteexpando ) {4590 delete elem[ jquery.expando ];4591 } else if ( elem.removeattribute ) {4592 elem.removeattribute( jquery.expando );4593 }4594 delete cache[ id ];4595 }4596 }4597 }4598});4599function evalscript( i, elem ) {4600 if ( elem.src ) {4601 jquery.ajax({4602 url: elem.src,4603 async: false,4604 datatype: "script"4605 });4606 } else {4607 jquery.globaleval( elem.text || elem.textcontent || elem.innerhtml || "" );4608 }4609 if ( elem.parentnode ) {4610 elem.parentnode.removechild( elem );4611 }4612}4613var ralpha = /alpha\([^)]*\)/i,4614 ropacity = /opacity=([^)]*)/,4615 rdashalpha = /-([a-z])/ig,4616 rupper = /([a-z])/g,4617 rnumpx = /^-?\d+(?:px)?$/i,4618 rnum = /^-?\d/,4619 cssshow = { position: "absolute", visibility: "hidden", display: "block" },4620 csswidth = [ "left", "right" ],4621 cssheight = [ "top", "bottom" ],4622 curcss,4623 getcomputedstyle,4624 currentstyle,4625 fcamelcase = function( all, letter ) {4626 return letter.touppercase();4627 };4628jquery.fn.css = function( name, value ) {4629 // setting 'undefined' is a no-op4630 if ( arguments.length === 2 && value === undefined ) {4631 return this;4632 }4633 return jquery.access( this, name, value, true, function( elem, name, value ) {4634 return value !== undefined ?4635 jquery.style( elem, name, value ) :4636 jquery.css( elem, name );4637 });4638};4639jquery.extend({4640 // add in style property hooks for overriding the default4641 // behavior of getting and setting a style property4642 csshooks: {4643 opacity: {4644 get: function( elem, computed ) {4645 if ( computed ) {4646 // we should always get a number back from opacity4647 var ret = curcss( elem, "opacity", "opacity" );4648 return ret === "" ? "1" : ret;4649 } else {4650 return elem.style.opacity;4651 }4652 }4653 }4654 },4655 // exclude the following css properties to add px4656 cssnumber: {4657 "zindex": true,4658 "fontweight": true,4659 "opacity": true,4660 "zoom": true,4661 "lineheight": true4662 },4663 // add in properties whose names you wish to fix before4664 // setting or getting the value4665 cssprops: {4666 // normalize float css property4667 "float": jquery.support.cssfloat ? "cssfloat" : "stylefloat"4668 },4669 // get and set the style property on a dom node4670 style: function( elem, name, value, extra ) {4671 // don't set styles on text and comment nodes4672 if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || !elem.style ) {4673 return;4674 }4675 // make sure that we're working with the right name4676 var ret, origname = jquery.camelcase( name ),4677 style = elem.style, hooks = jquery.csshooks[ origname ];4678 name = jquery.cssprops[ origname ] || origname;4679 // check if we're setting a value4680 if ( value !== undefined ) {4681 // make sure that nan and null values aren't set. see: #71164682 if ( typeof value === "number" && isnan( value ) || value == null ) {4683 return;4684 }4685 // if a number was passed in, add 'px' to the (except for certain css properties)4686 if ( typeof value === "number" && !jquery.cssnumber[ origname ] ) {4687 value += "px";4688 }4689 // if a hook was provided, use that value, otherwise just set the specified value4690 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {4691 // wrapped to prevent ie from throwing errors when 'invalid' values are provided4692 // fixes bug #55094693 try {4694 style[ name ] = value;4695 } catch(e) {}4696 }4697 } else {4698 // if a hook was provided get the non-computed value from there4699 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {4700 return ret;4701 }4702 // otherwise just get the value from the style object4703 return style[ name ];4704 }4705 },4706 css: function( elem, name, extra ) {4707 // make sure that we're working with the right name4708 var ret, origname = jquery.camelcase( name ),4709 hooks = jquery.csshooks[ origname ];4710 name = jquery.cssprops[ origname ] || origname;4711 // if a hook was provided get the computed value from there4712 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {4713 return ret;4714 // otherwise, if a way to get the computed value exists, use that4715 } else if ( curcss ) {4716 return curcss( elem, name, origname );4717 }4718 },4719 // a method for quickly swapping in/out css properties to get correct calculations4720 swap: function( elem, options, callback ) {4721 var old = {};4722 // remember the old values, and insert the new ones4723 for ( var name in options ) {4724 old[ name ] = elem.style[ name ];4725 elem.style[ name ] = options[ name ];4726 }4727 callback.call( elem );4728 // revert the old values4729 for ( name in options ) {4730 elem.style[ name ] = old[ name ];4731 }4732 },4733 camelcase: function( string ) {4734 return string.replace( rdashalpha, fcamelcase );4735 }4736});4737// deprecated, use jquery.css() instead4738jquery.curcss = jquery.css;4739jquery.each(["height", "width"], function( i, name ) {4740 jquery.csshooks[ name ] = {4741 get: function( elem, computed, extra ) {4742 var val;4743 if ( computed ) {4744 if ( elem.offsetwidth !== 0 ) {4745 val = getwh( elem, name, extra );4746 } else {4747 jquery.swap( elem, cssshow, function() {4748 val = getwh( elem, name, extra );4749 });4750 }4751 if ( val <= 0 ) {4752 val = curcss( elem, name, name );4753 if ( val === "0px" && currentstyle ) {4754 val = currentstyle( elem, name, name );4755 }4756 if ( val != null ) {4757 // should return "auto" instead of 0, use 0 for4758 // temporary backwards-compat4759 return val === "" || val === "auto" ? "0px" : val;4760 }4761 }4762 if ( val < 0 || val == null ) {4763 val = elem.style[ name ];4764 // should return "auto" instead of 0, use 0 for4765 // temporary backwards-compat4766 return val === "" || val === "auto" ? "0px" : val;4767 }4768 return typeof val === "string" ? val : val + "px";4769 }4770 },4771 set: function( elem, value ) {4772 if ( rnumpx.test( value ) ) {4773 // ignore negative width and height values #15994774 value = parsefloat(value);4775 if ( value >= 0 ) {4776 return value + "px";4777 }4778 } else {4779 return value;4780 }4781 }4782 };4783});4784if ( !jquery.support.opacity ) {4785 jquery.csshooks.opacity = {4786 get: function( elem, computed ) {4787 // ie uses filters for opacity4788 return ropacity.test((computed && elem.currentstyle ? elem.currentstyle.filter : elem.style.filter) || "") ?4789 (parsefloat(regexp.$1) / 100) + "" :4790 computed ? "1" : "";4791 },4792 set: function( elem, value ) {4793 var style = elem.style;4794 // ie has trouble with opacity if it does not have layout4795 // force it by setting the zoom level4796 style.zoom = 1;4797 // set the alpha filter to set the opacity4798 var opacity = jquery.isnan(value) ?4799 "" :4800 "alpha(opacity=" + value * 100 + ")",4801 filter = style.filter || "";4802 style.filter = ralpha.test(filter) ?4803 filter.replace(ralpha, opacity) :4804 style.filter + ' ' + opacity;4805 }4806 };4807}4808if ( document.defaultview && document.defaultview.getcomputedstyle ) {4809 getcomputedstyle = function( elem, newname, name ) {4810 var ret, defaultview, computedstyle;4811 name = name.replace( rupper, "-$1" ).tolowercase();4812 if ( !(defaultview = elem.ownerdocument.defaultview) ) {4813 return undefined;4814 }4815 if ( (computedstyle = defaultview.getcomputedstyle( elem, null )) ) {4816 ret = computedstyle.getpropertyvalue( name );4817 if ( ret === "" && !jquery.contains( elem.ownerdocument.documentelement, elem ) ) {4818 ret = jquery.style( elem, name );4819 }4820 }4821 return ret;4822 };4823}4824if ( document.documentelement.currentstyle ) {4825 currentstyle = function( elem, name ) {4826 var left,4827 ret = elem.currentstyle && elem.currentstyle[ name ],4828 rsleft = elem.runtimestyle && elem.runtimestyle[ name ],4829 style = elem.style;4830 // from the awesome hack by dean edwards4831 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022914832 // if we're not dealing with a regular pixel number4833 // but a number that has a weird ending, we need to convert it to pixels4834 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {4835 // remember the original values4836 left = style.left;4837 // put in the new values to get a computed value out4838 if ( rsleft ) {4839 elem.runtimestyle.left = elem.currentstyle.left;4840 }4841 style.left = name === "fontsize" ? "1em" : (ret || 0);4842 ret = style.pixelleft + "px";4843 // revert the changed values4844 style.left = left;4845 if ( rsleft ) {4846 elem.runtimestyle.left = rsleft;4847 }4848 }4849 return ret === "" ? "auto" : ret;4850 };4851}4852curcss = getcomputedstyle || currentstyle;4853function getwh( elem, name, extra ) {4854 var which = name === "width" ? csswidth : cssheight,4855 val = name === "width" ? elem.offsetwidth : elem.offsetheight;4856 if ( extra === "border" ) {4857 return val;4858 }4859 jquery.each( which, function() {4860 if ( !extra ) {4861 val -= parsefloat(jquery.css( elem, "padding" + this )) || 0;4862 }4863 if ( extra === "margin" ) {4864 val += parsefloat(jquery.css( elem, "margin" + this )) || 0;4865 } else {4866 val -= parsefloat(jquery.css( elem, "border" + this + "width" )) || 0;4867 }4868 });4869 return val;4870}4871if ( jquery.expr && jquery.expr.filters ) {4872 jquery.expr.filters.hidden = function( elem ) {4873 var width = elem.offsetwidth,4874 height = elem.offsetheight;4875 return (width === 0 && height === 0) || (!jquery.support.reliablehiddenoffsets && (elem.style.display || jquery.css( elem, "display" )) === "none");4876 };4877 jquery.expr.filters.visible = function( elem ) {4878 return !jquery.expr.filters.hidden( elem );4879 };4880}4881var r20 = /%20/g,4882 rbracket = /\[\]$/,4883 rcrlf = /\r?\n/g,4884 rhash = /#.*$/,4885 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // ie leaves an \r character at eol4886 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,4887 // #7653, #8125, #8152: local protocol detection4888 rlocalprotocol = /(?:^file|^widget|\-extension):$/,4889 rnocontent = /^(?:get|head)$/,4890 rprotocol = /^\/\//,4891 rquery = /\?/,4892 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,4893 rselecttextarea = /^(?:select|textarea)/i,4894 rspacesajax = /\s+/,4895 rts = /([?&])_=[^&]*/,4896 rucheaders = /(^|\-)([a-z])/g,4897 rucheadersfunc = function( _, $1, $2 ) {4898 return $1 + $2.touppercase();4899 },4900 rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,4901 // keep a copy of the old load method4902 _load = jquery.fn.load,4903 /* prefilters4904 * 1) they are useful to introduce custom datatypes (see ajax/jsonp.js for an example)4905 * 2) these are called:4906 * - before asking for a transport4907 * - after param serialization (s.data is a string if s.processdata is true)4908 * 3) key is the datatype4909 * 4) the catchall symbol "*" can be used4910 * 5) execution will start with transport datatype and then continue down to "*" if needed4911 */4912 prefilters = {},4913 /* transports bindings4914 * 1) key is the datatype4915 * 2) the catchall symbol "*" can be used4916 * 3) selection will start with transport datatype and then go to "*" if needed4917 */4918 transports = {},4919 // document location4920 ajaxlocation,4921 // document location segments4922 ajaxlocparts;4923// #8138, ie may throw an exception when accessing4924// a field from document.location if document.domain has been set4925try {4926 ajaxlocation = document.location.href;4927} catch( e ) {4928 // use the href attribute of an a element4929 // since ie will modify it given document.location4930 ajaxlocation = document.createelement( "a" );4931 ajaxlocation.href = "";4932 ajaxlocation = ajaxlocation.href;4933}4934// segment location into parts4935ajaxlocparts = rurl.exec( ajaxlocation.tolowercase() );4936// base "constructor" for jquery.ajaxprefilter and jquery.ajaxtransport4937function addtoprefiltersortransports( structure ) {4938 // datatypeexpression is optional and defaults to "*"4939 return function( datatypeexpression, func ) {4940 if ( typeof datatypeexpression !== "string" ) {4941 func = datatypeexpression;4942 datatypeexpression = "*";4943 }4944 if ( jquery.isfunction( func ) ) {4945 var datatypes = datatypeexpression.tolowercase().split( rspacesajax ),4946 i = 0,4947 length = datatypes.length,4948 datatype,4949 list,4950 placebefore;4951 // for each datatype in the datatypeexpression4952 for(; i < length; i++ ) {4953 datatype = datatypes[ i ];4954 // we control if we're asked to add before4955 // any existing element4956 placebefore = /^\+/.test( datatype );4957 if ( placebefore ) {4958 datatype = datatype.substr( 1 ) || "*";4959 }4960 list = structure[ datatype ] = structure[ datatype ] || [];4961 // then we add to the structure accordingly4962 list[ placebefore ? "unshift" : "push" ]( func );4963 }4964 }4965 };4966}4967//base inspection function for prefilters and transports4968function inspectprefiltersortransports( structure, options, originaloptions, jqxhr,4969 datatype /* internal */, inspected /* internal */ ) {4970 datatype = datatype || options.datatypes[ 0 ];4971 inspected = inspected || {};4972 inspected[ datatype ] = true;4973 var list = structure[ datatype ],4974 i = 0,4975 length = list ? list.length : 0,4976 executeonly = ( structure === prefilters ),4977 selection;4978 for(; i < length && ( executeonly || !selection ); i++ ) {4979 selection = list[ i ]( options, originaloptions, jqxhr );4980 // if we got redirected to another datatype4981 // we try there if executing only and not done already4982 if ( typeof selection === "string" ) {4983 if ( !executeonly || inspected[ selection ] ) {4984 selection = undefined;4985 } else {4986 options.datatypes.unshift( selection );4987 selection = inspectprefiltersortransports(4988 structure, options, originaloptions, jqxhr, selection, inspected );4989 }4990 }4991 }4992 // if we're only executing or nothing was selected4993 // we try the catchall datatype if not done already4994 if ( ( executeonly || !selection ) && !inspected[ "*" ] ) {4995 selection = inspectprefiltersortransports(4996 structure, options, originaloptions, jqxhr, "*", inspected );4997 }4998 // unnecessary when only executing (prefilters)4999 // but it'll be ignored by the caller in that case5000 return selection;5001}5002jquery.fn.extend({5003 load: function( url, params, callback ) {5004 if ( typeof url !== "string" && _load ) {5005 return _load.apply( this, arguments );5006 // don't do a request if no elements are being requested5007 } else if ( !this.length ) {5008 return this;5009 }5010 var off = url.indexof( " " );5011 if ( off >= 0 ) {5012 var selector = url.slice( off, url.length );5013 url = url.slice( 0, off );5014 }5015 // default to a get request5016 var type = "get";5017 // if the second parameter was provided5018 if ( params ) {5019 // if it's a function5020 if ( jquery.isfunction( params ) ) {5021 // we assume that it's the callback5022 callback = params;5023 params = undefined;5024 // otherwise, build a param string5025 } else if ( typeof params === "object" ) {5026 params = jquery.param( params, jquery.ajaxsettings.traditional );5027 type = "post";5028 }5029 }5030 var self = this;5031 // request the remote document5032 jquery.ajax({5033 url: url,5034 type: type,5035 datatype: "html",5036 data: params,5037 // complete callback (responsetext is used internally)5038 complete: function( jqxhr, status, responsetext ) {5039 // store the response as specified by the jqxhr object5040 responsetext = jqxhr.responsetext;5041 // if successful, inject the html into all the matched elements5042 if ( jqxhr.isresolved() ) {5043 // #4825: get the actual response in case5044 // a datafilter is present in ajaxsettings5045 jqxhr.done(function( r ) {5046 responsetext = r;5047 });5048 // see if a selector was specified5049 self.html( selector ?5050 // create a dummy div to hold the results5051 jquery("<div>")5052 // inject the contents of the document in, removing the scripts5053 // to avoid any 'permission denied' errors in ie5054 .append(responsetext.replace(rscript, ""))5055 // locate the specified elements5056 .find(selector) :5057 // if not, just inject the full result5058 responsetext );5059 }5060 if ( callback ) {5061 self.each( callback, [ responsetext, status, jqxhr ] );5062 }5063 }5064 });5065 return this;5066 },5067 serialize: function() {5068 return jquery.param( this.serializearray() );5069 },5070 serializearray: function() {5071 return this.map(function(){5072 return this.elements ? jquery.makearray( this.elements ) : this;5073 })5074 .filter(function(){5075 return this.name && !this.disabled &&5076 ( this.checked || rselecttextarea.test( this.nodename ) ||5077 rinput.test( this.type ) );5078 })5079 .map(function( i, elem ){5080 var val = jquery( this ).val();5081 return val == null ?5082 null :5083 jquery.isarray( val ) ?5084 jquery.map( val, function( val, i ){5085 return { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };5086 }) :5087 { name: elem.name, value: val.replace( rcrlf, "\r\n" ) };5088 }).get();5089 }5090});5091// attach a bunch of functions for handling common ajax events5092jquery.each( "ajaxstart ajaxstop ajaxcomplete ajaxerror ajaxsuccess ajaxsend".split( " " ), function( i, o ){5093 jquery.fn[ o ] = function( f ){5094 return this.bind( o, f );5095 };5096} );5097jquery.each( [ "get", "post" ], function( i, method ) {5098 jquery[ method ] = function( url, data, callback, type ) {5099 // shift arguments if data argument was omitted5100 if ( jquery.isfunction( data ) ) {5101 type = type || callback;5102 callback = data;5103 data = undefined;5104 }5105 return jquery.ajax({5106 type: method,5107 url: url,5108 data: data,5109 success: callback,5110 datatype: type5111 });5112 };5113} );5114jquery.extend({5115 getscript: function( url, callback ) {5116 return jquery.get( url, undefined, callback, "script" );5117 },5118 getjson: function( url, data, callback ) {5119 return jquery.get( url, data, callback, "json" );5120 },5121 // creates a full fledged settings object into target5122 // with both ajaxsettings and settings fields.5123 // if target is omitted, writes into ajaxsettings.5124 ajaxsetup: function ( target, settings ) {5125 if ( !settings ) {5126 // only one parameter, we extend ajaxsettings5127 settings = target;5128 target = jquery.extend( true, jquery.ajaxsettings, settings );5129 } else {5130 // target was provided, we extend into it5131 jquery.extend( true, target, jquery.ajaxsettings, settings );5132 }5133 // flatten fields we don't want deep extended5134 for( var field in { context: 1, url: 1 } ) {5135 if ( field in settings ) {5136 target[ field ] = settings[ field ];5137 } else if( field in jquery.ajaxsettings ) {5138 target[ field ] = jquery.ajaxsettings[ field ];5139 }5140 }5141 return target;5142 },5143 ajaxsettings: {5144 url: ajaxlocation,5145 islocal: rlocalprotocol.test( ajaxlocparts[ 1 ] ),5146 global: true,5147 type: "get",5148 contenttype: "application/x-www-form-urlencoded",5149 processdata: true,5150 async: true,5151 /*5152 timeout: 0,5153 data: null,5154 datatype: null,5155 username: null,5156 password: null,5157 cache: null,5158 traditional: false,5159 headers: {},5160 crossdomain: null,5161 */5162 accepts: {5163 xml: "application/xml, text/xml",5164 html: "text/html",5165 text: "text/plain",5166 json: "application/json, text/javascript",5167 "*": "*/*"5168 },5169 contents: {5170 xml: /xml/,5171 html: /html/,5172 json: /json/5173 },5174 responsefields: {5175 xml: "responsexml",5176 text: "responsetext"5177 },5178 // list of data converters5179 // 1) key format is "source_type destination_type" (a single space in-between)5180 // 2) the catchall symbol "*" can be used for source_type5181 converters: {5182 // convert anything to text5183 "* text": window.string,5184 // text to html (true = no transformation)5185 "text html": true,5186 // evaluate text as a json expression5187 "text json": jquery.parsejson,5188 // parse text as xml5189 "text xml": jquery.parsexml5190 }5191 },5192 ajaxprefilter: addtoprefiltersortransports( prefilters ),5193 ajaxtransport: addtoprefiltersortransports( transports ),5194 // main method5195 ajax: function( url, options ) {5196 // if url is an object, simulate pre-1.5 signature5197 if ( typeof url === "object" ) {5198 options = url;5199 url = undefined;5200 }5201 // force options to be an object5202 options = options || {};5203 var // create the final options object5204 s = jquery.ajaxsetup( {}, options ),5205 // callbacks context5206 callbackcontext = s.context || s,5207 // context for global events5208 // it's the callbackcontext if one was provided in the options5209 // and if it's a dom node or a jquery collection5210 globaleventcontext = callbackcontext !== s &&5211 ( callbackcontext.nodetype || callbackcontext instanceof jquery ) ?5212 jquery( callbackcontext ) : jquery.event,5213 // deferreds5214 deferred = jquery.deferred(),5215 completedeferred = jquery._deferred(),5216 // status-dependent callbacks5217 statuscode = s.statuscode || {},5218 // ifmodified key5219 ifmodifiedkey,5220 // headers (they are sent all at once)5221 requestheaders = {},5222 // response headers5223 responseheadersstring,5224 responseheaders,5225 // transport5226 transport,5227 // timeout handle5228 timeouttimer,5229 // cross-domain detection vars5230 parts,5231 // the jqxhr state5232 state = 0,5233 // to know if global events are to be dispatched5234 fireglobals,5235 // loop variable5236 i,5237 // fake xhr5238 jqxhr = {5239 readystate: 0,5240 // caches the header5241 setrequestheader: function( name, value ) {5242 if ( !state ) {5243 requestheaders[ name.tolowercase().replace( rucheaders, rucheadersfunc ) ] = value;5244 }5245 return this;5246 },5247 // raw string5248 getallresponseheaders: function() {5249 return state === 2 ? responseheadersstring : null;5250 },5251 // builds headers hashtable if needed5252 getresponseheader: function( key ) {5253 var match;5254 if ( state === 2 ) {5255 if ( !responseheaders ) {5256 responseheaders = {};5257 while( ( match = rheaders.exec( responseheadersstring ) ) ) {5258 responseheaders[ match[1].tolowercase() ] = match[ 2 ];5259 }5260 }5261 match = responseheaders[ key.tolowercase() ];5262 }5263 return match === undefined ? null : match;5264 },5265 // overrides response content-type header5266 overridemimetype: function( type ) {5267 if ( !state ) {5268 s.mimetype = type;5269 }5270 return this;5271 },5272 // cancel the request5273 abort: function( statustext ) {5274 statustext = statustext || "abort";5275 if ( transport ) {5276 transport.abort( statustext );5277 }5278 done( 0, statustext );5279 return this;5280 }5281 };5282 // callback for when everything is done5283 // it is defined here because jslint complains if it is declared5284 // at the end of the function (which would be more logical and readable)5285 function done( status, statustext, responses, headers ) {5286 // called once5287 if ( state === 2 ) {5288 return;5289 }5290 // state is "done" now5291 state = 2;5292 // clear timeout if it exists5293 if ( timeouttimer ) {5294 cleartimeout( timeouttimer );5295 }5296 // dereference transport for early garbage collection5297 // (no matter how long the jqxhr object will be used)5298 transport = undefined;5299 // cache response headers5300 responseheadersstring = headers || "";5301 // set readystate5302 jqxhr.readystate = status ? 4 : 0;5303 var issuccess,5304 success,5305 error,5306 response = responses ? ajaxhandleresponses( s, jqxhr, responses ) : undefined,5307 lastmodified,5308 etag;5309 // if successful, handle type chaining5310 if ( status >= 200 && status < 300 || status === 304 ) {5311 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.5312 if ( s.ifmodified ) {5313 if ( ( lastmodified = jqxhr.getresponseheader( "last-modified" ) ) ) {5314 jquery.lastmodified[ ifmodifiedkey ] = lastmodified;5315 }5316 if ( ( etag = jqxhr.getresponseheader( "etag" ) ) ) {5317 jquery.etag[ ifmodifiedkey ] = etag;5318 }5319 }5320 // if not modified5321 if ( status === 304 ) {5322 statustext = "notmodified";5323 issuccess = true;5324 // if we have data5325 } else {5326 try {5327 success = ajaxconvert( s, response );5328 statustext = "success";5329 issuccess = true;5330 } catch(e) {5331 // we have a parsererror5332 statustext = "parsererror";5333 error = e;5334 }5335 }5336 } else {5337 // we extract error from statustext5338 // then normalize statustext and status for non-aborts5339 error = statustext;5340 if( !statustext || status ) {5341 statustext = "error";5342 if ( status < 0 ) {5343 status = 0;5344 }5345 }5346 }5347 // set data for the fake xhr object5348 jqxhr.status = status;5349 jqxhr.statustext = statustext;5350 // success/error5351 if ( issuccess ) {5352 deferred.resolvewith( callbackcontext, [ success, statustext, jqxhr ] );5353 } else {5354 deferred.rejectwith( callbackcontext, [ jqxhr, statustext, error ] );5355 }5356 // status-dependent callbacks5357 jqxhr.statuscode( statuscode );5358 statuscode = undefined;5359 if ( fireglobals ) {5360 globaleventcontext.trigger( "ajax" + ( issuccess ? "success" : "error" ),5361 [ jqxhr, s, issuccess ? success : error ] );5362 }5363 // complete5364 completedeferred.resolvewith( callbackcontext, [ jqxhr, statustext ] );5365 if ( fireglobals ) {5366 globaleventcontext.trigger( "ajaxcomplete", [ jqxhr, s] );5367 // handle the global ajax counter5368 if ( !( --jquery.active ) ) {5369 jquery.event.trigger( "ajaxstop" );5370 }5371 }5372 }5373 // attach deferreds5374 deferred.promise( jqxhr );5375 jqxhr.success = jqxhr.done;5376 jqxhr.error = jqxhr.fail;5377 jqxhr.complete = completedeferred.done;5378 // status-dependent callbacks5379 jqxhr.statuscode = function( map ) {5380 if ( map ) {5381 var tmp;5382 if ( state < 2 ) {5383 for( tmp in map ) {5384 statuscode[ tmp ] = [ statuscode[tmp], map[tmp] ];5385 }5386 } else {5387 tmp = map[ jqxhr.status ];5388 jqxhr.then( tmp, tmp );5389 }5390 }5391 return this;5392 };5393 // remove hash character (#7531: and string promotion)5394 // add protocol if not provided (#5866: ie7 issue with protocol-less urls)5395 // we also use the url parameter if available5396 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxlocparts[ 1 ] + "//" );5397 // extract datatypes list5398 s.datatypes = jquery.trim( s.datatype || "*" ).tolowercase().split( rspacesajax );5399 // determine if a cross-domain request is in order5400 if ( !s.crossdomain ) {5401 parts = rurl.exec( s.url.tolowercase() );5402 s.crossdomain = !!( parts &&5403 ( parts[ 1 ] != ajaxlocparts[ 1 ] || parts[ 2 ] != ajaxlocparts[ 2 ] ||5404 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=5405 ( ajaxlocparts[ 3 ] || ( ajaxlocparts[ 1 ] === "http:" ? 80 : 443 ) ) )5406 );5407 }5408 // convert data if not already a string5409 if ( s.data && s.processdata && typeof s.data !== "string" ) {5410 s.data = jquery.param( s.data, s.traditional );5411 }5412 // apply prefilters5413 inspectprefiltersortransports( prefilters, s, options, jqxhr );5414 // if request was aborted inside a prefiler, stop there5415 if ( state === 2 ) {5416 return false;5417 }5418 // we can fire global events as of now if asked to5419 fireglobals = s.global;5420 // uppercase the type5421 s.type = s.type.touppercase();5422 // determine if request has content5423 s.hascontent = !rnocontent.test( s.type );5424 // watch for a new set of requests5425 if ( fireglobals && jquery.active++ === 0 ) {5426 jquery.event.trigger( "ajaxstart" );5427 }5428 // more options handling for requests with no content5429 if ( !s.hascontent ) {5430 // if data is available, append data to url5431 if ( s.data ) {5432 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;5433 }5434 // get ifmodifiedkey before adding the anti-cache parameter5435 ifmodifiedkey = s.url;5436 // add anti-cache in url if needed5437 if ( s.cache === false ) {5438 var ts = jquery.now(),5439 // try replacing _= if it is there5440 ret = s.url.replace( rts, "$1_=" + ts );5441 // if nothing was replaced, add timestamp to the end5442 s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );5443 }5444 }5445 // set the correct header, if data is being sent5446 if ( s.data && s.hascontent && s.contenttype !== false || options.contenttype ) {5447 requestheaders[ "content-type" ] = s.contenttype;5448 }5449 // set the if-modified-since and/or if-none-match header, if in ifmodified mode.5450 if ( s.ifmodified ) {5451 ifmodifiedkey = ifmodifiedkey || s.url;5452 if ( jquery.lastmodified[ ifmodifiedkey ] ) {5453 requestheaders[ "if-modified-since" ] = jquery.lastmodified[ ifmodifiedkey ];5454 }5455 if ( jquery.etag[ ifmodifiedkey ] ) {5456 requestheaders[ "if-none-match" ] = jquery.etag[ ifmodifiedkey ];5457 }5458 }5459 // set the accepts header for the server, depending on the datatype5460 requestheaders.accept = s.datatypes[ 0 ] && s.accepts[ s.datatypes[0] ] ?5461 s.accepts[ s.datatypes[0] ] + ( s.datatypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :5462 s.accepts[ "*" ];5463 // check for headers option5464 for ( i in s.headers ) {5465 jqxhr.setrequestheader( i, s.headers[ i ] );5466 }5467 // allow custom headers/mimetypes and early abort5468 if ( s.beforesend && ( s.beforesend.call( callbackcontext, jqxhr, s ) === false || state === 2 ) ) {5469 // abort if not done already5470 jqxhr.abort();5471 return false;5472 }5473 // install callbacks on deferreds5474 for ( i in { success: 1, error: 1, complete: 1 } ) {5475 jqxhr[ i ]( s[ i ] );5476 }5477 // get transport5478 transport = inspectprefiltersortransports( transports, s, options, jqxhr );5479 // if no transport, we auto-abort5480 if ( !transport ) {5481 done( -1, "no transport" );5482 } else {5483 jqxhr.readystate = 1;5484 // send global event5485 if ( fireglobals ) {5486 globaleventcontext.trigger( "ajaxsend", [ jqxhr, s ] );5487 }5488 // timeout5489 if ( s.async && s.timeout > 0 ) {5490 timeouttimer = settimeout( function(){5491 jqxhr.abort( "timeout" );5492 }, s.timeout );5493 }5494 try {5495 state = 1;5496 transport.send( requestheaders, done );5497 } catch (e) {5498 // propagate exception as error if not done5499 if ( status < 2 ) {5500 done( -1, e );5501 // simply rethrow otherwise5502 } else {5503 jquery.error( e );5504 }5505 }5506 }5507 return jqxhr;5508 },5509 // serialize an array of form elements or a set of5510 // key/values into a query string5511 param: function( a, traditional ) {5512 var s = [],5513 add = function( key, value ) {5514 // if value is a function, invoke it and return its value5515 value = jquery.isfunction( value ) ? value() : value;5516 s[ s.length ] = encodeuricomponent( key ) + "=" + encodeuricomponent( value );5517 };5518 // set traditional to true for jquery <= 1.3.2 behavior.5519 if ( traditional === undefined ) {5520 traditional = jquery.ajaxsettings.traditional;5521 }5522 // if an array was passed in, assume that it is an array of form elements.5523 if ( jquery.isarray( a ) || ( a.jquery && !jquery.isplainobject( a ) ) ) {5524 // serialize the form elements5525 jquery.each( a, function() {5526 add( this.name, this.value );5527 } );5528 } else {5529 // if traditional, encode the "old" way (the way 1.3.2 or older5530 // did it), otherwise encode params recursively.5531 for ( var prefix in a ) {5532 buildparams( prefix, a[ prefix ], traditional, add );5533 }5534 }5535 // return the resulting serialization5536 return s.join( "&" ).replace( r20, "+" );5537 }5538});5539function buildparams( prefix, obj, traditional, add ) {5540 if ( jquery.isarray( obj ) && obj.length ) {5541 // serialize array item.5542 jquery.each( obj, function( i, v ) {5543 if ( traditional || rbracket.test( prefix ) ) {5544 // treat each array item as a scalar.5545 add( prefix, v );5546 } else {5547 // if array item is non-scalar (array or object), encode its5548 // numeric index to resolve deserialization ambiguity issues.5549 // note that rack (as of 1.0.0) can't currently deserialize5550 // nested arrays properly, and attempting to do so may cause5551 // a server error. possible fixes are to modify rack's5552 // deserialization algorithm or to provide an option or flag5553 // to force array serialization to be shallow.5554 buildparams( prefix + "[" + ( typeof v === "object" || jquery.isarray(v) ? i : "" ) + "]", v, traditional, add );5555 }5556 });5557 } else if ( !traditional && obj != null && typeof obj === "object" ) {5558 // if we see an array here, it is empty and should be treated as an empty5559 // object5560 if ( jquery.isarray( obj ) || jquery.isemptyobject( obj ) ) {5561 add( prefix, "" );5562 // serialize object item.5563 } else {5564 for ( var name in obj ) {5565 buildparams( prefix + "[" + name + "]", obj[ name ], traditional, add );5566 }5567 }5568 } else {5569 // serialize scalar item.5570 add( prefix, obj );5571 }5572}5573// this is still on the jquery object... for now5574// want to move this to jquery.ajax some day5575jquery.extend({5576 // counter for holding the number of active queries5577 active: 0,5578 // last-modified header cache for next request5579 lastmodified: {},5580 etag: {}5581});5582/* handles responses to an ajax request:5583 * - sets all responsexxx fields accordingly5584 * - finds the right datatype (mediates between content-type and expected datatype)5585 * - returns the corresponding response5586 */5587function ajaxhandleresponses( s, jqxhr, responses ) {5588 var contents = s.contents,5589 datatypes = s.datatypes,5590 responsefields = s.responsefields,5591 ct,5592 type,5593 finaldatatype,5594 firstdatatype;5595 // fill responsexxx fields5596 for( type in responsefields ) {5597 if ( type in responses ) {5598 jqxhr[ responsefields[type] ] = responses[ type ];5599 }5600 }5601 // remove auto datatype and get content-type in the process5602 while( datatypes[ 0 ] === "*" ) {5603 datatypes.shift();5604 if ( ct === undefined ) {5605 ct = s.mimetype || jqxhr.getresponseheader( "content-type" );5606 }5607 }5608 // check if we're dealing with a known content-type5609 if ( ct ) {5610 for ( type in contents ) {5611 if ( contents[ type ] && contents[ type ].test( ct ) ) {5612 datatypes.unshift( type );5613 break;5614 }5615 }5616 }5617 // check to see if we have a response for the expected datatype5618 if ( datatypes[ 0 ] in responses ) {5619 finaldatatype = datatypes[ 0 ];5620 } else {5621 // try convertible datatypes5622 for ( type in responses ) {5623 if ( !datatypes[ 0 ] || s.converters[ type + " " + datatypes[0] ] ) {5624 finaldatatype = type;5625 break;5626 }5627 if ( !firstdatatype ) {5628 firstdatatype = type;5629 }5630 }5631 // or just use first one5632 finaldatatype = finaldatatype || firstdatatype;5633 }5634 // if we found a datatype5635 // we add the datatype to the list if needed5636 // and return the corresponding response5637 if ( finaldatatype ) {5638 if ( finaldatatype !== datatypes[ 0 ] ) {5639 datatypes.unshift( finaldatatype );5640 }5641 return responses[ finaldatatype ];5642 }5643}5644// chain conversions given the request and the original response5645function ajaxconvert( s, response ) {5646 // apply the datafilter if provided5647 if ( s.datafilter ) {5648 response = s.datafilter( response, s.datatype );5649 }5650 var datatypes = s.datatypes,5651 converters = {},5652 i,5653 key,5654 length = datatypes.length,5655 tmp,5656 // current and previous datatypes5657 current = datatypes[ 0 ],5658 prev,5659 // conversion expression5660 conversion,5661 // conversion function5662 conv,5663 // conversion functions (transitive conversion)5664 conv1,5665 conv2;5666 // for each datatype in the chain5667 for( i = 1; i < length; i++ ) {5668 // create converters map5669 // with lowercased keys5670 if ( i === 1 ) {5671 for( key in s.converters ) {5672 if( typeof key === "string" ) {5673 converters[ key.tolowercase() ] = s.converters[ key ];5674 }5675 }5676 }5677 // get the datatypes5678 prev = current;5679 current = datatypes[ i ];5680 // if current is auto datatype, update it to prev5681 if( current === "*" ) {5682 current = prev;5683 // if no auto and datatypes are actually different5684 } else if ( prev !== "*" && prev !== current ) {5685 // get the converter5686 conversion = prev + " " + current;5687 conv = converters[ conversion ] || converters[ "* " + current ];5688 // if there is no direct converter, search transitively5689 if ( !conv ) {5690 conv2 = undefined;5691 for( conv1 in converters ) {5692 tmp = conv1.split( " " );5693 if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {5694 conv2 = converters[ tmp[1] + " " + current ];5695 if ( conv2 ) {5696 conv1 = converters[ conv1 ];5697 if ( conv1 === true ) {5698 conv = conv2;5699 } else if ( conv2 === true ) {5700 conv = conv1;5701 }5702 break;5703 }5704 }5705 }5706 }5707 // if we found no converter, dispatch an error5708 if ( !( conv || conv2 ) ) {5709 jquery.error( "no conversion from " + conversion.replace(" "," to ") );5710 }5711 // if found converter is not an equivalence5712 if ( conv !== true ) {5713 // convert with 1 or 2 converters accordingly5714 response = conv ? conv( response ) : conv2( conv1(response) );5715 }5716 }5717 }5718 return response;5719}5720var jsc = jquery.now(),5721 jsre = /(\=)\?(&|$)|()\?\?()/i;5722// default jsonp settings5723jquery.ajaxsetup({5724 jsonp: "callback",5725 jsonpcallback: function() {5726 return jquery.expando + "_" + ( jsc++ );5727 }5728});5729// detect, normalize options and install callbacks for jsonp requests5730jquery.ajaxprefilter( "json jsonp", function( s, originalsettings, jqxhr ) {5731 var dataisstring = ( typeof s.data === "string" );5732 if ( s.datatypes[ 0 ] === "jsonp" ||5733 originalsettings.jsonpcallback ||5734 originalsettings.jsonp != null ||5735 s.jsonp !== false && ( jsre.test( s.url ) ||5736 dataisstring && jsre.test( s.data ) ) ) {5737 var responsecontainer,5738 jsonpcallback = s.jsonpcallback =5739 jquery.isfunction( s.jsonpcallback ) ? s.jsonpcallback() : s.jsonpcallback,5740 previous = window[ jsonpcallback ],5741 url = s.url,5742 data = s.data,5743 replace = "$1" + jsonpcallback + "$2",5744 cleanup = function() {5745 // set callback back to previous value5746 window[ jsonpcallback ] = previous;5747 // call if it was a function and we have a response5748 if ( responsecontainer && jquery.isfunction( previous ) ) {5749 window[ jsonpcallback ]( responsecontainer[ 0 ] );5750 }5751 };5752 if ( s.jsonp !== false ) {5753 url = url.replace( jsre, replace );5754 if ( s.url === url ) {5755 if ( dataisstring ) {5756 data = data.replace( jsre, replace );5757 }5758 if ( s.data === data ) {5759 // add callback manually5760 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpcallback;5761 }5762 }5763 }5764 s.url = url;5765 s.data = data;5766 // install callback5767 window[ jsonpcallback ] = function( response ) {5768 responsecontainer = [ response ];5769 };5770 // install cleanup function5771 jqxhr.then( cleanup, cleanup );5772 // use data converter to retrieve json after script execution5773 s.converters["script json"] = function() {5774 if ( !responsecontainer ) {5775 jquery.error( jsonpcallback + " was not called" );5776 }5777 return responsecontainer[ 0 ];5778 };5779 // force json datatype5780 s.datatypes[ 0 ] = "json";5781 // delegate to script5782 return "script";5783 }5784} );5785// install script datatype5786jquery.ajaxsetup({5787 accepts: {5788 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"5789 },5790 contents: {5791 script: /javascript|ecmascript/5792 },5793 converters: {5794 "text script": function( text ) {5795 jquery.globaleval( text );5796 return text;5797 }5798 }5799});5800// handle cache's special case and global5801jquery.ajaxprefilter( "script", function( s ) {5802 if ( s.cache === undefined ) {5803 s.cache = false;5804 }5805 if ( s.crossdomain ) {5806 s.type = "get";5807 s.global = false;5808 }5809} );5810// bind script tag hack transport5811jquery.ajaxtransport( "script", function(s) {5812 // this transport only deals with cross domain requests5813 if ( s.crossdomain ) {5814 var script,5815 head = document.head || document.getelementsbytagname( "head" )[0] || document.documentelement;5816 return {5817 send: function( _, callback ) {5818 script = document.createelement( "script" );5819 script.async = "async";5820 if ( s.scriptcharset ) {5821 script.charset = s.scriptcharset;5822 }5823 script.src = s.url;5824 // attach handlers for all browsers5825 script.onload = script.onreadystatechange = function( _, isabort ) {5826 if ( !script.readystate || /loaded|complete/.test( script.readystate ) ) {5827 // handle memory leak in ie5828 script.onload = script.onreadystatechange = null;5829 // remove the script5830 if ( head && script.parentnode ) {5831 head.removechild( script );5832 }5833 // dereference the script5834 script = undefined;5835 // callback if not abort5836 if ( !isabort ) {5837 callback( 200, "success" );5838 }5839 }5840 };5841 // use insertbefore instead of appendchild to circumvent an ie6 bug.5842 // this arises when a base node is used (#2709 and #4378).5843 head.insertbefore( script, head.firstchild );5844 },5845 abort: function() {5846 if ( script ) {5847 script.onload( 0, 1 );5848 }5849 }5850 };5851 }5852} );5853var // #5280: next active xhr id and list of active xhrs' callbacks5854 xhrid = jquery.now(),5855 xhrcallbacks,5856 // xhr used to determine supports properties5857 testxhr;5858// #5280: internet explorer will keep connections alive if we don't abort on unload5859function xhronunloadabort() {5860 jquery( window ).unload(function() {5861 // abort all pending requests5862 for ( var key in xhrcallbacks ) {5863 xhrcallbacks[ key ]( 0, 1 );5864 }5865 });5866}5867// functions to create xhrs5868function createstandardxhr() {5869 try {5870 return new window.xmlhttprequest();5871 } catch( e ) {}5872}5873function createactivexhr() {5874 try {5875 return new window.activexobject( "microsoft.xmlhttp" );5876 } catch( e ) {}5877}5878// create the request object5879// (this is still attached to ajaxsettings for backward compatibility)5880jquery.ajaxsettings.xhr = window.activexobject ?5881 /* microsoft failed to properly5882 * implement the xmlhttprequest in ie7 (can't request local files),5883 * so we use the activexobject when it is available5884 * additionally xmlhttprequest can be disabled in ie7/ie8 so5885 * we need a fallback.5886 */5887 function() {5888 return !this.islocal && createstandardxhr() || createactivexhr();5889 } :5890 // for all other browsers, use the standard xmlhttprequest object5891 createstandardxhr;5892// test if we can create an xhr object5893testxhr = jquery.ajaxsettings.xhr();5894jquery.support.ajax = !!testxhr;5895// does this browser support crossdomain xhr requests5896jquery.support.cors = testxhr && ( "withcredentials" in testxhr );5897// no need for the temporary xhr anymore5898testxhr = undefined;5899// create transport if the browser can provide an xhr5900if ( jquery.support.ajax ) {5901 jquery.ajaxtransport(function( s ) {5902 // cross domain only allowed if supported through xmlhttprequest5903 if ( !s.crossdomain || jquery.support.cors ) {5904 var callback;5905 return {5906 send: function( headers, complete ) {5907 // get a new xhr5908 var xhr = s.xhr(),5909 handle,5910 i;5911 // open the socket5912 // passing null username, generates a login popup on opera (#2865)5913 if ( s.username ) {5914 xhr.open( s.type, s.url, s.async, s.username, s.password );5915 } else {5916 xhr.open( s.type, s.url, s.async );5917 }5918 // apply custom fields if provided5919 if ( s.xhrfields ) {5920 for ( i in s.xhrfields ) {5921 xhr[ i ] = s.xhrfields[ i ];5922 }5923 }5924 // override mime type if needed5925 if ( s.mimetype && xhr.overridemimetype ) {5926 xhr.overridemimetype( s.mimetype );5927 }5928 // requested-with header5929 // not set for crossdomain requests with no content5930 // (see why at http://trac.dojotoolkit.org/ticket/9486)5931 // won't change header if already provided5932 if ( !( s.crossdomain && !s.hascontent ) && !headers["x-requested-with"] ) {5933 headers[ "x-requested-with" ] = "xmlhttprequest";5934 }5935 // need an extra try/catch for cross domain requests in firefox 35936 try {5937 for ( i in headers ) {5938 xhr.setrequestheader( i, headers[ i ] );5939 }5940 } catch( _ ) {}5941 // do send the request5942 // this may raise an exception which is actually5943 // handled in jquery.ajax (so no try/catch here)5944 xhr.send( ( s.hascontent && s.data ) || null );5945 // listener5946 callback = function( _, isabort ) {5947 var status,5948 statustext,5949 responseheaders,5950 responses,5951 xml;5952 // firefox throws exceptions when accessing properties5953 // of an xhr when a network error occured5954 // http://helpful.knobs-dials.com/index.php/component_returned_failure_code:_0x80040111_(ns_error_not_available)5955 try {5956 // was never called and is aborted or complete5957 if ( callback && ( isabort || xhr.readystate === 4 ) ) {5958 // only called once5959 callback = undefined;5960 // do not keep as active anymore5961 if ( handle ) {5962 xhr.onreadystatechange = jquery.noop;5963 delete xhrcallbacks[ handle ];5964 }5965 // if it's an abort5966 if ( isabort ) {5967 // abort it manually if needed5968 if ( xhr.readystate !== 4 ) {5969 xhr.abort();5970 }5971 } else {5972 status = xhr.status;5973 responseheaders = xhr.getallresponseheaders();5974 responses = {};5975 xml = xhr.responsexml;5976 // construct response list5977 if ( xml && xml.documentelement /* #4958 */ ) {5978 responses.xml = xml;5979 }5980 responses.text = xhr.responsetext;5981 // firefox throws an exception when accessing5982 // statustext for faulty cross-domain requests5983 try {5984 statustext = xhr.statustext;5985 } catch( e ) {5986 // we normalize with webkit giving an empty statustext5987 statustext = "";5988 }5989 // filter status for non standard behaviors5990 // if the request is local and we have data: assume a success5991 // (success with no data won't get notified, that's the best we5992 // can do given current implementations)5993 if ( !status && s.islocal && !s.crossdomain ) {5994 status = responses.text ? 200 : 404;5995 // ie - #1450: sometimes returns 1223 when it should be 2045996 } else if ( status === 1223 ) {5997 status = 204;5998 }5999 }6000 }6001 } catch( firefoxaccessexception ) {6002 if ( !isabort ) {6003 complete( -1, firefoxaccessexception );6004 }6005 }6006 // call complete if needed6007 if ( responses ) {6008 complete( status, statustext, responses, responseheaders );6009 }6010 };6011 // if we're in sync mode or it's in cache6012 // and has been retrieved directly (ie6 & ie7)6013 // we need to manually fire the callback6014 if ( !s.async || xhr.readystate === 4 ) {6015 callback();6016 } else {6017 // create the active xhrs callbacks list if needed6018 // and attach the unload handler6019 if ( !xhrcallbacks ) {6020 xhrcallbacks = {};6021 xhronunloadabort();6022 }6023 // add to list of active xhrs callbacks6024 handle = xhrid++;6025 xhr.onreadystatechange = xhrcallbacks[ handle ] = callback;6026 }6027 },6028 abort: function() {6029 if ( callback ) {6030 callback(0,1);6031 }6032 }6033 };6034 }6035 });6036}6037var elemdisplay = {},6038 rfxtypes = /^(?:toggle|show|hide)$/,6039 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,6040 timerid,6041 fxattrs = [6042 // height animations6043 [ "height", "margintop", "marginbottom", "paddingtop", "paddingbottom" ],6044 // width animations6045 [ "width", "marginleft", "marginright", "paddingleft", "paddingright" ],6046 // opacity animations6047 [ "opacity" ]6048 ];6049jquery.fn.extend({6050 show: function( speed, easing, callback ) {6051 var elem, display;6052 if ( speed || speed === 0 ) {6053 return this.animate( genfx("show", 3), speed, easing, callback);6054 } else {6055 for ( var i = 0, j = this.length; i < j; i++ ) {6056 elem = this[i];6057 display = elem.style.display;6058 // reset the inline display of this element to learn if it is6059 // being hidden by cascaded rules or not6060 if ( !jquery._data(elem, "olddisplay") && display === "none" ) {6061 display = elem.style.display = "";6062 }6063 // set elements which have been overridden with display: none6064 // in a stylesheet to whatever the default browser style is6065 // for such an element6066 if ( display === "" && jquery.css( elem, "display" ) === "none" ) {6067 jquery._data(elem, "olddisplay", defaultdisplay(elem.nodename));6068 }6069 }6070 // set the display of most of the elements in a second loop6071 // to avoid the constant reflow6072 for ( i = 0; i < j; i++ ) {6073 elem = this[i];6074 display = elem.style.display;6075 if ( display === "" || display === "none" ) {6076 elem.style.display = jquery._data(elem, "olddisplay") || "";6077 }6078 }6079 return this;6080 }6081 },6082 hide: function( speed, easing, callback ) {6083 if ( speed || speed === 0 ) {6084 return this.animate( genfx("hide", 3), speed, easing, callback);6085 } else {6086 for ( var i = 0, j = this.length; i < j; i++ ) {6087 var display = jquery.css( this[i], "display" );6088 if ( display !== "none" && !jquery._data( this[i], "olddisplay" ) ) {6089 jquery._data( this[i], "olddisplay", display );6090 }6091 }6092 // set the display of the elements in a second loop6093 // to avoid the constant reflow6094 for ( i = 0; i < j; i++ ) {6095 this[i].style.display = "none";6096 }6097 return this;6098 }6099 },6100 // save the old toggle function6101 _toggle: jquery.fn.toggle,6102 toggle: function( fn, fn2, callback ) {6103 var bool = typeof fn === "boolean";6104 if ( jquery.isfunction(fn) && jquery.isfunction(fn2) ) {6105 this._toggle.apply( this, arguments );6106 } else if ( fn == null || bool ) {6107 this.each(function() {6108 var state = bool ? fn : jquery(this).is(":hidden");6109 jquery(this)[ state ? "show" : "hide" ]();6110 });6111 } else {6112 this.animate(genfx("toggle", 3), fn, fn2, callback);6113 }6114 return this;6115 },6116 fadeto: function( speed, to, easing, callback ) {6117 return this.filter(":hidden").css("opacity", 0).show().end()6118 .animate({opacity: to}, speed, easing, callback);6119 },6120 animate: function( prop, speed, easing, callback ) {6121 var optall = jquery.speed(speed, easing, callback);6122 if ( jquery.isemptyobject( prop ) ) {6123 return this.each( optall.complete );6124 }6125 return this[ optall.queue === false ? "each" : "queue" ](function() {6126 // xxx 'this' does not always have a nodename when running the6127 // test suite6128 var opt = jquery.extend({}, optall), p,6129 iselement = this.nodetype === 1,6130 hidden = iselement && jquery(this).is(":hidden"),6131 self = this;6132 for ( p in prop ) {6133 var name = jquery.camelcase( p );6134 if ( p !== name ) {6135 prop[ name ] = prop[ p ];6136 delete prop[ p ];6137 p = name;6138 }6139 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {6140 return opt.complete.call(this);6141 }6142 if ( iselement && ( p === "height" || p === "width" ) ) {6143 // make sure that nothing sneaks out6144 // record all 3 overflow attributes because ie does not6145 // change the overflow attribute when overflowx and6146 // overflowy are set to the same value6147 opt.overflow = [ this.style.overflow, this.style.overflowx, this.style.overflowy ];6148 // set display property to inline-block for height/width6149 // animations on inline elements that are having width/height6150 // animated6151 if ( jquery.css( this, "display" ) === "inline" &&6152 jquery.css( this, "float" ) === "none" ) {6153 if ( !jquery.support.inlineblockneedslayout ) {6154 this.style.display = "inline-block";6155 } else {6156 var display = defaultdisplay(this.nodename);6157 // inline-level elements accept inline-block;6158 // block-level elements need to be inline with layout6159 if ( display === "inline" ) {6160 this.style.display = "inline-block";6161 } else {6162 this.style.display = "inline";6163 this.style.zoom = 1;6164 }6165 }6166 }6167 }6168 if ( jquery.isarray( prop[p] ) ) {6169 // create (if needed) and add to specialeasing6170 (opt.specialeasing = opt.specialeasing || {})[p] = prop[p][1];6171 prop[p] = prop[p][0];6172 }6173 }6174 if ( opt.overflow != null ) {6175 this.style.overflow = "hidden";6176 }6177 opt.curanim = jquery.extend({}, prop);6178 jquery.each( prop, function( name, val ) {6179 var e = new jquery.fx( self, opt, name );6180 if ( rfxtypes.test(val) ) {6181 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );6182 } else {6183 var parts = rfxnum.exec(val),6184 start = e.cur();6185 if ( parts ) {6186 var end = parsefloat( parts[2] ),6187 unit = parts[3] || ( jquery.cssnumber[ name ] ? "" : "px" );6188 // we need to compute starting value6189 if ( unit !== "px" ) {6190 jquery.style( self, name, (end || 1) + unit);6191 start = ((end || 1) / e.cur()) * start;6192 jquery.style( self, name, start + unit);6193 }6194 // if a +=/-= token was provided, we're doing a relative animation6195 if ( parts[1] ) {6196 end = ((parts[1] === "-=" ? -1 : 1) * end) + start;6197 }6198 e.custom( start, end, unit );6199 } else {6200 e.custom( start, val, "" );6201 }6202 }6203 });6204 // for js strict compliance6205 return true;6206 });6207 },6208 stop: function( clearqueue, gotoend ) {6209 var timers = jquery.timers;6210 if ( clearqueue ) {6211 this.queue([]);6212 }6213 this.each(function() {6214 // go in reverse order so anything added to the queue during the loop is ignored6215 for ( var i = timers.length - 1; i >= 0; i-- ) {6216 if ( timers[i].elem === this ) {6217 if (gotoend) {6218 // force the next step to be the last6219 timers[i](true);6220 }6221 timers.splice(i, 1);6222 }6223 }6224 });6225 // start the next in the queue if the last step wasn't forced6226 if ( !gotoend ) {6227 this.dequeue();6228 }6229 return this;6230 }6231});6232function genfx( type, num ) {6233 var obj = {};6234 jquery.each( fxattrs.concat.apply([], fxattrs.slice(0,num)), function() {6235 obj[ this ] = type;6236 });6237 return obj;6238}6239// generate shortcuts for custom animations6240jquery.each({6241 slidedown: genfx("show", 1),6242 slideup: genfx("hide", 1),6243 slidetoggle: genfx("toggle", 1),6244 fadein: { opacity: "show" },6245 fadeout: { opacity: "hide" },6246 fadetoggle: { opacity: "toggle" }6247}, function( name, props ) {6248 jquery.fn[ name ] = function( speed, easing, callback ) {6249 return this.animate( props, speed, easing, callback );6250 };6251});6252jquery.extend({6253 speed: function( speed, easing, fn ) {6254 var opt = speed && typeof speed === "object" ? jquery.extend({}, speed) : {6255 complete: fn || !fn && easing ||6256 jquery.isfunction( speed ) && speed,6257 duration: speed,6258 easing: fn && easing || easing && !jquery.isfunction(easing) && easing6259 };6260 opt.duration = jquery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :6261 opt.duration in jquery.fx.speeds ? jquery.fx.speeds[opt.duration] : jquery.fx.speeds._default;6262 // queueing6263 opt.old = opt.complete;6264 opt.complete = function() {6265 if ( opt.queue !== false ) {6266 jquery(this).dequeue();6267 }6268 if ( jquery.isfunction( opt.old ) ) {6269 opt.old.call( this );6270 }6271 };6272 return opt;6273 },6274 easing: {6275 linear: function( p, n, firstnum, diff ) {6276 return firstnum + diff * p;6277 },6278 swing: function( p, n, firstnum, diff ) {6279 return ((-math.cos(p*math.pi)/2) + 0.5) * diff + firstnum;6280 }6281 },6282 timers: [],6283 fx: function( elem, options, prop ) {6284 this.options = options;6285 this.elem = elem;6286 this.prop = prop;6287 if ( !options.orig ) {6288 options.orig = {};6289 }6290 }6291});6292jquery.fx.prototype = {6293 // simple function for setting a style value6294 update: function() {6295 if ( this.options.step ) {6296 this.options.step.call( this.elem, this.now, this );6297 }6298 (jquery.fx.step[this.prop] || jquery.fx.step._default)( this );6299 },6300 // get the current size6301 cur: function() {6302 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {6303 return this.elem[ this.prop ];6304 }6305 var parsed,6306 r = jquery.css( this.elem, this.prop );6307 // empty strings, null, undefined and "auto" are converted to 0,6308 // complex values such as "rotate(1rad)" are returned as is,6309 // simple values such as "10px" are parsed to float.6310 return isnan( parsed = parsefloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;6311 },6312 // start an animation from one number to another6313 custom: function( from, to, unit ) {6314 var self = this,6315 fx = jquery.fx;6316 this.starttime = jquery.now();6317 this.start = from;6318 this.end = to;6319 this.unit = unit || this.unit || ( jquery.cssnumber[ this.prop ] ? "" : "px" );6320 this.now = this.start;6321 this.pos = this.state = 0;6322 function t( gotoend ) {6323 return self.step(gotoend);6324 }6325 t.elem = this.elem;6326 if ( t() && jquery.timers.push(t) && !timerid ) {6327 timerid = setinterval(fx.tick, fx.interval);6328 }6329 },6330 // simple 'show' function6331 show: function() {6332 // remember where we started, so that we can go back to it later6333 this.options.orig[this.prop] = jquery.style( this.elem, this.prop );6334 this.options.show = true;6335 // begin the animation6336 // make sure that we start at a small width/height to avoid any6337 // flash of content6338 this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());6339 // start by showing the element6340 jquery( this.elem ).show();6341 },6342 // simple 'hide' function6343 hide: function() {6344 // remember where we started, so that we can go back to it later6345 this.options.orig[this.prop] = jquery.style( this.elem, this.prop );6346 this.options.hide = true;6347 // begin the animation6348 this.custom(this.cur(), 0);6349 },6350 // each step of an animation6351 step: function( gotoend ) {6352 var t = jquery.now(), done = true;6353 if ( gotoend || t >= this.options.duration + this.starttime ) {6354 this.now = this.end;6355 this.pos = this.state = 1;6356 this.update();6357 this.options.curanim[ this.prop ] = true;6358 for ( var i in this.options.curanim ) {6359 if ( this.options.curanim[i] !== true ) {6360 done = false;6361 }6362 }6363 if ( done ) {6364 // reset the overflow6365 if ( this.options.overflow != null && !jquery.support.shrinkwrapblocks ) {6366 var elem = this.elem,6367 options = this.options;6368 jquery.each( [ "", "x", "y" ], function (index, value) {6369 elem.style[ "overflow" + value ] = options.overflow[index];6370 } );6371 }6372 // hide the element if the "hide" operation was done6373 if ( this.options.hide ) {6374 jquery(this.elem).hide();6375 }6376 // reset the properties, if the item has been hidden or shown6377 if ( this.options.hide || this.options.show ) {6378 for ( var p in this.options.curanim ) {6379 jquery.style( this.elem, p, this.options.orig[p] );6380 }6381 }6382 // execute the complete function6383 this.options.complete.call( this.elem );6384 }6385 return false;6386 } else {6387 var n = t - this.starttime;6388 this.state = n / this.options.duration;6389 // perform the easing function, defaults to swing6390 var specialeasing = this.options.specialeasing && this.options.specialeasing[this.prop];6391 var defaulteasing = this.options.easing || (jquery.easing.swing ? "swing" : "linear");6392 this.pos = jquery.easing[specialeasing || defaulteasing](this.state, n, 0, 1, this.options.duration);6393 this.now = this.start + ((this.end - this.start) * this.pos);6394 // perform the next step of the animation6395 this.update();6396 }6397 return true;6398 }6399};6400jquery.extend( jquery.fx, {6401 tick: function() {6402 var timers = jquery.timers;6403 for ( var i = 0; i < timers.length; i++ ) {6404 if ( !timers[i]() ) {6405 timers.splice(i--, 1);6406 }6407 }6408 if ( !timers.length ) {6409 jquery.fx.stop();6410 }6411 },6412 interval: 13,6413 stop: function() {6414 clearinterval( timerid );6415 timerid = null;6416 },6417 speeds: {6418 slow: 600,6419 fast: 200,6420 // default speed6421 _default: 4006422 },6423 step: {6424 opacity: function( fx ) {6425 jquery.style( fx.elem, "opacity", fx.now );6426 },6427 _default: function( fx ) {6428 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {6429 fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? math.max(0, fx.now) : fx.now) + fx.unit;6430 } else {6431 fx.elem[ fx.prop ] = fx.now;6432 }6433 }6434 }6435});6436if ( jquery.expr && jquery.expr.filters ) {6437 jquery.expr.filters.animated = function( elem ) {6438 return jquery.grep(jquery.timers, function( fn ) {6439 return elem === fn.elem;6440 }).length;6441 };6442}6443function defaultdisplay( nodename ) {6444 if ( !elemdisplay[ nodename ] ) {6445 var elem = jquery("<" + nodename + ">").appendto("body"),6446 display = elem.css("display");6447 elem.remove();6448 if ( display === "none" || display === "" ) {6449 display = "block";6450 }6451 elemdisplay[ nodename ] = display;6452 }6453 return elemdisplay[ nodename ];6454}6455var rtable = /^t(?:able|d|h)$/i,6456 rroot = /^(?:body|html)$/i;6457if ( "getboundingclientrect" in document.documentelement ) {6458 jquery.fn.offset = function( options ) {6459 var elem = this[0], box;6460 if ( options ) {6461 return this.each(function( i ) {6462 jquery.offset.setoffset( this, options, i );6463 });6464 }6465 if ( !elem || !elem.ownerdocument ) {6466 return null;6467 }6468 if ( elem === elem.ownerdocument.body ) {6469 return jquery.offset.bodyoffset( elem );6470 }6471 try {6472 box = elem.getboundingclientrect();6473 } catch(e) {}6474 var doc = elem.ownerdocument,6475 docelem = doc.documentelement;6476 // make sure we're not dealing with a disconnected dom node6477 if ( !box || !jquery.contains( docelem, elem ) ) {6478 return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };6479 }6480 var body = doc.body,6481 win = getwindow(doc),6482 clienttop = docelem.clienttop || body.clienttop || 0,6483 clientleft = docelem.clientleft || body.clientleft || 0,6484 scrolltop = (win.pageyoffset || jquery.support.boxmodel && docelem.scrolltop || body.scrolltop ),6485 scrollleft = (win.pagexoffset || jquery.support.boxmodel && docelem.scrollleft || body.scrollleft),6486 top = box.top + scrolltop - clienttop,6487 left = box.left + scrollleft - clientleft;6488 return { top: top, left: left };6489 };6490} else {6491 jquery.fn.offset = function( options ) {6492 var elem = this[0];6493 if ( options ) {6494 return this.each(function( i ) {6495 jquery.offset.setoffset( this, options, i );6496 });6497 }6498 if ( !elem || !elem.ownerdocument ) {6499 return null;6500 }6501 if ( elem === elem.ownerdocument.body ) {6502 return jquery.offset.bodyoffset( elem );6503 }6504 jquery.offset.initialize();6505 var computedstyle,6506 offsetparent = elem.offsetparent,6507 prevoffsetparent = elem,6508 doc = elem.ownerdocument,6509 docelem = doc.documentelement,6510 body = doc.body,6511 defaultview = doc.defaultview,6512 prevcomputedstyle = defaultview ? defaultview.getcomputedstyle( elem, null ) : elem.currentstyle,6513 top = elem.offsettop,6514 left = elem.offsetleft;6515 while ( (elem = elem.parentnode) && elem !== body && elem !== docelem ) {6516 if ( jquery.offset.supportsfixedposition && prevcomputedstyle.position === "fixed" ) {6517 break;6518 }6519 computedstyle = defaultview ? defaultview.getcomputedstyle(elem, null) : elem.currentstyle;6520 top -= elem.scrolltop;6521 left -= elem.scrollleft;6522 if ( elem === offsetparent ) {6523 top += elem.offsettop;6524 left += elem.offsetleft;6525 if ( jquery.offset.doesnotaddborder && !(jquery.offset.doesaddborderfortableandcells && rtable.test(elem.nodename)) ) {6526 top += parsefloat( computedstyle.bordertopwidth ) || 0;6527 left += parsefloat( computedstyle.borderleftwidth ) || 0;6528 }6529 prevoffsetparent = offsetparent;6530 offsetparent = elem.offsetparent;6531 }6532 if ( jquery.offset.subtractsborderforoverflownotvisible && computedstyle.overflow !== "visible" ) {6533 top += parsefloat( computedstyle.bordertopwidth ) || 0;6534 left += parsefloat( computedstyle.borderleftwidth ) || 0;6535 }6536 prevcomputedstyle = computedstyle;6537 }6538 if ( prevcomputedstyle.position === "relative" || prevcomputedstyle.position === "static" ) {6539 top += body.offsettop;6540 left += body.offsetleft;6541 }6542 if ( jquery.offset.supportsfixedposition && prevcomputedstyle.position === "fixed" ) {6543 top += math.max( docelem.scrolltop, body.scrolltop );6544 left += math.max( docelem.scrollleft, body.scrollleft );6545 }6546 return { top: top, left: left };6547 };6548}6549jquery.offset = {6550 initialize: function() {6551 var body = document.body, container = document.createelement("div"), innerdiv, checkdiv, table, td, bodymargintop = parsefloat( jquery.css(body, "margintop") ) || 0,6552 html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";6553 jquery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );6554 container.innerhtml = html;6555 body.insertbefore( container, body.firstchild );6556 innerdiv = container.firstchild;6557 checkdiv = innerdiv.firstchild;6558 td = innerdiv.nextsibling.firstchild.firstchild;6559 this.doesnotaddborder = (checkdiv.offsettop !== 5);6560 this.doesaddborderfortableandcells = (td.offsettop === 5);6561 checkdiv.style.position = "fixed";6562 checkdiv.style.top = "20px";6563 // safari subtracts parent border width here which is 5px6564 this.supportsfixedposition = (checkdiv.offsettop === 20 || checkdiv.offsettop === 15);6565 checkdiv.style.position = checkdiv.style.top = "";6566 innerdiv.style.overflow = "hidden";6567 innerdiv.style.position = "relative";6568 this.subtractsborderforoverflownotvisible = (checkdiv.offsettop === -5);6569 this.doesnotincludemargininbodyoffset = (body.offsettop !== bodymargintop);6570 body.removechild( container );6571 body = container = innerdiv = checkdiv = table = td = null;6572 jquery.offset.initialize = jquery.noop;6573 },6574 bodyoffset: function( body ) {6575 var top = body.offsettop,6576 left = body.offsetleft;6577 jquery.offset.initialize();6578 if ( jquery.offset.doesnotincludemargininbodyoffset ) {6579 top += parsefloat( jquery.css(body, "margintop") ) || 0;6580 left += parsefloat( jquery.css(body, "marginleft") ) || 0;6581 }6582 return { top: top, left: left };6583 },6584 setoffset: function( elem, options, i ) {6585 var position = jquery.css( elem, "position" );6586 // set position first, in-case top/left are set even on static elem6587 if ( position === "static" ) {6588 elem.style.position = "relative";6589 }6590 var curelem = jquery( elem ),6591 curoffset = curelem.offset(),6592 curcsstop = jquery.css( elem, "top" ),6593 curcssleft = jquery.css( elem, "left" ),6594 calculateposition = (position === "absolute" && jquery.inarray('auto', [curcsstop, curcssleft]) > -1),6595 props = {}, curposition = {}, curtop, curleft;6596 // need to be able to calculate position if either top or left is auto and position is absolute6597 if ( calculateposition ) {6598 curposition = curelem.position();6599 }6600 curtop = calculateposition ? curposition.top : parseint( curcsstop, 10 ) || 0;6601 curleft = calculateposition ? curposition.left : parseint( curcssleft, 10 ) || 0;6602 if ( jquery.isfunction( options ) ) {6603 options = options.call( elem, i, curoffset );6604 }6605 if (options.top != null) {6606 props.top = (options.top - curoffset.top) + curtop;6607 }6608 if (options.left != null) {6609 props.left = (options.left - curoffset.left) + curleft;6610 }6611 if ( "using" in options ) {6612 options.using.call( elem, props );6613 } else {6614 curelem.css( props );6615 }6616 }6617};6618jquery.fn.extend({6619 position: function() {6620 if ( !this[0] ) {6621 return null;6622 }6623 var elem = this[0],6624 // get *real* offsetparent6625 offsetparent = this.offsetparent(),6626 // get correct offsets6627 offset = this.offset(),6628 parentoffset = rroot.test(offsetparent[0].nodename) ? { top: 0, left: 0 } : offsetparent.offset();6629 // subtract element margins6630 // note: when an element has margin: auto the offsetleft and marginleft6631 // are the same in safari causing offset.left to incorrectly be 06632 offset.top -= parsefloat( jquery.css(elem, "margintop") ) || 0;6633 offset.left -= parsefloat( jquery.css(elem, "marginleft") ) || 0;6634 // add offsetparent borders6635 parentoffset.top += parsefloat( jquery.css(offsetparent[0], "bordertopwidth") ) || 0;6636 parentoffset.left += parsefloat( jquery.css(offsetparent[0], "borderleftwidth") ) || 0;6637 // subtract the two offsets6638 return {6639 top: offset.top - parentoffset.top,6640 left: offset.left - parentoffset.left6641 };6642 },6643 offsetparent: function() {6644 return this.map(function() {6645 var offsetparent = this.offsetparent || document.body;6646 while ( offsetparent && (!rroot.test(offsetparent.nodename) && jquery.css(offsetparent, "position") === "static") ) {6647 offsetparent = offsetparent.offsetparent;6648 }6649 return offsetparent;6650 });6651 }6652});6653// create scrollleft and scrolltop methods6654jquery.each( ["left", "top"], function( i, name ) {6655 var method = "scroll" + name;6656 jquery.fn[ method ] = function(val) {6657 var elem = this[0], win;6658 if ( !elem ) {6659 return null;6660 }6661 if ( val !== undefined ) {6662 // set the scroll offset6663 return this.each(function() {6664 win = getwindow( this );6665 if ( win ) {6666 win.scrollto(6667 !i ? val : jquery(win).scrollleft(),6668 i ? val : jquery(win).scrolltop()6669 );6670 } else {6671 this[ method ] = val;6672 }6673 });6674 } else {6675 win = getwindow( elem );6676 // return the scroll offset6677 return win ? ("pagexoffset" in win) ? win[ i ? "pageyoffset" : "pagexoffset" ] :6678 jquery.support.boxmodel && win.document.documentelement[ method ] ||6679 win.document.body[ method ] :6680 elem[ method ];6681 }6682 };6683});6684function getwindow( elem ) {6685 return jquery.iswindow( elem ) ?6686 elem :6687 elem.nodetype === 9 ?6688 elem.defaultview || elem.parentwindow :6689 false;6690}6691// create innerheight, innerwidth, outerheight and outerwidth methods6692jquery.each([ "height", "width" ], function( i, name ) {6693 var type = name.tolowercase();6694 // innerheight and innerwidth6695 jquery.fn["inner" + name] = function() {6696 return this[0] ?6697 parsefloat( jquery.css( this[0], type, "padding" ) ) :6698 null;6699 };6700 // outerheight and outerwidth6701 jquery.fn["outer" + name] = function( margin ) {6702 return this[0] ?6703 parsefloat( jquery.css( this[0], type, margin ? "margin" : "border" ) ) :6704 null;6705 };6706 jquery.fn[ type ] = function( size ) {6707 // get window width or height6708 var elem = this[0];6709 if ( !elem ) {6710 return size == null ? null : this;6711 }6712 if ( jquery.isfunction( size ) ) {6713 return this.each(function( i ) {6714 var self = jquery( this );6715 self[ type ]( size.call( this, i, self[ type ]() ) );6716 });6717 }6718 if ( jquery.iswindow( elem ) ) {6719 // everyone else use document.documentelement or document.body depending on quirks vs standards mode6720 // 3rd condition allows nokia support, as it supports the docelem prop but not css1compat6721 var docelemprop = elem.document.documentelement[ "client" + name ];6722 return elem.document.compatmode === "css1compat" && docelemprop ||6723 elem.document.body[ "client" + name ] || docelemprop;6724 // get document width or height6725 } else if ( elem.nodetype === 9 ) {6726 // either scroll[width/height] or offset[width/height], whichever is greater6727 return math.max(6728 elem.documentelement["client" + name],6729 elem.body["scroll" + name], elem.documentelement["scroll" + name],6730 elem.body["offset" + name], elem.documentelement["offset" + name]6731 );6732 // get or set width or height on the element6733 } else if ( size === undefined ) {6734 var orig = jquery.css( elem, type ),6735 ret = parsefloat( orig );6736 return jquery.isnan( ret ) ? orig : ret;6737 // set the width or height on the element (default to pixels if value is unitless)6738 } else {6739 return this.css( type, typeof size === "string" ? size : size + "px" );6740 }6741 };6742});6743window.jquery = window.$ = jquery;...
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('
Using AI Code Generation
1describe('Test', () => {2 it('test', () => {3 cy.get('input.gLFyf').type('test')4 cy.get('input.gNO89b').click()5 cy.get('div#search').click()6 cy.get('div#se
Using AI Code Generation
1describe('Test', function () {2 it('Test', function () {3 cy.get('#hplogo').then(($img) => {4 })5 })6})
Using AI Code Generation
1it('test', () => {2 cy.get('body').then(($body) => {3 const $input = $body.find('input');4 console.log($input[0].nodeName);5 console.log($input[0].nodeName.toLowerCase());6 });7});8describe('test', () => {9 it('test', () => {10 cy.get('body').then(($body) => {11 const $input = $body.find('input');12 console.log($input[0].nodeName);13 console.log($input[0].nodeName.toLowerCase());14 });15 });16});
Using AI Code Generation
1const { $ } = Cypress2const getDest = (dest) => {3 return $(dest).get(0)4}5const getDest = (dest) => {6 return $(dest).get(0)7}8Cypress.Commands.add('drag', { prevSubject: 'element' }, (src, dest) => {9 const getDest = (dest) => {10 return $(dest).get(0)11 }12 const srcNode = src.get(0)13 const destNode = getDest(dest)14 if (srcNode && destNode) {15 cy.log('dragging')16 const dataTransfer = new DataTransfer()17 cy.wrap(srcNode).trigger('dragstart', { dataTransfer })18 cy.wrap(destNode).trigger('dragenter', { dataTransfer })19 cy.wrap(destNode).trigger('dragover', { dataTransfer })20 cy.wrap(destNode).trigger('drop', { dataTransfer })21 cy.wrap(destNode).trigger('dragleave')22 cy.wrap(srcNode).trigger('dragend')23 }24})25Cypress.Commands.add('drag', { prevSubject: 'element' }, (src, dest) => {26 const getDest = (dest) => {27 return $(dest).get(0)28 }29 const srcNode = src.get(0)30 const destNode = getDest(dest)31 if (srcNode && destNode) {32 cy.log('dragging')33 const dataTransfer = new DataTransfer()34 cy.wrap(srcNode).trigger('dragstart', { dataTransfer })35 cy.wrap(destNode).trigger('dragenter', { dataTransfer })36 cy.wrap(destNode).trigger('dragover', { dataTransfer })37 cy.wrap(destNode).trigger('drop', { dataTransfer })38 cy.wrap(destNode).trigger('dragleave')39 cy.wrap(srcNode).trigger('dragend')40 }41})42Cypress.Commands.add('drag', { prevSubject: 'element' }, (src, dest) => {43 const getDest = (dest) => {44 return $(dest).get(0)45 }46 const srcNode = src.get(0)47 const destNode = getDest(dest)48 if (srcNode && destNode) {49 cy.log('dragging')50 const dataTransfer = new DataTransfer()51 cy.wrap(srcNode).trigger('dragstart',
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.
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.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!