Python Library Stringtools
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

jquery.js 265KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365
  1. /*!
  2. * jQuery JavaScript Library v3.3.1-dfsg
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright JS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2019-04-19T06:52Z
  13. */
  14. ( function( global, factory ) {
  15. "use strict";
  16. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17. // For CommonJS and CommonJS-like environments where a proper `window`
  18. // is present, execute the factory and get jQuery.
  19. // For environments that do not have a `window` with a `document`
  20. // (such as Node.js), expose a factory as module.exports.
  21. // This accentuates the need for the creation of a real `window`.
  22. // e.g. var jQuery = require("jquery")(window);
  23. // See ticket #14549 for more info.
  24. module.exports = global.document ?
  25. factory( global, true ) :
  26. function( w ) {
  27. if ( !w.document ) {
  28. throw new Error( "jQuery requires a window with a document" );
  29. }
  30. return factory( w );
  31. };
  32. } else {
  33. factory( global );
  34. }
  35. // Pass this if window is not defined yet
  36. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  37. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  38. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  40. // enough that all such attempts are guarded in a try block.
  41. var arr = [];
  42. var document = window.document;
  43. var getProto = Object.getPrototypeOf;
  44. var slice = arr.slice;
  45. var concat = arr.concat;
  46. var push = arr.push;
  47. var indexOf = arr.indexOf;
  48. var class2type = {};
  49. var toString = class2type.toString;
  50. var hasOwn = class2type.hasOwnProperty;
  51. var fnToString = hasOwn.toString;
  52. var ObjectFunctionString = fnToString.call( Object );
  53. var support = {};
  54. var isFunction = function isFunction( obj ) {
  55. // Support: Chrome <=57, Firefox <=52
  56. // In some browsers, typeof returns "function" for HTML <object> elements
  57. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  58. // We don't want to classify *any* DOM node as a function.
  59. return typeof obj === "function" && typeof obj.nodeType !== "number";
  60. };
  61. var isWindow = function isWindow( obj ) {
  62. return obj != null && obj === obj.window;
  63. };
  64. var preservedScriptAttributes = {
  65. type: true,
  66. src: true,
  67. noModule: true
  68. };
  69. function DOMEval( code, doc, node ) {
  70. doc = doc || document;
  71. var i,
  72. script = doc.createElement( "script" );
  73. script.text = code;
  74. if ( node ) {
  75. for ( i in preservedScriptAttributes ) {
  76. if ( node[ i ] ) {
  77. script[ i ] = node[ i ];
  78. }
  79. }
  80. }
  81. doc.head.appendChild( script ).parentNode.removeChild( script );
  82. }
  83. function toType( obj ) {
  84. if ( obj == null ) {
  85. return obj + "";
  86. }
  87. // Support: Android <=2.3 only (functionish RegExp)
  88. return typeof obj === "object" || typeof obj === "function" ?
  89. class2type[ toString.call( obj ) ] || "object" :
  90. typeof obj;
  91. }
  92. /* global Symbol */
  93. // Defining this global in .eslintrc.json would create a danger of using the global
  94. // unguarded in another place, it seems safer to define global only for this module
  95. var
  96. version = "3.3.1",
  97. // Define a local copy of jQuery
  98. jQuery = function( selector, context ) {
  99. // The jQuery object is actually just the init constructor 'enhanced'
  100. // Need init if jQuery is called (just allow error to be thrown if not included)
  101. return new jQuery.fn.init( selector, context );
  102. },
  103. // Support: Android <=4.0 only
  104. // Make sure we trim BOM and NBSP
  105. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  106. jQuery.fn = jQuery.prototype = {
  107. // The current version of jQuery being used
  108. jquery: version,
  109. constructor: jQuery,
  110. // The default length of a jQuery object is 0
  111. length: 0,
  112. toArray: function() {
  113. return slice.call( this );
  114. },
  115. // Get the Nth element in the matched element set OR
  116. // Get the whole matched element set as a clean array
  117. get: function( num ) {
  118. // Return all the elements in a clean array
  119. if ( num == null ) {
  120. return slice.call( this );
  121. }
  122. // Return just the one element from the set
  123. return num < 0 ? this[ num + this.length ] : this[ num ];
  124. },
  125. // Take an array of elements and push it onto the stack
  126. // (returning the new matched element set)
  127. pushStack: function( elems ) {
  128. // Build a new jQuery matched element set
  129. var ret = jQuery.merge( this.constructor(), elems );
  130. // Add the old object onto the stack (as a reference)
  131. ret.prevObject = this;
  132. // Return the newly-formed element set
  133. return ret;
  134. },
  135. // Execute a callback for every element in the matched set.
  136. each: function( callback ) {
  137. return jQuery.each( this, callback );
  138. },
  139. map: function( callback ) {
  140. return this.pushStack( jQuery.map( this, function( elem, i ) {
  141. return callback.call( elem, i, elem );
  142. } ) );
  143. },
  144. slice: function() {
  145. return this.pushStack( slice.apply( this, arguments ) );
  146. },
  147. first: function() {
  148. return this.eq( 0 );
  149. },
  150. last: function() {
  151. return this.eq( -1 );
  152. },
  153. eq: function( i ) {
  154. var len = this.length,
  155. j = +i + ( i < 0 ? len : 0 );
  156. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  157. },
  158. end: function() {
  159. return this.prevObject || this.constructor();
  160. },
  161. // For internal use only.
  162. // Behaves like an Array's method, not like a jQuery method.
  163. push: push,
  164. sort: arr.sort,
  165. splice: arr.splice
  166. };
  167. jQuery.extend = jQuery.fn.extend = function() {
  168. var options, name, src, copy, copyIsArray, clone,
  169. target = arguments[ 0 ] || {},
  170. i = 1,
  171. length = arguments.length,
  172. deep = false;
  173. // Handle a deep copy situation
  174. if ( typeof target === "boolean" ) {
  175. deep = target;
  176. // Skip the boolean and the target
  177. target = arguments[ i ] || {};
  178. i++;
  179. }
  180. // Handle case when target is a string or something (possible in deep copy)
  181. if ( typeof target !== "object" && !isFunction( target ) ) {
  182. target = {};
  183. }
  184. // Extend jQuery itself if only one argument is passed
  185. if ( i === length ) {
  186. target = this;
  187. i--;
  188. }
  189. for ( ; i < length; i++ ) {
  190. // Only deal with non-null/undefined values
  191. if ( ( options = arguments[ i ] ) != null ) {
  192. // Extend the base object
  193. for ( name in options ) {
  194. src = target[ name ];
  195. copy = options[ name ];
  196. // Prevent Object.prototype pollution
  197. // Prevent never-ending loop
  198. if ( name === "__proto__" || target === copy ) {
  199. continue;
  200. }
  201. // Recurse if we're merging plain objects or arrays
  202. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  203. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  204. if ( copyIsArray ) {
  205. copyIsArray = false;
  206. clone = src && Array.isArray( src ) ? src : [];
  207. } else {
  208. clone = src && jQuery.isPlainObject( src ) ? src : {};
  209. }
  210. // Never move original objects, clone them
  211. target[ name ] = jQuery.extend( deep, clone, copy );
  212. // Don't bring in undefined values
  213. } else if ( copy !== undefined ) {
  214. target[ name ] = copy;
  215. }
  216. }
  217. }
  218. }
  219. // Return the modified object
  220. return target;
  221. };
  222. jQuery.extend( {
  223. // Unique for each copy of jQuery on the page
  224. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  225. // Assume jQuery is ready without the ready module
  226. isReady: true,
  227. error: function( msg ) {
  228. throw new Error( msg );
  229. },
  230. noop: function() {},
  231. isPlainObject: function( obj ) {
  232. var proto, Ctor;
  233. // Detect obvious negatives
  234. // Use toString instead of jQuery.type to catch host objects
  235. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  236. return false;
  237. }
  238. proto = getProto( obj );
  239. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  240. if ( !proto ) {
  241. return true;
  242. }
  243. // Objects with prototype are plain iff they were constructed by a global Object function
  244. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  245. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  246. },
  247. isEmptyObject: function( obj ) {
  248. /* eslint-disable no-unused-vars */
  249. // See https://github.com/eslint/eslint/issues/6125
  250. var name;
  251. for ( name in obj ) {
  252. return false;
  253. }
  254. return true;
  255. },
  256. // Evaluates a script in a global context
  257. globalEval: function( code ) {
  258. DOMEval( code );
  259. },
  260. each: function( obj, callback ) {
  261. var length, i = 0;
  262. if ( isArrayLike( obj ) ) {
  263. length = obj.length;
  264. for ( ; i < length; i++ ) {
  265. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  266. break;
  267. }
  268. }
  269. } else {
  270. for ( i in obj ) {
  271. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  272. break;
  273. }
  274. }
  275. }
  276. return obj;
  277. },
  278. // Support: Android <=4.0 only
  279. trim: function( text ) {
  280. return text == null ?
  281. "" :
  282. ( text + "" ).replace( rtrim, "" );
  283. },
  284. // results is for internal usage only
  285. makeArray: function( arr, results ) {
  286. var ret = results || [];
  287. if ( arr != null ) {
  288. if ( isArrayLike( Object( arr ) ) ) {
  289. jQuery.merge( ret,
  290. typeof arr === "string" ?
  291. [ arr ] : arr
  292. );
  293. } else {
  294. push.call( ret, arr );
  295. }
  296. }
  297. return ret;
  298. },
  299. inArray: function( elem, arr, i ) {
  300. return arr == null ? -1 : indexOf.call( arr, elem, i );
  301. },
  302. // Support: Android <=4.0 only, PhantomJS 1 only
  303. // push.apply(_, arraylike) throws on ancient WebKit
  304. merge: function( first, second ) {
  305. var len = +second.length,
  306. j = 0,
  307. i = first.length;
  308. for ( ; j < len; j++ ) {
  309. first[ i++ ] = second[ j ];
  310. }
  311. first.length = i;
  312. return first;
  313. },
  314. grep: function( elems, callback, invert ) {
  315. var callbackInverse,
  316. matches = [],
  317. i = 0,
  318. length = elems.length,
  319. callbackExpect = !invert;
  320. // Go through the array, only saving the items
  321. // that pass the validator function
  322. for ( ; i < length; i++ ) {
  323. callbackInverse = !callback( elems[ i ], i );
  324. if ( callbackInverse !== callbackExpect ) {
  325. matches.push( elems[ i ] );
  326. }
  327. }
  328. return matches;
  329. },
  330. // arg is for internal usage only
  331. map: function( elems, callback, arg ) {
  332. var length, value,
  333. i = 0,
  334. ret = [];
  335. // Go through the array, translating each of the items to their new values
  336. if ( isArrayLike( elems ) ) {
  337. length = elems.length;
  338. for ( ; i < length; i++ ) {
  339. value = callback( elems[ i ], i, arg );
  340. if ( value != null ) {
  341. ret.push( value );
  342. }
  343. }
  344. // Go through every key on the object,
  345. } else {
  346. for ( i in elems ) {
  347. value = callback( elems[ i ], i, arg );
  348. if ( value != null ) {
  349. ret.push( value );
  350. }
  351. }
  352. }
  353. // Flatten any nested arrays
  354. return concat.apply( [], ret );
  355. },
  356. // A global GUID counter for objects
  357. guid: 1,
  358. // jQuery.support is not used in Core but other projects attach their
  359. // properties to it so it needs to exist.
  360. support: support
  361. } );
  362. if ( typeof Symbol === "function" ) {
  363. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  364. }
  365. // Populate the class2type map
  366. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  367. function( i, name ) {
  368. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  369. } );
  370. function isArrayLike( obj ) {
  371. // Support: real iOS 8.2 only (not reproducible in simulator)
  372. // `in` check used to prevent JIT error (gh-2145)
  373. // hasOwn isn't used here due to false negatives
  374. // regarding Nodelist length in IE
  375. var length = !!obj && "length" in obj && obj.length,
  376. type = toType( obj );
  377. if ( isFunction( obj ) || isWindow( obj ) ) {
  378. return false;
  379. }
  380. return type === "array" || length === 0 ||
  381. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  382. }
  383. var Sizzle =
  384. /*!
  385. * Sizzle CSS Selector Engine v2.3.3
  386. * https://sizzlejs.com/
  387. *
  388. * Copyright jQuery Foundation and other contributors
  389. * Released under the MIT license
  390. * http://jquery.org/license
  391. *
  392. * Date: 2016-08-08
  393. */
  394. (function( window ) {
  395. var i,
  396. support,
  397. Expr,
  398. getText,
  399. isXML,
  400. tokenize,
  401. compile,
  402. select,
  403. outermostContext,
  404. sortInput,
  405. hasDuplicate,
  406. // Local document vars
  407. setDocument,
  408. document,
  409. docElem,
  410. documentIsHTML,
  411. rbuggyQSA,
  412. rbuggyMatches,
  413. matches,
  414. contains,
  415. // Instance-specific data
  416. expando = "sizzle" + 1 * new Date(),
  417. preferredDoc = window.document,
  418. dirruns = 0,
  419. done = 0,
  420. classCache = createCache(),
  421. tokenCache = createCache(),
  422. compilerCache = createCache(),
  423. sortOrder = function( a, b ) {
  424. if ( a === b ) {
  425. hasDuplicate = true;
  426. }
  427. return 0;
  428. },
  429. // Instance methods
  430. hasOwn = ({}).hasOwnProperty,
  431. arr = [],
  432. pop = arr.pop,
  433. push_native = arr.push,
  434. push = arr.push,
  435. slice = arr.slice,
  436. // Use a stripped-down indexOf as it's faster than native
  437. // https://jsperf.com/thor-indexof-vs-for/5
  438. indexOf = function( list, elem ) {
  439. var i = 0,
  440. len = list.length;
  441. for ( ; i < len; i++ ) {
  442. if ( list[i] === elem ) {
  443. return i;
  444. }
  445. }
  446. return -1;
  447. },
  448. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  449. // Regular expressions
  450. // http://www.w3.org/TR/css3-selectors/#whitespace
  451. whitespace = "[\\x20\\t\\r\\n\\f]",
  452. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  453. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  454. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  455. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  456. // Operator (capture 2)
  457. "*([*^$|!~]?=)" + whitespace +
  458. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  459. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  460. "*\\]",
  461. pseudos = ":(" + identifier + ")(?:\\((" +
  462. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  463. // 1. quoted (capture 3; capture 4 or capture 5)
  464. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  465. // 2. simple (capture 6)
  466. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  467. // 3. anything else (capture 2)
  468. ".*" +
  469. ")\\)|)",
  470. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  471. rwhitespace = new RegExp( whitespace + "+", "g" ),
  472. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  473. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  474. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  475. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  476. rpseudo = new RegExp( pseudos ),
  477. ridentifier = new RegExp( "^" + identifier + "$" ),
  478. matchExpr = {
  479. "ID": new RegExp( "^#(" + identifier + ")" ),
  480. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  481. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  482. "ATTR": new RegExp( "^" + attributes ),
  483. "PSEUDO": new RegExp( "^" + pseudos ),
  484. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  485. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  486. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  487. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  488. // For use in libraries implementing .is()
  489. // We use this for POS matching in `select`
  490. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  491. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  492. },
  493. rinputs = /^(?:input|select|textarea|button)$/i,
  494. rheader = /^h\d$/i,
  495. rnative = /^[^{]+\{\s*\[native \w/,
  496. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  497. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  498. rsibling = /[+~]/,
  499. // CSS escapes
  500. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  501. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  502. funescape = function( _, escaped, escapedWhitespace ) {
  503. var high = "0x" + escaped - 0x10000;
  504. // NaN means non-codepoint
  505. // Support: Firefox<24
  506. // Workaround erroneous numeric interpretation of +"0x"
  507. return high !== high || escapedWhitespace ?
  508. escaped :
  509. high < 0 ?
  510. // BMP codepoint
  511. String.fromCharCode( high + 0x10000 ) :
  512. // Supplemental Plane codepoint (surrogate pair)
  513. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  514. },
  515. // CSS string/identifier serialization
  516. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  517. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  518. fcssescape = function( ch, asCodePoint ) {
  519. if ( asCodePoint ) {
  520. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  521. if ( ch === "\0" ) {
  522. return "\uFFFD";
  523. }
  524. // Control characters and (dependent upon position) numbers get escaped as code points
  525. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  526. }
  527. // Other potentially-special ASCII characters get backslash-escaped
  528. return "\\" + ch;
  529. },
  530. // Used for iframes
  531. // See setDocument()
  532. // Removing the function wrapper causes a "Permission Denied"
  533. // error in IE
  534. unloadHandler = function() {
  535. setDocument();
  536. },
  537. disabledAncestor = addCombinator(
  538. function( elem ) {
  539. return elem.disabled === true && ("form" in elem || "label" in elem);
  540. },
  541. { dir: "parentNode", next: "legend" }
  542. );
  543. // Optimize for push.apply( _, NodeList )
  544. try {
  545. push.apply(
  546. (arr = slice.call( preferredDoc.childNodes )),
  547. preferredDoc.childNodes
  548. );
  549. // Support: Android<4.0
  550. // Detect silently failing push.apply
  551. arr[ preferredDoc.childNodes.length ].nodeType;
  552. } catch ( e ) {
  553. push = { apply: arr.length ?
  554. // Leverage slice if possible
  555. function( target, els ) {
  556. push_native.apply( target, slice.call(els) );
  557. } :
  558. // Support: IE<9
  559. // Otherwise append directly
  560. function( target, els ) {
  561. var j = target.length,
  562. i = 0;
  563. // Can't trust NodeList.length
  564. while ( (target[j++] = els[i++]) ) {}
  565. target.length = j - 1;
  566. }
  567. };
  568. }
  569. function Sizzle( selector, context, results, seed ) {
  570. var m, i, elem, nid, match, groups, newSelector,
  571. newContext = context && context.ownerDocument,
  572. // nodeType defaults to 9, since context defaults to document
  573. nodeType = context ? context.nodeType : 9;
  574. results = results || [];
  575. // Return early from calls with invalid selector or context
  576. if ( typeof selector !== "string" || !selector ||
  577. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  578. return results;
  579. }
  580. // Try to shortcut find operations (as opposed to filters) in HTML documents
  581. if ( !seed ) {
  582. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  583. setDocument( context );
  584. }
  585. context = context || document;
  586. if ( documentIsHTML ) {
  587. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  588. // (excepting DocumentFragment context, where the methods don't exist)
  589. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  590. // ID selector
  591. if ( (m = match[1]) ) {
  592. // Document context
  593. if ( nodeType === 9 ) {
  594. if ( (elem = context.getElementById( m )) ) {
  595. // Support: IE, Opera, Webkit
  596. // TODO: identify versions
  597. // getElementById can match elements by name instead of ID
  598. if ( elem.id === m ) {
  599. results.push( elem );
  600. return results;
  601. }
  602. } else {
  603. return results;
  604. }
  605. // Element context
  606. } else {
  607. // Support: IE, Opera, Webkit
  608. // TODO: identify versions
  609. // getElementById can match elements by name instead of ID
  610. if ( newContext && (elem = newContext.getElementById( m )) &&
  611. contains( context, elem ) &&
  612. elem.id === m ) {
  613. results.push( elem );
  614. return results;
  615. }
  616. }
  617. // Type selector
  618. } else if ( match[2] ) {
  619. push.apply( results, context.getElementsByTagName( selector ) );
  620. return results;
  621. // Class selector
  622. } else if ( (m = match[3]) && support.getElementsByClassName &&
  623. context.getElementsByClassName ) {
  624. push.apply( results, context.getElementsByClassName( m ) );
  625. return results;
  626. }
  627. }
  628. // Take advantage of querySelectorAll
  629. if ( support.qsa &&
  630. !compilerCache[ selector + " " ] &&
  631. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  632. if ( nodeType !== 1 ) {
  633. newContext = context;
  634. newSelector = selector;
  635. // qSA looks outside Element context, which is not what we want
  636. // Thanks to Andrew Dupont for this workaround technique
  637. // Support: IE <=8
  638. // Exclude object elements
  639. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  640. // Capture the context ID, setting it first if necessary
  641. if ( (nid = context.getAttribute( "id" )) ) {
  642. nid = nid.replace( rcssescape, fcssescape );
  643. } else {
  644. context.setAttribute( "id", (nid = expando) );
  645. }
  646. // Prefix every selector in the list
  647. groups = tokenize( selector );
  648. i = groups.length;
  649. while ( i-- ) {
  650. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  651. }
  652. newSelector = groups.join( "," );
  653. // Expand context for sibling selectors
  654. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  655. context;
  656. }
  657. if ( newSelector ) {
  658. try {
  659. push.apply( results,
  660. newContext.querySelectorAll( newSelector )
  661. );
  662. return results;
  663. } catch ( qsaError ) {
  664. } finally {
  665. if ( nid === expando ) {
  666. context.removeAttribute( "id" );
  667. }
  668. }
  669. }
  670. }
  671. }
  672. }
  673. // All others
  674. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  675. }
  676. /**
  677. * Create key-value caches of limited size
  678. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  679. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  680. * deleting the oldest entry
  681. */
  682. function createCache() {
  683. var keys = [];
  684. function cache( key, value ) {
  685. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  686. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  687. // Only keep the most recent entries
  688. delete cache[ keys.shift() ];
  689. }
  690. return (cache[ key + " " ] = value);
  691. }
  692. return cache;
  693. }
  694. /**
  695. * Mark a function for special use by Sizzle
  696. * @param {Function} fn The function to mark
  697. */
  698. function markFunction( fn ) {
  699. fn[ expando ] = true;
  700. return fn;
  701. }
  702. /**
  703. * Support testing using an element
  704. * @param {Function} fn Passed the created element and returns a boolean result
  705. */
  706. function assert( fn ) {
  707. var el = document.createElement("fieldset");
  708. try {
  709. return !!fn( el );
  710. } catch (e) {
  711. return false;
  712. } finally {
  713. // Remove from its parent by default
  714. if ( el.parentNode ) {
  715. el.parentNode.removeChild( el );
  716. }
  717. // release memory in IE
  718. el = null;
  719. }
  720. }
  721. /**
  722. * Adds the same handler for all of the specified attrs
  723. * @param {String} attrs Pipe-separated list of attributes
  724. * @param {Function} handler The method that will be applied
  725. */
  726. function addHandle( attrs, handler ) {
  727. var arr = attrs.split("|"),
  728. i = arr.length;
  729. while ( i-- ) {
  730. Expr.attrHandle[ arr[i] ] = handler;
  731. }
  732. }
  733. /**
  734. * Checks document order of two siblings
  735. * @param {Element} a
  736. * @param {Element} b
  737. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  738. */
  739. function siblingCheck( a, b ) {
  740. var cur = b && a,
  741. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  742. a.sourceIndex - b.sourceIndex;
  743. // Use IE sourceIndex if available on both nodes
  744. if ( diff ) {
  745. return diff;
  746. }
  747. // Check if b follows a
  748. if ( cur ) {
  749. while ( (cur = cur.nextSibling) ) {
  750. if ( cur === b ) {
  751. return -1;
  752. }
  753. }
  754. }
  755. return a ? 1 : -1;
  756. }
  757. /**
  758. * Returns a function to use in pseudos for input types
  759. * @param {String} type
  760. */
  761. function createInputPseudo( type ) {
  762. return function( elem ) {
  763. var name = elem.nodeName.toLowerCase();
  764. return name === "input" && elem.type === type;
  765. };
  766. }
  767. /**
  768. * Returns a function to use in pseudos for buttons
  769. * @param {String} type
  770. */
  771. function createButtonPseudo( type ) {
  772. return function( elem ) {
  773. var name = elem.nodeName.toLowerCase();
  774. return (name === "input" || name === "button") && elem.type === type;
  775. };
  776. }
  777. /**
  778. * Returns a function to use in pseudos for :enabled/:disabled
  779. * @param {Boolean} disabled true for :disabled; false for :enabled
  780. */
  781. function createDisabledPseudo( disabled ) {
  782. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  783. return function( elem ) {
  784. // Only certain elements can match :enabled or :disabled
  785. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  787. if ( "form" in elem ) {
  788. // Check for inherited disabledness on relevant non-disabled elements:
  789. // * listed form-associated elements in a disabled fieldset
  790. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  791. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  792. // * option elements in a disabled optgroup
  793. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  794. // All such elements have a "form" property.
  795. if ( elem.parentNode && elem.disabled === false ) {
  796. // Option elements defer to a parent optgroup if present
  797. if ( "label" in elem ) {
  798. if ( "label" in elem.parentNode ) {
  799. return elem.parentNode.disabled === disabled;
  800. } else {
  801. return elem.disabled === disabled;
  802. }
  803. }
  804. // Support: IE 6 - 11
  805. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  806. return elem.isDisabled === disabled ||
  807. // Where there is no isDisabled, check manually
  808. /* jshint -W018 */
  809. elem.isDisabled !== !disabled &&
  810. disabledAncestor( elem ) === disabled;
  811. }
  812. return elem.disabled === disabled;
  813. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  814. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  815. // even exist on them, let alone have a boolean value.
  816. } else if ( "label" in elem ) {
  817. return elem.disabled === disabled;
  818. }
  819. // Remaining elements are neither :enabled nor :disabled
  820. return false;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for positionals
  825. * @param {Function} fn
  826. */
  827. function createPositionalPseudo( fn ) {
  828. return markFunction(function( argument ) {
  829. argument = +argument;
  830. return markFunction(function( seed, matches ) {
  831. var j,
  832. matchIndexes = fn( [], seed.length, argument ),
  833. i = matchIndexes.length;
  834. // Match elements found at the specified indexes
  835. while ( i-- ) {
  836. if ( seed[ (j = matchIndexes[i]) ] ) {
  837. seed[j] = !(matches[j] = seed[j]);
  838. }
  839. }
  840. });
  841. });
  842. }
  843. /**
  844. * Checks a node for validity as a Sizzle context
  845. * @param {Element|Object=} context
  846. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  847. */
  848. function testContext( context ) {
  849. return context && typeof context.getElementsByTagName !== "undefined" && context;
  850. }
  851. // Expose support vars for convenience
  852. support = Sizzle.support = {};
  853. /**
  854. * Detects XML nodes
  855. * @param {Element|Object} elem An element or a document
  856. * @returns {Boolean} True iff elem is a non-HTML XML node
  857. */
  858. isXML = Sizzle.isXML = function( elem ) {
  859. // documentElement is verified for cases where it doesn't yet exist
  860. // (such as loading iframes in IE - #4833)
  861. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  862. return documentElement ? documentElement.nodeName !== "HTML" : false;
  863. };
  864. /**
  865. * Sets document-related variables once based on the current document
  866. * @param {Element|Object} [doc] An element or document object to use to set the document
  867. * @returns {Object} Returns the current document
  868. */
  869. setDocument = Sizzle.setDocument = function( node ) {
  870. var hasCompare, subWindow,
  871. doc = node ? node.ownerDocument || node : preferredDoc;
  872. // Return early if doc is invalid or already selected
  873. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  874. return document;
  875. }
  876. // Update global variables
  877. document = doc;
  878. docElem = document.documentElement;
  879. documentIsHTML = !isXML( document );
  880. // Support: IE 9-11, Edge
  881. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  882. if ( preferredDoc !== document &&
  883. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  884. // Support: IE 11, Edge
  885. if ( subWindow.addEventListener ) {
  886. subWindow.addEventListener( "unload", unloadHandler, false );
  887. // Support: IE 9 - 10 only
  888. } else if ( subWindow.attachEvent ) {
  889. subWindow.attachEvent( "onunload", unloadHandler );
  890. }
  891. }
  892. /* Attributes
  893. ---------------------------------------------------------------------- */
  894. // Support: IE<8
  895. // Verify that getAttribute really returns attributes and not properties
  896. // (excepting IE8 booleans)
  897. support.attributes = assert(function( el ) {
  898. el.className = "i";
  899. return !el.getAttribute("className");
  900. });
  901. /* getElement(s)By*
  902. ---------------------------------------------------------------------- */
  903. // Check if getElementsByTagName("*") returns only elements
  904. support.getElementsByTagName = assert(function( el ) {
  905. el.appendChild( document.createComment("") );
  906. return !el.getElementsByTagName("*").length;
  907. });
  908. // Support: IE<9
  909. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  910. // Support: IE<10
  911. // Check if getElementById returns elements by name
  912. // The broken getElementById methods don't pick up programmatically-set names,
  913. // so use a roundabout getElementsByName test
  914. support.getById = assert(function( el ) {
  915. docElem.appendChild( el ).id = expando;
  916. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  917. });
  918. // ID filter and find
  919. if ( support.getById ) {
  920. Expr.filter["ID"] = function( id ) {
  921. var attrId = id.replace( runescape, funescape );
  922. return function( elem ) {
  923. return elem.getAttribute("id") === attrId;
  924. };
  925. };
  926. Expr.find["ID"] = function( id, context ) {
  927. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  928. var elem = context.getElementById( id );
  929. return elem ? [ elem ] : [];
  930. }
  931. };
  932. } else {
  933. Expr.filter["ID"] = function( id ) {
  934. var attrId = id.replace( runescape, funescape );
  935. return function( elem ) {
  936. var node = typeof elem.getAttributeNode !== "undefined" &&
  937. elem.getAttributeNode("id");
  938. return node && node.value === attrId;
  939. };
  940. };
  941. // Support: IE 6 - 7 only
  942. // getElementById is not reliable as a find shortcut
  943. Expr.find["ID"] = function( id, context ) {
  944. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  945. var node, i, elems,
  946. elem = context.getElementById( id );
  947. if ( elem ) {
  948. // Verify the id attribute
  949. node = elem.getAttributeNode("id");
  950. if ( node && node.value === id ) {
  951. return [ elem ];
  952. }
  953. // Fall back on getElementsByName
  954. elems = context.getElementsByName( id );
  955. i = 0;
  956. while ( (elem = elems[i++]) ) {
  957. node = elem.getAttributeNode("id");
  958. if ( node && node.value === id ) {
  959. return [ elem ];
  960. }
  961. }
  962. }
  963. return [];
  964. }
  965. };
  966. }
  967. // Tag
  968. Expr.find["TAG"] = support.getElementsByTagName ?
  969. function( tag, context ) {
  970. if ( typeof context.getElementsByTagName !== "undefined" ) {
  971. return context.getElementsByTagName( tag );
  972. // DocumentFragment nodes don't have gEBTN
  973. } else if ( support.qsa ) {
  974. return context.querySelectorAll( tag );
  975. }
  976. } :
  977. function( tag, context ) {
  978. var elem,
  979. tmp = [],
  980. i = 0,
  981. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  982. results = context.getElementsByTagName( tag );
  983. // Filter out possible comments
  984. if ( tag === "*" ) {
  985. while ( (elem = results[i++]) ) {
  986. if ( elem.nodeType === 1 ) {
  987. tmp.push( elem );
  988. }
  989. }
  990. return tmp;
  991. }
  992. return results;
  993. };
  994. // Class
  995. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  996. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  997. return context.getElementsByClassName( className );
  998. }
  999. };
  1000. /* QSA/matchesSelector
  1001. ---------------------------------------------------------------------- */
  1002. // QSA and matchesSelector support
  1003. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1004. rbuggyMatches = [];
  1005. // qSa(:focus) reports false when true (Chrome 21)
  1006. // We allow this because of a bug in IE8/9 that throws an error
  1007. // whenever `document.activeElement` is accessed on an iframe
  1008. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1009. // See https://bugs.jquery.com/ticket/13378
  1010. rbuggyQSA = [];
  1011. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1012. // Build QSA regex
  1013. // Regex strategy adopted from Diego Perini
  1014. assert(function( el ) {
  1015. // Select is set to empty string on purpose
  1016. // This is to test IE's treatment of not explicitly
  1017. // setting a boolean content attribute,
  1018. // since its presence should be enough
  1019. // https://bugs.jquery.com/ticket/12359
  1020. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1021. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1022. "<option selected=''></option></select>";
  1023. // Support: IE8, Opera 11-12.16
  1024. // Nothing should be selected when empty strings follow ^= or $= or *=
  1025. // The test attribute must be unknown in Opera but "safe" for WinRT
  1026. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1027. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1028. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1029. }
  1030. // Support: IE8
  1031. // Boolean attributes and "value" are not treated correctly
  1032. if ( !el.querySelectorAll("[selected]").length ) {
  1033. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1034. }
  1035. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1036. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1037. rbuggyQSA.push("~=");
  1038. }
  1039. // Webkit/Opera - :checked should return selected option elements
  1040. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1041. // IE8 throws error here and will not see later tests
  1042. if ( !el.querySelectorAll(":checked").length ) {
  1043. rbuggyQSA.push(":checked");
  1044. }
  1045. // Support: Safari 8+, iOS 8+
  1046. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1047. // In-page `selector#id sibling-combinator selector` fails
  1048. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1049. rbuggyQSA.push(".#.+[+~]");
  1050. }
  1051. });
  1052. assert(function( el ) {
  1053. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1054. "<select disabled='disabled'><option/></select>";
  1055. // Support: Windows 8 Native Apps
  1056. // The type and name attributes are restricted during .innerHTML assignment
  1057. var input = document.createElement("input");
  1058. input.setAttribute( "type", "hidden" );
  1059. el.appendChild( input ).setAttribute( "name", "D" );
  1060. // Support: IE8
  1061. // Enforce case-sensitivity of name attribute
  1062. if ( el.querySelectorAll("[name=d]").length ) {
  1063. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1064. }
  1065. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1066. // IE8 throws error here and will not see later tests
  1067. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1068. rbuggyQSA.push( ":enabled", ":disabled" );
  1069. }
  1070. // Support: IE9-11+
  1071. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1072. docElem.appendChild( el ).disabled = true;
  1073. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1074. rbuggyQSA.push( ":enabled", ":disabled" );
  1075. }
  1076. // Opera 10-11 does not throw on post-comma invalid pseudos
  1077. el.querySelectorAll("*,:x");
  1078. rbuggyQSA.push(",.*:");
  1079. });
  1080. }
  1081. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1082. docElem.webkitMatchesSelector ||
  1083. docElem.mozMatchesSelector ||
  1084. docElem.oMatchesSelector ||
  1085. docElem.msMatchesSelector) )) ) {
  1086. assert(function( el ) {
  1087. // Check to see if it's possible to do matchesSelector
  1088. // on a disconnected node (IE 9)
  1089. support.disconnectedMatch = matches.call( el, "*" );
  1090. // This should fail with an exception
  1091. // Gecko does not error, returns false instead
  1092. matches.call( el, "[s!='']:x" );
  1093. rbuggyMatches.push( "!=", pseudos );
  1094. });
  1095. }
  1096. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1097. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1098. /* Contains
  1099. ---------------------------------------------------------------------- */
  1100. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1101. // Element contains another
  1102. // Purposefully self-exclusive
  1103. // As in, an element does not contain itself
  1104. contains = hasCompare || rnative.test( docElem.contains ) ?
  1105. function( a, b ) {
  1106. var adown = a.nodeType === 9 ? a.documentElement : a,
  1107. bup = b && b.parentNode;
  1108. return a === bup || !!( bup && bup.nodeType === 1 && (
  1109. adown.contains ?
  1110. adown.contains( bup ) :
  1111. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1112. ));
  1113. } :
  1114. function( a, b ) {
  1115. if ( b ) {
  1116. while ( (b = b.parentNode) ) {
  1117. if ( b === a ) {
  1118. return true;
  1119. }
  1120. }
  1121. }
  1122. return false;
  1123. };
  1124. /* Sorting
  1125. ---------------------------------------------------------------------- */
  1126. // Document order sorting
  1127. sortOrder = hasCompare ?
  1128. function( a, b ) {
  1129. // Flag for duplicate removal
  1130. if ( a === b ) {
  1131. hasDuplicate = true;
  1132. return 0;
  1133. }
  1134. // Sort on method existence if only one input has compareDocumentPosition
  1135. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1136. if ( compare ) {
  1137. return compare;
  1138. }
  1139. // Calculate position if both inputs belong to the same document
  1140. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1141. a.compareDocumentPosition( b ) :
  1142. // Otherwise we know they are disconnected
  1143. 1;
  1144. // Disconnected nodes
  1145. if ( compare & 1 ||
  1146. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1147. // Choose the first element that is related to our preferred document
  1148. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1149. return -1;
  1150. }
  1151. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1152. return 1;
  1153. }
  1154. // Maintain original order
  1155. return sortInput ?
  1156. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1157. 0;
  1158. }
  1159. return compare & 4 ? -1 : 1;
  1160. } :
  1161. function( a, b ) {
  1162. // Exit early if the nodes are identical
  1163. if ( a === b ) {
  1164. hasDuplicate = true;
  1165. return 0;
  1166. }
  1167. var cur,
  1168. i = 0,
  1169. aup = a.parentNode,
  1170. bup = b.parentNode,
  1171. ap = [ a ],
  1172. bp = [ b ];
  1173. // Parentless nodes are either documents or disconnected
  1174. if ( !aup || !bup ) {
  1175. return a === document ? -1 :
  1176. b === document ? 1 :
  1177. aup ? -1 :
  1178. bup ? 1 :
  1179. sortInput ?
  1180. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1181. 0;
  1182. // If the nodes are siblings, we can do a quick check
  1183. } else if ( aup === bup ) {
  1184. return siblingCheck( a, b );
  1185. }
  1186. // Otherwise we need full lists of their ancestors for comparison
  1187. cur = a;
  1188. while ( (cur = cur.parentNode) ) {
  1189. ap.unshift( cur );
  1190. }
  1191. cur = b;
  1192. while ( (cur = cur.parentNode) ) {
  1193. bp.unshift( cur );
  1194. }
  1195. // Walk down the tree looking for a discrepancy
  1196. while ( ap[i] === bp[i] ) {
  1197. i++;
  1198. }
  1199. return i ?
  1200. // Do a sibling check if the nodes have a common ancestor
  1201. siblingCheck( ap[i], bp[i] ) :
  1202. // Otherwise nodes in our document sort first
  1203. ap[i] === preferredDoc ? -1 :
  1204. bp[i] === preferredDoc ? 1 :
  1205. 0;
  1206. };
  1207. return document;
  1208. };
  1209. Sizzle.matches = function( expr, elements ) {
  1210. return Sizzle( expr, null, null, elements );
  1211. };
  1212. Sizzle.matchesSelector = function( elem, expr ) {
  1213. // Set document vars if needed
  1214. if ( ( elem.ownerDocument || elem ) !== document ) {
  1215. setDocument( elem );
  1216. }
  1217. // Make sure that attribute selectors are quoted
  1218. expr = expr.replace( rattributeQuotes, "='$1']" );
  1219. if ( support.matchesSelector && documentIsHTML &&
  1220. !compilerCache[ expr + " " ] &&
  1221. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1222. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1223. try {
  1224. var ret = matches.call( elem, expr );
  1225. // IE 9's matchesSelector returns false on disconnected nodes
  1226. if ( ret || support.disconnectedMatch ||
  1227. // As well, disconnected nodes are said to be in a document
  1228. // fragment in IE 9
  1229. elem.document && elem.document.nodeType !== 11 ) {
  1230. return ret;
  1231. }
  1232. } catch (e) {}
  1233. }
  1234. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1235. };
  1236. Sizzle.contains = function( context, elem ) {
  1237. // Set document vars if needed
  1238. if ( ( context.ownerDocument || context ) !== document ) {
  1239. setDocument( context );
  1240. }
  1241. return contains( context, elem );
  1242. };
  1243. Sizzle.attr = function( elem, name ) {
  1244. // Set document vars if needed
  1245. if ( ( elem.ownerDocument || elem ) !== document ) {
  1246. setDocument( elem );
  1247. }
  1248. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1249. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1250. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1251. fn( elem, name, !documentIsHTML ) :
  1252. undefined;
  1253. return val !== undefined ?
  1254. val :
  1255. support.attributes || !documentIsHTML ?
  1256. elem.getAttribute( name ) :
  1257. (val = elem.getAttributeNode(name)) && val.specified ?
  1258. val.value :
  1259. null;
  1260. };
  1261. Sizzle.escape = function( sel ) {
  1262. return (sel + "").replace( rcssescape, fcssescape );
  1263. };
  1264. Sizzle.error = function( msg ) {
  1265. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1266. };
  1267. /**
  1268. * Document sorting and removing duplicates
  1269. * @param {ArrayLike} results
  1270. */
  1271. Sizzle.uniqueSort = function( results ) {
  1272. var elem,
  1273. duplicates = [],
  1274. j = 0,
  1275. i = 0;
  1276. // Unless we *know* we can detect duplicates, assume their presence
  1277. hasDuplicate = !support.detectDuplicates;
  1278. sortInput = !support.sortStable && results.slice( 0 );
  1279. results.sort( sortOrder );
  1280. if ( hasDuplicate ) {
  1281. while ( (elem = results[i++]) ) {
  1282. if ( elem === results[ i ] ) {
  1283. j = duplicates.push( i );
  1284. }
  1285. }
  1286. while ( j-- ) {
  1287. results.splice( duplicates[ j ], 1 );
  1288. }
  1289. }
  1290. // Clear input after sorting to release objects
  1291. // See https://github.com/jquery/sizzle/pull/225
  1292. sortInput = null;
  1293. return results;
  1294. };
  1295. /**
  1296. * Utility function for retrieving the text value of an array of DOM nodes
  1297. * @param {Array|Element} elem
  1298. */
  1299. getText = Sizzle.getText = function( elem ) {
  1300. var node,
  1301. ret = "",
  1302. i = 0,
  1303. nodeType = elem.nodeType;
  1304. if ( !nodeType ) {
  1305. // If no nodeType, this is expected to be an array
  1306. while ( (node = elem[i++]) ) {
  1307. // Do not traverse comment nodes
  1308. ret += getText( node );
  1309. }
  1310. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1311. // Use textContent for elements
  1312. // innerText usage removed for consistency of new lines (jQuery #11153)
  1313. if ( typeof elem.textContent === "string" ) {
  1314. return elem.textContent;
  1315. } else {
  1316. // Traverse its children
  1317. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1318. ret += getText( elem );
  1319. }
  1320. }
  1321. } else if ( nodeType === 3 || nodeType === 4 ) {
  1322. return elem.nodeValue;
  1323. }
  1324. // Do not include comment or processing instruction nodes
  1325. return ret;
  1326. };
  1327. Expr = Sizzle.selectors = {
  1328. // Can be adjusted by the user
  1329. cacheLength: 50,
  1330. createPseudo: markFunction,
  1331. match: matchExpr,
  1332. attrHandle: {},
  1333. find: {},
  1334. relative: {
  1335. ">": { dir: "parentNode", first: true },
  1336. " ": { dir: "parentNode" },
  1337. "+": { dir: "previousSibling", first: true },
  1338. "~": { dir: "previousSibling" }
  1339. },
  1340. preFilter: {
  1341. "ATTR": function( match ) {
  1342. match[1] = match[1].replace( runescape, funescape );
  1343. // Move the given value to match[3] whether quoted or unquoted
  1344. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1345. if ( match[2] === "~=" ) {
  1346. match[3] = " " + match[3] + " ";
  1347. }
  1348. return match.slice( 0, 4 );
  1349. },
  1350. "CHILD": function( match ) {
  1351. /* matches from matchExpr["CHILD"]
  1352. 1 type (only|nth|...)
  1353. 2 what (child|of-type)
  1354. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1355. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1356. 5 sign of xn-component
  1357. 6 x of xn-component
  1358. 7 sign of y-component
  1359. 8 y of y-component
  1360. */
  1361. match[1] = match[1].toLowerCase();
  1362. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1363. // nth-* requires argument
  1364. if ( !match[3] ) {
  1365. Sizzle.error( match[0] );
  1366. }
  1367. // numeric x and y parameters for Expr.filter.CHILD
  1368. // remember that false/true cast respectively to 0/1
  1369. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1370. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1371. // other types prohibit arguments
  1372. } else if ( match[3] ) {
  1373. Sizzle.error( match[0] );
  1374. }
  1375. return match;
  1376. },
  1377. "PSEUDO": function( match ) {
  1378. var excess,
  1379. unquoted = !match[6] && match[2];
  1380. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1381. return null;
  1382. }
  1383. // Accept quoted arguments as-is
  1384. if ( match[3] ) {
  1385. match[2] = match[4] || match[5] || "";
  1386. // Strip excess characters from unquoted arguments
  1387. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1388. // Get excess from tokenize (recursively)
  1389. (excess = tokenize( unquoted, true )) &&
  1390. // advance to the next closing parenthesis
  1391. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1392. // excess is a negative index
  1393. match[0] = match[0].slice( 0, excess );
  1394. match[2] = unquoted.slice( 0, excess );
  1395. }
  1396. // Return only captures needed by the pseudo filter method (type and argument)
  1397. return match.slice( 0, 3 );
  1398. }
  1399. },
  1400. filter: {
  1401. "TAG": function( nodeNameSelector ) {
  1402. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1403. return nodeNameSelector === "*" ?
  1404. function() { return true; } :
  1405. function( elem ) {
  1406. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1407. };
  1408. },
  1409. "CLASS": function( className ) {
  1410. var pattern = classCache[ className + " " ];
  1411. return pattern ||
  1412. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1413. classCache( className, function( elem ) {
  1414. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1415. });
  1416. },
  1417. "ATTR": function( name, operator, check ) {
  1418. return function( elem ) {
  1419. var result = Sizzle.attr( elem, name );
  1420. if ( result == null ) {
  1421. return operator === "!=";
  1422. }
  1423. if ( !operator ) {
  1424. return true;
  1425. }
  1426. result += "";
  1427. return operator === "=" ? result === check :
  1428. operator === "!=" ? result !== check :
  1429. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1430. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1431. operator === "$=" ? check && result.slice( -check.length ) === check :
  1432. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1433. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1434. false;
  1435. };
  1436. },
  1437. "CHILD": function( type, what, argument, first, last ) {
  1438. var simple = type.slice( 0, 3 ) !== "nth",
  1439. forward = type.slice( -4 ) !== "last",
  1440. ofType = what === "of-type";
  1441. return first === 1 && last === 0 ?
  1442. // Shortcut for :nth-*(n)
  1443. function( elem ) {
  1444. return !!elem.parentNode;
  1445. } :
  1446. function( elem, context, xml ) {
  1447. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1448. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1449. parent = elem.parentNode,
  1450. name = ofType && elem.nodeName.toLowerCase(),
  1451. useCache = !xml && !ofType,
  1452. diff = false;
  1453. if ( parent ) {
  1454. // :(first|last|only)-(child|of-type)
  1455. if ( simple ) {
  1456. while ( dir ) {
  1457. node = elem;
  1458. while ( (node = node[ dir ]) ) {
  1459. if ( ofType ?
  1460. node.nodeName.toLowerCase() === name :
  1461. node.nodeType === 1 ) {
  1462. return false;
  1463. }
  1464. }
  1465. // Reverse direction for :only-* (if we haven't yet done so)
  1466. start = dir = type === "only" && !start && "nextSibling";
  1467. }
  1468. return true;
  1469. }
  1470. start = [ forward ? parent.firstChild : parent.lastChild ];
  1471. // non-xml :nth-child(...) stores cache data on `parent`
  1472. if ( forward && useCache ) {
  1473. // Seek `elem` from a previously-cached index
  1474. // ...in a gzip-friendly way
  1475. node = parent;
  1476. outerCache = node[ expando ] || (node[ expando ] = {});
  1477. // Support: IE <9 only
  1478. // Defend against cloned attroperties (jQuery gh-1709)
  1479. uniqueCache = outerCache[ node.uniqueID ] ||
  1480. (outerCache[ node.uniqueID ] = {});
  1481. cache = uniqueCache[ type ] || [];
  1482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1483. diff = nodeIndex && cache[ 2 ];
  1484. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1485. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1486. // Fallback to seeking `elem` from the start
  1487. (diff = nodeIndex = 0) || start.pop()) ) {
  1488. // When found, cache indexes on `parent` and break
  1489. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1490. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1491. break;
  1492. }
  1493. }
  1494. } else {
  1495. // Use previously-cached element index if available
  1496. if ( useCache ) {
  1497. // ...in a gzip-friendly way
  1498. node = elem;
  1499. outerCache = node[ expando ] || (node[ expando ] = {});
  1500. // Support: IE <9 only
  1501. // Defend against cloned attroperties (jQuery gh-1709)
  1502. uniqueCache = outerCache[ node.uniqueID ] ||
  1503. (outerCache[ node.uniqueID ] = {});
  1504. cache = uniqueCache[ type ] || [];
  1505. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1506. diff = nodeIndex;
  1507. }
  1508. // xml :nth-child(...)
  1509. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1510. if ( diff === false ) {
  1511. // Use the same loop as above to seek `elem` from the start
  1512. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1513. (diff = nodeIndex = 0) || start.pop()) ) {
  1514. if ( ( ofType ?
  1515. node.nodeName.toLowerCase() === name :
  1516. node.nodeType === 1 ) &&
  1517. ++diff ) {
  1518. // Cache the index of each encountered element
  1519. if ( useCache ) {
  1520. outerCache = node[ expando ] || (node[ expando ] = {});
  1521. // Support: IE <9 only
  1522. // Defend against cloned attroperties (jQuery gh-1709)
  1523. uniqueCache = outerCache[ node.uniqueID ] ||
  1524. (outerCache[ node.uniqueID ] = {});
  1525. uniqueCache[ type ] = [ dirruns, diff ];
  1526. }
  1527. if ( node === elem ) {
  1528. break;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. // Incorporate the offset, then check against cycle size
  1535. diff -= last;
  1536. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1537. }
  1538. };
  1539. },
  1540. "PSEUDO": function( pseudo, argument ) {
  1541. // pseudo-class names are case-insensitive
  1542. // http://www.w3.org/TR/selectors/#pseudo-classes
  1543. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1544. // Remember that setFilters inherits from pseudos
  1545. var args,
  1546. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1547. Sizzle.error( "unsupported pseudo: " + pseudo );
  1548. // The user may use createPseudo to indicate that
  1549. // arguments are needed to create the filter function
  1550. // just as Sizzle does
  1551. if ( fn[ expando ] ) {
  1552. return fn( argument );
  1553. }
  1554. // But maintain support for old signatures
  1555. if ( fn.length > 1 ) {
  1556. args = [ pseudo, pseudo, "", argument ];
  1557. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1558. markFunction(function( seed, matches ) {
  1559. var idx,
  1560. matched = fn( seed, argument ),
  1561. i = matched.length;
  1562. while ( i-- ) {
  1563. idx = indexOf( seed, matched[i] );
  1564. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1565. }
  1566. }) :
  1567. function( elem ) {
  1568. return fn( elem, 0, args );
  1569. };
  1570. }
  1571. return fn;
  1572. }
  1573. },
  1574. pseudos: {
  1575. // Potentially complex pseudos
  1576. "not": markFunction(function( selector ) {
  1577. // Trim the selector passed to compile
  1578. // to avoid treating leading and trailing
  1579. // spaces as combinators
  1580. var input = [],
  1581. results = [],
  1582. matcher = compile( selector.replace( rtrim, "$1" ) );
  1583. return matcher[ expando ] ?
  1584. markFunction(function( seed, matches, context, xml ) {
  1585. var elem,
  1586. unmatched = matcher( seed, null, xml, [] ),
  1587. i = seed.length;
  1588. // Match elements unmatched by `matcher`
  1589. while ( i-- ) {
  1590. if ( (elem = unmatched[i]) ) {
  1591. seed[i] = !(matches[i] = elem);
  1592. }
  1593. }
  1594. }) :
  1595. function( elem, context, xml ) {
  1596. input[0] = elem;
  1597. matcher( input, null, xml, results );
  1598. // Don't keep the element (issue #299)
  1599. input[0] = null;
  1600. return !results.pop();
  1601. };
  1602. }),
  1603. "has": markFunction(function( selector ) {
  1604. return function( elem ) {
  1605. return Sizzle( selector, elem ).length > 0;
  1606. };
  1607. }),
  1608. "contains": markFunction(function( text ) {
  1609. text = text.replace( runescape, funescape );
  1610. return function( elem ) {
  1611. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1612. };
  1613. }),
  1614. // "Whether an element is represented by a :lang() selector
  1615. // is based solely on the element's language value
  1616. // being equal to the identifier C,
  1617. // or beginning with the identifier C immediately followed by "-".
  1618. // The matching of C against the element's language value is performed case-insensitively.
  1619. // The identifier C does not have to be a valid language name."
  1620. // http://www.w3.org/TR/selectors/#lang-pseudo
  1621. "lang": markFunction( function( lang ) {
  1622. // lang value must be a valid identifier
  1623. if ( !ridentifier.test(lang || "") ) {
  1624. Sizzle.error( "unsupported lang: " + lang );
  1625. }
  1626. lang = lang.replace( runescape, funescape ).toLowerCase();
  1627. return function( elem ) {
  1628. var elemLang;
  1629. do {
  1630. if ( (elemLang = documentIsHTML ?
  1631. elem.lang :
  1632. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1633. elemLang = elemLang.toLowerCase();
  1634. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1635. }
  1636. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1637. return false;
  1638. };
  1639. }),
  1640. // Miscellaneous
  1641. "target": function( elem ) {
  1642. var hash = window.location && window.location.hash;
  1643. return hash && hash.slice( 1 ) === elem.id;
  1644. },
  1645. "root": function( elem ) {
  1646. return elem === docElem;
  1647. },
  1648. "focus": function( elem ) {
  1649. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1650. },
  1651. // Boolean properties
  1652. "enabled": createDisabledPseudo( false ),
  1653. "disabled": createDisabledPseudo( true ),
  1654. "checked": function( elem ) {
  1655. // In CSS3, :checked should return both checked and selected elements
  1656. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1657. var nodeName = elem.nodeName.toLowerCase();
  1658. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1659. },
  1660. "selected": function( elem ) {
  1661. // Accessing this property makes selected-by-default
  1662. // options in Safari work properly
  1663. if ( elem.parentNode ) {
  1664. elem.parentNode.selectedIndex;
  1665. }
  1666. return elem.selected === true;
  1667. },
  1668. // Contents
  1669. "empty": function( elem ) {
  1670. // http://www.w3.org/TR/selectors/#empty-pseudo
  1671. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1672. // but not by others (comment: 8; processing instruction: 7; etc.)
  1673. // nodeType < 6 works because attributes (2) do not appear as children
  1674. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1675. if ( elem.nodeType < 6 ) {
  1676. return false;
  1677. }
  1678. }
  1679. return true;
  1680. },
  1681. "parent": function( elem ) {
  1682. return !Expr.pseudos["empty"]( elem );
  1683. },
  1684. // Element/input types
  1685. "header": function( elem ) {
  1686. return rheader.test( elem.nodeName );
  1687. },
  1688. "input": function( elem ) {
  1689. return rinputs.test( elem.nodeName );
  1690. },
  1691. "button": function( elem ) {
  1692. var name = elem.nodeName.toLowerCase();
  1693. return name === "input" && elem.type === "button" || name === "button";
  1694. },
  1695. "text": function( elem ) {
  1696. var attr;
  1697. return elem.nodeName.toLowerCase() === "input" &&
  1698. elem.type === "text" &&
  1699. // Support: IE<8
  1700. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1701. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1702. },
  1703. // Position-in-collection
  1704. "first": createPositionalPseudo(function() {
  1705. return [ 0 ];
  1706. }),
  1707. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1708. return [ length - 1 ];
  1709. }),
  1710. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1711. return [ argument < 0 ? argument + length : argument ];
  1712. }),
  1713. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1714. var i = 0;
  1715. for ( ; i < length; i += 2 ) {
  1716. matchIndexes.push( i );
  1717. }
  1718. return matchIndexes;
  1719. }),
  1720. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1721. var i = 1;
  1722. for ( ; i < length; i += 2 ) {
  1723. matchIndexes.push( i );
  1724. }
  1725. return matchIndexes;
  1726. }),
  1727. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1728. var i = argument < 0 ? argument + length : argument;
  1729. for ( ; --i >= 0; ) {
  1730. matchIndexes.push( i );
  1731. }
  1732. return matchIndexes;
  1733. }),
  1734. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1735. var i = argument < 0 ? argument + length : argument;
  1736. for ( ; ++i < length; ) {
  1737. matchIndexes.push( i );
  1738. }
  1739. return matchIndexes;
  1740. })
  1741. }
  1742. };
  1743. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1744. // Add button/input type pseudos
  1745. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1746. Expr.pseudos[ i ] = createInputPseudo( i );
  1747. }
  1748. for ( i in { submit: true, reset: true } ) {
  1749. Expr.pseudos[ i ] = createButtonPseudo( i );
  1750. }
  1751. // Easy API for creating new setFilters
  1752. function setFilters() {}
  1753. setFilters.prototype = Expr.filters = Expr.pseudos;
  1754. Expr.setFilters = new setFilters();
  1755. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1756. var matched, match, tokens, type,
  1757. soFar, groups, preFilters,
  1758. cached = tokenCache[ selector + " " ];
  1759. if ( cached ) {
  1760. return parseOnly ? 0 : cached.slice( 0 );
  1761. }
  1762. soFar = selector;
  1763. groups = [];
  1764. preFilters = Expr.preFilter;
  1765. while ( soFar ) {
  1766. // Comma and first run
  1767. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1768. if ( match ) {
  1769. // Don't consume trailing commas as valid
  1770. soFar = soFar.slice( match[0].length ) || soFar;
  1771. }
  1772. groups.push( (tokens = []) );
  1773. }
  1774. matched = false;
  1775. // Combinators
  1776. if ( (match = rcombinators.exec( soFar )) ) {
  1777. matched = match.shift();
  1778. tokens.push({
  1779. value: matched,
  1780. // Cast descendant combinators to space
  1781. type: match[0].replace( rtrim, " " )
  1782. });
  1783. soFar = soFar.slice( matched.length );
  1784. }
  1785. // Filters
  1786. for ( type in Expr.filter ) {
  1787. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1788. (match = preFilters[ type ]( match ))) ) {
  1789. matched = match.shift();
  1790. tokens.push({
  1791. value: matched,
  1792. type: type,
  1793. matches: match
  1794. });
  1795. soFar = soFar.slice( matched.length );
  1796. }
  1797. }
  1798. if ( !matched ) {
  1799. break;
  1800. }
  1801. }
  1802. // Return the length of the invalid excess
  1803. // if we're just parsing
  1804. // Otherwise, throw an error or return tokens
  1805. return parseOnly ?
  1806. soFar.length :
  1807. soFar ?
  1808. Sizzle.error( selector ) :
  1809. // Cache the tokens
  1810. tokenCache( selector, groups ).slice( 0 );
  1811. };
  1812. function toSelector( tokens ) {
  1813. var i = 0,
  1814. len = tokens.length,
  1815. selector = "";
  1816. for ( ; i < len; i++ ) {
  1817. selector += tokens[i].value;
  1818. }
  1819. return selector;
  1820. }
  1821. function addCombinator( matcher, combinator, base ) {
  1822. var dir = combinator.dir,
  1823. skip = combinator.next,
  1824. key = skip || dir,
  1825. checkNonElements = base && key === "parentNode",
  1826. doneName = done++;
  1827. return combinator.first ?
  1828. // Check against closest ancestor/preceding element
  1829. function( elem, context, xml ) {
  1830. while ( (elem = elem[ dir ]) ) {
  1831. if ( elem.nodeType === 1 || checkNonElements ) {
  1832. return matcher( elem, context, xml );
  1833. }
  1834. }
  1835. return false;
  1836. } :
  1837. // Check against all ancestor/preceding elements
  1838. function( elem, context, xml ) {
  1839. var oldCache, uniqueCache, outerCache,
  1840. newCache = [ dirruns, doneName ];
  1841. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1842. if ( xml ) {
  1843. while ( (elem = elem[ dir ]) ) {
  1844. if ( elem.nodeType === 1 || checkNonElements ) {
  1845. if ( matcher( elem, context, xml ) ) {
  1846. return true;
  1847. }
  1848. }
  1849. }
  1850. } else {
  1851. while ( (elem = elem[ dir ]) ) {
  1852. if ( elem.nodeType === 1 || checkNonElements ) {
  1853. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1854. // Support: IE <9 only
  1855. // Defend against cloned attroperties (jQuery gh-1709)
  1856. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1857. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1858. elem = elem[ dir ] || elem;
  1859. } else if ( (oldCache = uniqueCache[ key ]) &&
  1860. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1861. // Assign to newCache so results back-propagate to previous elements
  1862. return (newCache[ 2 ] = oldCache[ 2 ]);
  1863. } else {
  1864. // Reuse newcache so results back-propagate to previous elements
  1865. uniqueCache[ key ] = newCache;
  1866. // A match means we're done; a fail means we have to keep checking
  1867. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1868. return true;
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. return false;
  1875. };
  1876. }
  1877. function elementMatcher( matchers ) {
  1878. return matchers.length > 1 ?
  1879. function( elem, context, xml ) {
  1880. var i = matchers.length;
  1881. while ( i-- ) {
  1882. if ( !matchers[i]( elem, context, xml ) ) {
  1883. return false;
  1884. }
  1885. }
  1886. return true;
  1887. } :
  1888. matchers[0];
  1889. }
  1890. function multipleContexts( selector, contexts, results ) {
  1891. var i = 0,
  1892. len = contexts.length;
  1893. for ( ; i < len; i++ ) {
  1894. Sizzle( selector, contexts[i], results );
  1895. }
  1896. return results;
  1897. }
  1898. function condense( unmatched, map, filter, context, xml ) {
  1899. var elem,
  1900. newUnmatched = [],
  1901. i = 0,
  1902. len = unmatched.length,
  1903. mapped = map != null;
  1904. for ( ; i < len; i++ ) {
  1905. if ( (elem = unmatched[i]) ) {
  1906. if ( !filter || filter( elem, context, xml ) ) {
  1907. newUnmatched.push( elem );
  1908. if ( mapped ) {
  1909. map.push( i );
  1910. }
  1911. }
  1912. }
  1913. }
  1914. return newUnmatched;
  1915. }
  1916. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1917. if ( postFilter && !postFilter[ expando ] ) {
  1918. postFilter = setMatcher( postFilter );
  1919. }
  1920. if ( postFinder && !postFinder[ expando ] ) {
  1921. postFinder = setMatcher( postFinder, postSelector );
  1922. }
  1923. return markFunction(function( seed, results, context, xml ) {
  1924. var temp, i, elem,
  1925. preMap = [],
  1926. postMap = [],
  1927. preexisting = results.length,
  1928. // Get initial elements from seed or context
  1929. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1930. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1931. matcherIn = preFilter && ( seed || !selector ) ?
  1932. condense( elems, preMap, preFilter, context, xml ) :
  1933. elems,
  1934. matcherOut = matcher ?
  1935. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1936. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1937. // ...intermediate processing is necessary
  1938. [] :
  1939. // ...otherwise use results directly
  1940. results :
  1941. matcherIn;
  1942. // Find primary matches
  1943. if ( matcher ) {
  1944. matcher( matcherIn, matcherOut, context, xml );
  1945. }
  1946. // Apply postFilter
  1947. if ( postFilter ) {
  1948. temp = condense( matcherOut, postMap );
  1949. postFilter( temp, [], context, xml );
  1950. // Un-match failing elements by moving them back to matcherIn
  1951. i = temp.length;
  1952. while ( i-- ) {
  1953. if ( (elem = temp[i]) ) {
  1954. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1955. }
  1956. }
  1957. }
  1958. if ( seed ) {
  1959. if ( postFinder || preFilter ) {
  1960. if ( postFinder ) {
  1961. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1962. temp = [];
  1963. i = matcherOut.length;
  1964. while ( i-- ) {
  1965. if ( (elem = matcherOut[i]) ) {
  1966. // Restore matcherIn since elem is not yet a final match
  1967. temp.push( (matcherIn[i] = elem) );
  1968. }
  1969. }
  1970. postFinder( null, (matcherOut = []), temp, xml );
  1971. }
  1972. // Move matched elements from seed to results to keep them synchronized
  1973. i = matcherOut.length;
  1974. while ( i-- ) {
  1975. if ( (elem = matcherOut[i]) &&
  1976. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1977. seed[temp] = !(results[temp] = elem);
  1978. }
  1979. }
  1980. }
  1981. // Add elements to results, through postFinder if defined
  1982. } else {
  1983. matcherOut = condense(
  1984. matcherOut === results ?
  1985. matcherOut.splice( preexisting, matcherOut.length ) :
  1986. matcherOut
  1987. );
  1988. if ( postFinder ) {
  1989. postFinder( null, results, matcherOut, xml );
  1990. } else {
  1991. push.apply( results, matcherOut );
  1992. }
  1993. }
  1994. });
  1995. }
  1996. function matcherFromTokens( tokens ) {
  1997. var checkContext, matcher, j,
  1998. len = tokens.length,
  1999. leadingRelative = Expr.relative[ tokens[0].type ],
  2000. implicitRelative = leadingRelative || Expr.relative[" "],
  2001. i = leadingRelative ? 1 : 0,
  2002. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2003. matchContext = addCombinator( function( elem ) {
  2004. return elem === checkContext;
  2005. }, implicitRelative, true ),
  2006. matchAnyContext = addCombinator( function( elem ) {
  2007. return indexOf( checkContext, elem ) > -1;
  2008. }, implicitRelative, true ),
  2009. matchers = [ function( elem, context, xml ) {
  2010. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2011. (checkContext = context).nodeType ?
  2012. matchContext( elem, context, xml ) :
  2013. matchAnyContext( elem, context, xml ) );
  2014. // Avoid hanging onto element (issue #299)
  2015. checkContext = null;
  2016. return ret;
  2017. } ];
  2018. for ( ; i < len; i++ ) {
  2019. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2020. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2021. } else {
  2022. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2023. // Return special upon seeing a positional matcher
  2024. if ( matcher[ expando ] ) {
  2025. // Find the next relative operator (if any) for proper handling
  2026. j = ++i;
  2027. for ( ; j < len; j++ ) {
  2028. if ( Expr.relative[ tokens[j].type ] ) {
  2029. break;
  2030. }
  2031. }
  2032. return setMatcher(
  2033. i > 1 && elementMatcher( matchers ),
  2034. i > 1 && toSelector(
  2035. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2036. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2037. ).replace( rtrim, "$1" ),
  2038. matcher,
  2039. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2040. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2041. j < len && toSelector( tokens )
  2042. );
  2043. }
  2044. matchers.push( matcher );
  2045. }
  2046. }
  2047. return elementMatcher( matchers );
  2048. }
  2049. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2050. var bySet = setMatchers.length > 0,
  2051. byElement = elementMatchers.length > 0,
  2052. superMatcher = function( seed, context, xml, results, outermost ) {
  2053. var elem, j, matcher,
  2054. matchedCount = 0,
  2055. i = "0",
  2056. unmatched = seed && [],
  2057. setMatched = [],
  2058. contextBackup = outermostContext,
  2059. // We must always have either seed elements or outermost context
  2060. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2061. // Use integer dirruns iff this is the outermost matcher
  2062. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2063. len = elems.length;
  2064. if ( outermost ) {
  2065. outermostContext = context === document || context || outermost;
  2066. }
  2067. // Add elements passing elementMatchers directly to results
  2068. // Support: IE<9, Safari
  2069. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2070. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2071. if ( byElement && elem ) {
  2072. j = 0;
  2073. if ( !context && elem.ownerDocument !== document ) {
  2074. setDocument( elem );
  2075. xml = !documentIsHTML;
  2076. }
  2077. while ( (matcher = elementMatchers[j++]) ) {
  2078. if ( matcher( elem, context || document, xml) ) {
  2079. results.push( elem );
  2080. break;
  2081. }
  2082. }
  2083. if ( outermost ) {
  2084. dirruns = dirrunsUnique;
  2085. }
  2086. }
  2087. // Track unmatched elements for set filters
  2088. if ( bySet ) {
  2089. // They will have gone through all possible matchers
  2090. if ( (elem = !matcher && elem) ) {
  2091. matchedCount--;
  2092. }
  2093. // Lengthen the array for every element, matched or not
  2094. if ( seed ) {
  2095. unmatched.push( elem );
  2096. }
  2097. }
  2098. }
  2099. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2100. // makes the latter nonnegative.
  2101. matchedCount += i;
  2102. // Apply set filters to unmatched elements
  2103. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2104. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2105. // no element matchers and no seed.
  2106. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2107. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2108. // numerically zero.
  2109. if ( bySet && i !== matchedCount ) {
  2110. j = 0;
  2111. while ( (matcher = setMatchers[j++]) ) {
  2112. matcher( unmatched, setMatched, context, xml );
  2113. }
  2114. if ( seed ) {
  2115. // Reintegrate element matches to eliminate the need for sorting
  2116. if ( matchedCount > 0 ) {
  2117. while ( i-- ) {
  2118. if ( !(unmatched[i] || setMatched[i]) ) {
  2119. setMatched[i] = pop.call( results );
  2120. }
  2121. }
  2122. }
  2123. // Discard index placeholder values to get only actual matches
  2124. setMatched = condense( setMatched );
  2125. }
  2126. // Add matches to results
  2127. push.apply( results, setMatched );
  2128. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2129. if ( outermost && !seed && setMatched.length > 0 &&
  2130. ( matchedCount + setMatchers.length ) > 1 ) {
  2131. Sizzle.uniqueSort( results );
  2132. }
  2133. }
  2134. // Override manipulation of globals by nested matchers
  2135. if ( outermost ) {
  2136. dirruns = dirrunsUnique;
  2137. outermostContext = contextBackup;
  2138. }
  2139. return unmatched;
  2140. };
  2141. return bySet ?
  2142. markFunction( superMatcher ) :
  2143. superMatcher;
  2144. }
  2145. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2146. var i,
  2147. setMatchers = [],
  2148. elementMatchers = [],
  2149. cached = compilerCache[ selector + " " ];
  2150. if ( !cached ) {
  2151. // Generate a function of recursive functions that can be used to check each element
  2152. if ( !match ) {
  2153. match = tokenize( selector );
  2154. }
  2155. i = match.length;
  2156. while ( i-- ) {
  2157. cached = matcherFromTokens( match[i] );
  2158. if ( cached[ expando ] ) {
  2159. setMatchers.push( cached );
  2160. } else {
  2161. elementMatchers.push( cached );
  2162. }
  2163. }
  2164. // Cache the compiled function
  2165. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2166. // Save selector and tokenization
  2167. cached.selector = selector;
  2168. }
  2169. return cached;
  2170. };
  2171. /**
  2172. * A low-level selection function that works with Sizzle's compiled
  2173. * selector functions
  2174. * @param {String|Function} selector A selector or a pre-compiled
  2175. * selector function built with Sizzle.compile
  2176. * @param {Element} context
  2177. * @param {Array} [results]
  2178. * @param {Array} [seed] A set of elements to match against
  2179. */
  2180. select = Sizzle.select = function( selector, context, results, seed ) {
  2181. var i, tokens, token, type, find,
  2182. compiled = typeof selector === "function" && selector,
  2183. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2184. results = results || [];
  2185. // Try to minimize operations if there is only one selector in the list and no seed
  2186. // (the latter of which guarantees us context)
  2187. if ( match.length === 1 ) {
  2188. // Reduce context if the leading compound selector is an ID
  2189. tokens = match[0] = match[0].slice( 0 );
  2190. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2191. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2192. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2193. if ( !context ) {
  2194. return results;
  2195. // Precompiled matchers will still verify ancestry, so step up a level
  2196. } else if ( compiled ) {
  2197. context = context.parentNode;
  2198. }
  2199. selector = selector.slice( tokens.shift().value.length );
  2200. }
  2201. // Fetch a seed set for right-to-left matching
  2202. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2203. while ( i-- ) {
  2204. token = tokens[i];
  2205. // Abort if we hit a combinator
  2206. if ( Expr.relative[ (type = token.type) ] ) {
  2207. break;
  2208. }
  2209. if ( (find = Expr.find[ type ]) ) {
  2210. // Search, expanding context for leading sibling combinators
  2211. if ( (seed = find(
  2212. token.matches[0].replace( runescape, funescape ),
  2213. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2214. )) ) {
  2215. // If seed is empty or no tokens remain, we can return early
  2216. tokens.splice( i, 1 );
  2217. selector = seed.length && toSelector( tokens );
  2218. if ( !selector ) {
  2219. push.apply( results, seed );
  2220. return results;
  2221. }
  2222. break;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. // Compile and execute a filtering function if one is not provided
  2228. // Provide `match` to avoid retokenization if we modified the selector above
  2229. ( compiled || compile( selector, match ) )(
  2230. seed,
  2231. context,
  2232. !documentIsHTML,
  2233. results,
  2234. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2235. );
  2236. return results;
  2237. };
  2238. // One-time assignments
  2239. // Sort stability
  2240. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2241. // Support: Chrome 14-35+
  2242. // Always assume duplicates if they aren't passed to the comparison function
  2243. support.detectDuplicates = !!hasDuplicate;
  2244. // Initialize against the default document
  2245. setDocument();
  2246. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2247. // Detached nodes confoundingly follow *each other*
  2248. support.sortDetached = assert(function( el ) {
  2249. // Should return 1, but returns 4 (following)
  2250. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2251. });
  2252. // Support: IE<8
  2253. // Prevent attribute/property "interpolation"
  2254. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2255. if ( !assert(function( el ) {
  2256. el.innerHTML = "<a href='#'></a>";
  2257. return el.firstChild.getAttribute("href") === "#" ;
  2258. }) ) {
  2259. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2260. if ( !isXML ) {
  2261. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2262. }
  2263. });
  2264. }
  2265. // Support: IE<9
  2266. // Use defaultValue in place of getAttribute("value")
  2267. if ( !support.attributes || !assert(function( el ) {
  2268. el.innerHTML = "<input/>";
  2269. el.firstChild.setAttribute( "value", "" );
  2270. return el.firstChild.getAttribute( "value" ) === "";
  2271. }) ) {
  2272. addHandle( "value", function( elem, name, isXML ) {
  2273. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2274. return elem.defaultValue;
  2275. }
  2276. });
  2277. }
  2278. // Support: IE<9
  2279. // Use getAttributeNode to fetch booleans when getAttribute lies
  2280. if ( !assert(function( el ) {
  2281. return el.getAttribute("disabled") == null;
  2282. }) ) {
  2283. addHandle( booleans, function( elem, name, isXML ) {
  2284. var val;
  2285. if ( !isXML ) {
  2286. return elem[ name ] === true ? name.toLowerCase() :
  2287. (val = elem.getAttributeNode( name )) && val.specified ?
  2288. val.value :
  2289. null;
  2290. }
  2291. });
  2292. }
  2293. return Sizzle;
  2294. })( window );
  2295. jQuery.find = Sizzle;
  2296. jQuery.expr = Sizzle.selectors;
  2297. // Deprecated
  2298. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2299. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2300. jQuery.text = Sizzle.getText;
  2301. jQuery.isXMLDoc = Sizzle.isXML;
  2302. jQuery.contains = Sizzle.contains;
  2303. jQuery.escapeSelector = Sizzle.escape;
  2304. var dir = function( elem, dir, until ) {
  2305. var matched = [],
  2306. truncate = until !== undefined;
  2307. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2308. if ( elem.nodeType === 1 ) {
  2309. if ( truncate && jQuery( elem ).is( until ) ) {
  2310. break;
  2311. }
  2312. matched.push( elem );
  2313. }
  2314. }
  2315. return matched;
  2316. };
  2317. var siblings = function( n, elem ) {
  2318. var matched = [];
  2319. for ( ; n; n = n.nextSibling ) {
  2320. if ( n.nodeType === 1 && n !== elem ) {
  2321. matched.push( n );
  2322. }
  2323. }
  2324. return matched;
  2325. };
  2326. var rneedsContext = jQuery.expr.match.needsContext;
  2327. function nodeName( elem, name ) {
  2328. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2329. };
  2330. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2331. // Implement the identical functionality for filter and not
  2332. function winnow( elements, qualifier, not ) {
  2333. if ( isFunction( qualifier ) ) {
  2334. return jQuery.grep( elements, function( elem, i ) {
  2335. return !!qualifier.call( elem, i, elem ) !== not;
  2336. } );
  2337. }
  2338. // Single element
  2339. if ( qualifier.nodeType ) {
  2340. return jQuery.grep( elements, function( elem ) {
  2341. return ( elem === qualifier ) !== not;
  2342. } );
  2343. }
  2344. // Arraylike of elements (jQuery, arguments, Array)
  2345. if ( typeof qualifier !== "string" ) {
  2346. return jQuery.grep( elements, function( elem ) {
  2347. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2348. } );
  2349. }
  2350. // Filtered directly for both simple and complex selectors
  2351. return jQuery.filter( qualifier, elements, not );
  2352. }
  2353. jQuery.filter = function( expr, elems, not ) {
  2354. var elem = elems[ 0 ];
  2355. if ( not ) {
  2356. expr = ":not(" + expr + ")";
  2357. }
  2358. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2359. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2360. }
  2361. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2362. return elem.nodeType === 1;
  2363. } ) );
  2364. };
  2365. jQuery.fn.extend( {
  2366. find: function( selector ) {
  2367. var i, ret,
  2368. len = this.length,
  2369. self = this;
  2370. if ( typeof selector !== "string" ) {
  2371. return this.pushStack( jQuery( selector ).filter( function() {
  2372. for ( i = 0; i < len; i++ ) {
  2373. if ( jQuery.contains( self[ i ], this ) ) {
  2374. return true;
  2375. }
  2376. }
  2377. } ) );
  2378. }
  2379. ret = this.pushStack( [] );
  2380. for ( i = 0; i < len; i++ ) {
  2381. jQuery.find( selector, self[ i ], ret );
  2382. }
  2383. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2384. },
  2385. filter: function( selector ) {
  2386. return this.pushStack( winnow( this, selector || [], false ) );
  2387. },
  2388. not: function( selector ) {
  2389. return this.pushStack( winnow( this, selector || [], true ) );
  2390. },
  2391. is: function( selector ) {
  2392. return !!winnow(
  2393. this,
  2394. // If this is a positional/relative selector, check membership in the returned set
  2395. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2396. typeof selector === "string" && rneedsContext.test( selector ) ?
  2397. jQuery( selector ) :
  2398. selector || [],
  2399. false
  2400. ).length;
  2401. }
  2402. } );
  2403. // Initialize a jQuery object
  2404. // A central reference to the root jQuery(document)
  2405. var rootjQuery,
  2406. // A simple way to check for HTML strings
  2407. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2408. // Strict HTML recognition (#11290: must start with <)
  2409. // Shortcut simple #id case for speed
  2410. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2411. init = jQuery.fn.init = function( selector, context, root ) {
  2412. var match, elem;
  2413. // HANDLE: $(""), $(null), $(undefined), $(false)
  2414. if ( !selector ) {
  2415. return this;
  2416. }
  2417. // Method init() accepts an alternate rootjQuery
  2418. // so migrate can support jQuery.sub (gh-2101)
  2419. root = root || rootjQuery;
  2420. // Handle HTML strings
  2421. if ( typeof selector === "string" ) {
  2422. if ( selector[ 0 ] === "<" &&
  2423. selector[ selector.length - 1 ] === ">" &&
  2424. selector.length >= 3 ) {
  2425. // Assume that strings that start and end with <> are HTML and skip the regex check
  2426. match = [ null, selector, null ];
  2427. } else {
  2428. match = rquickExpr.exec( selector );
  2429. }
  2430. // Match html or make sure no context is specified for #id
  2431. if ( match && ( match[ 1 ] || !context ) ) {
  2432. // HANDLE: $(html) -> $(array)
  2433. if ( match[ 1 ] ) {
  2434. context = context instanceof jQuery ? context[ 0 ] : context;
  2435. // Option to run scripts is true for back-compat
  2436. // Intentionally let the error be thrown if parseHTML is not present
  2437. jQuery.merge( this, jQuery.parseHTML(
  2438. match[ 1 ],
  2439. context && context.nodeType ? context.ownerDocument || context : document,
  2440. true
  2441. ) );
  2442. // HANDLE: $(html, props)
  2443. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2444. for ( match in context ) {
  2445. // Properties of context are called as methods if possible
  2446. if ( isFunction( this[ match ] ) ) {
  2447. this[ match ]( context[ match ] );
  2448. // ...and otherwise set as attributes
  2449. } else {
  2450. this.attr( match, context[ match ] );
  2451. }
  2452. }
  2453. }
  2454. return this;
  2455. // HANDLE: $(#id)
  2456. } else {
  2457. elem = document.getElementById( match[ 2 ] );
  2458. if ( elem ) {
  2459. // Inject the element directly into the jQuery object
  2460. this[ 0 ] = elem;
  2461. this.length = 1;
  2462. }
  2463. return this;
  2464. }
  2465. // HANDLE: $(expr, $(...))
  2466. } else if ( !context || context.jquery ) {
  2467. return ( context || root ).find( selector );
  2468. // HANDLE: $(expr, context)
  2469. // (which is just equivalent to: $(context).find(expr)
  2470. } else {
  2471. return this.constructor( context ).find( selector );
  2472. }
  2473. // HANDLE: $(DOMElement)
  2474. } else if ( selector.nodeType ) {
  2475. this[ 0 ] = selector;
  2476. this.length = 1;
  2477. return this;
  2478. // HANDLE: $(function)
  2479. // Shortcut for document ready
  2480. } else if ( isFunction( selector ) ) {
  2481. return root.ready !== undefined ?
  2482. root.ready( selector ) :
  2483. // Execute immediately if ready is not present
  2484. selector( jQuery );
  2485. }
  2486. return jQuery.makeArray( selector, this );
  2487. };
  2488. // Give the init function the jQuery prototype for later instantiation
  2489. init.prototype = jQuery.fn;
  2490. // Initialize central reference
  2491. rootjQuery = jQuery( document );
  2492. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2493. // Methods guaranteed to produce a unique set when starting from a unique set
  2494. guaranteedUnique = {
  2495. children: true,
  2496. contents: true,
  2497. next: true,
  2498. prev: true
  2499. };
  2500. jQuery.fn.extend( {
  2501. has: function( target ) {
  2502. var targets = jQuery( target, this ),
  2503. l = targets.length;
  2504. return this.filter( function() {
  2505. var i = 0;
  2506. for ( ; i < l; i++ ) {
  2507. if ( jQuery.contains( this, targets[ i ] ) ) {
  2508. return true;
  2509. }
  2510. }
  2511. } );
  2512. },
  2513. closest: function( selectors, context ) {
  2514. var cur,
  2515. i = 0,
  2516. l = this.length,
  2517. matched = [],
  2518. targets = typeof selectors !== "string" && jQuery( selectors );
  2519. // Positional selectors never match, since there's no _selection_ context
  2520. if ( !rneedsContext.test( selectors ) ) {
  2521. for ( ; i < l; i++ ) {
  2522. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2523. // Always skip document fragments
  2524. if ( cur.nodeType < 11 && ( targets ?
  2525. targets.index( cur ) > -1 :
  2526. // Don't pass non-elements to Sizzle
  2527. cur.nodeType === 1 &&
  2528. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2529. matched.push( cur );
  2530. break;
  2531. }
  2532. }
  2533. }
  2534. }
  2535. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2536. },
  2537. // Determine the position of an element within the set
  2538. index: function( elem ) {
  2539. // No argument, return index in parent
  2540. if ( !elem ) {
  2541. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2542. }
  2543. // Index in selector
  2544. if ( typeof elem === "string" ) {
  2545. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2546. }
  2547. // Locate the position of the desired element
  2548. return indexOf.call( this,
  2549. // If it receives a jQuery object, the first element is used
  2550. elem.jquery ? elem[ 0 ] : elem
  2551. );
  2552. },
  2553. add: function( selector, context ) {
  2554. return this.pushStack(
  2555. jQuery.uniqueSort(
  2556. jQuery.merge( this.get(), jQuery( selector, context ) )
  2557. )
  2558. );
  2559. },
  2560. addBack: function( selector ) {
  2561. return this.add( selector == null ?
  2562. this.prevObject : this.prevObject.filter( selector )
  2563. );
  2564. }
  2565. } );
  2566. function sibling( cur, dir ) {
  2567. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2568. return cur;
  2569. }
  2570. jQuery.each( {
  2571. parent: function( elem ) {
  2572. var parent = elem.parentNode;
  2573. return parent && parent.nodeType !== 11 ? parent : null;
  2574. },
  2575. parents: function( elem ) {
  2576. return dir( elem, "parentNode" );
  2577. },
  2578. parentsUntil: function( elem, i, until ) {
  2579. return dir( elem, "parentNode", until );
  2580. },
  2581. next: function( elem ) {
  2582. return sibling( elem, "nextSibling" );
  2583. },
  2584. prev: function( elem ) {
  2585. return sibling( elem, "previousSibling" );
  2586. },
  2587. nextAll: function( elem ) {
  2588. return dir( elem, "nextSibling" );
  2589. },
  2590. prevAll: function( elem ) {
  2591. return dir( elem, "previousSibling" );
  2592. },
  2593. nextUntil: function( elem, i, until ) {
  2594. return dir( elem, "nextSibling", until );
  2595. },
  2596. prevUntil: function( elem, i, until ) {
  2597. return dir( elem, "previousSibling", until );
  2598. },
  2599. siblings: function( elem ) {
  2600. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2601. },
  2602. children: function( elem ) {
  2603. return siblings( elem.firstChild );
  2604. },
  2605. contents: function( elem ) {
  2606. if ( nodeName( elem, "iframe" ) ) {
  2607. return elem.contentDocument;
  2608. }
  2609. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2610. // Treat the template element as a regular one in browsers that
  2611. // don't support it.
  2612. if ( nodeName( elem, "template" ) ) {
  2613. elem = elem.content || elem;
  2614. }
  2615. return jQuery.merge( [], elem.childNodes );
  2616. }
  2617. }, function( name, fn ) {
  2618. jQuery.fn[ name ] = function( until, selector ) {
  2619. var matched = jQuery.map( this, fn, until );
  2620. if ( name.slice( -5 ) !== "Until" ) {
  2621. selector = until;
  2622. }
  2623. if ( selector && typeof selector === "string" ) {
  2624. matched = jQuery.filter( selector, matched );
  2625. }
  2626. if ( this.length > 1 ) {
  2627. // Remove duplicates
  2628. if ( !guaranteedUnique[ name ] ) {
  2629. jQuery.uniqueSort( matched );
  2630. }
  2631. // Reverse order for parents* and prev-derivatives
  2632. if ( rparentsprev.test( name ) ) {
  2633. matched.reverse();
  2634. }
  2635. }
  2636. return this.pushStack( matched );
  2637. };
  2638. } );
  2639. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2640. // Convert String-formatted options into Object-formatted ones
  2641. function createOptions( options ) {
  2642. var object = {};
  2643. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2644. object[ flag ] = true;
  2645. } );
  2646. return object;
  2647. }
  2648. /*
  2649. * Create a callback list using the following parameters:
  2650. *
  2651. * options: an optional list of space-separated options that will change how
  2652. * the callback list behaves or a more traditional option object
  2653. *
  2654. * By default a callback list will act like an event callback list and can be
  2655. * "fired" multiple times.
  2656. *
  2657. * Possible options:
  2658. *
  2659. * once: will ensure the callback list can only be fired once (like a Deferred)
  2660. *
  2661. * memory: will keep track of previous values and will call any callback added
  2662. * after the list has been fired right away with the latest "memorized"
  2663. * values (like a Deferred)
  2664. *
  2665. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2666. *
  2667. * stopOnFalse: interrupt callings when a callback returns false
  2668. *
  2669. */
  2670. jQuery.Callbacks = function( options ) {
  2671. // Convert options from String-formatted to Object-formatted if needed
  2672. // (we check in cache first)
  2673. options = typeof options === "string" ?
  2674. createOptions( options ) :
  2675. jQuery.extend( {}, options );
  2676. var // Flag to know if list is currently firing
  2677. firing,
  2678. // Last fire value for non-forgettable lists
  2679. memory,
  2680. // Flag to know if list was already fired
  2681. fired,
  2682. // Flag to prevent firing
  2683. locked,
  2684. // Actual callback list
  2685. list = [],
  2686. // Queue of execution data for repeatable lists
  2687. queue = [],
  2688. // Index of currently firing callback (modified by add/remove as needed)
  2689. firingIndex = -1,
  2690. // Fire callbacks
  2691. fire = function() {
  2692. // Enforce single-firing
  2693. locked = locked || options.once;
  2694. // Execute callbacks for all pending executions,
  2695. // respecting firingIndex overrides and runtime changes
  2696. fired = firing = true;
  2697. for ( ; queue.length; firingIndex = -1 ) {
  2698. memory = queue.shift();
  2699. while ( ++firingIndex < list.length ) {
  2700. // Run callback and check for early termination
  2701. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2702. options.stopOnFalse ) {
  2703. // Jump to end and forget the data so .add doesn't re-fire
  2704. firingIndex = list.length;
  2705. memory = false;
  2706. }
  2707. }
  2708. }
  2709. // Forget the data if we're done with it
  2710. if ( !options.memory ) {
  2711. memory = false;
  2712. }
  2713. firing = false;
  2714. // Clean up if we're done firing for good
  2715. if ( locked ) {
  2716. // Keep an empty list if we have data for future add calls
  2717. if ( memory ) {
  2718. list = [];
  2719. // Otherwise, this object is spent
  2720. } else {
  2721. list = "";
  2722. }
  2723. }
  2724. },
  2725. // Actual Callbacks object
  2726. self = {
  2727. // Add a callback or a collection of callbacks to the list
  2728. add: function() {
  2729. if ( list ) {
  2730. // If we have memory from a past run, we should fire after adding
  2731. if ( memory && !firing ) {
  2732. firingIndex = list.length - 1;
  2733. queue.push( memory );
  2734. }
  2735. ( function add( args ) {
  2736. jQuery.each( args, function( _, arg ) {
  2737. if ( isFunction( arg ) ) {
  2738. if ( !options.unique || !self.has( arg ) ) {
  2739. list.push( arg );
  2740. }
  2741. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  2742. // Inspect recursively
  2743. add( arg );
  2744. }
  2745. } );
  2746. } )( arguments );
  2747. if ( memory && !firing ) {
  2748. fire();
  2749. }
  2750. }
  2751. return this;
  2752. },
  2753. // Remove a callback from the list
  2754. remove: function() {
  2755. jQuery.each( arguments, function( _, arg ) {
  2756. var index;
  2757. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2758. list.splice( index, 1 );
  2759. // Handle firing indexes
  2760. if ( index <= firingIndex ) {
  2761. firingIndex--;
  2762. }
  2763. }
  2764. } );
  2765. return this;
  2766. },
  2767. // Check if a given callback is in the list.
  2768. // If no argument is given, return whether or not list has callbacks attached.
  2769. has: function( fn ) {
  2770. return fn ?
  2771. jQuery.inArray( fn, list ) > -1 :
  2772. list.length > 0;
  2773. },
  2774. // Remove all callbacks from the list
  2775. empty: function() {
  2776. if ( list ) {
  2777. list = [];
  2778. }
  2779. return this;
  2780. },
  2781. // Disable .fire and .add
  2782. // Abort any current/pending executions
  2783. // Clear all callbacks and values
  2784. disable: function() {
  2785. locked = queue = [];
  2786. list = memory = "";
  2787. return this;
  2788. },
  2789. disabled: function() {
  2790. return !list;
  2791. },
  2792. // Disable .fire
  2793. // Also disable .add unless we have memory (since it would have no effect)
  2794. // Abort any pending executions
  2795. lock: function() {
  2796. locked = queue = [];
  2797. if ( !memory && !firing ) {
  2798. list = memory = "";
  2799. }
  2800. return this;
  2801. },
  2802. locked: function() {
  2803. return !!locked;
  2804. },
  2805. // Call all callbacks with the given context and arguments
  2806. fireWith: function( context, args ) {
  2807. if ( !locked ) {
  2808. args = args || [];
  2809. args = [ context, args.slice ? args.slice() : args ];
  2810. queue.push( args );
  2811. if ( !firing ) {
  2812. fire();
  2813. }
  2814. }
  2815. return this;
  2816. },
  2817. // Call all the callbacks with the given arguments
  2818. fire: function() {
  2819. self.fireWith( this, arguments );
  2820. return this;
  2821. },
  2822. // To know if the callbacks have already been called at least once
  2823. fired: function() {
  2824. return !!fired;
  2825. }
  2826. };
  2827. return self;
  2828. };
  2829. function Identity( v ) {
  2830. return v;
  2831. }
  2832. function Thrower( ex ) {
  2833. throw ex;
  2834. }
  2835. function adoptValue( value, resolve, reject, noValue ) {
  2836. var method;
  2837. try {
  2838. // Check for promise aspect first to privilege synchronous behavior
  2839. if ( value && isFunction( ( method = value.promise ) ) ) {
  2840. method.call( value ).done( resolve ).fail( reject );
  2841. // Other thenables
  2842. } else if ( value && isFunction( ( method = value.then ) ) ) {
  2843. method.call( value, resolve, reject );
  2844. // Other non-thenables
  2845. } else {
  2846. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  2847. // * false: [ value ].slice( 0 ) => resolve( value )
  2848. // * true: [ value ].slice( 1 ) => resolve()
  2849. resolve.apply( undefined, [ value ].slice( noValue ) );
  2850. }
  2851. // For Promises/A+, convert exceptions into rejections
  2852. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2853. // Deferred#then to conditionally suppress rejection.
  2854. } catch ( value ) {
  2855. // Support: Android 4.0 only
  2856. // Strict mode functions invoked without .call/.apply get global-object context
  2857. reject.apply( undefined, [ value ] );
  2858. }
  2859. }
  2860. jQuery.extend( {
  2861. Deferred: function( func ) {
  2862. var tuples = [
  2863. // action, add listener, callbacks,
  2864. // ... .then handlers, argument index, [final state]
  2865. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  2866. jQuery.Callbacks( "memory" ), 2 ],
  2867. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  2868. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  2869. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  2870. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  2871. ],
  2872. state = "pending",
  2873. promise = {
  2874. state: function() {
  2875. return state;
  2876. },
  2877. always: function() {
  2878. deferred.done( arguments ).fail( arguments );
  2879. return this;
  2880. },
  2881. "catch": function( fn ) {
  2882. return promise.then( null, fn );
  2883. },
  2884. // Keep pipe for back-compat
  2885. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  2886. var fns = arguments;
  2887. return jQuery.Deferred( function( newDefer ) {
  2888. jQuery.each( tuples, function( i, tuple ) {
  2889. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2890. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  2891. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2892. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2893. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2894. deferred[ tuple[ 1 ] ]( function() {
  2895. var returned = fn && fn.apply( this, arguments );
  2896. if ( returned && isFunction( returned.promise ) ) {
  2897. returned.promise()
  2898. .progress( newDefer.notify )
  2899. .done( newDefer.resolve )
  2900. .fail( newDefer.reject );
  2901. } else {
  2902. newDefer[ tuple[ 0 ] + "With" ](
  2903. this,
  2904. fn ? [ returned ] : arguments
  2905. );
  2906. }
  2907. } );
  2908. } );
  2909. fns = null;
  2910. } ).promise();
  2911. },
  2912. then: function( onFulfilled, onRejected, onProgress ) {
  2913. var maxDepth = 0;
  2914. function resolve( depth, deferred, handler, special ) {
  2915. return function() {
  2916. var that = this,
  2917. args = arguments,
  2918. mightThrow = function() {
  2919. var returned, then;
  2920. // Support: Promises/A+ section 2.3.3.3.3
  2921. // https://promisesaplus.com/#point-59
  2922. // Ignore double-resolution attempts
  2923. if ( depth < maxDepth ) {
  2924. return;
  2925. }
  2926. returned = handler.apply( that, args );
  2927. // Support: Promises/A+ section 2.3.1
  2928. // https://promisesaplus.com/#point-48
  2929. if ( returned === deferred.promise() ) {
  2930. throw new TypeError( "Thenable self-resolution" );
  2931. }
  2932. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2933. // https://promisesaplus.com/#point-54
  2934. // https://promisesaplus.com/#point-75
  2935. // Retrieve `then` only once
  2936. then = returned &&
  2937. // Support: Promises/A+ section 2.3.4
  2938. // https://promisesaplus.com/#point-64
  2939. // Only check objects and functions for thenability
  2940. ( typeof returned === "object" ||
  2941. typeof returned === "function" ) &&
  2942. returned.then;
  2943. // Handle a returned thenable
  2944. if ( isFunction( then ) ) {
  2945. // Special processors (notify) just wait for resolution
  2946. if ( special ) {
  2947. then.call(
  2948. returned,
  2949. resolve( maxDepth, deferred, Identity, special ),
  2950. resolve( maxDepth, deferred, Thrower, special )
  2951. );
  2952. // Normal processors (resolve) also hook into progress
  2953. } else {
  2954. // ...and disregard older resolution values
  2955. maxDepth++;
  2956. then.call(
  2957. returned,
  2958. resolve( maxDepth, deferred, Identity, special ),
  2959. resolve( maxDepth, deferred, Thrower, special ),
  2960. resolve( maxDepth, deferred, Identity,
  2961. deferred.notifyWith )
  2962. );
  2963. }
  2964. // Handle all other returned values
  2965. } else {
  2966. // Only substitute handlers pass on context
  2967. // and multiple values (non-spec behavior)
  2968. if ( handler !== Identity ) {
  2969. that = undefined;
  2970. args = [ returned ];
  2971. }
  2972. // Process the value(s)
  2973. // Default process is resolve
  2974. ( special || deferred.resolveWith )( that, args );
  2975. }
  2976. },
  2977. // Only normal processors (resolve) catch and reject exceptions
  2978. process = special ?
  2979. mightThrow :
  2980. function() {
  2981. try {
  2982. mightThrow();
  2983. } catch ( e ) {
  2984. if ( jQuery.Deferred.exceptionHook ) {
  2985. jQuery.Deferred.exceptionHook( e,
  2986. process.stackTrace );
  2987. }
  2988. // Support: Promises/A+ section 2.3.3.3.4.1
  2989. // https://promisesaplus.com/#point-61
  2990. // Ignore post-resolution exceptions
  2991. if ( depth + 1 >= maxDepth ) {
  2992. // Only substitute handlers pass on context
  2993. // and multiple values (non-spec behavior)
  2994. if ( handler !== Thrower ) {
  2995. that = undefined;
  2996. args = [ e ];
  2997. }
  2998. deferred.rejectWith( that, args );
  2999. }
  3000. }
  3001. };
  3002. // Support: Promises/A+ section 2.3.3.3.1
  3003. // https://promisesaplus.com/#point-57
  3004. // Re-resolve promises immediately to dodge false rejection from
  3005. // subsequent errors
  3006. if ( depth ) {
  3007. process();
  3008. } else {
  3009. // Call an optional hook to record the stack, in case of exception
  3010. // since it's otherwise lost when execution goes async
  3011. if ( jQuery.Deferred.getStackHook ) {
  3012. process.stackTrace = jQuery.Deferred.getStackHook();
  3013. }
  3014. window.setTimeout( process );
  3015. }
  3016. };
  3017. }
  3018. return jQuery.Deferred( function( newDefer ) {
  3019. // progress_handlers.add( ... )
  3020. tuples[ 0 ][ 3 ].add(
  3021. resolve(
  3022. 0,
  3023. newDefer,
  3024. isFunction( onProgress ) ?
  3025. onProgress :
  3026. Identity,
  3027. newDefer.notifyWith
  3028. )
  3029. );
  3030. // fulfilled_handlers.add( ... )
  3031. tuples[ 1 ][ 3 ].add(
  3032. resolve(
  3033. 0,
  3034. newDefer,
  3035. isFunction( onFulfilled ) ?
  3036. onFulfilled :
  3037. Identity
  3038. )
  3039. );
  3040. // rejected_handlers.add( ... )
  3041. tuples[ 2 ][ 3 ].add(
  3042. resolve(
  3043. 0,
  3044. newDefer,
  3045. isFunction( onRejected ) ?
  3046. onRejected :
  3047. Thrower
  3048. )
  3049. );
  3050. } ).promise();
  3051. },
  3052. // Get a promise for this deferred
  3053. // If obj is provided, the promise aspect is added to the object
  3054. promise: function( obj ) {
  3055. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3056. }
  3057. },
  3058. deferred = {};
  3059. // Add list-specific methods
  3060. jQuery.each( tuples, function( i, tuple ) {
  3061. var list = tuple[ 2 ],
  3062. stateString = tuple[ 5 ];
  3063. // promise.progress = list.add
  3064. // promise.done = list.add
  3065. // promise.fail = list.add
  3066. promise[ tuple[ 1 ] ] = list.add;
  3067. // Handle state
  3068. if ( stateString ) {
  3069. list.add(
  3070. function() {
  3071. // state = "resolved" (i.e., fulfilled)
  3072. // state = "rejected"
  3073. state = stateString;
  3074. },
  3075. // rejected_callbacks.disable
  3076. // fulfilled_callbacks.disable
  3077. tuples[ 3 - i ][ 2 ].disable,
  3078. // rejected_handlers.disable
  3079. // fulfilled_handlers.disable
  3080. tuples[ 3 - i ][ 3 ].disable,
  3081. // progress_callbacks.lock
  3082. tuples[ 0 ][ 2 ].lock,
  3083. // progress_handlers.lock
  3084. tuples[ 0 ][ 3 ].lock
  3085. );
  3086. }
  3087. // progress_handlers.fire
  3088. // fulfilled_handlers.fire
  3089. // rejected_handlers.fire
  3090. list.add( tuple[ 3 ].fire );
  3091. // deferred.notify = function() { deferred.notifyWith(...) }
  3092. // deferred.resolve = function() { deferred.resolveWith(...) }
  3093. // deferred.reject = function() { deferred.rejectWith(...) }
  3094. deferred[ tuple[ 0 ] ] = function() {
  3095. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3096. return this;
  3097. };
  3098. // deferred.notifyWith = list.fireWith
  3099. // deferred.resolveWith = list.fireWith
  3100. // deferred.rejectWith = list.fireWith
  3101. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3102. } );
  3103. // Make the deferred a promise
  3104. promise.promise( deferred );
  3105. // Call given func if any
  3106. if ( func ) {
  3107. func.call( deferred, deferred );
  3108. }
  3109. // All done!
  3110. return deferred;
  3111. },
  3112. // Deferred helper
  3113. when: function( singleValue ) {
  3114. var
  3115. // count of uncompleted subordinates
  3116. remaining = arguments.length,
  3117. // count of unprocessed arguments
  3118. i = remaining,
  3119. // subordinate fulfillment data
  3120. resolveContexts = Array( i ),
  3121. resolveValues = slice.call( arguments ),
  3122. // the master Deferred
  3123. master = jQuery.Deferred(),
  3124. // subordinate callback factory
  3125. updateFunc = function( i ) {
  3126. return function( value ) {
  3127. resolveContexts[ i ] = this;
  3128. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3129. if ( !( --remaining ) ) {
  3130. master.resolveWith( resolveContexts, resolveValues );
  3131. }
  3132. };
  3133. };
  3134. // Single- and empty arguments are adopted like Promise.resolve
  3135. if ( remaining <= 1 ) {
  3136. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3137. !remaining );
  3138. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3139. if ( master.state() === "pending" ||
  3140. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3141. return master.then();
  3142. }
  3143. }
  3144. // Multiple arguments are aggregated like Promise.all array elements
  3145. while ( i-- ) {
  3146. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3147. }
  3148. return master.promise();
  3149. }
  3150. } );
  3151. // These usually indicate a programmer mistake during development,
  3152. // warn about them ASAP rather than swallowing them by default.
  3153. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3154. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3155. // Support: IE 8 - 9 only
  3156. // Console exists when dev tools are open, which can happen at any time
  3157. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3158. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3159. }
  3160. };
  3161. jQuery.readyException = function( error ) {
  3162. window.setTimeout( function() {
  3163. throw error;
  3164. } );
  3165. };
  3166. // The deferred used on DOM ready
  3167. var readyList = jQuery.Deferred();
  3168. jQuery.fn.ready = function( fn ) {
  3169. readyList
  3170. .then( fn )
  3171. // Wrap jQuery.readyException in a function so that the lookup
  3172. // happens at the time of error handling instead of callback
  3173. // registration.
  3174. .catch( function( error ) {
  3175. jQuery.readyException( error );
  3176. } );
  3177. return this;
  3178. };
  3179. jQuery.extend( {
  3180. // Is the DOM ready to be used? Set to true once it occurs.
  3181. isReady: false,
  3182. // A counter to track how many items to wait for before
  3183. // the ready event fires. See #6781
  3184. readyWait: 1,
  3185. // Handle when the DOM is ready
  3186. ready: function( wait ) {
  3187. // Abort if there are pending holds or we're already ready
  3188. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3189. return;
  3190. }
  3191. // Remember that the DOM is ready
  3192. jQuery.isReady = true;
  3193. // If a normal DOM Ready event fired, decrement, and wait if need be
  3194. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3195. return;
  3196. }
  3197. // If there are functions bound, to execute
  3198. readyList.resolveWith( document, [ jQuery ] );
  3199. }
  3200. } );
  3201. jQuery.ready.then = readyList.then;
  3202. // The ready event handler and self cleanup method
  3203. function completed() {
  3204. document.removeEventListener( "DOMContentLoaded", completed );
  3205. window.removeEventListener( "load", completed );
  3206. jQuery.ready();
  3207. }
  3208. // Catch cases where $(document).ready() is called
  3209. // after the browser event has already occurred.
  3210. // Support: IE <=9 - 10 only
  3211. // Older IE sometimes signals "interactive" too soon
  3212. if ( document.readyState === "complete" ||
  3213. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3214. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3215. window.setTimeout( jQuery.ready );
  3216. } else {
  3217. // Use the handy event callback
  3218. document.addEventListener( "DOMContentLoaded", completed );
  3219. // A fallback to window.onload, that will always work
  3220. window.addEventListener( "load", completed );
  3221. }
  3222. // Multifunctional method to get and set values of a collection
  3223. // The value/s can optionally be executed if it's a function
  3224. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3225. var i = 0,
  3226. len = elems.length,
  3227. bulk = key == null;
  3228. // Sets many values
  3229. if ( toType( key ) === "object" ) {
  3230. chainable = true;
  3231. for ( i in key ) {
  3232. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3233. }
  3234. // Sets one value
  3235. } else if ( value !== undefined ) {
  3236. chainable = true;
  3237. if ( !isFunction( value ) ) {
  3238. raw = true;
  3239. }
  3240. if ( bulk ) {
  3241. // Bulk operations run against the entire set
  3242. if ( raw ) {
  3243. fn.call( elems, value );
  3244. fn = null;
  3245. // ...except when executing function values
  3246. } else {
  3247. bulk = fn;
  3248. fn = function( elem, key, value ) {
  3249. return bulk.call( jQuery( elem ), value );
  3250. };
  3251. }
  3252. }
  3253. if ( fn ) {
  3254. for ( ; i < len; i++ ) {
  3255. fn(
  3256. elems[ i ], key, raw ?
  3257. value :
  3258. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3259. );
  3260. }
  3261. }
  3262. }
  3263. if ( chainable ) {
  3264. return elems;
  3265. }
  3266. // Gets
  3267. if ( bulk ) {
  3268. return fn.call( elems );
  3269. }
  3270. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3271. };
  3272. // Matches dashed string for camelizing
  3273. var rmsPrefix = /^-ms-/,
  3274. rdashAlpha = /-([a-z])/g;
  3275. // Used by camelCase as callback to replace()
  3276. function fcamelCase( all, letter ) {
  3277. return letter.toUpperCase();
  3278. }
  3279. // Convert dashed to camelCase; used by the css and data modules
  3280. // Support: IE <=9 - 11, Edge 12 - 15
  3281. // Microsoft forgot to hump their vendor prefix (#9572)
  3282. function camelCase( string ) {
  3283. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  3284. }
  3285. var acceptData = function( owner ) {
  3286. // Accepts only:
  3287. // - Node
  3288. // - Node.ELEMENT_NODE
  3289. // - Node.DOCUMENT_NODE
  3290. // - Object
  3291. // - Any
  3292. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3293. };
  3294. function Data() {
  3295. this.expando = jQuery.expando + Data.uid++;
  3296. }
  3297. Data.uid = 1;
  3298. Data.prototype = {
  3299. cache: function( owner ) {
  3300. // Check if the owner object already has a cache
  3301. var value = owner[ this.expando ];
  3302. // If not, create one
  3303. if ( !value ) {
  3304. value = {};
  3305. // We can accept data for non-element nodes in modern browsers,
  3306. // but we should not, see #8335.
  3307. // Always return an empty object.
  3308. if ( acceptData( owner ) ) {
  3309. // If it is a node unlikely to be stringify-ed or looped over
  3310. // use plain assignment
  3311. if ( owner.nodeType ) {
  3312. owner[ this.expando ] = value;
  3313. // Otherwise secure it in a non-enumerable property
  3314. // configurable must be true to allow the property to be
  3315. // deleted when data is removed
  3316. } else {
  3317. Object.defineProperty( owner, this.expando, {
  3318. value: value,
  3319. configurable: true
  3320. } );
  3321. }
  3322. }
  3323. }
  3324. return value;
  3325. },
  3326. set: function( owner, data, value ) {
  3327. var prop,
  3328. cache = this.cache( owner );
  3329. // Handle: [ owner, key, value ] args
  3330. // Always use camelCase key (gh-2257)
  3331. if ( typeof data === "string" ) {
  3332. cache[ camelCase( data ) ] = value;
  3333. // Handle: [ owner, { properties } ] args
  3334. } else {
  3335. // Copy the properties one-by-one to the cache object
  3336. for ( prop in data ) {
  3337. cache[ camelCase( prop ) ] = data[ prop ];
  3338. }
  3339. }
  3340. return cache;
  3341. },
  3342. get: function( owner, key ) {
  3343. return key === undefined ?
  3344. this.cache( owner ) :
  3345. // Always use camelCase key (gh-2257)
  3346. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  3347. },
  3348. access: function( owner, key, value ) {
  3349. // In cases where either:
  3350. //
  3351. // 1. No key was specified
  3352. // 2. A string key was specified, but no value provided
  3353. //
  3354. // Take the "read" path and allow the get method to determine
  3355. // which value to return, respectively either:
  3356. //
  3357. // 1. The entire cache object
  3358. // 2. The data stored at the key
  3359. //
  3360. if ( key === undefined ||
  3361. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3362. return this.get( owner, key );
  3363. }
  3364. // When the key is not a string, or both a key and value
  3365. // are specified, set or extend (existing objects) with either:
  3366. //
  3367. // 1. An object of properties
  3368. // 2. A key and value
  3369. //
  3370. this.set( owner, key, value );
  3371. // Since the "set" path can have two possible entry points
  3372. // return the expected data based on which path was taken[*]
  3373. return value !== undefined ? value : key;
  3374. },
  3375. remove: function( owner, key ) {
  3376. var i,
  3377. cache = owner[ this.expando ];
  3378. if ( cache === undefined ) {
  3379. return;
  3380. }
  3381. if ( key !== undefined ) {
  3382. // Support array or space separated string of keys
  3383. if ( Array.isArray( key ) ) {
  3384. // If key is an array of keys...
  3385. // We always set camelCase keys, so remove that.
  3386. key = key.map( camelCase );
  3387. } else {
  3388. key = camelCase( key );
  3389. // If a key with the spaces exists, use it.
  3390. // Otherwise, create an array by matching non-whitespace
  3391. key = key in cache ?
  3392. [ key ] :
  3393. ( key.match( rnothtmlwhite ) || [] );
  3394. }
  3395. i = key.length;
  3396. while ( i-- ) {
  3397. delete cache[ key[ i ] ];
  3398. }
  3399. }
  3400. // Remove the expando if there's no more data
  3401. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3402. // Support: Chrome <=35 - 45
  3403. // Webkit & Blink performance suffers when deleting properties
  3404. // from DOM nodes, so set to undefined instead
  3405. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3406. if ( owner.nodeType ) {
  3407. owner[ this.expando ] = undefined;
  3408. } else {
  3409. delete owner[ this.expando ];
  3410. }
  3411. }
  3412. },
  3413. hasData: function( owner ) {
  3414. var cache = owner[ this.expando ];
  3415. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3416. }
  3417. };
  3418. var dataPriv = new Data();
  3419. var dataUser = new Data();
  3420. // Implementation Summary
  3421. //
  3422. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3423. // 2. Improve the module's maintainability by reducing the storage
  3424. // paths to a single mechanism.
  3425. // 3. Use the same single mechanism to support "private" and "user" data.
  3426. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3427. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3428. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3429. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3430. rmultiDash = /[A-Z]/g;
  3431. function getData( data ) {
  3432. if ( data === "true" ) {
  3433. return true;
  3434. }
  3435. if ( data === "false" ) {
  3436. return false;
  3437. }
  3438. if ( data === "null" ) {
  3439. return null;
  3440. }
  3441. // Only convert to a number if it doesn't change the string
  3442. if ( data === +data + "" ) {
  3443. return +data;
  3444. }
  3445. if ( rbrace.test( data ) ) {
  3446. return JSON.parse( data );
  3447. }
  3448. return data;
  3449. }
  3450. function dataAttr( elem, key, data ) {
  3451. var name;
  3452. // If nothing was found internally, try to fetch any
  3453. // data from the HTML5 data-* attribute
  3454. if ( data === undefined && elem.nodeType === 1 ) {
  3455. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3456. data = elem.getAttribute( name );
  3457. if ( typeof data === "string" ) {
  3458. try {
  3459. data = getData( data );
  3460. } catch ( e ) {}
  3461. // Make sure we set the data so it isn't changed later
  3462. dataUser.set( elem, key, data );
  3463. } else {
  3464. data = undefined;
  3465. }
  3466. }
  3467. return data;
  3468. }
  3469. jQuery.extend( {
  3470. hasData: function( elem ) {
  3471. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3472. },
  3473. data: function( elem, name, data ) {
  3474. return dataUser.access( elem, name, data );
  3475. },
  3476. removeData: function( elem, name ) {
  3477. dataUser.remove( elem, name );
  3478. },
  3479. // TODO: Now that all calls to _data and _removeData have been replaced
  3480. // with direct calls to dataPriv methods, these can be deprecated.
  3481. _data: function( elem, name, data ) {
  3482. return dataPriv.access( elem, name, data );
  3483. },
  3484. _removeData: function( elem, name ) {
  3485. dataPriv.remove( elem, name );
  3486. }
  3487. } );
  3488. jQuery.fn.extend( {
  3489. data: function( key, value ) {
  3490. var i, name, data,
  3491. elem = this[ 0 ],
  3492. attrs = elem && elem.attributes;
  3493. // Gets all values
  3494. if ( key === undefined ) {
  3495. if ( this.length ) {
  3496. data = dataUser.get( elem );
  3497. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3498. i = attrs.length;
  3499. while ( i-- ) {
  3500. // Support: IE 11 only
  3501. // The attrs elements can be null (#14894)
  3502. if ( attrs[ i ] ) {
  3503. name = attrs[ i ].name;
  3504. if ( name.indexOf( "data-" ) === 0 ) {
  3505. name = camelCase( name.slice( 5 ) );
  3506. dataAttr( elem, name, data[ name ] );
  3507. }
  3508. }
  3509. }
  3510. dataPriv.set( elem, "hasDataAttrs", true );
  3511. }
  3512. }
  3513. return data;
  3514. }
  3515. // Sets multiple values
  3516. if ( typeof key === "object" ) {
  3517. return this.each( function() {
  3518. dataUser.set( this, key );
  3519. } );
  3520. }
  3521. return access( this, function( value ) {
  3522. var data;
  3523. // The calling jQuery object (element matches) is not empty
  3524. // (and therefore has an element appears at this[ 0 ]) and the
  3525. // `value` parameter was not undefined. An empty jQuery object
  3526. // will result in `undefined` for elem = this[ 0 ] which will
  3527. // throw an exception if an attempt to read a data cache is made.
  3528. if ( elem && value === undefined ) {
  3529. // Attempt to get data from the cache
  3530. // The key will always be camelCased in Data
  3531. data = dataUser.get( elem, key );
  3532. if ( data !== undefined ) {
  3533. return data;
  3534. }
  3535. // Attempt to "discover" the data in
  3536. // HTML5 custom data-* attrs
  3537. data = dataAttr( elem, key );
  3538. if ( data !== undefined ) {
  3539. return data;
  3540. }
  3541. // We tried really hard, but the data doesn't exist.
  3542. return;
  3543. }
  3544. // Set the data...
  3545. this.each( function() {
  3546. // We always store the camelCased key
  3547. dataUser.set( this, key, value );
  3548. } );
  3549. }, null, value, arguments.length > 1, null, true );
  3550. },
  3551. removeData: function( key ) {
  3552. return this.each( function() {
  3553. dataUser.remove( this, key );
  3554. } );
  3555. }
  3556. } );
  3557. jQuery.extend( {
  3558. queue: function( elem, type, data ) {
  3559. var queue;
  3560. if ( elem ) {
  3561. type = ( type || "fx" ) + "queue";
  3562. queue = dataPriv.get( elem, type );
  3563. // Speed up dequeue by getting out quickly if this is just a lookup
  3564. if ( data ) {
  3565. if ( !queue || Array.isArray( data ) ) {
  3566. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3567. } else {
  3568. queue.push( data );
  3569. }
  3570. }
  3571. return queue || [];
  3572. }
  3573. },
  3574. dequeue: function( elem, type ) {
  3575. type = type || "fx";
  3576. var queue = jQuery.queue( elem, type ),
  3577. startLength = queue.length,
  3578. fn = queue.shift(),
  3579. hooks = jQuery._queueHooks( elem, type ),
  3580. next = function() {
  3581. jQuery.dequeue( elem, type );
  3582. };
  3583. // If the fx queue is dequeued, always remove the progress sentinel
  3584. if ( fn === "inprogress" ) {
  3585. fn = queue.shift();
  3586. startLength--;
  3587. }
  3588. if ( fn ) {
  3589. // Add a progress sentinel to prevent the fx queue from being
  3590. // automatically dequeued
  3591. if ( type === "fx" ) {
  3592. queue.unshift( "inprogress" );
  3593. }
  3594. // Clear up the last queue stop function
  3595. delete hooks.stop;
  3596. fn.call( elem, next, hooks );
  3597. }
  3598. if ( !startLength && hooks ) {
  3599. hooks.empty.fire();
  3600. }
  3601. },
  3602. // Not public - generate a queueHooks object, or return the current one
  3603. _queueHooks: function( elem, type ) {
  3604. var key = type + "queueHooks";
  3605. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3606. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3607. dataPriv.remove( elem, [ type + "queue", key ] );
  3608. } )
  3609. } );
  3610. }
  3611. } );
  3612. jQuery.fn.extend( {
  3613. queue: function( type, data ) {
  3614. var setter = 2;
  3615. if ( typeof type !== "string" ) {
  3616. data = type;
  3617. type = "fx";
  3618. setter--;
  3619. }
  3620. if ( arguments.length < setter ) {
  3621. return jQuery.queue( this[ 0 ], type );
  3622. }
  3623. return data === undefined ?
  3624. this :
  3625. this.each( function() {
  3626. var queue = jQuery.queue( this, type, data );
  3627. // Ensure a hooks for this queue
  3628. jQuery._queueHooks( this, type );
  3629. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3630. jQuery.dequeue( this, type );
  3631. }
  3632. } );
  3633. },
  3634. dequeue: function( type ) {
  3635. return this.each( function() {
  3636. jQuery.dequeue( this, type );
  3637. } );
  3638. },
  3639. clearQueue: function( type ) {
  3640. return this.queue( type || "fx", [] );
  3641. },
  3642. // Get a promise resolved when queues of a certain type
  3643. // are emptied (fx is the type by default)
  3644. promise: function( type, obj ) {
  3645. var tmp,
  3646. count = 1,
  3647. defer = jQuery.Deferred(),
  3648. elements = this,
  3649. i = this.length,
  3650. resolve = function() {
  3651. if ( !( --count ) ) {
  3652. defer.resolveWith( elements, [ elements ] );
  3653. }
  3654. };
  3655. if ( typeof type !== "string" ) {
  3656. obj = type;
  3657. type = undefined;
  3658. }
  3659. type = type || "fx";
  3660. while ( i-- ) {
  3661. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3662. if ( tmp && tmp.empty ) {
  3663. count++;
  3664. tmp.empty.add( resolve );
  3665. }
  3666. }
  3667. resolve();
  3668. return defer.promise( obj );
  3669. }
  3670. } );
  3671. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3672. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3673. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3674. var isHiddenWithinTree = function( elem, el ) {
  3675. // isHiddenWithinTree might be called from jQuery#filter function;
  3676. // in that case, element will be second argument
  3677. elem = el || elem;
  3678. // Inline style trumps all
  3679. return elem.style.display === "none" ||
  3680. elem.style.display === "" &&
  3681. // Otherwise, check computed style
  3682. // Support: Firefox <=43 - 45
  3683. // Disconnected elements can have computed display: none, so first confirm that elem is
  3684. // in the document.
  3685. jQuery.contains( elem.ownerDocument, elem ) &&
  3686. jQuery.css( elem, "display" ) === "none";
  3687. };
  3688. var swap = function( elem, options, callback, args ) {
  3689. var ret, name,
  3690. old = {};
  3691. // Remember the old values, and insert the new ones
  3692. for ( name in options ) {
  3693. old[ name ] = elem.style[ name ];
  3694. elem.style[ name ] = options[ name ];
  3695. }
  3696. ret = callback.apply( elem, args || [] );
  3697. // Revert the old values
  3698. for ( name in options ) {
  3699. elem.style[ name ] = old[ name ];
  3700. }
  3701. return ret;
  3702. };
  3703. function adjustCSS( elem, prop, valueParts, tween ) {
  3704. var adjusted, scale,
  3705. maxIterations = 20,
  3706. currentValue = tween ?
  3707. function() {
  3708. return tween.cur();
  3709. } :
  3710. function() {
  3711. return jQuery.css( elem, prop, "" );
  3712. },
  3713. initial = currentValue(),
  3714. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3715. // Starting value computation is required for potential unit mismatches
  3716. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3717. rcssNum.exec( jQuery.css( elem, prop ) );
  3718. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3719. // Support: Firefox <=54
  3720. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3721. initial = initial / 2;
  3722. // Trust units reported by jQuery.css
  3723. unit = unit || initialInUnit[ 3 ];
  3724. // Iteratively approximate from a nonzero starting point
  3725. initialInUnit = +initial || 1;
  3726. while ( maxIterations-- ) {
  3727. // Evaluate and update our best guess (doubling guesses that zero out).
  3728. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3729. jQuery.style( elem, prop, initialInUnit + unit );
  3730. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  3731. maxIterations = 0;
  3732. }
  3733. initialInUnit = initialInUnit / scale;
  3734. }
  3735. initialInUnit = initialInUnit * 2;
  3736. jQuery.style( elem, prop, initialInUnit + unit );
  3737. // Make sure we update the tween properties later on
  3738. valueParts = valueParts || [];
  3739. }
  3740. if ( valueParts ) {
  3741. initialInUnit = +initialInUnit || +initial || 0;
  3742. // Apply relative offset (+=/-=) if specified
  3743. adjusted = valueParts[ 1 ] ?
  3744. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3745. +valueParts[ 2 ];
  3746. if ( tween ) {
  3747. tween.unit = unit;
  3748. tween.start = initialInUnit;
  3749. tween.end = adjusted;
  3750. }
  3751. }
  3752. return adjusted;
  3753. }
  3754. var defaultDisplayMap = {};
  3755. function getDefaultDisplay( elem ) {
  3756. var temp,
  3757. doc = elem.ownerDocument,
  3758. nodeName = elem.nodeName,
  3759. display = defaultDisplayMap[ nodeName ];
  3760. if ( display ) {
  3761. return display;
  3762. }
  3763. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3764. display = jQuery.css( temp, "display" );
  3765. temp.parentNode.removeChild( temp );
  3766. if ( display === "none" ) {
  3767. display = "block";
  3768. }
  3769. defaultDisplayMap[ nodeName ] = display;
  3770. return display;
  3771. }
  3772. function showHide( elements, show ) {
  3773. var display, elem,
  3774. values = [],
  3775. index = 0,
  3776. length = elements.length;
  3777. // Determine new display value for elements that need to change
  3778. for ( ; index < length; index++ ) {
  3779. elem = elements[ index ];
  3780. if ( !elem.style ) {
  3781. continue;
  3782. }
  3783. display = elem.style.display;
  3784. if ( show ) {
  3785. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3786. // check is required in this first loop unless we have a nonempty display value (either
  3787. // inline or about-to-be-restored)
  3788. if ( display === "none" ) {
  3789. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3790. if ( !values[ index ] ) {
  3791. elem.style.display = "";
  3792. }
  3793. }
  3794. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3795. values[ index ] = getDefaultDisplay( elem );
  3796. }
  3797. } else {
  3798. if ( display !== "none" ) {
  3799. values[ index ] = "none";
  3800. // Remember what we're overwriting
  3801. dataPriv.set( elem, "display", display );
  3802. }
  3803. }
  3804. }
  3805. // Set the display of the elements in a second loop to avoid constant reflow
  3806. for ( index = 0; index < length; index++ ) {
  3807. if ( values[ index ] != null ) {
  3808. elements[ index ].style.display = values[ index ];
  3809. }
  3810. }
  3811. return elements;
  3812. }
  3813. jQuery.fn.extend( {
  3814. show: function() {
  3815. return showHide( this, true );
  3816. },
  3817. hide: function() {
  3818. return showHide( this );
  3819. },
  3820. toggle: function( state ) {
  3821. if ( typeof state === "boolean" ) {
  3822. return state ? this.show() : this.hide();
  3823. }
  3824. return this.each( function() {
  3825. if ( isHiddenWithinTree( this ) ) {
  3826. jQuery( this ).show();
  3827. } else {
  3828. jQuery( this ).hide();
  3829. }
  3830. } );
  3831. }
  3832. } );
  3833. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3834. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  3835. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  3836. // We have to close these tags to support XHTML (#13200)
  3837. var wrapMap = {
  3838. // Support: IE <=9 only
  3839. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3840. // XHTML parsers do not magically insert elements in the
  3841. // same way that tag soup parsers do. So we cannot shorten
  3842. // this by omitting <tbody> or other required elements.
  3843. thead: [ 1, "<table>", "</table>" ],
  3844. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  3845. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3846. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3847. _default: [ 0, "", "" ]
  3848. };
  3849. // Support: IE <=9 only
  3850. wrapMap.optgroup = wrapMap.option;
  3851. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3852. wrapMap.th = wrapMap.td;
  3853. function getAll( context, tag ) {
  3854. // Support: IE <=9 - 11 only
  3855. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3856. var ret;
  3857. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3858. ret = context.getElementsByTagName( tag || "*" );
  3859. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  3860. ret = context.querySelectorAll( tag || "*" );
  3861. } else {
  3862. ret = [];
  3863. }
  3864. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  3865. return jQuery.merge( [ context ], ret );
  3866. }
  3867. return ret;
  3868. }
  3869. // Mark scripts as having already been evaluated
  3870. function setGlobalEval( elems, refElements ) {
  3871. var i = 0,
  3872. l = elems.length;
  3873. for ( ; i < l; i++ ) {
  3874. dataPriv.set(
  3875. elems[ i ],
  3876. "globalEval",
  3877. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  3878. );
  3879. }
  3880. }
  3881. var rhtml = /<|&#?\w+;/;
  3882. function buildFragment( elems, context, scripts, selection, ignored ) {
  3883. var elem, tmp, tag, wrap, contains, j,
  3884. fragment = context.createDocumentFragment(),
  3885. nodes = [],
  3886. i = 0,
  3887. l = elems.length;
  3888. for ( ; i < l; i++ ) {
  3889. elem = elems[ i ];
  3890. if ( elem || elem === 0 ) {
  3891. // Add nodes directly
  3892. if ( toType( elem ) === "object" ) {
  3893. // Support: Android <=4.0 only, PhantomJS 1 only
  3894. // push.apply(_, arraylike) throws on ancient WebKit
  3895. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3896. // Convert non-html into a text node
  3897. } else if ( !rhtml.test( elem ) ) {
  3898. nodes.push( context.createTextNode( elem ) );
  3899. // Convert html into DOM nodes
  3900. } else {
  3901. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  3902. // Deserialize a standard representation
  3903. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3904. wrap = wrapMap[ tag ] || wrapMap._default;
  3905. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3906. // Descend through wrappers to the right content
  3907. j = wrap[ 0 ];
  3908. while ( j-- ) {
  3909. tmp = tmp.lastChild;
  3910. }
  3911. // Support: Android <=4.0 only, PhantomJS 1 only
  3912. // push.apply(_, arraylike) throws on ancient WebKit
  3913. jQuery.merge( nodes, tmp.childNodes );
  3914. // Remember the top-level container
  3915. tmp = fragment.firstChild;
  3916. // Ensure the created nodes are orphaned (#12392)
  3917. tmp.textContent = "";
  3918. }
  3919. }
  3920. }
  3921. // Remove wrapper from fragment
  3922. fragment.textContent = "";
  3923. i = 0;
  3924. while ( ( elem = nodes[ i++ ] ) ) {
  3925. // Skip elements already in the context collection (trac-4087)
  3926. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3927. if ( ignored ) {
  3928. ignored.push( elem );
  3929. }
  3930. continue;
  3931. }
  3932. contains = jQuery.contains( elem.ownerDocument, elem );
  3933. // Append to fragment
  3934. tmp = getAll( fragment.appendChild( elem ), "script" );
  3935. // Preserve script evaluation history
  3936. if ( contains ) {
  3937. setGlobalEval( tmp );
  3938. }
  3939. // Capture executables
  3940. if ( scripts ) {
  3941. j = 0;
  3942. while ( ( elem = tmp[ j++ ] ) ) {
  3943. if ( rscriptType.test( elem.type || "" ) ) {
  3944. scripts.push( elem );
  3945. }
  3946. }
  3947. }
  3948. }
  3949. return fragment;
  3950. }
  3951. ( function() {
  3952. var fragment = document.createDocumentFragment(),
  3953. div = fragment.appendChild( document.createElement( "div" ) ),
  3954. input = document.createElement( "input" );
  3955. // Support: Android 4.0 - 4.3 only
  3956. // Check state lost if the name is set (#11217)
  3957. // Support: Windows Web Apps (WWA)
  3958. // `name` and `type` must use .setAttribute for WWA (#14901)
  3959. input.setAttribute( "type", "radio" );
  3960. input.setAttribute( "checked", "checked" );
  3961. input.setAttribute( "name", "t" );
  3962. div.appendChild( input );
  3963. // Support: Android <=4.1 only
  3964. // Older WebKit doesn't clone checked state correctly in fragments
  3965. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3966. // Support: IE <=11 only
  3967. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3968. div.innerHTML = "<textarea>x</textarea>";
  3969. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3970. } )();
  3971. var documentElement = document.documentElement;
  3972. var
  3973. rkeyEvent = /^key/,
  3974. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3975. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3976. function returnTrue() {
  3977. return true;
  3978. }
  3979. function returnFalse() {
  3980. return false;
  3981. }
  3982. // Support: IE <=9 only
  3983. // See #13393 for more info
  3984. function safeActiveElement() {
  3985. try {
  3986. return document.activeElement;
  3987. } catch ( err ) { }
  3988. }
  3989. function on( elem, types, selector, data, fn, one ) {
  3990. var origFn, type;
  3991. // Types can be a map of types/handlers
  3992. if ( typeof types === "object" ) {
  3993. // ( types-Object, selector, data )
  3994. if ( typeof selector !== "string" ) {
  3995. // ( types-Object, data )
  3996. data = data || selector;
  3997. selector = undefined;
  3998. }
  3999. for ( type in types ) {
  4000. on( elem, type, selector, data, types[ type ], one );
  4001. }
  4002. return elem;
  4003. }
  4004. if ( data == null && fn == null ) {
  4005. // ( types, fn )
  4006. fn = selector;
  4007. data = selector = undefined;
  4008. } else if ( fn == null ) {
  4009. if ( typeof selector === "string" ) {
  4010. // ( types, selector, fn )
  4011. fn = data;
  4012. data = undefined;
  4013. } else {
  4014. // ( types, data, fn )
  4015. fn = data;
  4016. data = selector;
  4017. selector = undefined;
  4018. }
  4019. }
  4020. if ( fn === false ) {
  4021. fn = returnFalse;
  4022. } else if ( !fn ) {
  4023. return elem;
  4024. }
  4025. if ( one === 1 ) {
  4026. origFn = fn;
  4027. fn = function( event ) {
  4028. // Can use an empty set, since event contains the info
  4029. jQuery().off( event );
  4030. return origFn.apply( this, arguments );
  4031. };
  4032. // Use same guid so caller can remove using origFn
  4033. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4034. }
  4035. return elem.each( function() {
  4036. jQuery.event.add( this, types, fn, data, selector );
  4037. } );
  4038. }
  4039. /*
  4040. * Helper functions for managing events -- not part of the public interface.
  4041. * Props to Dean Edwards' addEvent library for many of the ideas.
  4042. */
  4043. jQuery.event = {
  4044. global: {},
  4045. add: function( elem, types, handler, data, selector ) {
  4046. var handleObjIn, eventHandle, tmp,
  4047. events, t, handleObj,
  4048. special, handlers, type, namespaces, origType,
  4049. elemData = dataPriv.get( elem );
  4050. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4051. if ( !elemData ) {
  4052. return;
  4053. }
  4054. // Caller can pass in an object of custom data in lieu of the handler
  4055. if ( handler.handler ) {
  4056. handleObjIn = handler;
  4057. handler = handleObjIn.handler;
  4058. selector = handleObjIn.selector;
  4059. }
  4060. // Ensure that invalid selectors throw exceptions at attach time
  4061. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4062. if ( selector ) {
  4063. jQuery.find.matchesSelector( documentElement, selector );
  4064. }
  4065. // Make sure that the handler has a unique ID, used to find/remove it later
  4066. if ( !handler.guid ) {
  4067. handler.guid = jQuery.guid++;
  4068. }
  4069. // Init the element's event structure and main handler, if this is the first
  4070. if ( !( events = elemData.events ) ) {
  4071. events = elemData.events = {};
  4072. }
  4073. if ( !( eventHandle = elemData.handle ) ) {
  4074. eventHandle = elemData.handle = function( e ) {
  4075. // Discard the second event of a jQuery.event.trigger() and
  4076. // when an event is called after a page has unloaded
  4077. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4078. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4079. };
  4080. }
  4081. // Handle multiple events separated by a space
  4082. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4083. t = types.length;
  4084. while ( t-- ) {
  4085. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4086. type = origType = tmp[ 1 ];
  4087. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4088. // There *must* be a type, no attaching namespace-only handlers
  4089. if ( !type ) {
  4090. continue;
  4091. }
  4092. // If event changes its type, use the special event handlers for the changed type
  4093. special = jQuery.event.special[ type ] || {};
  4094. // If selector defined, determine special event api type, otherwise given type
  4095. type = ( selector ? special.delegateType : special.bindType ) || type;
  4096. // Update special based on newly reset type
  4097. special = jQuery.event.special[ type ] || {};
  4098. // handleObj is passed to all event handlers
  4099. handleObj = jQuery.extend( {
  4100. type: type,
  4101. origType: origType,
  4102. data: data,
  4103. handler: handler,
  4104. guid: handler.guid,
  4105. selector: selector,
  4106. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4107. namespace: namespaces.join( "." )
  4108. }, handleObjIn );
  4109. // Init the event handler queue if we're the first
  4110. if ( !( handlers = events[ type ] ) ) {
  4111. handlers = events[ type ] = [];
  4112. handlers.delegateCount = 0;
  4113. // Only use addEventListener if the special events handler returns false
  4114. if ( !special.setup ||
  4115. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4116. if ( elem.addEventListener ) {
  4117. elem.addEventListener( type, eventHandle );
  4118. }
  4119. }
  4120. }
  4121. if ( special.add ) {
  4122. special.add.call( elem, handleObj );
  4123. if ( !handleObj.handler.guid ) {
  4124. handleObj.handler.guid = handler.guid;
  4125. }
  4126. }
  4127. // Add to the element's handler list, delegates in front
  4128. if ( selector ) {
  4129. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4130. } else {
  4131. handlers.push( handleObj );
  4132. }
  4133. // Keep track of which events have ever been used, for event optimization
  4134. jQuery.event.global[ type ] = true;
  4135. }
  4136. },
  4137. // Detach an event or set of events from an element
  4138. remove: function( elem, types, handler, selector, mappedTypes ) {
  4139. var j, origCount, tmp,
  4140. events, t, handleObj,
  4141. special, handlers, type, namespaces, origType,
  4142. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4143. if ( !elemData || !( events = elemData.events ) ) {
  4144. return;
  4145. }
  4146. // Once for each type.namespace in types; type may be omitted
  4147. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4148. t = types.length;
  4149. while ( t-- ) {
  4150. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4151. type = origType = tmp[ 1 ];
  4152. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4153. // Unbind all events (on this namespace, if provided) for the element
  4154. if ( !type ) {
  4155. for ( type in events ) {
  4156. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4157. }
  4158. continue;
  4159. }
  4160. special = jQuery.event.special[ type ] || {};
  4161. type = ( selector ? special.delegateType : special.bindType ) || type;
  4162. handlers = events[ type ] || [];
  4163. tmp = tmp[ 2 ] &&
  4164. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4165. // Remove matching events
  4166. origCount = j = handlers.length;
  4167. while ( j-- ) {
  4168. handleObj = handlers[ j ];
  4169. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4170. ( !handler || handler.guid === handleObj.guid ) &&
  4171. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4172. ( !selector || selector === handleObj.selector ||
  4173. selector === "**" && handleObj.selector ) ) {
  4174. handlers.splice( j, 1 );
  4175. if ( handleObj.selector ) {
  4176. handlers.delegateCount--;
  4177. }
  4178. if ( special.remove ) {
  4179. special.remove.call( elem, handleObj );
  4180. }
  4181. }
  4182. }
  4183. // Remove generic event handler if we removed something and no more handlers exist
  4184. // (avoids potential for endless recursion during removal of special event handlers)
  4185. if ( origCount && !handlers.length ) {
  4186. if ( !special.teardown ||
  4187. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4188. jQuery.removeEvent( elem, type, elemData.handle );
  4189. }
  4190. delete events[ type ];
  4191. }
  4192. }
  4193. // Remove data and the expando if it's no longer used
  4194. if ( jQuery.isEmptyObject( events ) ) {
  4195. dataPriv.remove( elem, "handle events" );
  4196. }
  4197. },
  4198. dispatch: function( nativeEvent ) {
  4199. // Make a writable jQuery.Event from the native event object
  4200. var event = jQuery.event.fix( nativeEvent );
  4201. var i, j, ret, matched, handleObj, handlerQueue,
  4202. args = new Array( arguments.length ),
  4203. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4204. special = jQuery.event.special[ event.type ] || {};
  4205. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4206. args[ 0 ] = event;
  4207. for ( i = 1; i < arguments.length; i++ ) {
  4208. args[ i ] = arguments[ i ];
  4209. }
  4210. event.delegateTarget = this;
  4211. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4212. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4213. return;
  4214. }
  4215. // Determine handlers
  4216. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4217. // Run delegates first; they may want to stop propagation beneath us
  4218. i = 0;
  4219. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4220. event.currentTarget = matched.elem;
  4221. j = 0;
  4222. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4223. !event.isImmediatePropagationStopped() ) {
  4224. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4225. // a subset or equal to those in the bound event (both can have no namespace).
  4226. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4227. event.handleObj = handleObj;
  4228. event.data = handleObj.data;
  4229. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4230. handleObj.handler ).apply( matched.elem, args );
  4231. if ( ret !== undefined ) {
  4232. if ( ( event.result = ret ) === false ) {
  4233. event.preventDefault();
  4234. event.stopPropagation();
  4235. }
  4236. }
  4237. }
  4238. }
  4239. }
  4240. // Call the postDispatch hook for the mapped type
  4241. if ( special.postDispatch ) {
  4242. special.postDispatch.call( this, event );
  4243. }
  4244. return event.result;
  4245. },
  4246. handlers: function( event, handlers ) {
  4247. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4248. handlerQueue = [],
  4249. delegateCount = handlers.delegateCount,
  4250. cur = event.target;
  4251. // Find delegate handlers
  4252. if ( delegateCount &&
  4253. // Support: IE <=9
  4254. // Black-hole SVG <use> instance trees (trac-13180)
  4255. cur.nodeType &&
  4256. // Support: Firefox <=42
  4257. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4258. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4259. // Support: IE 11 only
  4260. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4261. !( event.type === "click" && event.button >= 1 ) ) {
  4262. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4263. // Don't check non-elements (#13208)
  4264. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4265. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4266. matchedHandlers = [];
  4267. matchedSelectors = {};
  4268. for ( i = 0; i < delegateCount; i++ ) {
  4269. handleObj = handlers[ i ];
  4270. // Don't conflict with Object.prototype properties (#13203)
  4271. sel = handleObj.selector + " ";
  4272. if ( matchedSelectors[ sel ] === undefined ) {
  4273. matchedSelectors[ sel ] = handleObj.needsContext ?
  4274. jQuery( sel, this ).index( cur ) > -1 :
  4275. jQuery.find( sel, this, null, [ cur ] ).length;
  4276. }
  4277. if ( matchedSelectors[ sel ] ) {
  4278. matchedHandlers.push( handleObj );
  4279. }
  4280. }
  4281. if ( matchedHandlers.length ) {
  4282. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4283. }
  4284. }
  4285. }
  4286. }
  4287. // Add the remaining (directly-bound) handlers
  4288. cur = this;
  4289. if ( delegateCount < handlers.length ) {
  4290. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4291. }
  4292. return handlerQueue;
  4293. },
  4294. addProp: function( name, hook ) {
  4295. Object.defineProperty( jQuery.Event.prototype, name, {
  4296. enumerable: true,
  4297. configurable: true,
  4298. get: isFunction( hook ) ?
  4299. function() {
  4300. if ( this.originalEvent ) {
  4301. return hook( this.originalEvent );
  4302. }
  4303. } :
  4304. function() {
  4305. if ( this.originalEvent ) {
  4306. return this.originalEvent[ name ];
  4307. }
  4308. },
  4309. set: function( value ) {
  4310. Object.defineProperty( this, name, {
  4311. enumerable: true,
  4312. configurable: true,
  4313. writable: true,
  4314. value: value
  4315. } );
  4316. }
  4317. } );
  4318. },
  4319. fix: function( originalEvent ) {
  4320. return originalEvent[ jQuery.expando ] ?
  4321. originalEvent :
  4322. new jQuery.Event( originalEvent );
  4323. },
  4324. special: {
  4325. load: {
  4326. // Prevent triggered image.load events from bubbling to window.load
  4327. noBubble: true
  4328. },
  4329. focus: {
  4330. // Fire native event if possible so blur/focus sequence is correct
  4331. trigger: function() {
  4332. if ( this !== safeActiveElement() && this.focus ) {
  4333. this.focus();
  4334. return false;
  4335. }
  4336. },
  4337. delegateType: "focusin"
  4338. },
  4339. blur: {
  4340. trigger: function() {
  4341. if ( this === safeActiveElement() && this.blur ) {
  4342. this.blur();
  4343. return false;
  4344. }
  4345. },
  4346. delegateType: "focusout"
  4347. },
  4348. click: {
  4349. // For checkbox, fire native event so checked state will be right
  4350. trigger: function() {
  4351. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  4352. this.click();
  4353. return false;
  4354. }
  4355. },
  4356. // For cross-browser consistency, don't fire native .click() on links
  4357. _default: function( event ) {
  4358. return nodeName( event.target, "a" );
  4359. }
  4360. },
  4361. beforeunload: {
  4362. postDispatch: function( event ) {
  4363. // Support: Firefox 20+
  4364. // Firefox doesn't alert if the returnValue field is not set.
  4365. if ( event.result !== undefined && event.originalEvent ) {
  4366. event.originalEvent.returnValue = event.result;
  4367. }
  4368. }
  4369. }
  4370. }
  4371. };
  4372. jQuery.removeEvent = function( elem, type, handle ) {
  4373. // This "if" is needed for plain objects
  4374. if ( elem.removeEventListener ) {
  4375. elem.removeEventListener( type, handle );
  4376. }
  4377. };
  4378. jQuery.Event = function( src, props ) {
  4379. // Allow instantiation without the 'new' keyword
  4380. if ( !( this instanceof jQuery.Event ) ) {
  4381. return new jQuery.Event( src, props );
  4382. }
  4383. // Event object
  4384. if ( src && src.type ) {
  4385. this.originalEvent = src;
  4386. this.type = src.type;
  4387. // Events bubbling up the document may have been marked as prevented
  4388. // by a handler lower down the tree; reflect the correct value.
  4389. this.isDefaultPrevented = src.defaultPrevented ||
  4390. src.defaultPrevented === undefined &&
  4391. // Support: Android <=2.3 only
  4392. src.returnValue === false ?
  4393. returnTrue :
  4394. returnFalse;
  4395. // Create target properties
  4396. // Support: Safari <=6 - 7 only
  4397. // Target should not be a text node (#504, #13143)
  4398. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4399. src.target.parentNode :
  4400. src.target;
  4401. this.currentTarget = src.currentTarget;
  4402. this.relatedTarget = src.relatedTarget;
  4403. // Event type
  4404. } else {
  4405. this.type = src;
  4406. }
  4407. // Put explicitly provided properties onto the event object
  4408. if ( props ) {
  4409. jQuery.extend( this, props );
  4410. }
  4411. // Create a timestamp if incoming event doesn't have one
  4412. this.timeStamp = src && src.timeStamp || Date.now();
  4413. // Mark it as fixed
  4414. this[ jQuery.expando ] = true;
  4415. };
  4416. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4417. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4418. jQuery.Event.prototype = {
  4419. constructor: jQuery.Event,
  4420. isDefaultPrevented: returnFalse,
  4421. isPropagationStopped: returnFalse,
  4422. isImmediatePropagationStopped: returnFalse,
  4423. isSimulated: false,
  4424. preventDefault: function() {
  4425. var e = this.originalEvent;
  4426. this.isDefaultPrevented = returnTrue;
  4427. if ( e && !this.isSimulated ) {
  4428. e.preventDefault();
  4429. }
  4430. },
  4431. stopPropagation: function() {
  4432. var e = this.originalEvent;
  4433. this.isPropagationStopped = returnTrue;
  4434. if ( e && !this.isSimulated ) {
  4435. e.stopPropagation();
  4436. }
  4437. },
  4438. stopImmediatePropagation: function() {
  4439. var e = this.originalEvent;
  4440. this.isImmediatePropagationStopped = returnTrue;
  4441. if ( e && !this.isSimulated ) {
  4442. e.stopImmediatePropagation();
  4443. }
  4444. this.stopPropagation();
  4445. }
  4446. };
  4447. // Includes all common event props including KeyEvent and MouseEvent specific props
  4448. jQuery.each( {
  4449. altKey: true,
  4450. bubbles: true,
  4451. cancelable: true,
  4452. changedTouches: true,
  4453. ctrlKey: true,
  4454. detail: true,
  4455. eventPhase: true,
  4456. metaKey: true,
  4457. pageX: true,
  4458. pageY: true,
  4459. shiftKey: true,
  4460. view: true,
  4461. "char": true,
  4462. charCode: true,
  4463. key: true,
  4464. keyCode: true,
  4465. button: true,
  4466. buttons: true,
  4467. clientX: true,
  4468. clientY: true,
  4469. offsetX: true,
  4470. offsetY: true,
  4471. pointerId: true,
  4472. pointerType: true,
  4473. screenX: true,
  4474. screenY: true,
  4475. targetTouches: true,
  4476. toElement: true,
  4477. touches: true,
  4478. which: function( event ) {
  4479. var button = event.button;
  4480. // Add which for key events
  4481. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  4482. return event.charCode != null ? event.charCode : event.keyCode;
  4483. }
  4484. // Add which for click: 1 === left; 2 === middle; 3 === right
  4485. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  4486. if ( button & 1 ) {
  4487. return 1;
  4488. }
  4489. if ( button & 2 ) {
  4490. return 3;
  4491. }
  4492. if ( button & 4 ) {
  4493. return 2;
  4494. }
  4495. return 0;
  4496. }
  4497. return event.which;
  4498. }
  4499. }, jQuery.event.addProp );
  4500. // Create mouseenter/leave events using mouseover/out and event-time checks
  4501. // so that event delegation works in jQuery.
  4502. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4503. //
  4504. // Support: Safari 7 only
  4505. // Safari sends mouseenter too often; see:
  4506. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4507. // for the description of the bug (it existed in older Chrome versions as well).
  4508. jQuery.each( {
  4509. mouseenter: "mouseover",
  4510. mouseleave: "mouseout",
  4511. pointerenter: "pointerover",
  4512. pointerleave: "pointerout"
  4513. }, function( orig, fix ) {
  4514. jQuery.event.special[ orig ] = {
  4515. delegateType: fix,
  4516. bindType: fix,
  4517. handle: function( event ) {
  4518. var ret,
  4519. target = this,
  4520. related = event.relatedTarget,
  4521. handleObj = event.handleObj;
  4522. // For mouseenter/leave call the handler if related is outside the target.
  4523. // NB: No relatedTarget if the mouse left/entered the browser window
  4524. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4525. event.type = handleObj.origType;
  4526. ret = handleObj.handler.apply( this, arguments );
  4527. event.type = fix;
  4528. }
  4529. return ret;
  4530. }
  4531. };
  4532. } );
  4533. jQuery.fn.extend( {
  4534. on: function( types, selector, data, fn ) {
  4535. return on( this, types, selector, data, fn );
  4536. },
  4537. one: function( types, selector, data, fn ) {
  4538. return on( this, types, selector, data, fn, 1 );
  4539. },
  4540. off: function( types, selector, fn ) {
  4541. var handleObj, type;
  4542. if ( types && types.preventDefault && types.handleObj ) {
  4543. // ( event ) dispatched jQuery.Event
  4544. handleObj = types.handleObj;
  4545. jQuery( types.delegateTarget ).off(
  4546. handleObj.namespace ?
  4547. handleObj.origType + "." + handleObj.namespace :
  4548. handleObj.origType,
  4549. handleObj.selector,
  4550. handleObj.handler
  4551. );
  4552. return this;
  4553. }
  4554. if ( typeof types === "object" ) {
  4555. // ( types-object [, selector] )
  4556. for ( type in types ) {
  4557. this.off( type, selector, types[ type ] );
  4558. }
  4559. return this;
  4560. }
  4561. if ( selector === false || typeof selector === "function" ) {
  4562. // ( types [, fn] )
  4563. fn = selector;
  4564. selector = undefined;
  4565. }
  4566. if ( fn === false ) {
  4567. fn = returnFalse;
  4568. }
  4569. return this.each( function() {
  4570. jQuery.event.remove( this, types, fn, selector );
  4571. } );
  4572. }
  4573. } );
  4574. var
  4575. /* eslint-disable max-len */
  4576. // See https://github.com/eslint/eslint/issues/3229
  4577. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  4578. /* eslint-enable */
  4579. // Support: IE <=10 - 11, Edge 12 - 13 only
  4580. // In IE/Edge using regex groups here causes severe slowdowns.
  4581. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4582. rnoInnerhtml = /<script|<style|<link/i,
  4583. // checked="checked" or checked
  4584. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4585. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4586. // Prefer a tbody over its parent table for containing new rows
  4587. function manipulationTarget( elem, content ) {
  4588. if ( nodeName( elem, "table" ) &&
  4589. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4590. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  4591. }
  4592. return elem;
  4593. }
  4594. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4595. function disableScript( elem ) {
  4596. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4597. return elem;
  4598. }
  4599. function restoreScript( elem ) {
  4600. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  4601. elem.type = elem.type.slice( 5 );
  4602. } else {
  4603. elem.removeAttribute( "type" );
  4604. }
  4605. return elem;
  4606. }
  4607. function cloneCopyEvent( src, dest ) {
  4608. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4609. if ( dest.nodeType !== 1 ) {
  4610. return;
  4611. }
  4612. // 1. Copy private data: events, handlers, etc.
  4613. if ( dataPriv.hasData( src ) ) {
  4614. pdataOld = dataPriv.access( src );
  4615. pdataCur = dataPriv.set( dest, pdataOld );
  4616. events = pdataOld.events;
  4617. if ( events ) {
  4618. delete pdataCur.handle;
  4619. pdataCur.events = {};
  4620. for ( type in events ) {
  4621. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4622. jQuery.event.add( dest, type, events[ type ][ i ] );
  4623. }
  4624. }
  4625. }
  4626. }
  4627. // 2. Copy user data
  4628. if ( dataUser.hasData( src ) ) {
  4629. udataOld = dataUser.access( src );
  4630. udataCur = jQuery.extend( {}, udataOld );
  4631. dataUser.set( dest, udataCur );
  4632. }
  4633. }
  4634. // Fix IE bugs, see support tests
  4635. function fixInput( src, dest ) {
  4636. var nodeName = dest.nodeName.toLowerCase();
  4637. // Fails to persist the checked state of a cloned checkbox or radio button.
  4638. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4639. dest.checked = src.checked;
  4640. // Fails to return the selected option to the default selected state when cloning options
  4641. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4642. dest.defaultValue = src.defaultValue;
  4643. }
  4644. }
  4645. function domManip( collection, args, callback, ignored ) {
  4646. // Flatten any nested arrays
  4647. args = concat.apply( [], args );
  4648. var fragment, first, scripts, hasScripts, node, doc,
  4649. i = 0,
  4650. l = collection.length,
  4651. iNoClone = l - 1,
  4652. value = args[ 0 ],
  4653. valueIsFunction = isFunction( value );
  4654. // We can't cloneNode fragments that contain checked, in WebKit
  4655. if ( valueIsFunction ||
  4656. ( l > 1 && typeof value === "string" &&
  4657. !support.checkClone && rchecked.test( value ) ) ) {
  4658. return collection.each( function( index ) {
  4659. var self = collection.eq( index );
  4660. if ( valueIsFunction ) {
  4661. args[ 0 ] = value.call( this, index, self.html() );
  4662. }
  4663. domManip( self, args, callback, ignored );
  4664. } );
  4665. }
  4666. if ( l ) {
  4667. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4668. first = fragment.firstChild;
  4669. if ( fragment.childNodes.length === 1 ) {
  4670. fragment = first;
  4671. }
  4672. // Require either new content or an interest in ignored elements to invoke the callback
  4673. if ( first || ignored ) {
  4674. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4675. hasScripts = scripts.length;
  4676. // Use the original fragment for the last item
  4677. // instead of the first because it can end up
  4678. // being emptied incorrectly in certain situations (#8070).
  4679. for ( ; i < l; i++ ) {
  4680. node = fragment;
  4681. if ( i !== iNoClone ) {
  4682. node = jQuery.clone( node, true, true );
  4683. // Keep references to cloned scripts for later restoration
  4684. if ( hasScripts ) {
  4685. // Support: Android <=4.0 only, PhantomJS 1 only
  4686. // push.apply(_, arraylike) throws on ancient WebKit
  4687. jQuery.merge( scripts, getAll( node, "script" ) );
  4688. }
  4689. }
  4690. callback.call( collection[ i ], node, i );
  4691. }
  4692. if ( hasScripts ) {
  4693. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4694. // Reenable scripts
  4695. jQuery.map( scripts, restoreScript );
  4696. // Evaluate executable scripts on first document insertion
  4697. for ( i = 0; i < hasScripts; i++ ) {
  4698. node = scripts[ i ];
  4699. if ( rscriptType.test( node.type || "" ) &&
  4700. !dataPriv.access( node, "globalEval" ) &&
  4701. jQuery.contains( doc, node ) ) {
  4702. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  4703. // Optional AJAX dependency, but won't run scripts if not present
  4704. if ( jQuery._evalUrl ) {
  4705. jQuery._evalUrl( node.src );
  4706. }
  4707. } else {
  4708. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  4709. }
  4710. }
  4711. }
  4712. }
  4713. }
  4714. }
  4715. return collection;
  4716. }
  4717. function remove( elem, selector, keepData ) {
  4718. var node,
  4719. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4720. i = 0;
  4721. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4722. if ( !keepData && node.nodeType === 1 ) {
  4723. jQuery.cleanData( getAll( node ) );
  4724. }
  4725. if ( node.parentNode ) {
  4726. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4727. setGlobalEval( getAll( node, "script" ) );
  4728. }
  4729. node.parentNode.removeChild( node );
  4730. }
  4731. }
  4732. return elem;
  4733. }
  4734. jQuery.extend( {
  4735. htmlPrefilter: function( html ) {
  4736. return html.replace( rxhtmlTag, "<$1></$2>" );
  4737. },
  4738. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4739. var i, l, srcElements, destElements,
  4740. clone = elem.cloneNode( true ),
  4741. inPage = jQuery.contains( elem.ownerDocument, elem );
  4742. // Fix IE cloning issues
  4743. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4744. !jQuery.isXMLDoc( elem ) ) {
  4745. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4746. destElements = getAll( clone );
  4747. srcElements = getAll( elem );
  4748. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4749. fixInput( srcElements[ i ], destElements[ i ] );
  4750. }
  4751. }
  4752. // Copy the events from the original to the clone
  4753. if ( dataAndEvents ) {
  4754. if ( deepDataAndEvents ) {
  4755. srcElements = srcElements || getAll( elem );
  4756. destElements = destElements || getAll( clone );
  4757. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4758. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4759. }
  4760. } else {
  4761. cloneCopyEvent( elem, clone );
  4762. }
  4763. }
  4764. // Preserve script evaluation history
  4765. destElements = getAll( clone, "script" );
  4766. if ( destElements.length > 0 ) {
  4767. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4768. }
  4769. // Return the cloned set
  4770. return clone;
  4771. },
  4772. cleanData: function( elems ) {
  4773. var data, elem, type,
  4774. special = jQuery.event.special,
  4775. i = 0;
  4776. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  4777. if ( acceptData( elem ) ) {
  4778. if ( ( data = elem[ dataPriv.expando ] ) ) {
  4779. if ( data.events ) {
  4780. for ( type in data.events ) {
  4781. if ( special[ type ] ) {
  4782. jQuery.event.remove( elem, type );
  4783. // This is a shortcut to avoid jQuery.event.remove's overhead
  4784. } else {
  4785. jQuery.removeEvent( elem, type, data.handle );
  4786. }
  4787. }
  4788. }
  4789. // Support: Chrome <=35 - 45+
  4790. // Assign undefined instead of using delete, see Data#remove
  4791. elem[ dataPriv.expando ] = undefined;
  4792. }
  4793. if ( elem[ dataUser.expando ] ) {
  4794. // Support: Chrome <=35 - 45+
  4795. // Assign undefined instead of using delete, see Data#remove
  4796. elem[ dataUser.expando ] = undefined;
  4797. }
  4798. }
  4799. }
  4800. }
  4801. } );
  4802. jQuery.fn.extend( {
  4803. detach: function( selector ) {
  4804. return remove( this, selector, true );
  4805. },
  4806. remove: function( selector ) {
  4807. return remove( this, selector );
  4808. },
  4809. text: function( value ) {
  4810. return access( this, function( value ) {
  4811. return value === undefined ?
  4812. jQuery.text( this ) :
  4813. this.empty().each( function() {
  4814. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4815. this.textContent = value;
  4816. }
  4817. } );
  4818. }, null, value, arguments.length );
  4819. },
  4820. append: function() {
  4821. return domManip( this, arguments, function( elem ) {
  4822. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4823. var target = manipulationTarget( this, elem );
  4824. target.appendChild( elem );
  4825. }
  4826. } );
  4827. },
  4828. prepend: function() {
  4829. return domManip( this, arguments, function( elem ) {
  4830. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4831. var target = manipulationTarget( this, elem );
  4832. target.insertBefore( elem, target.firstChild );
  4833. }
  4834. } );
  4835. },
  4836. before: function() {
  4837. return domManip( this, arguments, function( elem ) {
  4838. if ( this.parentNode ) {
  4839. this.parentNode.insertBefore( elem, this );
  4840. }
  4841. } );
  4842. },
  4843. after: function() {
  4844. return domManip( this, arguments, function( elem ) {
  4845. if ( this.parentNode ) {
  4846. this.parentNode.insertBefore( elem, this.nextSibling );
  4847. }
  4848. } );
  4849. },
  4850. empty: function() {
  4851. var elem,
  4852. i = 0;
  4853. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  4854. if ( elem.nodeType === 1 ) {
  4855. // Prevent memory leaks
  4856. jQuery.cleanData( getAll( elem, false ) );
  4857. // Remove any remaining nodes
  4858. elem.textContent = "";
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. clone: function( dataAndEvents, deepDataAndEvents ) {
  4864. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4865. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4866. return this.map( function() {
  4867. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4868. } );
  4869. },
  4870. html: function( value ) {
  4871. return access( this, function( value ) {
  4872. var elem = this[ 0 ] || {},
  4873. i = 0,
  4874. l = this.length;
  4875. if ( value === undefined && elem.nodeType === 1 ) {
  4876. return elem.innerHTML;
  4877. }
  4878. // See if we can take a shortcut and just use innerHTML
  4879. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4880. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4881. value = jQuery.htmlPrefilter( value );
  4882. try {
  4883. for ( ; i < l; i++ ) {
  4884. elem = this[ i ] || {};
  4885. // Remove element nodes and prevent memory leaks
  4886. if ( elem.nodeType === 1 ) {
  4887. jQuery.cleanData( getAll( elem, false ) );
  4888. elem.innerHTML = value;
  4889. }
  4890. }
  4891. elem = 0;
  4892. // If using innerHTML throws an exception, use the fallback method
  4893. } catch ( e ) {}
  4894. }
  4895. if ( elem ) {
  4896. this.empty().append( value );
  4897. }
  4898. }, null, value, arguments.length );
  4899. },
  4900. replaceWith: function() {
  4901. var ignored = [];
  4902. // Make the changes, replacing each non-ignored context element with the new content
  4903. return domManip( this, arguments, function( elem ) {
  4904. var parent = this.parentNode;
  4905. if ( jQuery.inArray( this, ignored ) < 0 ) {
  4906. jQuery.cleanData( getAll( this ) );
  4907. if ( parent ) {
  4908. parent.replaceChild( elem, this );
  4909. }
  4910. }
  4911. // Force callback invocation
  4912. }, ignored );
  4913. }
  4914. } );
  4915. jQuery.each( {
  4916. appendTo: "append",
  4917. prependTo: "prepend",
  4918. insertBefore: "before",
  4919. insertAfter: "after",
  4920. replaceAll: "replaceWith"
  4921. }, function( name, original ) {
  4922. jQuery.fn[ name ] = function( selector ) {
  4923. var elems,
  4924. ret = [],
  4925. insert = jQuery( selector ),
  4926. last = insert.length - 1,
  4927. i = 0;
  4928. for ( ; i <= last; i++ ) {
  4929. elems = i === last ? this : this.clone( true );
  4930. jQuery( insert[ i ] )[ original ]( elems );
  4931. // Support: Android <=4.0 only, PhantomJS 1 only
  4932. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4933. push.apply( ret, elems.get() );
  4934. }
  4935. return this.pushStack( ret );
  4936. };
  4937. } );
  4938. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4939. var getStyles = function( elem ) {
  4940. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4941. // IE throws on elements created in popups
  4942. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4943. var view = elem.ownerDocument.defaultView;
  4944. if ( !view || !view.opener ) {
  4945. view = window;
  4946. }
  4947. return view.getComputedStyle( elem );
  4948. };
  4949. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  4950. ( function() {
  4951. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4952. // so they're executed at the same time to save the second computation.
  4953. function computeStyleTests() {
  4954. // This is a singleton, we need to execute it only once
  4955. if ( !div ) {
  4956. return;
  4957. }
  4958. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  4959. "margin-top:1px;padding:0;border:0";
  4960. div.style.cssText =
  4961. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  4962. "margin:auto;border:1px;padding:1px;" +
  4963. "width:60%;top:1%";
  4964. documentElement.appendChild( container ).appendChild( div );
  4965. var divStyle = window.getComputedStyle( div );
  4966. pixelPositionVal = divStyle.top !== "1%";
  4967. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4968. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  4969. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  4970. // Some styles come back with percentage values, even though they shouldn't
  4971. div.style.right = "60%";
  4972. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  4973. // Support: IE 9 - 11 only
  4974. // Detect misreporting of content dimensions for box-sizing:border-box elements
  4975. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  4976. // Support: IE 9 only
  4977. // Detect overflow:scroll screwiness (gh-3699)
  4978. div.style.position = "absolute";
  4979. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  4980. documentElement.removeChild( container );
  4981. // Nullify the div so it wouldn't be stored in the memory and
  4982. // it will also be a sign that checks already performed
  4983. div = null;
  4984. }
  4985. function roundPixelMeasures( measure ) {
  4986. return Math.round( parseFloat( measure ) );
  4987. }
  4988. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  4989. reliableMarginLeftVal,
  4990. container = document.createElement( "div" ),
  4991. div = document.createElement( "div" );
  4992. // Finish early in limited (non-browser) environments
  4993. if ( !div.style ) {
  4994. return;
  4995. }
  4996. // Support: IE <=9 - 11 only
  4997. // Style of cloned element affects source element cloned (#8908)
  4998. div.style.backgroundClip = "content-box";
  4999. div.cloneNode( true ).style.backgroundClip = "";
  5000. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5001. jQuery.extend( support, {
  5002. boxSizingReliable: function() {
  5003. computeStyleTests();
  5004. return boxSizingReliableVal;
  5005. },
  5006. pixelBoxStyles: function() {
  5007. computeStyleTests();
  5008. return pixelBoxStylesVal;
  5009. },
  5010. pixelPosition: function() {
  5011. computeStyleTests();
  5012. return pixelPositionVal;
  5013. },
  5014. reliableMarginLeft: function() {
  5015. computeStyleTests();
  5016. return reliableMarginLeftVal;
  5017. },
  5018. scrollboxSize: function() {
  5019. computeStyleTests();
  5020. return scrollboxSizeVal;
  5021. }
  5022. } );
  5023. } )();
  5024. function curCSS( elem, name, computed ) {
  5025. var width, minWidth, maxWidth, ret,
  5026. // Support: Firefox 51+
  5027. // Retrieving style before computed somehow
  5028. // fixes an issue with getting wrong values
  5029. // on detached elements
  5030. style = elem.style;
  5031. computed = computed || getStyles( elem );
  5032. // getPropertyValue is needed for:
  5033. // .css('filter') (IE 9 only, #12537)
  5034. // .css('--customProperty) (#3144)
  5035. if ( computed ) {
  5036. ret = computed.getPropertyValue( name ) || computed[ name ];
  5037. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5038. ret = jQuery.style( elem, name );
  5039. }
  5040. // A tribute to the "awesome hack by Dean Edwards"
  5041. // Android Browser returns percentage for some values,
  5042. // but width seems to be reliably pixels.
  5043. // This is against the CSSOM draft spec:
  5044. // https://drafts.csswg.org/cssom/#resolved-values
  5045. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  5046. // Remember the original values
  5047. width = style.width;
  5048. minWidth = style.minWidth;
  5049. maxWidth = style.maxWidth;
  5050. // Put in the new values to get a computed value out
  5051. style.minWidth = style.maxWidth = style.width = ret;
  5052. ret = computed.width;
  5053. // Revert the changed values
  5054. style.width = width;
  5055. style.minWidth = minWidth;
  5056. style.maxWidth = maxWidth;
  5057. }
  5058. }
  5059. return ret !== undefined ?
  5060. // Support: IE <=9 - 11 only
  5061. // IE returns zIndex value as an integer.
  5062. ret + "" :
  5063. ret;
  5064. }
  5065. function addGetHookIf( conditionFn, hookFn ) {
  5066. // Define the hook, we'll check on the first run if it's really needed.
  5067. return {
  5068. get: function() {
  5069. if ( conditionFn() ) {
  5070. // Hook not needed (or it's not possible to use it due
  5071. // to missing dependency), remove it.
  5072. delete this.get;
  5073. return;
  5074. }
  5075. // Hook needed; redefine it so that the support test is not executed again.
  5076. return ( this.get = hookFn ).apply( this, arguments );
  5077. }
  5078. };
  5079. }
  5080. var
  5081. // Swappable if display is none or starts with table
  5082. // except "table", "table-cell", or "table-caption"
  5083. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5084. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5085. rcustomProp = /^--/,
  5086. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5087. cssNormalTransform = {
  5088. letterSpacing: "0",
  5089. fontWeight: "400"
  5090. },
  5091. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5092. emptyStyle = document.createElement( "div" ).style;
  5093. // Return a css property mapped to a potentially vendor prefixed property
  5094. function vendorPropName( name ) {
  5095. // Shortcut for names that are not vendor prefixed
  5096. if ( name in emptyStyle ) {
  5097. return name;
  5098. }
  5099. // Check for vendor prefixed names
  5100. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5101. i = cssPrefixes.length;
  5102. while ( i-- ) {
  5103. name = cssPrefixes[ i ] + capName;
  5104. if ( name in emptyStyle ) {
  5105. return name;
  5106. }
  5107. }
  5108. }
  5109. // Return a property mapped along what jQuery.cssProps suggests or to
  5110. // a vendor prefixed property.
  5111. function finalPropName( name ) {
  5112. var ret = jQuery.cssProps[ name ];
  5113. if ( !ret ) {
  5114. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5115. }
  5116. return ret;
  5117. }
  5118. function setPositiveNumber( elem, value, subtract ) {
  5119. // Any relative (+/-) values have already been
  5120. // normalized at this point
  5121. var matches = rcssNum.exec( value );
  5122. return matches ?
  5123. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5124. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5125. value;
  5126. }
  5127. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  5128. var i = dimension === "width" ? 1 : 0,
  5129. extra = 0,
  5130. delta = 0;
  5131. // Adjustment may not be necessary
  5132. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  5133. return 0;
  5134. }
  5135. for ( ; i < 4; i += 2 ) {
  5136. // Both box models exclude margin
  5137. if ( box === "margin" ) {
  5138. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  5139. }
  5140. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5141. if ( !isBorderBox ) {
  5142. // Add padding
  5143. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5144. // For "border" or "margin", add border
  5145. if ( box !== "padding" ) {
  5146. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5147. // But still keep track of it otherwise
  5148. } else {
  5149. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5150. }
  5151. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5152. // "padding" or "margin"
  5153. } else {
  5154. // For "content", subtract padding
  5155. if ( box === "content" ) {
  5156. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5157. }
  5158. // For "content" or "padding", subtract border
  5159. if ( box !== "margin" ) {
  5160. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5161. }
  5162. }
  5163. }
  5164. // Account for positive content-box scroll gutter when requested by providing computedVal
  5165. if ( !isBorderBox && computedVal >= 0 ) {
  5166. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5167. // Assuming integer scroll gutter, subtract the rest and round down
  5168. delta += Math.max( 0, Math.ceil(
  5169. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5170. computedVal -
  5171. delta -
  5172. extra -
  5173. 0.5
  5174. ) );
  5175. }
  5176. return delta;
  5177. }
  5178. function getWidthOrHeight( elem, dimension, extra ) {
  5179. // Start with computed style
  5180. var styles = getStyles( elem ),
  5181. val = curCSS( elem, dimension, styles ),
  5182. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5183. valueIsBorderBox = isBorderBox;
  5184. // Support: Firefox <=54
  5185. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5186. if ( rnumnonpx.test( val ) ) {
  5187. if ( !extra ) {
  5188. return val;
  5189. }
  5190. val = "auto";
  5191. }
  5192. // Check for style in case a browser which returns unreliable values
  5193. // for getComputedStyle silently falls back to the reliable elem.style
  5194. valueIsBorderBox = valueIsBorderBox &&
  5195. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  5196. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5197. // This happens for inline elements with no explicit setting (gh-3571)
  5198. // Support: Android <=4.1 - 4.3 only
  5199. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5200. if ( val === "auto" ||
  5201. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  5202. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  5203. // offsetWidth/offsetHeight provide border-box values
  5204. valueIsBorderBox = true;
  5205. }
  5206. // Normalize "" and auto
  5207. val = parseFloat( val ) || 0;
  5208. // Adjust for the element's box model
  5209. return ( val +
  5210. boxModelAdjustment(
  5211. elem,
  5212. dimension,
  5213. extra || ( isBorderBox ? "border" : "content" ),
  5214. valueIsBorderBox,
  5215. styles,
  5216. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5217. val
  5218. )
  5219. ) + "px";
  5220. }
  5221. jQuery.extend( {
  5222. // Add in style property hooks for overriding the default
  5223. // behavior of getting and setting a style property
  5224. cssHooks: {
  5225. opacity: {
  5226. get: function( elem, computed ) {
  5227. if ( computed ) {
  5228. // We should always get a number back from opacity
  5229. var ret = curCSS( elem, "opacity" );
  5230. return ret === "" ? "1" : ret;
  5231. }
  5232. }
  5233. }
  5234. },
  5235. // Don't automatically add "px" to these possibly-unitless properties
  5236. cssNumber: {
  5237. "animationIterationCount": true,
  5238. "columnCount": true,
  5239. "fillOpacity": true,
  5240. "flexGrow": true,
  5241. "flexShrink": true,
  5242. "fontWeight": true,
  5243. "lineHeight": true,
  5244. "opacity": true,
  5245. "order": true,
  5246. "orphans": true,
  5247. "widows": true,
  5248. "zIndex": true,
  5249. "zoom": true
  5250. },
  5251. // Add in properties whose names you wish to fix before
  5252. // setting or getting the value
  5253. cssProps: {},
  5254. // Get and set the style property on a DOM Node
  5255. style: function( elem, name, value, extra ) {
  5256. // Don't set styles on text and comment nodes
  5257. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5258. return;
  5259. }
  5260. // Make sure that we're working with the right name
  5261. var ret, type, hooks,
  5262. origName = camelCase( name ),
  5263. isCustomProp = rcustomProp.test( name ),
  5264. style = elem.style;
  5265. // Make sure that we're working with the right name. We don't
  5266. // want to query the value if it is a CSS custom property
  5267. // since they are user-defined.
  5268. if ( !isCustomProp ) {
  5269. name = finalPropName( origName );
  5270. }
  5271. // Gets hook for the prefixed version, then unprefixed version
  5272. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5273. // Check if we're setting a value
  5274. if ( value !== undefined ) {
  5275. type = typeof value;
  5276. // Convert "+=" or "-=" to relative numbers (#7345)
  5277. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5278. value = adjustCSS( elem, name, ret );
  5279. // Fixes bug #9237
  5280. type = "number";
  5281. }
  5282. // Make sure that null and NaN values aren't set (#7116)
  5283. if ( value == null || value !== value ) {
  5284. return;
  5285. }
  5286. // If a number was passed in, add the unit (except for certain CSS properties)
  5287. if ( type === "number" ) {
  5288. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5289. }
  5290. // background-* props affect original clone's values
  5291. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5292. style[ name ] = "inherit";
  5293. }
  5294. // If a hook was provided, use that value, otherwise just set the specified value
  5295. if ( !hooks || !( "set" in hooks ) ||
  5296. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5297. if ( isCustomProp ) {
  5298. style.setProperty( name, value );
  5299. } else {
  5300. style[ name ] = value;
  5301. }
  5302. }
  5303. } else {
  5304. // If a hook was provided get the non-computed value from there
  5305. if ( hooks && "get" in hooks &&
  5306. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5307. return ret;
  5308. }
  5309. // Otherwise just get the value from the style object
  5310. return style[ name ];
  5311. }
  5312. },
  5313. css: function( elem, name, extra, styles ) {
  5314. var val, num, hooks,
  5315. origName = camelCase( name ),
  5316. isCustomProp = rcustomProp.test( name );
  5317. // Make sure that we're working with the right name. We don't
  5318. // want to modify the value if it is a CSS custom property
  5319. // since they are user-defined.
  5320. if ( !isCustomProp ) {
  5321. name = finalPropName( origName );
  5322. }
  5323. // Try prefixed name followed by the unprefixed name
  5324. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5325. // If a hook was provided get the computed value from there
  5326. if ( hooks && "get" in hooks ) {
  5327. val = hooks.get( elem, true, extra );
  5328. }
  5329. // Otherwise, if a way to get the computed value exists, use that
  5330. if ( val === undefined ) {
  5331. val = curCSS( elem, name, styles );
  5332. }
  5333. // Convert "normal" to computed value
  5334. if ( val === "normal" && name in cssNormalTransform ) {
  5335. val = cssNormalTransform[ name ];
  5336. }
  5337. // Make numeric if forced or a qualifier was provided and val looks numeric
  5338. if ( extra === "" || extra ) {
  5339. num = parseFloat( val );
  5340. return extra === true || isFinite( num ) ? num || 0 : val;
  5341. }
  5342. return val;
  5343. }
  5344. } );
  5345. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  5346. jQuery.cssHooks[ dimension ] = {
  5347. get: function( elem, computed, extra ) {
  5348. if ( computed ) {
  5349. // Certain elements can have dimension info if we invisibly show them
  5350. // but it must have a current display style that would benefit
  5351. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5352. // Support: Safari 8+
  5353. // Table columns in Safari have non-zero offsetWidth & zero
  5354. // getBoundingClientRect().width unless display is changed.
  5355. // Support: IE <=11 only
  5356. // Running getBoundingClientRect on a disconnected node
  5357. // in IE throws an error.
  5358. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5359. swap( elem, cssShow, function() {
  5360. return getWidthOrHeight( elem, dimension, extra );
  5361. } ) :
  5362. getWidthOrHeight( elem, dimension, extra );
  5363. }
  5364. },
  5365. set: function( elem, value, extra ) {
  5366. var matches,
  5367. styles = getStyles( elem ),
  5368. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5369. subtract = extra && boxModelAdjustment(
  5370. elem,
  5371. dimension,
  5372. extra,
  5373. isBorderBox,
  5374. styles
  5375. );
  5376. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5377. // faking a content-box to get border and padding (gh-3699)
  5378. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  5379. subtract -= Math.ceil(
  5380. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5381. parseFloat( styles[ dimension ] ) -
  5382. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  5383. 0.5
  5384. );
  5385. }
  5386. // Convert to pixels if value adjustment is needed
  5387. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5388. ( matches[ 3 ] || "px" ) !== "px" ) {
  5389. elem.style[ dimension ] = value;
  5390. value = jQuery.css( elem, dimension );
  5391. }
  5392. return setPositiveNumber( elem, value, subtract );
  5393. }
  5394. };
  5395. } );
  5396. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5397. function( elem, computed ) {
  5398. if ( computed ) {
  5399. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5400. elem.getBoundingClientRect().left -
  5401. swap( elem, { marginLeft: 0 }, function() {
  5402. return elem.getBoundingClientRect().left;
  5403. } )
  5404. ) + "px";
  5405. }
  5406. }
  5407. );
  5408. // These hooks are used by animate to expand properties
  5409. jQuery.each( {
  5410. margin: "",
  5411. padding: "",
  5412. border: "Width"
  5413. }, function( prefix, suffix ) {
  5414. jQuery.cssHooks[ prefix + suffix ] = {
  5415. expand: function( value ) {
  5416. var i = 0,
  5417. expanded = {},
  5418. // Assumes a single number if not a string
  5419. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5420. for ( ; i < 4; i++ ) {
  5421. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5422. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5423. }
  5424. return expanded;
  5425. }
  5426. };
  5427. if ( prefix !== "margin" ) {
  5428. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5429. }
  5430. } );
  5431. jQuery.fn.extend( {
  5432. css: function( name, value ) {
  5433. return access( this, function( elem, name, value ) {
  5434. var styles, len,
  5435. map = {},
  5436. i = 0;
  5437. if ( Array.isArray( name ) ) {
  5438. styles = getStyles( elem );
  5439. len = name.length;
  5440. for ( ; i < len; i++ ) {
  5441. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5442. }
  5443. return map;
  5444. }
  5445. return value !== undefined ?
  5446. jQuery.style( elem, name, value ) :
  5447. jQuery.css( elem, name );
  5448. }, name, value, arguments.length > 1 );
  5449. }
  5450. } );
  5451. function Tween( elem, options, prop, end, easing ) {
  5452. return new Tween.prototype.init( elem, options, prop, end, easing );
  5453. }
  5454. jQuery.Tween = Tween;
  5455. Tween.prototype = {
  5456. constructor: Tween,
  5457. init: function( elem, options, prop, end, easing, unit ) {
  5458. this.elem = elem;
  5459. this.prop = prop;
  5460. this.easing = easing || jQuery.easing._default;
  5461. this.options = options;
  5462. this.start = this.now = this.cur();
  5463. this.end = end;
  5464. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5465. },
  5466. cur: function() {
  5467. var hooks = Tween.propHooks[ this.prop ];
  5468. return hooks && hooks.get ?
  5469. hooks.get( this ) :
  5470. Tween.propHooks._default.get( this );
  5471. },
  5472. run: function( percent ) {
  5473. var eased,
  5474. hooks = Tween.propHooks[ this.prop ];
  5475. if ( this.options.duration ) {
  5476. this.pos = eased = jQuery.easing[ this.easing ](
  5477. percent, this.options.duration * percent, 0, 1, this.options.duration
  5478. );
  5479. } else {
  5480. this.pos = eased = percent;
  5481. }
  5482. this.now = ( this.end - this.start ) * eased + this.start;
  5483. if ( this.options.step ) {
  5484. this.options.step.call( this.elem, this.now, this );
  5485. }
  5486. if ( hooks && hooks.set ) {
  5487. hooks.set( this );
  5488. } else {
  5489. Tween.propHooks._default.set( this );
  5490. }
  5491. return this;
  5492. }
  5493. };
  5494. Tween.prototype.init.prototype = Tween.prototype;
  5495. Tween.propHooks = {
  5496. _default: {
  5497. get: function( tween ) {
  5498. var result;
  5499. // Use a property on the element directly when it is not a DOM element,
  5500. // or when there is no matching style property that exists.
  5501. if ( tween.elem.nodeType !== 1 ||
  5502. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  5503. return tween.elem[ tween.prop ];
  5504. }
  5505. // Passing an empty string as a 3rd parameter to .css will automatically
  5506. // attempt a parseFloat and fallback to a string if the parse fails.
  5507. // Simple values such as "10px" are parsed to Float;
  5508. // complex values such as "rotate(1rad)" are returned as-is.
  5509. result = jQuery.css( tween.elem, tween.prop, "" );
  5510. // Empty strings, null, undefined and "auto" are converted to 0.
  5511. return !result || result === "auto" ? 0 : result;
  5512. },
  5513. set: function( tween ) {
  5514. // Use step hook for back compat.
  5515. // Use cssHook if its there.
  5516. // Use .style if available and use plain properties where available.
  5517. if ( jQuery.fx.step[ tween.prop ] ) {
  5518. jQuery.fx.step[ tween.prop ]( tween );
  5519. } else if ( tween.elem.nodeType === 1 &&
  5520. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  5521. jQuery.cssHooks[ tween.prop ] ) ) {
  5522. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5523. } else {
  5524. tween.elem[ tween.prop ] = tween.now;
  5525. }
  5526. }
  5527. }
  5528. };
  5529. // Support: IE <=9 only
  5530. // Panic based approach to setting things on disconnected nodes
  5531. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5532. set: function( tween ) {
  5533. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5534. tween.elem[ tween.prop ] = tween.now;
  5535. }
  5536. }
  5537. };
  5538. jQuery.easing = {
  5539. linear: function( p ) {
  5540. return p;
  5541. },
  5542. swing: function( p ) {
  5543. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5544. },
  5545. _default: "swing"
  5546. };
  5547. jQuery.fx = Tween.prototype.init;
  5548. // Back compat <1.8 extension point
  5549. jQuery.fx.step = {};
  5550. var
  5551. fxNow, inProgress,
  5552. rfxtypes = /^(?:toggle|show|hide)$/,
  5553. rrun = /queueHooks$/;
  5554. function schedule() {
  5555. if ( inProgress ) {
  5556. if ( document.hidden === false && window.requestAnimationFrame ) {
  5557. window.requestAnimationFrame( schedule );
  5558. } else {
  5559. window.setTimeout( schedule, jQuery.fx.interval );
  5560. }
  5561. jQuery.fx.tick();
  5562. }
  5563. }
  5564. // Animations created synchronously will run synchronously
  5565. function createFxNow() {
  5566. window.setTimeout( function() {
  5567. fxNow = undefined;
  5568. } );
  5569. return ( fxNow = Date.now() );
  5570. }
  5571. // Generate parameters to create a standard animation
  5572. function genFx( type, includeWidth ) {
  5573. var which,
  5574. i = 0,
  5575. attrs = { height: type };
  5576. // If we include width, step value is 1 to do all cssExpand values,
  5577. // otherwise step value is 2 to skip over Left and Right
  5578. includeWidth = includeWidth ? 1 : 0;
  5579. for ( ; i < 4; i += 2 - includeWidth ) {
  5580. which = cssExpand[ i ];
  5581. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5582. }
  5583. if ( includeWidth ) {
  5584. attrs.opacity = attrs.width = type;
  5585. }
  5586. return attrs;
  5587. }
  5588. function createTween( value, prop, animation ) {
  5589. var tween,
  5590. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  5591. index = 0,
  5592. length = collection.length;
  5593. for ( ; index < length; index++ ) {
  5594. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  5595. // We're done with this property
  5596. return tween;
  5597. }
  5598. }
  5599. }
  5600. function defaultPrefilter( elem, props, opts ) {
  5601. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  5602. isBox = "width" in props || "height" in props,
  5603. anim = this,
  5604. orig = {},
  5605. style = elem.style,
  5606. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  5607. dataShow = dataPriv.get( elem, "fxshow" );
  5608. // Queue-skipping animations hijack the fx hooks
  5609. if ( !opts.queue ) {
  5610. hooks = jQuery._queueHooks( elem, "fx" );
  5611. if ( hooks.unqueued == null ) {
  5612. hooks.unqueued = 0;
  5613. oldfire = hooks.empty.fire;
  5614. hooks.empty.fire = function() {
  5615. if ( !hooks.unqueued ) {
  5616. oldfire();
  5617. }
  5618. };
  5619. }
  5620. hooks.unqueued++;
  5621. anim.always( function() {
  5622. // Ensure the complete handler is called before this completes
  5623. anim.always( function() {
  5624. hooks.unqueued--;
  5625. if ( !jQuery.queue( elem, "fx" ).length ) {
  5626. hooks.empty.fire();
  5627. }
  5628. } );
  5629. } );
  5630. }
  5631. // Detect show/hide animations
  5632. for ( prop in props ) {
  5633. value = props[ prop ];
  5634. if ( rfxtypes.test( value ) ) {
  5635. delete props[ prop ];
  5636. toggle = toggle || value === "toggle";
  5637. if ( value === ( hidden ? "hide" : "show" ) ) {
  5638. // Pretend to be hidden if this is a "show" and
  5639. // there is still data from a stopped show/hide
  5640. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5641. hidden = true;
  5642. // Ignore all other no-op show/hide data
  5643. } else {
  5644. continue;
  5645. }
  5646. }
  5647. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5648. }
  5649. }
  5650. // Bail out if this is a no-op like .hide().hide()
  5651. propTween = !jQuery.isEmptyObject( props );
  5652. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  5653. return;
  5654. }
  5655. // Restrict "overflow" and "display" styles during box animations
  5656. if ( isBox && elem.nodeType === 1 ) {
  5657. // Support: IE <=9 - 11, Edge 12 - 15
  5658. // Record all 3 overflow attributes because IE does not infer the shorthand
  5659. // from identically-valued overflowX and overflowY and Edge just mirrors
  5660. // the overflowX value there.
  5661. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5662. // Identify a display type, preferring old show/hide data over the CSS cascade
  5663. restoreDisplay = dataShow && dataShow.display;
  5664. if ( restoreDisplay == null ) {
  5665. restoreDisplay = dataPriv.get( elem, "display" );
  5666. }
  5667. display = jQuery.css( elem, "display" );
  5668. if ( display === "none" ) {
  5669. if ( restoreDisplay ) {
  5670. display = restoreDisplay;
  5671. } else {
  5672. // Get nonempty value(s) by temporarily forcing visibility
  5673. showHide( [ elem ], true );
  5674. restoreDisplay = elem.style.display || restoreDisplay;
  5675. display = jQuery.css( elem, "display" );
  5676. showHide( [ elem ] );
  5677. }
  5678. }
  5679. // Animate inline elements as inline-block
  5680. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  5681. if ( jQuery.css( elem, "float" ) === "none" ) {
  5682. // Restore the original display value at the end of pure show/hide animations
  5683. if ( !propTween ) {
  5684. anim.done( function() {
  5685. style.display = restoreDisplay;
  5686. } );
  5687. if ( restoreDisplay == null ) {
  5688. display = style.display;
  5689. restoreDisplay = display === "none" ? "" : display;
  5690. }
  5691. }
  5692. style.display = "inline-block";
  5693. }
  5694. }
  5695. }
  5696. if ( opts.overflow ) {
  5697. style.overflow = "hidden";
  5698. anim.always( function() {
  5699. style.overflow = opts.overflow[ 0 ];
  5700. style.overflowX = opts.overflow[ 1 ];
  5701. style.overflowY = opts.overflow[ 2 ];
  5702. } );
  5703. }
  5704. // Implement show/hide animations
  5705. propTween = false;
  5706. for ( prop in orig ) {
  5707. // General show/hide setup for this element animation
  5708. if ( !propTween ) {
  5709. if ( dataShow ) {
  5710. if ( "hidden" in dataShow ) {
  5711. hidden = dataShow.hidden;
  5712. }
  5713. } else {
  5714. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  5715. }
  5716. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  5717. if ( toggle ) {
  5718. dataShow.hidden = !hidden;
  5719. }
  5720. // Show elements before animating them
  5721. if ( hidden ) {
  5722. showHide( [ elem ], true );
  5723. }
  5724. /* eslint-disable no-loop-func */
  5725. anim.done( function() {
  5726. /* eslint-enable no-loop-func */
  5727. // The final step of a "hide" animation is actually hiding the element
  5728. if ( !hidden ) {
  5729. showHide( [ elem ] );
  5730. }
  5731. dataPriv.remove( elem, "fxshow" );
  5732. for ( prop in orig ) {
  5733. jQuery.style( elem, prop, orig[ prop ] );
  5734. }
  5735. } );
  5736. }
  5737. // Per-property setup
  5738. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5739. if ( !( prop in dataShow ) ) {
  5740. dataShow[ prop ] = propTween.start;
  5741. if ( hidden ) {
  5742. propTween.end = propTween.start;
  5743. propTween.start = 0;
  5744. }
  5745. }
  5746. }
  5747. }
  5748. function propFilter( props, specialEasing ) {
  5749. var index, name, easing, value, hooks;
  5750. // camelCase, specialEasing and expand cssHook pass
  5751. for ( index in props ) {
  5752. name = camelCase( index );
  5753. easing = specialEasing[ name ];
  5754. value = props[ index ];
  5755. if ( Array.isArray( value ) ) {
  5756. easing = value[ 1 ];
  5757. value = props[ index ] = value[ 0 ];
  5758. }
  5759. if ( index !== name ) {
  5760. props[ name ] = value;
  5761. delete props[ index ];
  5762. }
  5763. hooks = jQuery.cssHooks[ name ];
  5764. if ( hooks && "expand" in hooks ) {
  5765. value = hooks.expand( value );
  5766. delete props[ name ];
  5767. // Not quite $.extend, this won't overwrite existing keys.
  5768. // Reusing 'index' because we have the correct "name"
  5769. for ( index in value ) {
  5770. if ( !( index in props ) ) {
  5771. props[ index ] = value[ index ];
  5772. specialEasing[ index ] = easing;
  5773. }
  5774. }
  5775. } else {
  5776. specialEasing[ name ] = easing;
  5777. }
  5778. }
  5779. }
  5780. function Animation( elem, properties, options ) {
  5781. var result,
  5782. stopped,
  5783. index = 0,
  5784. length = Animation.prefilters.length,
  5785. deferred = jQuery.Deferred().always( function() {
  5786. // Don't match elem in the :animated selector
  5787. delete tick.elem;
  5788. } ),
  5789. tick = function() {
  5790. if ( stopped ) {
  5791. return false;
  5792. }
  5793. var currentTime = fxNow || createFxNow(),
  5794. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5795. // Support: Android 2.3 only
  5796. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5797. temp = remaining / animation.duration || 0,
  5798. percent = 1 - temp,
  5799. index = 0,
  5800. length = animation.tweens.length;
  5801. for ( ; index < length; index++ ) {
  5802. animation.tweens[ index ].run( percent );
  5803. }
  5804. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  5805. // If there's more to do, yield
  5806. if ( percent < 1 && length ) {
  5807. return remaining;
  5808. }
  5809. // If this was an empty animation, synthesize a final progress notification
  5810. if ( !length ) {
  5811. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5812. }
  5813. // Resolve the animation and report its conclusion
  5814. deferred.resolveWith( elem, [ animation ] );
  5815. return false;
  5816. },
  5817. animation = deferred.promise( {
  5818. elem: elem,
  5819. props: jQuery.extend( {}, properties ),
  5820. opts: jQuery.extend( true, {
  5821. specialEasing: {},
  5822. easing: jQuery.easing._default
  5823. }, options ),
  5824. originalProperties: properties,
  5825. originalOptions: options,
  5826. startTime: fxNow || createFxNow(),
  5827. duration: options.duration,
  5828. tweens: [],
  5829. createTween: function( prop, end ) {
  5830. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5831. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5832. animation.tweens.push( tween );
  5833. return tween;
  5834. },
  5835. stop: function( gotoEnd ) {
  5836. var index = 0,
  5837. // If we are going to the end, we want to run all the tweens
  5838. // otherwise we skip this part
  5839. length = gotoEnd ? animation.tweens.length : 0;
  5840. if ( stopped ) {
  5841. return this;
  5842. }
  5843. stopped = true;
  5844. for ( ; index < length; index++ ) {
  5845. animation.tweens[ index ].run( 1 );
  5846. }
  5847. // Resolve when we played the last frame; otherwise, reject
  5848. if ( gotoEnd ) {
  5849. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5850. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5851. } else {
  5852. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5853. }
  5854. return this;
  5855. }
  5856. } ),
  5857. props = animation.props;
  5858. propFilter( props, animation.opts.specialEasing );
  5859. for ( ; index < length; index++ ) {
  5860. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  5861. if ( result ) {
  5862. if ( isFunction( result.stop ) ) {
  5863. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  5864. result.stop.bind( result );
  5865. }
  5866. return result;
  5867. }
  5868. }
  5869. jQuery.map( props, createTween, animation );
  5870. if ( isFunction( animation.opts.start ) ) {
  5871. animation.opts.start.call( elem, animation );
  5872. }
  5873. // Attach callbacks from options
  5874. animation
  5875. .progress( animation.opts.progress )
  5876. .done( animation.opts.done, animation.opts.complete )
  5877. .fail( animation.opts.fail )
  5878. .always( animation.opts.always );
  5879. jQuery.fx.timer(
  5880. jQuery.extend( tick, {
  5881. elem: elem,
  5882. anim: animation,
  5883. queue: animation.opts.queue
  5884. } )
  5885. );
  5886. return animation;
  5887. }
  5888. jQuery.Animation = jQuery.extend( Animation, {
  5889. tweeners: {
  5890. "*": [ function( prop, value ) {
  5891. var tween = this.createTween( prop, value );
  5892. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  5893. return tween;
  5894. } ]
  5895. },
  5896. tweener: function( props, callback ) {
  5897. if ( isFunction( props ) ) {
  5898. callback = props;
  5899. props = [ "*" ];
  5900. } else {
  5901. props = props.match( rnothtmlwhite );
  5902. }
  5903. var prop,
  5904. index = 0,
  5905. length = props.length;
  5906. for ( ; index < length; index++ ) {
  5907. prop = props[ index ];
  5908. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  5909. Animation.tweeners[ prop ].unshift( callback );
  5910. }
  5911. },
  5912. prefilters: [ defaultPrefilter ],
  5913. prefilter: function( callback, prepend ) {
  5914. if ( prepend ) {
  5915. Animation.prefilters.unshift( callback );
  5916. } else {
  5917. Animation.prefilters.push( callback );
  5918. }
  5919. }
  5920. } );
  5921. jQuery.speed = function( speed, easing, fn ) {
  5922. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5923. complete: fn || !fn && easing ||
  5924. isFunction( speed ) && speed,
  5925. duration: speed,
  5926. easing: fn && easing || easing && !isFunction( easing ) && easing
  5927. };
  5928. // Go to the end state if fx are off
  5929. if ( jQuery.fx.off ) {
  5930. opt.duration = 0;
  5931. } else {
  5932. if ( typeof opt.duration !== "number" ) {
  5933. if ( opt.duration in jQuery.fx.speeds ) {
  5934. opt.duration = jQuery.fx.speeds[ opt.duration ];
  5935. } else {
  5936. opt.duration = jQuery.fx.speeds._default;
  5937. }
  5938. }
  5939. }
  5940. // Normalize opt.queue - true/undefined/null -> "fx"
  5941. if ( opt.queue == null || opt.queue === true ) {
  5942. opt.queue = "fx";
  5943. }
  5944. // Queueing
  5945. opt.old = opt.complete;
  5946. opt.complete = function() {
  5947. if ( isFunction( opt.old ) ) {
  5948. opt.old.call( this );
  5949. }
  5950. if ( opt.queue ) {
  5951. jQuery.dequeue( this, opt.queue );
  5952. }
  5953. };
  5954. return opt;
  5955. };
  5956. jQuery.fn.extend( {
  5957. fadeTo: function( speed, to, easing, callback ) {
  5958. // Show any hidden elements after setting opacity to 0
  5959. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  5960. // Animate to the value specified
  5961. .end().animate( { opacity: to }, speed, easing, callback );
  5962. },
  5963. animate: function( prop, speed, easing, callback ) {
  5964. var empty = jQuery.isEmptyObject( prop ),
  5965. optall = jQuery.speed( speed, easing, callback ),
  5966. doAnimation = function() {
  5967. // Operate on a copy of prop so per-property easing won't be lost
  5968. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5969. // Empty animations, or finishing resolves immediately
  5970. if ( empty || dataPriv.get( this, "finish" ) ) {
  5971. anim.stop( true );
  5972. }
  5973. };
  5974. doAnimation.finish = doAnimation;
  5975. return empty || optall.queue === false ?
  5976. this.each( doAnimation ) :
  5977. this.queue( optall.queue, doAnimation );
  5978. },
  5979. stop: function( type, clearQueue, gotoEnd ) {
  5980. var stopQueue = function( hooks ) {
  5981. var stop = hooks.stop;
  5982. delete hooks.stop;
  5983. stop( gotoEnd );
  5984. };
  5985. if ( typeof type !== "string" ) {
  5986. gotoEnd = clearQueue;
  5987. clearQueue = type;
  5988. type = undefined;
  5989. }
  5990. if ( clearQueue && type !== false ) {
  5991. this.queue( type || "fx", [] );
  5992. }
  5993. return this.each( function() {
  5994. var dequeue = true,
  5995. index = type != null && type + "queueHooks",
  5996. timers = jQuery.timers,
  5997. data = dataPriv.get( this );
  5998. if ( index ) {
  5999. if ( data[ index ] && data[ index ].stop ) {
  6000. stopQueue( data[ index ] );
  6001. }
  6002. } else {
  6003. for ( index in data ) {
  6004. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6005. stopQueue( data[ index ] );
  6006. }
  6007. }
  6008. }
  6009. for ( index = timers.length; index--; ) {
  6010. if ( timers[ index ].elem === this &&
  6011. ( type == null || timers[ index ].queue === type ) ) {
  6012. timers[ index ].anim.stop( gotoEnd );
  6013. dequeue = false;
  6014. timers.splice( index, 1 );
  6015. }
  6016. }
  6017. // Start the next in the queue if the last step wasn't forced.
  6018. // Timers currently will call their complete callbacks, which
  6019. // will dequeue but only if they were gotoEnd.
  6020. if ( dequeue || !gotoEnd ) {
  6021. jQuery.dequeue( this, type );
  6022. }
  6023. } );
  6024. },
  6025. finish: function( type ) {
  6026. if ( type !== false ) {
  6027. type = type || "fx";
  6028. }
  6029. return this.each( function() {
  6030. var index,
  6031. data = dataPriv.get( this ),
  6032. queue = data[ type + "queue" ],
  6033. hooks = data[ type + "queueHooks" ],
  6034. timers = jQuery.timers,
  6035. length = queue ? queue.length : 0;
  6036. // Enable finishing flag on private data
  6037. data.finish = true;
  6038. // Empty the queue first
  6039. jQuery.queue( this, type, [] );
  6040. if ( hooks && hooks.stop ) {
  6041. hooks.stop.call( this, true );
  6042. }
  6043. // Look for any active animations, and finish them
  6044. for ( index = timers.length; index--; ) {
  6045. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6046. timers[ index ].anim.stop( true );
  6047. timers.splice( index, 1 );
  6048. }
  6049. }
  6050. // Look for any animations in the old queue and finish them
  6051. for ( index = 0; index < length; index++ ) {
  6052. if ( queue[ index ] && queue[ index ].finish ) {
  6053. queue[ index ].finish.call( this );
  6054. }
  6055. }
  6056. // Turn off finishing flag
  6057. delete data.finish;
  6058. } );
  6059. }
  6060. } );
  6061. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6062. var cssFn = jQuery.fn[ name ];
  6063. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6064. return speed == null || typeof speed === "boolean" ?
  6065. cssFn.apply( this, arguments ) :
  6066. this.animate( genFx( name, true ), speed, easing, callback );
  6067. };
  6068. } );
  6069. // Generate shortcuts for custom animations
  6070. jQuery.each( {
  6071. slideDown: genFx( "show" ),
  6072. slideUp: genFx( "hide" ),
  6073. slideToggle: genFx( "toggle" ),
  6074. fadeIn: { opacity: "show" },
  6075. fadeOut: { opacity: "hide" },
  6076. fadeToggle: { opacity: "toggle" }
  6077. }, function( name, props ) {
  6078. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6079. return this.animate( props, speed, easing, callback );
  6080. };
  6081. } );
  6082. jQuery.timers = [];
  6083. jQuery.fx.tick = function() {
  6084. var timer,
  6085. i = 0,
  6086. timers = jQuery.timers;
  6087. fxNow = Date.now();
  6088. for ( ; i < timers.length; i++ ) {
  6089. timer = timers[ i ];
  6090. // Run the timer and safely remove it when done (allowing for external removal)
  6091. if ( !timer() && timers[ i ] === timer ) {
  6092. timers.splice( i--, 1 );
  6093. }
  6094. }
  6095. if ( !timers.length ) {
  6096. jQuery.fx.stop();
  6097. }
  6098. fxNow = undefined;
  6099. };
  6100. jQuery.fx.timer = function( timer ) {
  6101. jQuery.timers.push( timer );
  6102. jQuery.fx.start();
  6103. };
  6104. jQuery.fx.interval = 13;
  6105. jQuery.fx.start = function() {
  6106. if ( inProgress ) {
  6107. return;
  6108. }
  6109. inProgress = true;
  6110. schedule();
  6111. };
  6112. jQuery.fx.stop = function() {
  6113. inProgress = null;
  6114. };
  6115. jQuery.fx.speeds = {
  6116. slow: 600,
  6117. fast: 200,
  6118. // Default speed
  6119. _default: 400
  6120. };
  6121. // Based off of the plugin by Clint Helfers, with permission.
  6122. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6123. jQuery.fn.delay = function( time, type ) {
  6124. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6125. type = type || "fx";
  6126. return this.queue( type, function( next, hooks ) {
  6127. var timeout = window.setTimeout( next, time );
  6128. hooks.stop = function() {
  6129. window.clearTimeout( timeout );
  6130. };
  6131. } );
  6132. };
  6133. ( function() {
  6134. var input = document.createElement( "input" ),
  6135. select = document.createElement( "select" ),
  6136. opt = select.appendChild( document.createElement( "option" ) );
  6137. input.type = "checkbox";
  6138. // Support: Android <=4.3 only
  6139. // Default value for a checkbox should be "on"
  6140. support.checkOn = input.value !== "";
  6141. // Support: IE <=11 only
  6142. // Must access selectedIndex to make default options select
  6143. support.optSelected = opt.selected;
  6144. // Support: IE <=11 only
  6145. // An input loses its value after becoming a radio
  6146. input = document.createElement( "input" );
  6147. input.value = "t";
  6148. input.type = "radio";
  6149. support.radioValue = input.value === "t";
  6150. } )();
  6151. var boolHook,
  6152. attrHandle = jQuery.expr.attrHandle;
  6153. jQuery.fn.extend( {
  6154. attr: function( name, value ) {
  6155. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6156. },
  6157. removeAttr: function( name ) {
  6158. return this.each( function() {
  6159. jQuery.removeAttr( this, name );
  6160. } );
  6161. }
  6162. } );
  6163. jQuery.extend( {
  6164. attr: function( elem, name, value ) {
  6165. var ret, hooks,
  6166. nType = elem.nodeType;
  6167. // Don't get/set attributes on text, comment and attribute nodes
  6168. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6169. return;
  6170. }
  6171. // Fallback to prop when attributes are not supported
  6172. if ( typeof elem.getAttribute === "undefined" ) {
  6173. return jQuery.prop( elem, name, value );
  6174. }
  6175. // Attribute hooks are determined by the lowercase version
  6176. // Grab necessary hook if one is defined
  6177. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6178. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6179. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6180. }
  6181. if ( value !== undefined ) {
  6182. if ( value === null ) {
  6183. jQuery.removeAttr( elem, name );
  6184. return;
  6185. }
  6186. if ( hooks && "set" in hooks &&
  6187. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6188. return ret;
  6189. }
  6190. elem.setAttribute( name, value + "" );
  6191. return value;
  6192. }
  6193. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6194. return ret;
  6195. }
  6196. ret = jQuery.find.attr( elem, name );
  6197. // Non-existent attributes return null, we normalize to undefined
  6198. return ret == null ? undefined : ret;
  6199. },
  6200. attrHooks: {
  6201. type: {
  6202. set: function( elem, value ) {
  6203. if ( !support.radioValue && value === "radio" &&
  6204. nodeName( elem, "input" ) ) {
  6205. var val = elem.value;
  6206. elem.setAttribute( "type", value );
  6207. if ( val ) {
  6208. elem.value = val;
  6209. }
  6210. return value;
  6211. }
  6212. }
  6213. }
  6214. },
  6215. removeAttr: function( elem, value ) {
  6216. var name,
  6217. i = 0,
  6218. // Attribute names can contain non-HTML whitespace characters
  6219. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6220. attrNames = value && value.match( rnothtmlwhite );
  6221. if ( attrNames && elem.nodeType === 1 ) {
  6222. while ( ( name = attrNames[ i++ ] ) ) {
  6223. elem.removeAttribute( name );
  6224. }
  6225. }
  6226. }
  6227. } );
  6228. // Hooks for boolean attributes
  6229. boolHook = {
  6230. set: function( elem, value, name ) {
  6231. if ( value === false ) {
  6232. // Remove boolean attributes when set to false
  6233. jQuery.removeAttr( elem, name );
  6234. } else {
  6235. elem.setAttribute( name, name );
  6236. }
  6237. return name;
  6238. }
  6239. };
  6240. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6241. var getter = attrHandle[ name ] || jQuery.find.attr;
  6242. attrHandle[ name ] = function( elem, name, isXML ) {
  6243. var ret, handle,
  6244. lowercaseName = name.toLowerCase();
  6245. if ( !isXML ) {
  6246. // Avoid an infinite loop by temporarily removing this function from the getter
  6247. handle = attrHandle[ lowercaseName ];
  6248. attrHandle[ lowercaseName ] = ret;
  6249. ret = getter( elem, name, isXML ) != null ?
  6250. lowercaseName :
  6251. null;
  6252. attrHandle[ lowercaseName ] = handle;
  6253. }
  6254. return ret;
  6255. };
  6256. } );
  6257. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6258. rclickable = /^(?:a|area)$/i;
  6259. jQuery.fn.extend( {
  6260. prop: function( name, value ) {
  6261. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6262. },
  6263. removeProp: function( name ) {
  6264. return this.each( function() {
  6265. delete this[ jQuery.propFix[ name ] || name ];
  6266. } );
  6267. }
  6268. } );
  6269. jQuery.extend( {
  6270. prop: function( elem, name, value ) {
  6271. var ret, hooks,
  6272. nType = elem.nodeType;
  6273. // Don't get/set properties on text, comment and attribute nodes
  6274. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6275. return;
  6276. }
  6277. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6278. // Fix name and attach hooks
  6279. name = jQuery.propFix[ name ] || name;
  6280. hooks = jQuery.propHooks[ name ];
  6281. }
  6282. if ( value !== undefined ) {
  6283. if ( hooks && "set" in hooks &&
  6284. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6285. return ret;
  6286. }
  6287. return ( elem[ name ] = value );
  6288. }
  6289. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6290. return ret;
  6291. }
  6292. return elem[ name ];
  6293. },
  6294. propHooks: {
  6295. tabIndex: {
  6296. get: function( elem ) {
  6297. // Support: IE <=9 - 11 only
  6298. // elem.tabIndex doesn't always return the
  6299. // correct value when it hasn't been explicitly set
  6300. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6301. // Use proper attribute retrieval(#12072)
  6302. var tabindex = jQuery.find.attr( elem, "tabindex" );
  6303. if ( tabindex ) {
  6304. return parseInt( tabindex, 10 );
  6305. }
  6306. if (
  6307. rfocusable.test( elem.nodeName ) ||
  6308. rclickable.test( elem.nodeName ) &&
  6309. elem.href
  6310. ) {
  6311. return 0;
  6312. }
  6313. return -1;
  6314. }
  6315. }
  6316. },
  6317. propFix: {
  6318. "for": "htmlFor",
  6319. "class": "className"
  6320. }
  6321. } );
  6322. // Support: IE <=11 only
  6323. // Accessing the selectedIndex property
  6324. // forces the browser to respect setting selected
  6325. // on the option
  6326. // The getter ensures a default option is selected
  6327. // when in an optgroup
  6328. // eslint rule "no-unused-expressions" is disabled for this code
  6329. // since it considers such accessions noop
  6330. if ( !support.optSelected ) {
  6331. jQuery.propHooks.selected = {
  6332. get: function( elem ) {
  6333. /* eslint no-unused-expressions: "off" */
  6334. var parent = elem.parentNode;
  6335. if ( parent && parent.parentNode ) {
  6336. parent.parentNode.selectedIndex;
  6337. }
  6338. return null;
  6339. },
  6340. set: function( elem ) {
  6341. /* eslint no-unused-expressions: "off" */
  6342. var parent = elem.parentNode;
  6343. if ( parent ) {
  6344. parent.selectedIndex;
  6345. if ( parent.parentNode ) {
  6346. parent.parentNode.selectedIndex;
  6347. }
  6348. }
  6349. }
  6350. };
  6351. }
  6352. jQuery.each( [
  6353. "tabIndex",
  6354. "readOnly",
  6355. "maxLength",
  6356. "cellSpacing",
  6357. "cellPadding",
  6358. "rowSpan",
  6359. "colSpan",
  6360. "useMap",
  6361. "frameBorder",
  6362. "contentEditable"
  6363. ], function() {
  6364. jQuery.propFix[ this.toLowerCase() ] = this;
  6365. } );
  6366. // Strip and collapse whitespace according to HTML spec
  6367. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  6368. function stripAndCollapse( value ) {
  6369. var tokens = value.match( rnothtmlwhite ) || [];
  6370. return tokens.join( " " );
  6371. }
  6372. function getClass( elem ) {
  6373. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6374. }
  6375. function classesToArray( value ) {
  6376. if ( Array.isArray( value ) ) {
  6377. return value;
  6378. }
  6379. if ( typeof value === "string" ) {
  6380. return value.match( rnothtmlwhite ) || [];
  6381. }
  6382. return [];
  6383. }
  6384. jQuery.fn.extend( {
  6385. addClass: function( value ) {
  6386. var classes, elem, cur, curValue, clazz, j, finalValue,
  6387. i = 0;
  6388. if ( isFunction( value ) ) {
  6389. return this.each( function( j ) {
  6390. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  6391. } );
  6392. }
  6393. classes = classesToArray( value );
  6394. if ( classes.length ) {
  6395. while ( ( elem = this[ i++ ] ) ) {
  6396. curValue = getClass( elem );
  6397. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6398. if ( cur ) {
  6399. j = 0;
  6400. while ( ( clazz = classes[ j++ ] ) ) {
  6401. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6402. cur += clazz + " ";
  6403. }
  6404. }
  6405. // Only assign if different to avoid unneeded rendering.
  6406. finalValue = stripAndCollapse( cur );
  6407. if ( curValue !== finalValue ) {
  6408. elem.setAttribute( "class", finalValue );
  6409. }
  6410. }
  6411. }
  6412. }
  6413. return this;
  6414. },
  6415. removeClass: function( value ) {
  6416. var classes, elem, cur, curValue, clazz, j, finalValue,
  6417. i = 0;
  6418. if ( isFunction( value ) ) {
  6419. return this.each( function( j ) {
  6420. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  6421. } );
  6422. }
  6423. if ( !arguments.length ) {
  6424. return this.attr( "class", "" );
  6425. }
  6426. classes = classesToArray( value );
  6427. if ( classes.length ) {
  6428. while ( ( elem = this[ i++ ] ) ) {
  6429. curValue = getClass( elem );
  6430. // This expression is here for better compressibility (see addClass)
  6431. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6432. if ( cur ) {
  6433. j = 0;
  6434. while ( ( clazz = classes[ j++ ] ) ) {
  6435. // Remove *all* instances
  6436. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  6437. cur = cur.replace( " " + clazz + " ", " " );
  6438. }
  6439. }
  6440. // Only assign if different to avoid unneeded rendering.
  6441. finalValue = stripAndCollapse( cur );
  6442. if ( curValue !== finalValue ) {
  6443. elem.setAttribute( "class", finalValue );
  6444. }
  6445. }
  6446. }
  6447. }
  6448. return this;
  6449. },
  6450. toggleClass: function( value, stateVal ) {
  6451. var type = typeof value,
  6452. isValidValue = type === "string" || Array.isArray( value );
  6453. if ( typeof stateVal === "boolean" && isValidValue ) {
  6454. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6455. }
  6456. if ( isFunction( value ) ) {
  6457. return this.each( function( i ) {
  6458. jQuery( this ).toggleClass(
  6459. value.call( this, i, getClass( this ), stateVal ),
  6460. stateVal
  6461. );
  6462. } );
  6463. }
  6464. return this.each( function() {
  6465. var className, i, self, classNames;
  6466. if ( isValidValue ) {
  6467. // Toggle individual class names
  6468. i = 0;
  6469. self = jQuery( this );
  6470. classNames = classesToArray( value );
  6471. while ( ( className = classNames[ i++ ] ) ) {
  6472. // Check each className given, space separated list
  6473. if ( self.hasClass( className ) ) {
  6474. self.removeClass( className );
  6475. } else {
  6476. self.addClass( className );
  6477. }
  6478. }
  6479. // Toggle whole class name
  6480. } else if ( value === undefined || type === "boolean" ) {
  6481. className = getClass( this );
  6482. if ( className ) {
  6483. // Store className if set
  6484. dataPriv.set( this, "__className__", className );
  6485. }
  6486. // If the element has a class name or if we're passed `false`,
  6487. // then remove the whole classname (if there was one, the above saved it).
  6488. // Otherwise bring back whatever was previously saved (if anything),
  6489. // falling back to the empty string if nothing was stored.
  6490. if ( this.setAttribute ) {
  6491. this.setAttribute( "class",
  6492. className || value === false ?
  6493. "" :
  6494. dataPriv.get( this, "__className__" ) || ""
  6495. );
  6496. }
  6497. }
  6498. } );
  6499. },
  6500. hasClass: function( selector ) {
  6501. var className, elem,
  6502. i = 0;
  6503. className = " " + selector + " ";
  6504. while ( ( elem = this[ i++ ] ) ) {
  6505. if ( elem.nodeType === 1 &&
  6506. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  6507. return true;
  6508. }
  6509. }
  6510. return false;
  6511. }
  6512. } );
  6513. var rreturn = /\r/g;
  6514. jQuery.fn.extend( {
  6515. val: function( value ) {
  6516. var hooks, ret, valueIsFunction,
  6517. elem = this[ 0 ];
  6518. if ( !arguments.length ) {
  6519. if ( elem ) {
  6520. hooks = jQuery.valHooks[ elem.type ] ||
  6521. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6522. if ( hooks &&
  6523. "get" in hooks &&
  6524. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6525. ) {
  6526. return ret;
  6527. }
  6528. ret = elem.value;
  6529. // Handle most common string cases
  6530. if ( typeof ret === "string" ) {
  6531. return ret.replace( rreturn, "" );
  6532. }
  6533. // Handle cases where value is null/undef or number
  6534. return ret == null ? "" : ret;
  6535. }
  6536. return;
  6537. }
  6538. valueIsFunction = isFunction( value );
  6539. return this.each( function( i ) {
  6540. var val;
  6541. if ( this.nodeType !== 1 ) {
  6542. return;
  6543. }
  6544. if ( valueIsFunction ) {
  6545. val = value.call( this, i, jQuery( this ).val() );
  6546. } else {
  6547. val = value;
  6548. }
  6549. // Treat null/undefined as ""; convert numbers to string
  6550. if ( val == null ) {
  6551. val = "";
  6552. } else if ( typeof val === "number" ) {
  6553. val += "";
  6554. } else if ( Array.isArray( val ) ) {
  6555. val = jQuery.map( val, function( value ) {
  6556. return value == null ? "" : value + "";
  6557. } );
  6558. }
  6559. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6560. // If set returns undefined, fall back to normal setting
  6561. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6562. this.value = val;
  6563. }
  6564. } );
  6565. }
  6566. } );
  6567. jQuery.extend( {
  6568. valHooks: {
  6569. option: {
  6570. get: function( elem ) {
  6571. var val = jQuery.find.attr( elem, "value" );
  6572. return val != null ?
  6573. val :
  6574. // Support: IE <=10 - 11 only
  6575. // option.text throws exceptions (#14686, #14858)
  6576. // Strip and collapse whitespace
  6577. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6578. stripAndCollapse( jQuery.text( elem ) );
  6579. }
  6580. },
  6581. select: {
  6582. get: function( elem ) {
  6583. var value, option, i,
  6584. options = elem.options,
  6585. index = elem.selectedIndex,
  6586. one = elem.type === "select-one",
  6587. values = one ? null : [],
  6588. max = one ? index + 1 : options.length;
  6589. if ( index < 0 ) {
  6590. i = max;
  6591. } else {
  6592. i = one ? index : 0;
  6593. }
  6594. // Loop through all the selected options
  6595. for ( ; i < max; i++ ) {
  6596. option = options[ i ];
  6597. // Support: IE <=9 only
  6598. // IE8-9 doesn't update selected after form reset (#2551)
  6599. if ( ( option.selected || i === index ) &&
  6600. // Don't return options that are disabled or in a disabled optgroup
  6601. !option.disabled &&
  6602. ( !option.parentNode.disabled ||
  6603. !nodeName( option.parentNode, "optgroup" ) ) ) {
  6604. // Get the specific value for the option
  6605. value = jQuery( option ).val();
  6606. // We don't need an array for one selects
  6607. if ( one ) {
  6608. return value;
  6609. }
  6610. // Multi-Selects return an array
  6611. values.push( value );
  6612. }
  6613. }
  6614. return values;
  6615. },
  6616. set: function( elem, value ) {
  6617. var optionSet, option,
  6618. options = elem.options,
  6619. values = jQuery.makeArray( value ),
  6620. i = options.length;
  6621. while ( i-- ) {
  6622. option = options[ i ];
  6623. /* eslint-disable no-cond-assign */
  6624. if ( option.selected =
  6625. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  6626. ) {
  6627. optionSet = true;
  6628. }
  6629. /* eslint-enable no-cond-assign */
  6630. }
  6631. // Force browsers to behave consistently when non-matching value is set
  6632. if ( !optionSet ) {
  6633. elem.selectedIndex = -1;
  6634. }
  6635. return values;
  6636. }
  6637. }
  6638. }
  6639. } );
  6640. // Radios and checkboxes getter/setter
  6641. jQuery.each( [ "radio", "checkbox" ], function() {
  6642. jQuery.valHooks[ this ] = {
  6643. set: function( elem, value ) {
  6644. if ( Array.isArray( value ) ) {
  6645. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6646. }
  6647. }
  6648. };
  6649. if ( !support.checkOn ) {
  6650. jQuery.valHooks[ this ].get = function( elem ) {
  6651. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6652. };
  6653. }
  6654. } );
  6655. // Return jQuery for attributes-only inclusion
  6656. support.focusin = "onfocusin" in window;
  6657. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  6658. stopPropagationCallback = function( e ) {
  6659. e.stopPropagation();
  6660. };
  6661. jQuery.extend( jQuery.event, {
  6662. trigger: function( event, data, elem, onlyHandlers ) {
  6663. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  6664. eventPath = [ elem || document ],
  6665. type = hasOwn.call( event, "type" ) ? event.type : event,
  6666. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6667. cur = lastElement = tmp = elem = elem || document;
  6668. // Don't do events on text and comment nodes
  6669. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6670. return;
  6671. }
  6672. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6673. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6674. return;
  6675. }
  6676. if ( type.indexOf( "." ) > -1 ) {
  6677. // Namespaced trigger; create a regexp to match event type in handle()
  6678. namespaces = type.split( "." );
  6679. type = namespaces.shift();
  6680. namespaces.sort();
  6681. }
  6682. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6683. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6684. event = event[ jQuery.expando ] ?
  6685. event :
  6686. new jQuery.Event( type, typeof event === "object" && event );
  6687. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6688. event.isTrigger = onlyHandlers ? 2 : 3;
  6689. event.namespace = namespaces.join( "." );
  6690. event.rnamespace = event.namespace ?
  6691. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6692. null;
  6693. // Clean up the event in case it is being reused
  6694. event.result = undefined;
  6695. if ( !event.target ) {
  6696. event.target = elem;
  6697. }
  6698. // Clone any incoming data and prepend the event, creating the handler arg list
  6699. data = data == null ?
  6700. [ event ] :
  6701. jQuery.makeArray( data, [ event ] );
  6702. // Allow special events to draw outside the lines
  6703. special = jQuery.event.special[ type ] || {};
  6704. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6705. return;
  6706. }
  6707. // Determine event propagation path in advance, per W3C events spec (#9951)
  6708. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6709. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  6710. bubbleType = special.delegateType || type;
  6711. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6712. cur = cur.parentNode;
  6713. }
  6714. for ( ; cur; cur = cur.parentNode ) {
  6715. eventPath.push( cur );
  6716. tmp = cur;
  6717. }
  6718. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6719. if ( tmp === ( elem.ownerDocument || document ) ) {
  6720. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6721. }
  6722. }
  6723. // Fire handlers on the event path
  6724. i = 0;
  6725. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6726. lastElement = cur;
  6727. event.type = i > 1 ?
  6728. bubbleType :
  6729. special.bindType || type;
  6730. // jQuery handler
  6731. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  6732. dataPriv.get( cur, "handle" );
  6733. if ( handle ) {
  6734. handle.apply( cur, data );
  6735. }
  6736. // Native handler
  6737. handle = ontype && cur[ ontype ];
  6738. if ( handle && handle.apply && acceptData( cur ) ) {
  6739. event.result = handle.apply( cur, data );
  6740. if ( event.result === false ) {
  6741. event.preventDefault();
  6742. }
  6743. }
  6744. }
  6745. event.type = type;
  6746. // If nobody prevented the default action, do it now
  6747. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6748. if ( ( !special._default ||
  6749. special._default.apply( eventPath.pop(), data ) === false ) &&
  6750. acceptData( elem ) ) {
  6751. // Call a native DOM method on the target with the same name as the event.
  6752. // Don't do default actions on window, that's where global variables be (#6170)
  6753. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  6754. // Don't re-trigger an onFOO event when we call its FOO() method
  6755. tmp = elem[ ontype ];
  6756. if ( tmp ) {
  6757. elem[ ontype ] = null;
  6758. }
  6759. // Prevent re-triggering of the same event, since we already bubbled it above
  6760. jQuery.event.triggered = type;
  6761. if ( event.isPropagationStopped() ) {
  6762. lastElement.addEventListener( type, stopPropagationCallback );
  6763. }
  6764. elem[ type ]();
  6765. if ( event.isPropagationStopped() ) {
  6766. lastElement.removeEventListener( type, stopPropagationCallback );
  6767. }
  6768. jQuery.event.triggered = undefined;
  6769. if ( tmp ) {
  6770. elem[ ontype ] = tmp;
  6771. }
  6772. }
  6773. }
  6774. }
  6775. return event.result;
  6776. },
  6777. // Piggyback on a donor event to simulate a different one
  6778. // Used only for `focus(in | out)` events
  6779. simulate: function( type, elem, event ) {
  6780. var e = jQuery.extend(
  6781. new jQuery.Event(),
  6782. event,
  6783. {
  6784. type: type,
  6785. isSimulated: true
  6786. }
  6787. );
  6788. jQuery.event.trigger( e, null, elem );
  6789. }
  6790. } );
  6791. jQuery.fn.extend( {
  6792. trigger: function( type, data ) {
  6793. return this.each( function() {
  6794. jQuery.event.trigger( type, data, this );
  6795. } );
  6796. },
  6797. triggerHandler: function( type, data ) {
  6798. var elem = this[ 0 ];
  6799. if ( elem ) {
  6800. return jQuery.event.trigger( type, data, elem, true );
  6801. }
  6802. }
  6803. } );
  6804. // Support: Firefox <=44
  6805. // Firefox doesn't have focus(in | out) events
  6806. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6807. //
  6808. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6809. // focus(in | out) events fire after focus & blur events,
  6810. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6811. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6812. if ( !support.focusin ) {
  6813. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6814. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6815. var handler = function( event ) {
  6816. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6817. };
  6818. jQuery.event.special[ fix ] = {
  6819. setup: function() {
  6820. var doc = this.ownerDocument || this,
  6821. attaches = dataPriv.access( doc, fix );
  6822. if ( !attaches ) {
  6823. doc.addEventListener( orig, handler, true );
  6824. }
  6825. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6826. },
  6827. teardown: function() {
  6828. var doc = this.ownerDocument || this,
  6829. attaches = dataPriv.access( doc, fix ) - 1;
  6830. if ( !attaches ) {
  6831. doc.removeEventListener( orig, handler, true );
  6832. dataPriv.remove( doc, fix );
  6833. } else {
  6834. dataPriv.access( doc, fix, attaches );
  6835. }
  6836. }
  6837. };
  6838. } );
  6839. }
  6840. var location = window.location;
  6841. var nonce = Date.now();
  6842. var rquery = ( /\?/ );
  6843. // Cross-browser xml parsing
  6844. jQuery.parseXML = function( data ) {
  6845. var xml;
  6846. if ( !data || typeof data !== "string" ) {
  6847. return null;
  6848. }
  6849. // Support: IE 9 - 11 only
  6850. // IE throws on parseFromString with invalid input.
  6851. try {
  6852. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  6853. } catch ( e ) {
  6854. xml = undefined;
  6855. }
  6856. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6857. jQuery.error( "Invalid XML: " + data );
  6858. }
  6859. return xml;
  6860. };
  6861. var
  6862. rbracket = /\[\]$/,
  6863. rCRLF = /\r?\n/g,
  6864. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6865. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6866. function buildParams( prefix, obj, traditional, add ) {
  6867. var name;
  6868. if ( Array.isArray( obj ) ) {
  6869. // Serialize array item.
  6870. jQuery.each( obj, function( i, v ) {
  6871. if ( traditional || rbracket.test( prefix ) ) {
  6872. // Treat each array item as a scalar.
  6873. add( prefix, v );
  6874. } else {
  6875. // Item is non-scalar (array or object), encode its numeric index.
  6876. buildParams(
  6877. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6878. v,
  6879. traditional,
  6880. add
  6881. );
  6882. }
  6883. } );
  6884. } else if ( !traditional && toType( obj ) === "object" ) {
  6885. // Serialize object item.
  6886. for ( name in obj ) {
  6887. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6888. }
  6889. } else {
  6890. // Serialize scalar item.
  6891. add( prefix, obj );
  6892. }
  6893. }
  6894. // Serialize an array of form elements or a set of
  6895. // key/values into a query string
  6896. jQuery.param = function( a, traditional ) {
  6897. var prefix,
  6898. s = [],
  6899. add = function( key, valueOrFunction ) {
  6900. // If value is a function, invoke it and use its return value
  6901. var value = isFunction( valueOrFunction ) ?
  6902. valueOrFunction() :
  6903. valueOrFunction;
  6904. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6905. encodeURIComponent( value == null ? "" : value );
  6906. };
  6907. // If an array was passed in, assume that it is an array of form elements.
  6908. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6909. // Serialize the form elements
  6910. jQuery.each( a, function() {
  6911. add( this.name, this.value );
  6912. } );
  6913. } else {
  6914. // If traditional, encode the "old" way (the way 1.3.2 or older
  6915. // did it), otherwise encode params recursively.
  6916. for ( prefix in a ) {
  6917. buildParams( prefix, a[ prefix ], traditional, add );
  6918. }
  6919. }
  6920. // Return the resulting serialization
  6921. return s.join( "&" );
  6922. };
  6923. jQuery.fn.extend( {
  6924. serialize: function() {
  6925. return jQuery.param( this.serializeArray() );
  6926. },
  6927. serializeArray: function() {
  6928. return this.map( function() {
  6929. // Can add propHook for "elements" to filter or add form elements
  6930. var elements = jQuery.prop( this, "elements" );
  6931. return elements ? jQuery.makeArray( elements ) : this;
  6932. } )
  6933. .filter( function() {
  6934. var type = this.type;
  6935. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6936. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6937. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6938. ( this.checked || !rcheckableType.test( type ) );
  6939. } )
  6940. .map( function( i, elem ) {
  6941. var val = jQuery( this ).val();
  6942. if ( val == null ) {
  6943. return null;
  6944. }
  6945. if ( Array.isArray( val ) ) {
  6946. return jQuery.map( val, function( val ) {
  6947. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6948. } );
  6949. }
  6950. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6951. } ).get();
  6952. }
  6953. } );
  6954. var
  6955. r20 = /%20/g,
  6956. rhash = /#.*$/,
  6957. rantiCache = /([?&])_=[^&]*/,
  6958. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6959. // #7653, #8125, #8152: local protocol detection
  6960. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6961. rnoContent = /^(?:GET|HEAD)$/,
  6962. rprotocol = /^\/\//,
  6963. /* Prefilters
  6964. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6965. * 2) These are called:
  6966. * - BEFORE asking for a transport
  6967. * - AFTER param serialization (s.data is a string if s.processData is true)
  6968. * 3) key is the dataType
  6969. * 4) the catchall symbol "*" can be used
  6970. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6971. */
  6972. prefilters = {},
  6973. /* Transports bindings
  6974. * 1) key is the dataType
  6975. * 2) the catchall symbol "*" can be used
  6976. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6977. */
  6978. transports = {},
  6979. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6980. allTypes = "*/".concat( "*" ),
  6981. // Anchor tag for parsing the document origin
  6982. originAnchor = document.createElement( "a" );
  6983. originAnchor.href = location.href;
  6984. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6985. function addToPrefiltersOrTransports( structure ) {
  6986. // dataTypeExpression is optional and defaults to "*"
  6987. return function( dataTypeExpression, func ) {
  6988. if ( typeof dataTypeExpression !== "string" ) {
  6989. func = dataTypeExpression;
  6990. dataTypeExpression = "*";
  6991. }
  6992. var dataType,
  6993. i = 0,
  6994. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  6995. if ( isFunction( func ) ) {
  6996. // For each dataType in the dataTypeExpression
  6997. while ( ( dataType = dataTypes[ i++ ] ) ) {
  6998. // Prepend if requested
  6999. if ( dataType[ 0 ] === "+" ) {
  7000. dataType = dataType.slice( 1 ) || "*";
  7001. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7002. // Otherwise append
  7003. } else {
  7004. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7005. }
  7006. }
  7007. }
  7008. };
  7009. }
  7010. // Base inspection function for prefilters and transports
  7011. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7012. var inspected = {},
  7013. seekingTransport = ( structure === transports );
  7014. function inspect( dataType ) {
  7015. var selected;
  7016. inspected[ dataType ] = true;
  7017. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7018. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7019. if ( typeof dataTypeOrTransport === "string" &&
  7020. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7021. options.dataTypes.unshift( dataTypeOrTransport );
  7022. inspect( dataTypeOrTransport );
  7023. return false;
  7024. } else if ( seekingTransport ) {
  7025. return !( selected = dataTypeOrTransport );
  7026. }
  7027. } );
  7028. return selected;
  7029. }
  7030. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7031. }
  7032. // A special extend for ajax options
  7033. // that takes "flat" options (not to be deep extended)
  7034. // Fixes #9887
  7035. function ajaxExtend( target, src ) {
  7036. var key, deep,
  7037. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7038. for ( key in src ) {
  7039. if ( src[ key ] !== undefined ) {
  7040. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7041. }
  7042. }
  7043. if ( deep ) {
  7044. jQuery.extend( true, target, deep );
  7045. }
  7046. return target;
  7047. }
  7048. /* Handles responses to an ajax request:
  7049. * - finds the right dataType (mediates between content-type and expected dataType)
  7050. * - returns the corresponding response
  7051. */
  7052. function ajaxHandleResponses( s, jqXHR, responses ) {
  7053. var ct, type, finalDataType, firstDataType,
  7054. contents = s.contents,
  7055. dataTypes = s.dataTypes;
  7056. // Remove auto dataType and get content-type in the process
  7057. while ( dataTypes[ 0 ] === "*" ) {
  7058. dataTypes.shift();
  7059. if ( ct === undefined ) {
  7060. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7061. }
  7062. }
  7063. // Check if we're dealing with a known content-type
  7064. if ( ct ) {
  7065. for ( type in contents ) {
  7066. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7067. dataTypes.unshift( type );
  7068. break;
  7069. }
  7070. }
  7071. }
  7072. // Check to see if we have a response for the expected dataType
  7073. if ( dataTypes[ 0 ] in responses ) {
  7074. finalDataType = dataTypes[ 0 ];
  7075. } else {
  7076. // Try convertible dataTypes
  7077. for ( type in responses ) {
  7078. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7079. finalDataType = type;
  7080. break;
  7081. }
  7082. if ( !firstDataType ) {
  7083. firstDataType = type;
  7084. }
  7085. }
  7086. // Or just use first one
  7087. finalDataType = finalDataType || firstDataType;
  7088. }
  7089. // If we found a dataType
  7090. // We add the dataType to the list if needed
  7091. // and return the corresponding response
  7092. if ( finalDataType ) {
  7093. if ( finalDataType !== dataTypes[ 0 ] ) {
  7094. dataTypes.unshift( finalDataType );
  7095. }
  7096. return responses[ finalDataType ];
  7097. }
  7098. }
  7099. /* Chain conversions given the request and the original response
  7100. * Also sets the responseXXX fields on the jqXHR instance
  7101. */
  7102. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7103. var conv2, current, conv, tmp, prev,
  7104. converters = {},
  7105. // Work with a copy of dataTypes in case we need to modify it for conversion
  7106. dataTypes = s.dataTypes.slice();
  7107. // Create converters map with lowercased keys
  7108. if ( dataTypes[ 1 ] ) {
  7109. for ( conv in s.converters ) {
  7110. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7111. }
  7112. }
  7113. current = dataTypes.shift();
  7114. // Convert to each sequential dataType
  7115. while ( current ) {
  7116. if ( s.responseFields[ current ] ) {
  7117. jqXHR[ s.responseFields[ current ] ] = response;
  7118. }
  7119. // Apply the dataFilter if provided
  7120. if ( !prev && isSuccess && s.dataFilter ) {
  7121. response = s.dataFilter( response, s.dataType );
  7122. }
  7123. prev = current;
  7124. current = dataTypes.shift();
  7125. if ( current ) {
  7126. // There's only work to do if current dataType is non-auto
  7127. if ( current === "*" ) {
  7128. current = prev;
  7129. // Convert response if prev dataType is non-auto and differs from current
  7130. } else if ( prev !== "*" && prev !== current ) {
  7131. // Seek a direct converter
  7132. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7133. // If none found, seek a pair
  7134. if ( !conv ) {
  7135. for ( conv2 in converters ) {
  7136. // If conv2 outputs current
  7137. tmp = conv2.split( " " );
  7138. if ( tmp[ 1 ] === current ) {
  7139. // If prev can be converted to accepted input
  7140. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7141. converters[ "* " + tmp[ 0 ] ];
  7142. if ( conv ) {
  7143. // Condense equivalence converters
  7144. if ( conv === true ) {
  7145. conv = converters[ conv2 ];
  7146. // Otherwise, insert the intermediate dataType
  7147. } else if ( converters[ conv2 ] !== true ) {
  7148. current = tmp[ 0 ];
  7149. dataTypes.unshift( tmp[ 1 ] );
  7150. }
  7151. break;
  7152. }
  7153. }
  7154. }
  7155. }
  7156. // Apply converter (if not an equivalence)
  7157. if ( conv !== true ) {
  7158. // Unless errors are allowed to bubble, catch and return them
  7159. if ( conv && s.throws ) {
  7160. response = conv( response );
  7161. } else {
  7162. try {
  7163. response = conv( response );
  7164. } catch ( e ) {
  7165. return {
  7166. state: "parsererror",
  7167. error: conv ? e : "No conversion from " + prev + " to " + current
  7168. };
  7169. }
  7170. }
  7171. }
  7172. }
  7173. }
  7174. }
  7175. return { state: "success", data: response };
  7176. }
  7177. jQuery.extend( {
  7178. // Counter for holding the number of active queries
  7179. active: 0,
  7180. // Last-Modified header cache for next request
  7181. lastModified: {},
  7182. etag: {},
  7183. ajaxSettings: {
  7184. url: location.href,
  7185. type: "GET",
  7186. isLocal: rlocalProtocol.test( location.protocol ),
  7187. global: true,
  7188. processData: true,
  7189. async: true,
  7190. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7191. /*
  7192. timeout: 0,
  7193. data: null,
  7194. dataType: null,
  7195. username: null,
  7196. password: null,
  7197. cache: null,
  7198. throws: false,
  7199. traditional: false,
  7200. headers: {},
  7201. */
  7202. accepts: {
  7203. "*": allTypes,
  7204. text: "text/plain",
  7205. html: "text/html",
  7206. xml: "application/xml, text/xml",
  7207. json: "application/json, text/javascript"
  7208. },
  7209. contents: {
  7210. xml: /\bxml\b/,
  7211. html: /\bhtml/,
  7212. json: /\bjson\b/
  7213. },
  7214. responseFields: {
  7215. xml: "responseXML",
  7216. text: "responseText",
  7217. json: "responseJSON"
  7218. },
  7219. // Data converters
  7220. // Keys separate source (or catchall "*") and destination types with a single space
  7221. converters: {
  7222. // Convert anything to text
  7223. "* text": String,
  7224. // Text to html (true = no transformation)
  7225. "text html": true,
  7226. // Evaluate text as a json expression
  7227. "text json": JSON.parse,
  7228. // Parse text as xml
  7229. "text xml": jQuery.parseXML
  7230. },
  7231. // For options that shouldn't be deep extended:
  7232. // you can add your own custom options here if
  7233. // and when you create one that shouldn't be
  7234. // deep extended (see ajaxExtend)
  7235. flatOptions: {
  7236. url: true,
  7237. context: true
  7238. }
  7239. },
  7240. // Creates a full fledged settings object into target
  7241. // with both ajaxSettings and settings fields.
  7242. // If target is omitted, writes into ajaxSettings.
  7243. ajaxSetup: function( target, settings ) {
  7244. return settings ?
  7245. // Building a settings object
  7246. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7247. // Extending ajaxSettings
  7248. ajaxExtend( jQuery.ajaxSettings, target );
  7249. },
  7250. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7251. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7252. // Main method
  7253. ajax: function( url, options ) {
  7254. // If url is an object, simulate pre-1.5 signature
  7255. if ( typeof url === "object" ) {
  7256. options = url;
  7257. url = undefined;
  7258. }
  7259. // Force options to be an object
  7260. options = options || {};
  7261. var transport,
  7262. // URL without anti-cache param
  7263. cacheURL,
  7264. // Response headers
  7265. responseHeadersString,
  7266. responseHeaders,
  7267. // timeout handle
  7268. timeoutTimer,
  7269. // Url cleanup var
  7270. urlAnchor,
  7271. // Request state (becomes false upon send and true upon completion)
  7272. completed,
  7273. // To know if global events are to be dispatched
  7274. fireGlobals,
  7275. // Loop variable
  7276. i,
  7277. // uncached part of the url
  7278. uncached,
  7279. // Create the final options object
  7280. s = jQuery.ajaxSetup( {}, options ),
  7281. // Callbacks context
  7282. callbackContext = s.context || s,
  7283. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7284. globalEventContext = s.context &&
  7285. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7286. jQuery( callbackContext ) :
  7287. jQuery.event,
  7288. // Deferreds
  7289. deferred = jQuery.Deferred(),
  7290. completeDeferred = jQuery.Callbacks( "once memory" ),
  7291. // Status-dependent callbacks
  7292. statusCode = s.statusCode || {},
  7293. // Headers (they are sent all at once)
  7294. requestHeaders = {},
  7295. requestHeadersNames = {},
  7296. // Default abort message
  7297. strAbort = "canceled",
  7298. // Fake xhr
  7299. jqXHR = {
  7300. readyState: 0,
  7301. // Builds headers hashtable if needed
  7302. getResponseHeader: function( key ) {
  7303. var match;
  7304. if ( completed ) {
  7305. if ( !responseHeaders ) {
  7306. responseHeaders = {};
  7307. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7308. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7309. }
  7310. }
  7311. match = responseHeaders[ key.toLowerCase() ];
  7312. }
  7313. return match == null ? null : match;
  7314. },
  7315. // Raw string
  7316. getAllResponseHeaders: function() {
  7317. return completed ? responseHeadersString : null;
  7318. },
  7319. // Caches the header
  7320. setRequestHeader: function( name, value ) {
  7321. if ( completed == null ) {
  7322. name = requestHeadersNames[ name.toLowerCase() ] =
  7323. requestHeadersNames[ name.toLowerCase() ] || name;
  7324. requestHeaders[ name ] = value;
  7325. }
  7326. return this;
  7327. },
  7328. // Overrides response content-type header
  7329. overrideMimeType: function( type ) {
  7330. if ( completed == null ) {
  7331. s.mimeType = type;
  7332. }
  7333. return this;
  7334. },
  7335. // Status-dependent callbacks
  7336. statusCode: function( map ) {
  7337. var code;
  7338. if ( map ) {
  7339. if ( completed ) {
  7340. // Execute the appropriate callbacks
  7341. jqXHR.always( map[ jqXHR.status ] );
  7342. } else {
  7343. // Lazy-add the new callbacks in a way that preserves old ones
  7344. for ( code in map ) {
  7345. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7346. }
  7347. }
  7348. }
  7349. return this;
  7350. },
  7351. // Cancel the request
  7352. abort: function( statusText ) {
  7353. var finalText = statusText || strAbort;
  7354. if ( transport ) {
  7355. transport.abort( finalText );
  7356. }
  7357. done( 0, finalText );
  7358. return this;
  7359. }
  7360. };
  7361. // Attach deferreds
  7362. deferred.promise( jqXHR );
  7363. // Add protocol if not provided (prefilters might expect it)
  7364. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7365. // We also use the url parameter if available
  7366. s.url = ( ( url || s.url || location.href ) + "" )
  7367. .replace( rprotocol, location.protocol + "//" );
  7368. // Alias method option to type as per ticket #12004
  7369. s.type = options.method || options.type || s.method || s.type;
  7370. // Extract dataTypes list
  7371. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  7372. // A cross-domain request is in order when the origin doesn't match the current origin.
  7373. if ( s.crossDomain == null ) {
  7374. urlAnchor = document.createElement( "a" );
  7375. // Support: IE <=8 - 11, Edge 12 - 15
  7376. // IE throws exception on accessing the href property if url is malformed,
  7377. // e.g. http://example.com:80x/
  7378. try {
  7379. urlAnchor.href = s.url;
  7380. // Support: IE <=8 - 11 only
  7381. // Anchor's host property isn't correctly set when s.url is relative
  7382. urlAnchor.href = urlAnchor.href;
  7383. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  7384. urlAnchor.protocol + "//" + urlAnchor.host;
  7385. } catch ( e ) {
  7386. // If there is an error parsing the URL, assume it is crossDomain,
  7387. // it can be rejected by the transport if it is invalid
  7388. s.crossDomain = true;
  7389. }
  7390. }
  7391. // Convert data if not already a string
  7392. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7393. s.data = jQuery.param( s.data, s.traditional );
  7394. }
  7395. // Apply prefilters
  7396. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7397. // If request was aborted inside a prefilter, stop there
  7398. if ( completed ) {
  7399. return jqXHR;
  7400. }
  7401. // We can fire global events as of now if asked to
  7402. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7403. fireGlobals = jQuery.event && s.global;
  7404. // Watch for a new set of requests
  7405. if ( fireGlobals && jQuery.active++ === 0 ) {
  7406. jQuery.event.trigger( "ajaxStart" );
  7407. }
  7408. // Uppercase the type
  7409. s.type = s.type.toUpperCase();
  7410. // Determine if request has content
  7411. s.hasContent = !rnoContent.test( s.type );
  7412. // Save the URL in case we're toying with the If-Modified-Since
  7413. // and/or If-None-Match header later on
  7414. // Remove hash to simplify url manipulation
  7415. cacheURL = s.url.replace( rhash, "" );
  7416. // More options handling for requests with no content
  7417. if ( !s.hasContent ) {
  7418. // Remember the hash so we can put it back
  7419. uncached = s.url.slice( cacheURL.length );
  7420. // If data is available and should be processed, append data to url
  7421. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  7422. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  7423. // #9682: remove data so that it's not used in an eventual retry
  7424. delete s.data;
  7425. }
  7426. // Add or update anti-cache param if needed
  7427. if ( s.cache === false ) {
  7428. cacheURL = cacheURL.replace( rantiCache, "$1" );
  7429. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  7430. }
  7431. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  7432. s.url = cacheURL + uncached;
  7433. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  7434. } else if ( s.data && s.processData &&
  7435. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  7436. s.data = s.data.replace( r20, "+" );
  7437. }
  7438. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7439. if ( s.ifModified ) {
  7440. if ( jQuery.lastModified[ cacheURL ] ) {
  7441. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7442. }
  7443. if ( jQuery.etag[ cacheURL ] ) {
  7444. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7445. }
  7446. }
  7447. // Set the correct header, if data is being sent
  7448. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7449. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7450. }
  7451. // Set the Accepts header for the server, depending on the dataType
  7452. jqXHR.setRequestHeader(
  7453. "Accept",
  7454. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7455. s.accepts[ s.dataTypes[ 0 ] ] +
  7456. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7457. s.accepts[ "*" ]
  7458. );
  7459. // Check for headers option
  7460. for ( i in s.headers ) {
  7461. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7462. }
  7463. // Allow custom headers/mimetypes and early abort
  7464. if ( s.beforeSend &&
  7465. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  7466. // Abort if not done already and return
  7467. return jqXHR.abort();
  7468. }
  7469. // Aborting is no longer a cancellation
  7470. strAbort = "abort";
  7471. // Install callbacks on deferreds
  7472. completeDeferred.add( s.complete );
  7473. jqXHR.done( s.success );
  7474. jqXHR.fail( s.error );
  7475. // Get transport
  7476. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7477. // If no transport, we auto-abort
  7478. if ( !transport ) {
  7479. done( -1, "No Transport" );
  7480. } else {
  7481. jqXHR.readyState = 1;
  7482. // Send global event
  7483. if ( fireGlobals ) {
  7484. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7485. }
  7486. // If request was aborted inside ajaxSend, stop there
  7487. if ( completed ) {
  7488. return jqXHR;
  7489. }
  7490. // Timeout
  7491. if ( s.async && s.timeout > 0 ) {
  7492. timeoutTimer = window.setTimeout( function() {
  7493. jqXHR.abort( "timeout" );
  7494. }, s.timeout );
  7495. }
  7496. try {
  7497. completed = false;
  7498. transport.send( requestHeaders, done );
  7499. } catch ( e ) {
  7500. // Rethrow post-completion exceptions
  7501. if ( completed ) {
  7502. throw e;
  7503. }
  7504. // Propagate others as results
  7505. done( -1, e );
  7506. }
  7507. }
  7508. // Callback for when everything is done
  7509. function done( status, nativeStatusText, responses, headers ) {
  7510. var isSuccess, success, error, response, modified,
  7511. statusText = nativeStatusText;
  7512. // Ignore repeat invocations
  7513. if ( completed ) {
  7514. return;
  7515. }
  7516. completed = true;
  7517. // Clear timeout if it exists
  7518. if ( timeoutTimer ) {
  7519. window.clearTimeout( timeoutTimer );
  7520. }
  7521. // Dereference transport for early garbage collection
  7522. // (no matter how long the jqXHR object will be used)
  7523. transport = undefined;
  7524. // Cache response headers
  7525. responseHeadersString = headers || "";
  7526. // Set readyState
  7527. jqXHR.readyState = status > 0 ? 4 : 0;
  7528. // Determine if successful
  7529. isSuccess = status >= 200 && status < 300 || status === 304;
  7530. // Get response data
  7531. if ( responses ) {
  7532. response = ajaxHandleResponses( s, jqXHR, responses );
  7533. }
  7534. // Convert no matter what (that way responseXXX fields are always set)
  7535. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7536. // If successful, handle type chaining
  7537. if ( isSuccess ) {
  7538. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7539. if ( s.ifModified ) {
  7540. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7541. if ( modified ) {
  7542. jQuery.lastModified[ cacheURL ] = modified;
  7543. }
  7544. modified = jqXHR.getResponseHeader( "etag" );
  7545. if ( modified ) {
  7546. jQuery.etag[ cacheURL ] = modified;
  7547. }
  7548. }
  7549. // if no content
  7550. if ( status === 204 || s.type === "HEAD" ) {
  7551. statusText = "nocontent";
  7552. // if not modified
  7553. } else if ( status === 304 ) {
  7554. statusText = "notmodified";
  7555. // If we have data, let's convert it
  7556. } else {
  7557. statusText = response.state;
  7558. success = response.data;
  7559. error = response.error;
  7560. isSuccess = !error;
  7561. }
  7562. } else {
  7563. // Extract error from statusText and normalize for non-aborts
  7564. error = statusText;
  7565. if ( status || !statusText ) {
  7566. statusText = "error";
  7567. if ( status < 0 ) {
  7568. status = 0;
  7569. }
  7570. }
  7571. }
  7572. // Set data for the fake xhr object
  7573. jqXHR.status = status;
  7574. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  7575. // Success/Error
  7576. if ( isSuccess ) {
  7577. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  7578. } else {
  7579. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  7580. }
  7581. // Status-dependent callbacks
  7582. jqXHR.statusCode( statusCode );
  7583. statusCode = undefined;
  7584. if ( fireGlobals ) {
  7585. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  7586. [ jqXHR, s, isSuccess ? success : error ] );
  7587. }
  7588. // Complete
  7589. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  7590. if ( fireGlobals ) {
  7591. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  7592. // Handle the global AJAX counter
  7593. if ( !( --jQuery.active ) ) {
  7594. jQuery.event.trigger( "ajaxStop" );
  7595. }
  7596. }
  7597. }
  7598. return jqXHR;
  7599. },
  7600. getJSON: function( url, data, callback ) {
  7601. return jQuery.get( url, data, callback, "json" );
  7602. },
  7603. getScript: function( url, callback ) {
  7604. return jQuery.get( url, undefined, callback, "script" );
  7605. }
  7606. } );
  7607. jQuery.each( [ "get", "post" ], function( i, method ) {
  7608. jQuery[ method ] = function( url, data, callback, type ) {
  7609. // Shift arguments if data argument was omitted
  7610. if ( isFunction( data ) ) {
  7611. type = type || callback;
  7612. callback = data;
  7613. data = undefined;
  7614. }
  7615. // The url can be an options object (which then must have .url)
  7616. return jQuery.ajax( jQuery.extend( {
  7617. url: url,
  7618. type: method,
  7619. dataType: type,
  7620. data: data,
  7621. success: callback
  7622. }, jQuery.isPlainObject( url ) && url ) );
  7623. };
  7624. } );
  7625. jQuery._evalUrl = function( url ) {
  7626. return jQuery.ajax( {
  7627. url: url,
  7628. // Make this explicit, since user can override this through ajaxSetup (#11264)
  7629. type: "GET",
  7630. dataType: "script",
  7631. cache: true,
  7632. async: false,
  7633. global: false,
  7634. "throws": true
  7635. } );
  7636. };
  7637. jQuery.fn.extend( {
  7638. wrapAll: function( html ) {
  7639. var wrap;
  7640. if ( this[ 0 ] ) {
  7641. if ( isFunction( html ) ) {
  7642. html = html.call( this[ 0 ] );
  7643. }
  7644. // The elements to wrap the target around
  7645. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  7646. if ( this[ 0 ].parentNode ) {
  7647. wrap.insertBefore( this[ 0 ] );
  7648. }
  7649. wrap.map( function() {
  7650. var elem = this;
  7651. while ( elem.firstElementChild ) {
  7652. elem = elem.firstElementChild;
  7653. }
  7654. return elem;
  7655. } ).append( this );
  7656. }
  7657. return this;
  7658. },
  7659. wrapInner: function( html ) {
  7660. if ( isFunction( html ) ) {
  7661. return this.each( function( i ) {
  7662. jQuery( this ).wrapInner( html.call( this, i ) );
  7663. } );
  7664. }
  7665. return this.each( function() {
  7666. var self = jQuery( this ),
  7667. contents = self.contents();
  7668. if ( contents.length ) {
  7669. contents.wrapAll( html );
  7670. } else {
  7671. self.append( html );
  7672. }
  7673. } );
  7674. },
  7675. wrap: function( html ) {
  7676. var htmlIsFunction = isFunction( html );
  7677. return this.each( function( i ) {
  7678. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  7679. } );
  7680. },
  7681. unwrap: function( selector ) {
  7682. this.parent( selector ).not( "body" ).each( function() {
  7683. jQuery( this ).replaceWith( this.childNodes );
  7684. } );
  7685. return this;
  7686. }
  7687. } );
  7688. jQuery.expr.pseudos.hidden = function( elem ) {
  7689. return !jQuery.expr.pseudos.visible( elem );
  7690. };
  7691. jQuery.expr.pseudos.visible = function( elem ) {
  7692. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  7693. };
  7694. jQuery.ajaxSettings.xhr = function() {
  7695. try {
  7696. return new window.XMLHttpRequest();
  7697. } catch ( e ) {}
  7698. };
  7699. var xhrSuccessStatus = {
  7700. // File protocol always yields status code 0, assume 200
  7701. 0: 200,
  7702. // Support: IE <=9 only
  7703. // #1450: sometimes IE returns 1223 when it should be 204
  7704. 1223: 204
  7705. },
  7706. xhrSupported = jQuery.ajaxSettings.xhr();
  7707. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7708. support.ajax = xhrSupported = !!xhrSupported;
  7709. jQuery.ajaxTransport( function( options ) {
  7710. var callback, errorCallback;
  7711. // Cross domain only allowed if supported through XMLHttpRequest
  7712. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7713. return {
  7714. send: function( headers, complete ) {
  7715. var i,
  7716. xhr = options.xhr();
  7717. xhr.open(
  7718. options.type,
  7719. options.url,
  7720. options.async,
  7721. options.username,
  7722. options.password
  7723. );
  7724. // Apply custom fields if provided
  7725. if ( options.xhrFields ) {
  7726. for ( i in options.xhrFields ) {
  7727. xhr[ i ] = options.xhrFields[ i ];
  7728. }
  7729. }
  7730. // Override mime type if needed
  7731. if ( options.mimeType && xhr.overrideMimeType ) {
  7732. xhr.overrideMimeType( options.mimeType );
  7733. }
  7734. // X-Requested-With header
  7735. // For cross-domain requests, seeing as conditions for a preflight are
  7736. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7737. // (it can always be set on a per-request basis or even using ajaxSetup)
  7738. // For same-domain requests, won't change header if already provided.
  7739. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  7740. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  7741. }
  7742. // Set headers
  7743. for ( i in headers ) {
  7744. xhr.setRequestHeader( i, headers[ i ] );
  7745. }
  7746. // Callback
  7747. callback = function( type ) {
  7748. return function() {
  7749. if ( callback ) {
  7750. callback = errorCallback = xhr.onload =
  7751. xhr.onerror = xhr.onabort = xhr.ontimeout =
  7752. xhr.onreadystatechange = null;
  7753. if ( type === "abort" ) {
  7754. xhr.abort();
  7755. } else if ( type === "error" ) {
  7756. // Support: IE <=9 only
  7757. // On a manual native abort, IE9 throws
  7758. // errors on any property access that is not readyState
  7759. if ( typeof xhr.status !== "number" ) {
  7760. complete( 0, "error" );
  7761. } else {
  7762. complete(
  7763. // File: protocol always yields status 0; see #8605, #14207
  7764. xhr.status,
  7765. xhr.statusText
  7766. );
  7767. }
  7768. } else {
  7769. complete(
  7770. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7771. xhr.statusText,
  7772. // Support: IE <=9 only
  7773. // IE9 has no XHR2 but throws on binary (trac-11426)
  7774. // For XHR2 non-text, let the caller handle it (gh-2498)
  7775. ( xhr.responseType || "text" ) !== "text" ||
  7776. typeof xhr.responseText !== "string" ?
  7777. { binary: xhr.response } :
  7778. { text: xhr.responseText },
  7779. xhr.getAllResponseHeaders()
  7780. );
  7781. }
  7782. }
  7783. };
  7784. };
  7785. // Listen to events
  7786. xhr.onload = callback();
  7787. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  7788. // Support: IE 9 only
  7789. // Use onreadystatechange to replace onabort
  7790. // to handle uncaught aborts
  7791. if ( xhr.onabort !== undefined ) {
  7792. xhr.onabort = errorCallback;
  7793. } else {
  7794. xhr.onreadystatechange = function() {
  7795. // Check readyState before timeout as it changes
  7796. if ( xhr.readyState === 4 ) {
  7797. // Allow onerror to be called first,
  7798. // but that will not handle a native abort
  7799. // Also, save errorCallback to a variable
  7800. // as xhr.onerror cannot be accessed
  7801. window.setTimeout( function() {
  7802. if ( callback ) {
  7803. errorCallback();
  7804. }
  7805. } );
  7806. }
  7807. };
  7808. }
  7809. // Create the abort callback
  7810. callback = callback( "abort" );
  7811. try {
  7812. // Do send the request (this may raise an exception)
  7813. xhr.send( options.hasContent && options.data || null );
  7814. } catch ( e ) {
  7815. // #14683: Only rethrow if this hasn't been notified as an error yet
  7816. if ( callback ) {
  7817. throw e;
  7818. }
  7819. }
  7820. },
  7821. abort: function() {
  7822. if ( callback ) {
  7823. callback();
  7824. }
  7825. }
  7826. };
  7827. }
  7828. } );
  7829. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  7830. jQuery.ajaxPrefilter( function( s ) {
  7831. if ( s.crossDomain ) {
  7832. s.contents.script = false;
  7833. }
  7834. } );
  7835. // Install script dataType
  7836. jQuery.ajaxSetup( {
  7837. accepts: {
  7838. script: "text/javascript, application/javascript, " +
  7839. "application/ecmascript, application/x-ecmascript"
  7840. },
  7841. contents: {
  7842. script: /\b(?:java|ecma)script\b/
  7843. },
  7844. converters: {
  7845. "text script": function( text ) {
  7846. jQuery.globalEval( text );
  7847. return text;
  7848. }
  7849. }
  7850. } );
  7851. // Handle cache's special case and crossDomain
  7852. jQuery.ajaxPrefilter( "script", function( s ) {
  7853. if ( s.cache === undefined ) {
  7854. s.cache = false;
  7855. }
  7856. if ( s.crossDomain ) {
  7857. s.type = "GET";
  7858. }
  7859. } );
  7860. // Bind script tag hack transport
  7861. jQuery.ajaxTransport( "script", function( s ) {
  7862. // This transport only deals with cross domain requests
  7863. if ( s.crossDomain ) {
  7864. var script, callback;
  7865. return {
  7866. send: function( _, complete ) {
  7867. script = jQuery( "<script>" ).prop( {
  7868. charset: s.scriptCharset,
  7869. src: s.url
  7870. } ).on(
  7871. "load error",
  7872. callback = function( evt ) {
  7873. script.remove();
  7874. callback = null;
  7875. if ( evt ) {
  7876. complete( evt.type === "error" ? 404 : 200, evt.type );
  7877. }
  7878. }
  7879. );
  7880. // Use native DOM manipulation to avoid our domManip AJAX trickery
  7881. document.head.appendChild( script[ 0 ] );
  7882. },
  7883. abort: function() {
  7884. if ( callback ) {
  7885. callback();
  7886. }
  7887. }
  7888. };
  7889. }
  7890. } );
  7891. var oldCallbacks = [],
  7892. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7893. // Default jsonp settings
  7894. jQuery.ajaxSetup( {
  7895. jsonp: "callback",
  7896. jsonpCallback: function() {
  7897. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7898. this[ callback ] = true;
  7899. return callback;
  7900. }
  7901. } );
  7902. // Detect, normalize options and install callbacks for jsonp requests
  7903. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7904. var callbackName, overwritten, responseContainer,
  7905. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7906. "url" :
  7907. typeof s.data === "string" &&
  7908. ( s.contentType || "" )
  7909. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  7910. rjsonp.test( s.data ) && "data"
  7911. );
  7912. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7913. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7914. // Get callback name, remembering preexisting value associated with it
  7915. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  7916. s.jsonpCallback() :
  7917. s.jsonpCallback;
  7918. // Insert callback into url or form data
  7919. if ( jsonProp ) {
  7920. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7921. } else if ( s.jsonp !== false ) {
  7922. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7923. }
  7924. // Use data converter to retrieve json after script execution
  7925. s.converters[ "script json" ] = function() {
  7926. if ( !responseContainer ) {
  7927. jQuery.error( callbackName + " was not called" );
  7928. }
  7929. return responseContainer[ 0 ];
  7930. };
  7931. // Force json dataType
  7932. s.dataTypes[ 0 ] = "json";
  7933. // Install callback
  7934. overwritten = window[ callbackName ];
  7935. window[ callbackName ] = function() {
  7936. responseContainer = arguments;
  7937. };
  7938. // Clean-up function (fires after converters)
  7939. jqXHR.always( function() {
  7940. // If previous value didn't exist - remove it
  7941. if ( overwritten === undefined ) {
  7942. jQuery( window ).removeProp( callbackName );
  7943. // Otherwise restore preexisting value
  7944. } else {
  7945. window[ callbackName ] = overwritten;
  7946. }
  7947. // Save back as free
  7948. if ( s[ callbackName ] ) {
  7949. // Make sure that re-using the options doesn't screw things around
  7950. s.jsonpCallback = originalSettings.jsonpCallback;
  7951. // Save the callback name for future use
  7952. oldCallbacks.push( callbackName );
  7953. }
  7954. // Call if it was a function and we have a response
  7955. if ( responseContainer && isFunction( overwritten ) ) {
  7956. overwritten( responseContainer[ 0 ] );
  7957. }
  7958. responseContainer = overwritten = undefined;
  7959. } );
  7960. // Delegate to script
  7961. return "script";
  7962. }
  7963. } );
  7964. // Support: Safari 8 only
  7965. // In Safari 8 documents created via document.implementation.createHTMLDocument
  7966. // collapse sibling forms: the second one becomes a child of the first one.
  7967. // Because of that, this security measure has to be disabled in Safari 8.
  7968. // https://bugs.webkit.org/show_bug.cgi?id=137337
  7969. support.createHTMLDocument = ( function() {
  7970. var body = document.implementation.createHTMLDocument( "" ).body;
  7971. body.innerHTML = "<form></form><form></form>";
  7972. return body.childNodes.length === 2;
  7973. } )();
  7974. // Argument "data" should be string of html
  7975. // context (optional): If specified, the fragment will be created in this context,
  7976. // defaults to document
  7977. // keepScripts (optional): If true, will include scripts passed in the html string
  7978. jQuery.parseHTML = function( data, context, keepScripts ) {
  7979. if ( typeof data !== "string" ) {
  7980. return [];
  7981. }
  7982. if ( typeof context === "boolean" ) {
  7983. keepScripts = context;
  7984. context = false;
  7985. }
  7986. var base, parsed, scripts;
  7987. if ( !context ) {
  7988. // Stop scripts or inline event handlers from being executed immediately
  7989. // by using document.implementation
  7990. if ( support.createHTMLDocument ) {
  7991. context = document.implementation.createHTMLDocument( "" );
  7992. // Set the base href for the created document
  7993. // so any parsed elements with URLs
  7994. // are based on the document's URL (gh-2965)
  7995. base = context.createElement( "base" );
  7996. base.href = document.location.href;
  7997. context.head.appendChild( base );
  7998. } else {
  7999. context = document;
  8000. }
  8001. }
  8002. parsed = rsingleTag.exec( data );
  8003. scripts = !keepScripts && [];
  8004. // Single tag
  8005. if ( parsed ) {
  8006. return [ context.createElement( parsed[ 1 ] ) ];
  8007. }
  8008. parsed = buildFragment( [ data ], context, scripts );
  8009. if ( scripts && scripts.length ) {
  8010. jQuery( scripts ).remove();
  8011. }
  8012. return jQuery.merge( [], parsed.childNodes );
  8013. };
  8014. /**
  8015. * Load a url into a page
  8016. */
  8017. jQuery.fn.load = function( url, params, callback ) {
  8018. var selector, type, response,
  8019. self = this,
  8020. off = url.indexOf( " " );
  8021. if ( off > -1 ) {
  8022. selector = stripAndCollapse( url.slice( off ) );
  8023. url = url.slice( 0, off );
  8024. }
  8025. // If it's a function
  8026. if ( isFunction( params ) ) {
  8027. // We assume that it's the callback
  8028. callback = params;
  8029. params = undefined;
  8030. // Otherwise, build a param string
  8031. } else if ( params && typeof params === "object" ) {
  8032. type = "POST";
  8033. }
  8034. // If we have elements to modify, make the request
  8035. if ( self.length > 0 ) {
  8036. jQuery.ajax( {
  8037. url: url,
  8038. // If "type" variable is undefined, then "GET" method will be used.
  8039. // Make value of this field explicit since
  8040. // user can override it through ajaxSetup method
  8041. type: type || "GET",
  8042. dataType: "html",
  8043. data: params
  8044. } ).done( function( responseText ) {
  8045. // Save response for use in complete callback
  8046. response = arguments;
  8047. self.html( selector ?
  8048. // If a selector was specified, locate the right elements in a dummy div
  8049. // Exclude scripts to avoid IE 'Permission Denied' errors
  8050. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8051. // Otherwise use the full result
  8052. responseText );
  8053. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8054. // but they are ignored because response was set above.
  8055. // If it fails, this function gets "jqXHR", "status", "error"
  8056. } ).always( callback && function( jqXHR, status ) {
  8057. self.each( function() {
  8058. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8059. } );
  8060. } );
  8061. }
  8062. return this;
  8063. };
  8064. // Attach a bunch of functions for handling common AJAX events
  8065. jQuery.each( [
  8066. "ajaxStart",
  8067. "ajaxStop",
  8068. "ajaxComplete",
  8069. "ajaxError",
  8070. "ajaxSuccess",
  8071. "ajaxSend"
  8072. ], function( i, type ) {
  8073. jQuery.fn[ type ] = function( fn ) {
  8074. return this.on( type, fn );
  8075. };
  8076. } );
  8077. jQuery.expr.pseudos.animated = function( elem ) {
  8078. return jQuery.grep( jQuery.timers, function( fn ) {
  8079. return elem === fn.elem;
  8080. } ).length;
  8081. };
  8082. jQuery.offset = {
  8083. setOffset: function( elem, options, i ) {
  8084. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8085. position = jQuery.css( elem, "position" ),
  8086. curElem = jQuery( elem ),
  8087. props = {};
  8088. // Set position first, in-case top/left are set even on static elem
  8089. if ( position === "static" ) {
  8090. elem.style.position = "relative";
  8091. }
  8092. curOffset = curElem.offset();
  8093. curCSSTop = jQuery.css( elem, "top" );
  8094. curCSSLeft = jQuery.css( elem, "left" );
  8095. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8096. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8097. // Need to be able to calculate position if either
  8098. // top or left is auto and position is either absolute or fixed
  8099. if ( calculatePosition ) {
  8100. curPosition = curElem.position();
  8101. curTop = curPosition.top;
  8102. curLeft = curPosition.left;
  8103. } else {
  8104. curTop = parseFloat( curCSSTop ) || 0;
  8105. curLeft = parseFloat( curCSSLeft ) || 0;
  8106. }
  8107. if ( isFunction( options ) ) {
  8108. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8109. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8110. }
  8111. if ( options.top != null ) {
  8112. props.top = ( options.top - curOffset.top ) + curTop;
  8113. }
  8114. if ( options.left != null ) {
  8115. props.left = ( options.left - curOffset.left ) + curLeft;
  8116. }
  8117. if ( "using" in options ) {
  8118. options.using.call( elem, props );
  8119. } else {
  8120. curElem.css( props );
  8121. }
  8122. }
  8123. };
  8124. jQuery.fn.extend( {
  8125. // offset() relates an element's border box to the document origin
  8126. offset: function( options ) {
  8127. // Preserve chaining for setter
  8128. if ( arguments.length ) {
  8129. return options === undefined ?
  8130. this :
  8131. this.each( function( i ) {
  8132. jQuery.offset.setOffset( this, options, i );
  8133. } );
  8134. }
  8135. var rect, win,
  8136. elem = this[ 0 ];
  8137. if ( !elem ) {
  8138. return;
  8139. }
  8140. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8141. // Support: IE <=11 only
  8142. // Running getBoundingClientRect on a
  8143. // disconnected node in IE throws an error
  8144. if ( !elem.getClientRects().length ) {
  8145. return { top: 0, left: 0 };
  8146. }
  8147. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8148. rect = elem.getBoundingClientRect();
  8149. win = elem.ownerDocument.defaultView;
  8150. return {
  8151. top: rect.top + win.pageYOffset,
  8152. left: rect.left + win.pageXOffset
  8153. };
  8154. },
  8155. // position() relates an element's margin box to its offset parent's padding box
  8156. // This corresponds to the behavior of CSS absolute positioning
  8157. position: function() {
  8158. if ( !this[ 0 ] ) {
  8159. return;
  8160. }
  8161. var offsetParent, offset, doc,
  8162. elem = this[ 0 ],
  8163. parentOffset = { top: 0, left: 0 };
  8164. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8165. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8166. // Assume position:fixed implies availability of getBoundingClientRect
  8167. offset = elem.getBoundingClientRect();
  8168. } else {
  8169. offset = this.offset();
  8170. // Account for the *real* offset parent, which can be the document or its root element
  8171. // when a statically positioned element is identified
  8172. doc = elem.ownerDocument;
  8173. offsetParent = elem.offsetParent || doc.documentElement;
  8174. while ( offsetParent &&
  8175. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  8176. jQuery.css( offsetParent, "position" ) === "static" ) {
  8177. offsetParent = offsetParent.parentNode;
  8178. }
  8179. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  8180. // Incorporate borders into its offset, since they are outside its content origin
  8181. parentOffset = jQuery( offsetParent ).offset();
  8182. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  8183. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  8184. }
  8185. }
  8186. // Subtract parent offsets and element margins
  8187. return {
  8188. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8189. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8190. };
  8191. },
  8192. // This method will return documentElement in the following cases:
  8193. // 1) For the element inside the iframe without offsetParent, this method will return
  8194. // documentElement of the parent window
  8195. // 2) For the hidden or detached element
  8196. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8197. //
  8198. // but those exceptions were never presented as a real life use-cases
  8199. // and might be considered as more preferable results.
  8200. //
  8201. // This logic, however, is not guaranteed and can change at any point in the future
  8202. offsetParent: function() {
  8203. return this.map( function() {
  8204. var offsetParent = this.offsetParent;
  8205. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8206. offsetParent = offsetParent.offsetParent;
  8207. }
  8208. return offsetParent || documentElement;
  8209. } );
  8210. }
  8211. } );
  8212. // Create scrollLeft and scrollTop methods
  8213. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8214. var top = "pageYOffset" === prop;
  8215. jQuery.fn[ method ] = function( val ) {
  8216. return access( this, function( elem, method, val ) {
  8217. // Coalesce documents and windows
  8218. var win;
  8219. if ( isWindow( elem ) ) {
  8220. win = elem;
  8221. } else if ( elem.nodeType === 9 ) {
  8222. win = elem.defaultView;
  8223. }
  8224. if ( val === undefined ) {
  8225. return win ? win[ prop ] : elem[ method ];
  8226. }
  8227. if ( win ) {
  8228. win.scrollTo(
  8229. !top ? val : win.pageXOffset,
  8230. top ? val : win.pageYOffset
  8231. );
  8232. } else {
  8233. elem[ method ] = val;
  8234. }
  8235. }, method, val, arguments.length );
  8236. };
  8237. } );
  8238. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8239. // Add the top/left cssHooks using jQuery.fn.position
  8240. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8241. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8242. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8243. // rather than make the css module depend on the offset module, just check for it here
  8244. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8245. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8246. function( elem, computed ) {
  8247. if ( computed ) {
  8248. computed = curCSS( elem, prop );
  8249. // If curCSS returns percentage, fallback to offset
  8250. return rnumnonpx.test( computed ) ?
  8251. jQuery( elem ).position()[ prop ] + "px" :
  8252. computed;
  8253. }
  8254. }
  8255. );
  8256. } );
  8257. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8258. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8259. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8260. function( defaultExtra, funcName ) {
  8261. // Margin is only for outerHeight, outerWidth
  8262. jQuery.fn[ funcName ] = function( margin, value ) {
  8263. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8264. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8265. return access( this, function( elem, type, value ) {
  8266. var doc;
  8267. if ( isWindow( elem ) ) {
  8268. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8269. return funcName.indexOf( "outer" ) === 0 ?
  8270. elem[ "inner" + name ] :
  8271. elem.document.documentElement[ "client" + name ];
  8272. }
  8273. // Get document width or height
  8274. if ( elem.nodeType === 9 ) {
  8275. doc = elem.documentElement;
  8276. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8277. // whichever is greatest
  8278. return Math.max(
  8279. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8280. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8281. doc[ "client" + name ]
  8282. );
  8283. }
  8284. return value === undefined ?
  8285. // Get width or height on the element, requesting but not forcing parseFloat
  8286. jQuery.css( elem, type, extra ) :
  8287. // Set width or height on the element
  8288. jQuery.style( elem, type, value, extra );
  8289. }, type, chainable ? margin : undefined, chainable );
  8290. };
  8291. } );
  8292. } );
  8293. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  8294. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8295. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  8296. function( i, name ) {
  8297. // Handle event binding
  8298. jQuery.fn[ name ] = function( data, fn ) {
  8299. return arguments.length > 0 ?
  8300. this.on( name, null, data, fn ) :
  8301. this.trigger( name );
  8302. };
  8303. } );
  8304. jQuery.fn.extend( {
  8305. hover: function( fnOver, fnOut ) {
  8306. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  8307. }
  8308. } );
  8309. jQuery.fn.extend( {
  8310. bind: function( types, data, fn ) {
  8311. return this.on( types, null, data, fn );
  8312. },
  8313. unbind: function( types, fn ) {
  8314. return this.off( types, null, fn );
  8315. },
  8316. delegate: function( selector, types, data, fn ) {
  8317. return this.on( types, selector, data, fn );
  8318. },
  8319. undelegate: function( selector, types, fn ) {
  8320. // ( namespace ) or ( selector, types [, fn] )
  8321. return arguments.length === 1 ?
  8322. this.off( selector, "**" ) :
  8323. this.off( types, selector || "**", fn );
  8324. }
  8325. } );
  8326. // Bind a function to a context, optionally partially applying any
  8327. // arguments.
  8328. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8329. // However, it is not slated for removal any time soon
  8330. jQuery.proxy = function( fn, context ) {
  8331. var tmp, args, proxy;
  8332. if ( typeof context === "string" ) {
  8333. tmp = fn[ context ];
  8334. context = fn;
  8335. fn = tmp;
  8336. }
  8337. // Quick check to determine if target is callable, in the spec
  8338. // this throws a TypeError, but we will just return undefined.
  8339. if ( !isFunction( fn ) ) {
  8340. return undefined;
  8341. }
  8342. // Simulated bind
  8343. args = slice.call( arguments, 2 );
  8344. proxy = function() {
  8345. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  8346. };
  8347. // Set the guid of unique handler to the same of original handler, so it can be removed
  8348. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8349. return proxy;
  8350. };
  8351. jQuery.holdReady = function( hold ) {
  8352. if ( hold ) {
  8353. jQuery.readyWait++;
  8354. } else {
  8355. jQuery.ready( true );
  8356. }
  8357. };
  8358. jQuery.isArray = Array.isArray;
  8359. jQuery.parseJSON = JSON.parse;
  8360. jQuery.nodeName = nodeName;
  8361. jQuery.isFunction = isFunction;
  8362. jQuery.isWindow = isWindow;
  8363. jQuery.camelCase = camelCase;
  8364. jQuery.type = toType;
  8365. jQuery.now = Date.now;
  8366. jQuery.isNumeric = function( obj ) {
  8367. // As of jQuery 3.0, isNumeric is limited to
  8368. // strings and numbers (primitives or objects)
  8369. // that can be coerced to finite numbers (gh-2662)
  8370. var type = jQuery.type( obj );
  8371. return ( type === "number" || type === "string" ) &&
  8372. // parseFloat NaNs numeric-cast false positives ("")
  8373. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8374. // subtraction forces infinities to NaN
  8375. !isNaN( obj - parseFloat( obj ) );
  8376. };
  8377. // Register as a named AMD module, since jQuery can be concatenated with other
  8378. // files that may use define, but not via a proper concatenation script that
  8379. // understands anonymous AMD modules. A named AMD is safest and most robust
  8380. // way to register. Lowercase jquery is used because AMD module names are
  8381. // derived from file names, and jQuery is normally delivered in a lowercase
  8382. // file name. Do this after creating the global so that if an AMD module wants
  8383. // to call noConflict to hide this version of jQuery, it will work.
  8384. // Note that for maximum portability, libraries that are not jQuery should
  8385. // declare themselves as anonymous modules, and avoid setting a global if an
  8386. // AMD loader is present. jQuery is a special case. For more information, see
  8387. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8388. if ( typeof define === "function" && define.amd ) {
  8389. define( "jquery", [], function() {
  8390. return jQuery;
  8391. } );
  8392. }
  8393. var
  8394. // Map over jQuery in case of overwrite
  8395. _jQuery = window.jQuery,
  8396. // Map over the $ in case of overwrite
  8397. _$ = window.$;
  8398. jQuery.noConflict = function( deep ) {
  8399. if ( window.$ === jQuery ) {
  8400. window.$ = _$;
  8401. }
  8402. if ( deep && window.jQuery === jQuery ) {
  8403. window.jQuery = _jQuery;
  8404. }
  8405. return jQuery;
  8406. };
  8407. // Expose jQuery and $ identifiers, even in AMD
  8408. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8409. // and CommonJS for browser emulators (#13566)
  8410. if ( !noGlobal ) {
  8411. window.jQuery = window.$ = jQuery;
  8412. }
  8413. return jQuery;
  8414. } );