JQueryStatic.d.ts 442 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944
  1. // tslint:disable:jsdoc-format
  2. // tslint:disable:no-irregular-whitespace
  3. interface JQueryStatic {
  4. /**
  5. * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax1 }\`
  6. * @deprecated ​ Deprecated. Use \`{@link ajaxSetup }\`.
  7. */
  8. ajaxSettings: JQuery.AjaxSettings;
  9. Animation: JQuery.AnimationStatic;
  10. Callbacks: JQuery.CallbacksStatic;
  11. /**
  12. * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
  13. * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\`
  14. * @since 1.4.3
  15. */
  16. cssHooks: JQuery.CSSHooks;
  17. /**
  18. * An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values.
  19. * @see \`{@link https://api.jquery.com/jQuery.cssNumber/ }\`
  20. * @since 1.4.3
  21. */
  22. cssNumber: JQuery.PlainObject<boolean>;
  23. Deferred: JQuery.DeferredStatic;
  24. easing: JQuery.Easings;
  25. Event: JQuery.EventStatic;
  26. /**
  27. * @see \`{@link https://learn.jquery.com/events/event-extensions/ }\`
  28. */
  29. event: JQuery.EventExtensions;
  30. expr: JQuery.Selectors;
  31. // Set to HTMLElement to minimize breaks but should probably be Element.
  32. readonly fn: JQuery;
  33. fx: JQuery.Effects;
  34. /**
  35. * A Promise-like object (or "thenable") that resolves when the document is ready.
  36. * @see \`{@link https://api.jquery.com/jQuery.ready/ }\`
  37. * @since 1.8
  38. * @example ​ ````Listen for document ready using jQuery.when.
  39. ```javascript
  40. $.when( $.ready ).then(function() {
  41. // Document is ready.
  42. });
  43. ```
  44. * @example ​ ````Typical usage involving another promise, using jQuery.when.
  45. ```javascript
  46. $.when(
  47. $.getJSON( "ajax/test.json" ),
  48. $.ready
  49. ).done(function( data ) {
  50. // Document is ready.
  51. // Value of test.json is passed as `data`.
  52. });
  53. ```
  54. */
  55. ready: JQuery.Thenable<JQueryStatic>;
  56. /**
  57. * A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.
  58. * @see \`{@link https://api.jquery.com/jQuery.support/ }\`
  59. * @since 1.3
  60. * @deprecated ​ Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`.
  61. */
  62. support: JQuery.PlainObject;
  63. timers: Array<JQuery.TickFunction<any>>;
  64. Tween: JQuery.TweenStatic;
  65. valHooks: JQuery.ValHooks;
  66. // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic.
  67. // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function.
  68. (window: Window, discriminator: boolean): JQueryStatic;
  69. /**
  70. * Creates DOM elements on the fly from the provided string of raw HTML.
  71. * @param html _&#x40;param_ `html`
  72. * <br>
  73. * * `html (ownerDocument)` — A string of HTML to create on the fly. Note that this parses HTML, not XML. <br>
  74. * * `html (attributes)` — A string defining a single, standalone, HTML element (e.g. &lt;div/&gt; or &lt;div&gt;&lt;/div&gt;).
  75. * @param ownerDocument_attributes _&#x40;param_ `ownerDocument_attributes`
  76. * <br>
  77. * * `ownerDocument` — A document in which the new elements will be created. <br>
  78. * * `attributes` — An object of attributes, events, and methods to call on the newly-created element.
  79. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  80. * @since 1.0
  81. * @since 1.4
  82. * @example ​ ````Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup.
  83. ```javascript
  84. $( "<div><p>Hello</p></div>" ).appendTo( "body" )
  85. ```
  86. * @example ​ ````Create some DOM elements.
  87. ```javascript
  88. $( "<div/>", {
  89. "class": "test",
  90. text: "Click me!",
  91. click: function() {
  92. $( this ).toggleClass( "test" );
  93. }
  94. })
  95. .appendTo( "body" );
  96. ```
  97. */
  98. // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
  99. <TElement extends HTMLElement = HTMLElement>(
  100. html: JQuery.htmlString,
  101. ownerDocument_attributes?: Document | JQuery.PlainObject,
  102. ): JQuery<TElement>;
  103. /**
  104. * Accepts a string containing a CSS selector which is then used to match a set of elements.
  105. * @param selector A string containing a selector expression
  106. * @param context A DOM Element, Document, Selector or jQuery to use as context
  107. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  108. * @since 1.0
  109. * @example ​ ````Find all p elements that are children of a div element and apply a border to them.
  110. ```html
  111. <!doctype html>
  112. <html lang="en">
  113. <head>
  114. <meta charset="utf-8">
  115. <title>jQuery demo</title>
  116. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  117. </head>
  118. <body>
  119. <p>one</p>
  120. <div><p>two</p></div>
  121. <p>three</p>
  122. <script>
  123. $( "div > p" ).css( "border", "1px solid gray" );
  124. </script>
  125. </body>
  126. </html>
  127. ```
  128. * @example ​ ````Find all inputs of type radio within the first form in the document.
  129. ```javascript
  130. $( "input:radio", document.forms[ 0 ] );
  131. ```
  132. * @example ​ ````Find all div elements within an XML document from an Ajax response.
  133. ```javascript
  134. $( "div", xml.responseXML );
  135. ```
  136. */
  137. // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
  138. <TElement extends Element = HTMLElement>(
  139. selector: JQuery.Selector,
  140. context?: Element | Document | JQuery | JQuery.Selector,
  141. ): JQuery<TElement>;
  142. /**
  143. * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
  144. * @param element A DOM element to wrap in a jQuery object.
  145. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  146. * @since 1.0
  147. * @example ​ ````Set the background color of the page to black.
  148. ```javascript
  149. $( document.body ).css( "background", "black" );
  150. ```
  151. */
  152. // NOTE: `HTMLSelectElement` is both an Element and an Array-Like Object but jQuery treats it as an Element.
  153. (element: HTMLSelectElement): JQuery<HTMLSelectElement>;
  154. /**
  155. * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
  156. * @param element_elementArray _&#x40;param_ `element_elementArray`
  157. * <br>
  158. * * `element` — A DOM element to wrap in a jQuery object. <br>
  159. * * `elementArray` — An array containing a set of DOM elements to wrap in a jQuery object.
  160. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  161. * @since 1.0
  162. * @example ​ ````Set the background color of the page to black.
  163. ```javascript
  164. $( document.body ).css( "background", "black" );
  165. ```
  166. * @example ​ ````Hide all the input elements within a form.
  167. ```javascript
  168. $( myForm.elements ).hide();
  169. ```
  170. */
  171. <T extends Element>(element_elementArray: T | ArrayLike<T>): JQuery<T>;
  172. /**
  173. * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
  174. * @param selection An existing jQuery object to clone.
  175. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  176. * @since 1.0
  177. */
  178. <T>(selection: JQuery<T>): JQuery<T>;
  179. /**
  180. * Binds a function to be executed when the DOM has finished loading.
  181. * @param callback The function to execute when the DOM is ready.
  182. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  183. * @since 1.0
  184. * @example ​ ````Execute the function when the DOM is ready to be used.
  185. ```javascript
  186. $(function() {
  187. // Document is ready
  188. });
  189. ```
  190. * @example ​ ````Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.
  191. ```javascript
  192. jQuery(function( $ ) {
  193. // Your code using failsafe $ alias here...
  194. });
  195. ```
  196. */
  197. /* eslint-disable @definitelytyped/no-unnecessary-generics */
  198. // tslint:disable-next-line:unified-signatures
  199. <TElement = HTMLElement>(callback: (this: Document, $: JQueryStatic) => void): JQuery<TElement>;
  200. /* eslint-enable @definitelytyped/no-unnecessary-generics */
  201. /**
  202. * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
  203. * @param object A plain object to wrap in a jQuery object.
  204. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  205. * @since 1.0
  206. */
  207. <T extends JQuery.PlainObject>(object: T): JQuery<T>;
  208. /**
  209. * Returns an empty jQuery set.
  210. * @see \`{@link https://api.jquery.com/jQuery/ }\`
  211. * @since 1.4
  212. */
  213. // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
  214. <TElement = HTMLElement>(): JQuery<TElement>;
  215. /**
  216. * Perform an asynchronous HTTP (Ajax) request.
  217. * @param url A string containing the URL to which the request is sent.
  218. * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can
  219. * be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings.
  220. * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\`
  221. * @since 1.5
  222. */
  223. ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR;
  224. /**
  225. * Perform an asynchronous HTTP (Ajax) request.
  226. * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can
  227. * be set for any option with $.ajaxSetup().
  228. * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\`
  229. * @since 1.0
  230. * @example ​ ````Save some data to the server and notify the user once it&#39;s complete.
  231. ```javascript
  232. $.ajax({
  233. method: "POST",
  234. url: "some.php",
  235. data: { name: "John", location: "Boston" }
  236. })
  237. .done(function( msg ) {
  238. alert( "Data Saved: " + msg );
  239. });
  240. ```
  241. * @example ​ ````Retrieve the latest version of an HTML page.
  242. ```javascript
  243. $.ajax({
  244. url: "test.html",
  245. cache: false
  246. })
  247. .done(function( html ) {
  248. $( "#results" ).append( html );
  249. });
  250. ```
  251. * @example ​ ````Send an xml document as data to the server. By setting the processData
  252. option to false, the automatic conversion of data to strings is prevented.
  253. ```javascript
  254. var xmlDocument = [create xml document];
  255. var xmlRequest = $.ajax({
  256. url: "page.php",
  257. processData: false,
  258. data: xmlDocument
  259. });
  260. xmlRequest.done( handleResponse );
  261. ```
  262. * @example ​ ````Send an id as data to the server, save some data to the server, and notify the user once it&#39;s complete. If the request fails, alert the user.
  263. ```javascript
  264. var menuId = $( "ul.nav" ).first().attr( "id" );
  265. var request = $.ajax({
  266. url: "script.php",
  267. method: "POST",
  268. data: { id : menuId },
  269. dataType: "html"
  270. });
  271. request.done(function( msg ) {
  272. $( "#log" ).html( msg );
  273. });
  274. request.fail(function( jqXHR, textStatus ) {
  275. alert( "Request failed: " + textStatus );
  276. });
  277. ```
  278. * @example ​ ````Load and execute a JavaScript file.
  279. ```javascript
  280. $.ajax({
  281. method: "GET",
  282. url: "test.js",
  283. dataType: "script"
  284. });
  285. ```
  286. */
  287. ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR;
  288. /**
  289. * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
  290. * @param dataTypes An optional string containing one or more space-separated dataTypes
  291. * @param handler A handler to set default values for future Ajax requests.
  292. * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\`
  293. * @since 1.5
  294. */
  295. ajaxPrefilter(
  296. dataTypes: string,
  297. handler: (
  298. options: JQuery.AjaxSettings,
  299. originalOptions: JQuery.AjaxSettings,
  300. jqXHR: JQuery.jqXHR,
  301. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  302. ) => string | void,
  303. ): void;
  304. /**
  305. * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
  306. * @param handler A handler to set default values for future Ajax requests.
  307. * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\`
  308. * @since 1.5
  309. */
  310. ajaxPrefilter(
  311. handler: (
  312. options: JQuery.AjaxSettings,
  313. originalOptions: JQuery.AjaxSettings,
  314. jqXHR: JQuery.jqXHR,
  315. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  316. ) => string | void,
  317. ): void;
  318. /**
  319. * Set default values for future Ajax requests. Its use is not recommended.
  320. * @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
  321. * @see \`{@link https://api.jquery.com/jQuery.ajaxSetup/ }\`
  322. * @since 1.1
  323. * @example ​ ````Sets the defaults for Ajax requests to the url &quot;/xmlhttp/&quot;, disables global handlers and uses POST instead of GET. The following Ajax requests then sends some data without having to set anything else.
  324. ```javascript
  325. $.ajaxSetup({
  326. url: "/xmlhttp/",
  327. global: false,
  328. type: "POST"
  329. });
  330. $.ajax({ data: myData });
  331. ```
  332. */
  333. ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings;
  334. /**
  335. * Creates an object that handles the actual transmission of Ajax data.
  336. * @param dataType A string identifying the data type to use
  337. * @param handler A handler to return the new transport object to use with the data type provided in the first argument.
  338. * @see \`{@link https://api.jquery.com/jQuery.ajaxTransport/ }\`
  339. * @since 1.5
  340. */
  341. ajaxTransport(
  342. dataType: string,
  343. handler: (
  344. options: JQuery.AjaxSettings,
  345. originalOptions: JQuery.AjaxSettings,
  346. jqXHR: JQuery.jqXHR,
  347. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  348. ) => JQuery.Transport | void,
  349. ): void;
  350. /**
  351. * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3384 }\`.
  352. */
  353. camelCase(value: string): string;
  354. cleanData(elems: ArrayLike<Element | Document | Window | JQuery.PlainObject>): void;
  355. /**
  356. * Check to see if a DOM element is a descendant of another DOM element.
  357. * @param container The DOM element that may contain the other element.
  358. * @param contained The DOM element that may be contained by (a descendant of) the other element.
  359. * @see \`{@link https://api.jquery.com/jQuery.contains/ }\`
  360. * @since 1.4
  361. * @example ​ ````Check if an element is a descendant of another.
  362. ```javascript
  363. $.contains( document.documentElement, document.body ); // true
  364. $.contains( document.body, document.documentElement ); // false
  365. ```
  366. */
  367. contains(container: Element, contained: Element): boolean;
  368. css(elem: Element, name: string): any;
  369. /**
  370. * Store arbitrary data associated with the specified element. Returns the value that was set.
  371. * @param element The DOM element to associate with the data.
  372. * @param key A string naming the piece of data to set.
  373. * @param value The new data value; this can be any Javascript type except `undefined`.
  374. * @see \`{@link https://api.jquery.com/jQuery.data/ }\`
  375. * @since 1.2.3
  376. * @example ​ ````Get the data named &quot;blah&quot; stored at for an element.
  377. ```html
  378. <!doctype html>
  379. <html lang="en">
  380. <head>
  381. <meta charset="utf-8">
  382. <title>jQuery.data demo</title>
  383. <style>
  384. div {
  385. margin: 5px;
  386. background: yellow;
  387. }
  388. button {
  389. margin: 5px;
  390. font-size: 14px;
  391. }
  392. p {
  393. margin: 5px;
  394. color: blue;
  395. }
  396. span {
  397. color: red;
  398. }
  399. </style>
  400. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  401. </head>
  402. <body>
  403. <div>A div</div>
  404. <button>Get "blah" from the div</button>
  405. <button>Set "blah" to "hello"</button>
  406. <button>Set "blah" to 86</button>
  407. <button>Remove "blah" from the div</button>
  408. <p>The "blah" value of this div is <span>?</span></p>
  409. <script>
  410. $( "button" ).click( function() {
  411. var value,
  412. div = $( "div" )[ 0 ];
  413. switch ( $( "button" ).index( this ) ) {
  414. case 0 :
  415. value = jQuery.data( div, "blah" );
  416. break;
  417. case 1 :
  418. jQuery.data( div, "blah", "hello" );
  419. value = "Stored!";
  420. break;
  421. case 2 :
  422. jQuery.data( div, "blah", 86 );
  423. value = "Stored!";
  424. break;
  425. case 3 :
  426. jQuery.removeData( div, "blah" );
  427. value = "Removed!";
  428. break;
  429. }
  430. $( "span" ).text( "" + value );
  431. });
  432. </script>
  433. </body>
  434. </html>
  435. ```
  436. */
  437. data<T extends string | number | boolean | symbol | object | null>(
  438. element: Element | Document | Window | JQuery.PlainObject,
  439. key: string,
  440. value: T,
  441. ): T;
  442. /**
  443. * Returns value at named data store for the element, as set by `jQuery.data(element, name, value)`, or the full data store for the element.
  444. * @param element The DOM element to query for the data.
  445. * @param key Name of the data stored.
  446. * @param value `undefined` is not recognized as a data value. Calls such as `jQuery.data( el, "name", undefined )`
  447. * will return the corresponding data for "name", and is therefore the same as `jQuery.data( el, "name" )`
  448. * @see \`{@link https://api.jquery.com/jQuery.data/ }\`
  449. * @since 1.2.3
  450. */
  451. // `unified-signatures` is disabled so that behavior when passing `undefined` to `value` can be documented. Unifying the signatures
  452. // results in potential confusion for users from an unexpected parameter.
  453. // tslint:disable-next-line:unified-signatures
  454. data(element: Element | Document | Window | JQuery.PlainObject, key: string, value: undefined): any;
  455. /**
  456. * Returns value at named data store for the element, as set by `jQuery.data(element, name, value)`, or the full data store for the element.
  457. * @param element The DOM element to query for the data.
  458. * @param key Name of the data stored.
  459. * @see \`{@link https://api.jquery.com/jQuery.data/ }\`
  460. * @since 1.2.3
  461. * @since 1.4
  462. * @example ​ ````Store then retrieve a value from the div element.
  463. ```html
  464. <!doctype html>
  465. <html lang="en">
  466. <head>
  467. <meta charset="utf-8">
  468. <title>jQuery.data demo</title>
  469. <style>
  470. div {
  471. color: blue;
  472. }
  473. span {
  474. color: red;
  475. }
  476. </style>
  477. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  478. </head>
  479. <body>
  480. <div>
  481. The values stored were
  482. <span></span>
  483. and
  484. <span></span>
  485. </div>
  486. <script>
  487. var div = $( "div" )[ 0 ];
  488. jQuery.data( div, "test", {
  489. first: 16,
  490. last: "pizza!"
  491. });
  492. $( "span:first" ).text( jQuery.data( div, "test" ).first );
  493. $( "span:last" ).text( jQuery.data( div, "test" ).last );
  494. </script>
  495. </body>
  496. </html>
  497. ```
  498. */
  499. data(element: Element | Document | Window | JQuery.PlainObject, key?: string): any;
  500. /**
  501. * Execute the next function on the queue for the matched element.
  502. * @param element A DOM element from which to remove and execute a queued function.
  503. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
  504. * @see \`{@link https://api.jquery.com/jQuery.dequeue/ }\`
  505. * @since 1.3
  506. * @example ​ ````Use jQuery.dequeue() to end a custom queue function which allows the queue to keep going.
  507. ```html
  508. <!doctype html>
  509. <html lang="en">
  510. <head>
  511. <meta charset="utf-8">
  512. <title>jQuery.dequeue demo</title>
  513. <style>
  514. div {
  515. margin: 3px;
  516. width: 50px;
  517. position: absolute;
  518. height: 50px;
  519. left: 10px;
  520. top: 30px;
  521. background-color: yellow;
  522. }
  523. div.red {
  524. background-color: red;
  525. }
  526. </style>
  527. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  528. </head>
  529. <body>
  530. <button>Start</button>
  531. <div></div>
  532. <script>
  533. $( "button" ).click(function() {
  534. $( "div" )
  535. .animate({ left: '+=200px' }, 2000 )
  536. .animate({ top: '0px' }, 600 )
  537. .queue(function() {
  538. $( this ).toggleClass( "red" );
  539. $.dequeue( this );
  540. })
  541. .animate({ left:'10px', top:'30px' }, 700 );
  542. });
  543. </script>
  544. </body>
  545. </html>
  546. ```
  547. */
  548. dequeue(element: Element, queueName?: string): void;
  549. /**
  550. * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
  551. * @param array The array to iterate over.
  552. * @param callback The function that will be executed on every object.
  553. * @see \`{@link https://api.jquery.com/jQuery.each/ }\`
  554. * @since 1.0
  555. * @example ​ ````Iterates through the array displaying each number as both a word and numeral
  556. ```html
  557. <!doctype html>
  558. <html lang="en">
  559. <head>
  560. <meta charset="utf-8">
  561. <title>jQuery.each demo</title>
  562. <style>
  563. div {
  564. color: blue;
  565. }
  566. div#five {
  567. color: red;
  568. }
  569. </style>
  570. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  571. </head>
  572. <body>
  573. <div id="one"></div>
  574. <div id="two"></div>
  575. <div id="three"></div>
  576. <div id="four"></div>
  577. <div id="five"></div>
  578. <script>
  579. var arr = [ "one", "two", "three", "four", "five" ];
  580. var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };
  581. jQuery.each( arr, function( i, val ) {
  582. $( "#" + val ).text( "Mine is " + val + "." );
  583. // Will stop running after "three"
  584. return ( val !== "three" );
  585. });
  586. jQuery.each( obj, function( i, val ) {
  587. $( "#" + i ).append( document.createTextNode( " - " + val ) );
  588. });
  589. </script>
  590. </body>
  591. </html>
  592. ```
  593. * @example ​ ````Iterates over items in an array, accessing both the current item and its index.
  594. ```javascript
  595. $.each( [ "a", "b", "c" ], function( i, l ){
  596. alert( "Index #" + i + ": " + l );
  597. });
  598. ```
  599. */
  600. each<T>(array: ArrayLike<T>, callback: (this: T, indexInArray: number, value: T) => any): ArrayLike<T>;
  601. /**
  602. * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
  603. * @param obj The object to iterate over.
  604. * @param callback The function that will be executed on every object.
  605. * @see \`{@link https://api.jquery.com/jQuery.each/ }\`
  606. * @since 1.0
  607. * @example ​ ````Iterates through the array displaying each number as both a word and numeral
  608. ```html
  609. <!doctype html>
  610. <html lang="en">
  611. <head>
  612. <meta charset="utf-8">
  613. <title>jQuery.each demo</title>
  614. <style>
  615. div {
  616. color: blue;
  617. }
  618. div#five {
  619. color: red;
  620. }
  621. </style>
  622. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  623. </head>
  624. <body>
  625. <div id="one"></div>
  626. <div id="two"></div>
  627. <div id="three"></div>
  628. <div id="four"></div>
  629. <div id="five"></div>
  630. <script>
  631. var arr = [ "one", "two", "three", "four", "five" ];
  632. var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };
  633. jQuery.each( arr, function( i, val ) {
  634. $( "#" + val ).text( "Mine is " + val + "." );
  635. // Will stop running after "three"
  636. return ( val !== "three" );
  637. });
  638. jQuery.each( obj, function( i, val ) {
  639. $( "#" + i ).append( document.createTextNode( " - " + val ) );
  640. });
  641. </script>
  642. </body>
  643. </html>
  644. ```
  645. * @example ​ ````Iterates over the properties in an object, accessing both the current item and its key.
  646. ```javascript
  647. $.each({ name: "John", lang: "JS" }, function( k, v ) {
  648. alert( "Key: " + k + ", Value: " + v );
  649. });
  650. ```
  651. */
  652. each<T, K extends keyof T>(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => any): T;
  653. /**
  654. * Takes a string and throws an exception containing it.
  655. * @param message The message to send out.
  656. * @see \`{@link https://api.jquery.com/jQuery.error/ }\`
  657. * @since 1.4.1
  658. * @example ​ ````Override jQuery.error for display in Firebug.
  659. ```javascript
  660. jQuery.error = console.error;
  661. ```
  662. */
  663. error(message: string): any;
  664. /**
  665. * Escapes any character that has a special meaning in a CSS selector.
  666. * @param selector A string containing a selector expression to escape.
  667. * @see \`{@link https://api.jquery.com/jQuery.escapeSelector/ }\`
  668. * @since 3.0
  669. * @example ​ ````Escape an ID containing a hash.
  670. ```javascript
  671. $.escapeSelector( "#target" ); // "\#target"
  672. ```
  673. * @example ​ ````Select all the elements having a class name of .box inside a div.
  674. ```javascript
  675. $( "div" ).find( "." + $.escapeSelector( ".box" ) );
  676. ```
  677. */
  678. escapeSelector(selector: JQuery.Selector): JQuery.Selector;
  679. /**
  680. * Merge the contents of two or more objects together into the first object.
  681. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  682. * @param target The object to extend. It will receive the new properties.
  683. * @param object1 An object containing additional properties to merge in.
  684. * @param object2 An object containing additional properties to merge in.
  685. * @param object3 An object containing additional properties to merge in.
  686. * @param object4 An object containing additional properties to merge in.
  687. * @param object5 An object containing additional properties to merge in.
  688. * @param object6 An object containing additional properties to merge in.
  689. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  690. * @since 1.1.4
  691. * @example ​ ````Merge two objects recursively, modifying the first.
  692. ```html
  693. <!doctype html>
  694. <html lang="en">
  695. <head>
  696. <meta charset="utf-8">
  697. <title>jQuery.extend demo</title>
  698. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  699. </head>
  700. <body>
  701. <div id="log"></div>
  702. <script>
  703. var object1 = {
  704. apple: 0,
  705. banana: { weight: 52, price: 100 },
  706. cherry: 97
  707. };
  708. var object2 = {
  709. banana: { price: 200 },
  710. durian: 100
  711. };
  712. // Merge object2 into object1, recursively
  713. $.extend( true, object1, object2 );
  714. // Assuming JSON.stringify - not available in IE<8
  715. $( "#log" ).append( JSON.stringify( object1 ) );
  716. </script>
  717. </body>
  718. </html>
  719. ```
  720. */
  721. extend<T, U, V, W, X, Y, Z>(
  722. deep: true,
  723. target: T,
  724. object1: U,
  725. object2: V,
  726. object3: W,
  727. object4: X,
  728. object5: Y,
  729. object6: Z,
  730. ): T & U & V & W & X & Y & Z;
  731. /**
  732. * Merge the contents of two or more objects together into the first object.
  733. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  734. * @param target The object to extend. It will receive the new properties.
  735. * @param object1 An object containing additional properties to merge in.
  736. * @param object2 An object containing additional properties to merge in.
  737. * @param object3 An object containing additional properties to merge in.
  738. * @param object4 An object containing additional properties to merge in.
  739. * @param object5 An object containing additional properties to merge in.
  740. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  741. * @since 1.1.4
  742. * @example ​ ````Merge two objects recursively, modifying the first.
  743. ```html
  744. <!doctype html>
  745. <html lang="en">
  746. <head>
  747. <meta charset="utf-8">
  748. <title>jQuery.extend demo</title>
  749. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  750. </head>
  751. <body>
  752. <div id="log"></div>
  753. <script>
  754. var object1 = {
  755. apple: 0,
  756. banana: { weight: 52, price: 100 },
  757. cherry: 97
  758. };
  759. var object2 = {
  760. banana: { price: 200 },
  761. durian: 100
  762. };
  763. // Merge object2 into object1, recursively
  764. $.extend( true, object1, object2 );
  765. // Assuming JSON.stringify - not available in IE<8
  766. $( "#log" ).append( JSON.stringify( object1 ) );
  767. </script>
  768. </body>
  769. </html>
  770. ```
  771. */
  772. extend<T, U, V, W, X, Y>(
  773. deep: true,
  774. target: T,
  775. object1: U,
  776. object2: V,
  777. object3: W,
  778. object4: X,
  779. object5: Y,
  780. ): T & U & V & W & X & Y;
  781. /**
  782. * Merge the contents of two or more objects together into the first object.
  783. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  784. * @param target The object to extend. It will receive the new properties.
  785. * @param object1 An object containing additional properties to merge in.
  786. * @param object2 An object containing additional properties to merge in.
  787. * @param object3 An object containing additional properties to merge in.
  788. * @param object4 An object containing additional properties to merge in.
  789. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  790. * @since 1.1.4
  791. * @example ​ ````Merge two objects recursively, modifying the first.
  792. ```html
  793. <!doctype html>
  794. <html lang="en">
  795. <head>
  796. <meta charset="utf-8">
  797. <title>jQuery.extend demo</title>
  798. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  799. </head>
  800. <body>
  801. <div id="log"></div>
  802. <script>
  803. var object1 = {
  804. apple: 0,
  805. banana: { weight: 52, price: 100 },
  806. cherry: 97
  807. };
  808. var object2 = {
  809. banana: { price: 200 },
  810. durian: 100
  811. };
  812. // Merge object2 into object1, recursively
  813. $.extend( true, object1, object2 );
  814. // Assuming JSON.stringify - not available in IE<8
  815. $( "#log" ).append( JSON.stringify( object1 ) );
  816. </script>
  817. </body>
  818. </html>
  819. ```
  820. */
  821. extend<T, U, V, W, X>(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
  822. /**
  823. * Merge the contents of two or more objects together into the first object.
  824. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  825. * @param target The object to extend. It will receive the new properties.
  826. * @param object1 An object containing additional properties to merge in.
  827. * @param object2 An object containing additional properties to merge in.
  828. * @param object3 An object containing additional properties to merge in.
  829. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  830. * @since 1.1.4
  831. * @example ​ ````Merge two objects recursively, modifying the first.
  832. ```html
  833. <!doctype html>
  834. <html lang="en">
  835. <head>
  836. <meta charset="utf-8">
  837. <title>jQuery.extend demo</title>
  838. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  839. </head>
  840. <body>
  841. <div id="log"></div>
  842. <script>
  843. var object1 = {
  844. apple: 0,
  845. banana: { weight: 52, price: 100 },
  846. cherry: 97
  847. };
  848. var object2 = {
  849. banana: { price: 200 },
  850. durian: 100
  851. };
  852. // Merge object2 into object1, recursively
  853. $.extend( true, object1, object2 );
  854. // Assuming JSON.stringify - not available in IE<8
  855. $( "#log" ).append( JSON.stringify( object1 ) );
  856. </script>
  857. </body>
  858. </html>
  859. ```
  860. */
  861. extend<T, U, V, W>(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W;
  862. /**
  863. * Merge the contents of two or more objects together into the first object.
  864. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  865. * @param target The object to extend. It will receive the new properties.
  866. * @param object1 An object containing additional properties to merge in.
  867. * @param object2 An object containing additional properties to merge in.
  868. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  869. * @since 1.1.4
  870. * @example ​ ````Merge two objects recursively, modifying the first.
  871. ```html
  872. <!doctype html>
  873. <html lang="en">
  874. <head>
  875. <meta charset="utf-8">
  876. <title>jQuery.extend demo</title>
  877. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  878. </head>
  879. <body>
  880. <div id="log"></div>
  881. <script>
  882. var object1 = {
  883. apple: 0,
  884. banana: { weight: 52, price: 100 },
  885. cherry: 97
  886. };
  887. var object2 = {
  888. banana: { price: 200 },
  889. durian: 100
  890. };
  891. // Merge object2 into object1, recursively
  892. $.extend( true, object1, object2 );
  893. // Assuming JSON.stringify - not available in IE<8
  894. $( "#log" ).append( JSON.stringify( object1 ) );
  895. </script>
  896. </body>
  897. </html>
  898. ```
  899. */
  900. extend<T, U, V>(deep: true, target: T, object1: U, object2: V): T & U & V;
  901. /**
  902. * Merge the contents of two or more objects together into the first object.
  903. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  904. * @param target The object to extend. It will receive the new properties.
  905. * @param object1 An object containing additional properties to merge in.
  906. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  907. * @since 1.1.4
  908. * @example ​ ````Merge two objects recursively, modifying the first.
  909. ```html
  910. <!doctype html>
  911. <html lang="en">
  912. <head>
  913. <meta charset="utf-8">
  914. <title>jQuery.extend demo</title>
  915. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  916. </head>
  917. <body>
  918. <div id="log"></div>
  919. <script>
  920. var object1 = {
  921. apple: 0,
  922. banana: { weight: 52, price: 100 },
  923. cherry: 97
  924. };
  925. var object2 = {
  926. banana: { price: 200 },
  927. durian: 100
  928. };
  929. // Merge object2 into object1, recursively
  930. $.extend( true, object1, object2 );
  931. // Assuming JSON.stringify - not available in IE<8
  932. $( "#log" ).append( JSON.stringify( object1 ) );
  933. </script>
  934. </body>
  935. </html>
  936. ```
  937. */
  938. extend<T, U>(deep: true, target: T, object1: U): T & U;
  939. /**
  940. * Merge the contents of two or more objects together into the first object.
  941. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  942. * @param target The object to extend. It will receive the new properties.
  943. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  944. * @since 1.1.4
  945. */
  946. extend<T>(deep: true, target: T): this & T;
  947. /**
  948. * Merge the contents of two or more objects together into the first object.
  949. * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
  950. * @param target The object to extend. It will receive the new properties.
  951. * @param object1 An object containing additional properties to merge in.
  952. * @param objectN Additional objects containing properties to merge in.
  953. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  954. * @since 1.1.4
  955. * @example ​ ````Merge two objects recursively, modifying the first.
  956. ```html
  957. <!doctype html>
  958. <html lang="en">
  959. <head>
  960. <meta charset="utf-8">
  961. <title>jQuery.extend demo</title>
  962. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  963. </head>
  964. <body>
  965. <div id="log"></div>
  966. <script>
  967. var object1 = {
  968. apple: 0,
  969. banana: { weight: 52, price: 100 },
  970. cherry: 97
  971. };
  972. var object2 = {
  973. banana: { price: 200 },
  974. durian: 100
  975. };
  976. // Merge object2 into object1, recursively
  977. $.extend( true, object1, object2 );
  978. // Assuming JSON.stringify - not available in IE<8
  979. $( "#log" ).append( JSON.stringify( object1 ) );
  980. </script>
  981. </body>
  982. </html>
  983. ```
  984. */
  985. extend(deep: true, target: any, object1: any, ...objectN: any[]): any;
  986. /**
  987. * Merge the contents of two or more objects together into the first object.
  988. * @param target An object that will receive the new properties if additional objects are passed in or that will
  989. * extend the jQuery namespace if it is the sole argument.
  990. * @param object1 An object containing additional properties to merge in.
  991. * @param object2 An object containing additional properties to merge in.
  992. * @param object3 An object containing additional properties to merge in.
  993. * @param object4 An object containing additional properties to merge in.
  994. * @param object5 An object containing additional properties to merge in.
  995. * @param object6 An object containing additional properties to merge in.
  996. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  997. * @since 1.0
  998. * @example ​ ````Merge two objects, modifying the first.
  999. ```html
  1000. <!doctype html>
  1001. <html lang="en">
  1002. <head>
  1003. <meta charset="utf-8">
  1004. <title>jQuery.extend demo</title>
  1005. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1006. </head>
  1007. <body>
  1008. <div id="log"></div>
  1009. <script>
  1010. var object1 = {
  1011. apple: 0,
  1012. banana: { weight: 52, price: 100 },
  1013. cherry: 97
  1014. };
  1015. var object2 = {
  1016. banana: { price: 200 },
  1017. durian: 100
  1018. };
  1019. // Merge object2 into object1
  1020. $.extend( object1, object2 );
  1021. // Assuming JSON.stringify - not available in IE<8
  1022. $( "#log" ).append( JSON.stringify( object1 ) );
  1023. </script>
  1024. </body>
  1025. </html>
  1026. ```
  1027. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1028. ```html
  1029. <!doctype html>
  1030. <html lang="en">
  1031. <head>
  1032. <meta charset="utf-8">
  1033. <title>jQuery.extend demo</title>
  1034. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1035. </head>
  1036. <body>
  1037. <div id="log"></div>
  1038. <script>
  1039. var defaults = { validate: false, limit: 5, name: "foo" };
  1040. var options = { validate: true, name: "bar" };
  1041. // Merge defaults and options, without modifying defaults
  1042. var settings = $.extend( {}, defaults, options );
  1043. // Assuming JSON.stringify - not available in IE<8
  1044. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1045. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1046. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1047. </script>
  1048. </body>
  1049. </html>
  1050. ```
  1051. */
  1052. extend<T, U, V, W, X, Y, Z>(
  1053. target: T,
  1054. object1: U,
  1055. object2: V,
  1056. object3: W,
  1057. object4: X,
  1058. object5: Y,
  1059. object6: Z,
  1060. ): T & U & V & W & X & Y & Z;
  1061. /**
  1062. * Merge the contents of two or more objects together into the first object.
  1063. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1064. * extend the jQuery namespace if it is the sole argument.
  1065. * @param object1 An object containing additional properties to merge in.
  1066. * @param object2 An object containing additional properties to merge in.
  1067. * @param object3 An object containing additional properties to merge in.
  1068. * @param object4 An object containing additional properties to merge in.
  1069. * @param object5 An object containing additional properties to merge in.
  1070. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1071. * @since 1.0
  1072. * @example ​ ````Merge two objects, modifying the first.
  1073. ```html
  1074. <!doctype html>
  1075. <html lang="en">
  1076. <head>
  1077. <meta charset="utf-8">
  1078. <title>jQuery.extend demo</title>
  1079. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1080. </head>
  1081. <body>
  1082. <div id="log"></div>
  1083. <script>
  1084. var object1 = {
  1085. apple: 0,
  1086. banana: { weight: 52, price: 100 },
  1087. cherry: 97
  1088. };
  1089. var object2 = {
  1090. banana: { price: 200 },
  1091. durian: 100
  1092. };
  1093. // Merge object2 into object1
  1094. $.extend( object1, object2 );
  1095. // Assuming JSON.stringify - not available in IE<8
  1096. $( "#log" ).append( JSON.stringify( object1 ) );
  1097. </script>
  1098. </body>
  1099. </html>
  1100. ```
  1101. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1102. ```html
  1103. <!doctype html>
  1104. <html lang="en">
  1105. <head>
  1106. <meta charset="utf-8">
  1107. <title>jQuery.extend demo</title>
  1108. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1109. </head>
  1110. <body>
  1111. <div id="log"></div>
  1112. <script>
  1113. var defaults = { validate: false, limit: 5, name: "foo" };
  1114. var options = { validate: true, name: "bar" };
  1115. // Merge defaults and options, without modifying defaults
  1116. var settings = $.extend( {}, defaults, options );
  1117. // Assuming JSON.stringify - not available in IE<8
  1118. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1119. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1120. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1121. </script>
  1122. </body>
  1123. </html>
  1124. ```
  1125. */
  1126. extend<T, U, V, W, X, Y>(
  1127. target: T,
  1128. object1: U,
  1129. object2: V,
  1130. object3: W,
  1131. object4: X,
  1132. object5: Y,
  1133. ): T & U & V & W & X & Y;
  1134. /**
  1135. * Merge the contents of two or more objects together into the first object.
  1136. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1137. * extend the jQuery namespace if it is the sole argument.
  1138. * @param object1 An object containing additional properties to merge in.
  1139. * @param object2 An object containing additional properties to merge in.
  1140. * @param object3 An object containing additional properties to merge in.
  1141. * @param object4 An object containing additional properties to merge in.
  1142. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1143. * @since 1.0
  1144. * @example ​ ````Merge two objects, modifying the first.
  1145. ```html
  1146. <!doctype html>
  1147. <html lang="en">
  1148. <head>
  1149. <meta charset="utf-8">
  1150. <title>jQuery.extend demo</title>
  1151. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1152. </head>
  1153. <body>
  1154. <div id="log"></div>
  1155. <script>
  1156. var object1 = {
  1157. apple: 0,
  1158. banana: { weight: 52, price: 100 },
  1159. cherry: 97
  1160. };
  1161. var object2 = {
  1162. banana: { price: 200 },
  1163. durian: 100
  1164. };
  1165. // Merge object2 into object1
  1166. $.extend( object1, object2 );
  1167. // Assuming JSON.stringify - not available in IE<8
  1168. $( "#log" ).append( JSON.stringify( object1 ) );
  1169. </script>
  1170. </body>
  1171. </html>
  1172. ```
  1173. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1174. ```html
  1175. <!doctype html>
  1176. <html lang="en">
  1177. <head>
  1178. <meta charset="utf-8">
  1179. <title>jQuery.extend demo</title>
  1180. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1181. </head>
  1182. <body>
  1183. <div id="log"></div>
  1184. <script>
  1185. var defaults = { validate: false, limit: 5, name: "foo" };
  1186. var options = { validate: true, name: "bar" };
  1187. // Merge defaults and options, without modifying defaults
  1188. var settings = $.extend( {}, defaults, options );
  1189. // Assuming JSON.stringify - not available in IE<8
  1190. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1191. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1192. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1193. </script>
  1194. </body>
  1195. </html>
  1196. ```
  1197. */
  1198. extend<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
  1199. /**
  1200. * Merge the contents of two or more objects together into the first object.
  1201. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1202. * extend the jQuery namespace if it is the sole argument.
  1203. * @param object1 An object containing additional properties to merge in.
  1204. * @param object2 An object containing additional properties to merge in.
  1205. * @param object3 An object containing additional properties to merge in.
  1206. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1207. * @since 1.0
  1208. * @example ​ ````Merge two objects, modifying the first.
  1209. ```html
  1210. <!doctype html>
  1211. <html lang="en">
  1212. <head>
  1213. <meta charset="utf-8">
  1214. <title>jQuery.extend demo</title>
  1215. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1216. </head>
  1217. <body>
  1218. <div id="log"></div>
  1219. <script>
  1220. var object1 = {
  1221. apple: 0,
  1222. banana: { weight: 52, price: 100 },
  1223. cherry: 97
  1224. };
  1225. var object2 = {
  1226. banana: { price: 200 },
  1227. durian: 100
  1228. };
  1229. // Merge object2 into object1
  1230. $.extend( object1, object2 );
  1231. // Assuming JSON.stringify - not available in IE<8
  1232. $( "#log" ).append( JSON.stringify( object1 ) );
  1233. </script>
  1234. </body>
  1235. </html>
  1236. ```
  1237. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1238. ```html
  1239. <!doctype html>
  1240. <html lang="en">
  1241. <head>
  1242. <meta charset="utf-8">
  1243. <title>jQuery.extend demo</title>
  1244. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1245. </head>
  1246. <body>
  1247. <div id="log"></div>
  1248. <script>
  1249. var defaults = { validate: false, limit: 5, name: "foo" };
  1250. var options = { validate: true, name: "bar" };
  1251. // Merge defaults and options, without modifying defaults
  1252. var settings = $.extend( {}, defaults, options );
  1253. // Assuming JSON.stringify - not available in IE<8
  1254. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1255. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1256. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1257. </script>
  1258. </body>
  1259. </html>
  1260. ```
  1261. */
  1262. extend<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W;
  1263. /**
  1264. * Merge the contents of two or more objects together into the first object.
  1265. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1266. * extend the jQuery namespace if it is the sole argument.
  1267. * @param object1 An object containing additional properties to merge in.
  1268. * @param object2 An object containing additional properties to merge in.
  1269. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1270. * @since 1.0
  1271. * @example ​ ````Merge two objects, modifying the first.
  1272. ```html
  1273. <!doctype html>
  1274. <html lang="en">
  1275. <head>
  1276. <meta charset="utf-8">
  1277. <title>jQuery.extend demo</title>
  1278. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1279. </head>
  1280. <body>
  1281. <div id="log"></div>
  1282. <script>
  1283. var object1 = {
  1284. apple: 0,
  1285. banana: { weight: 52, price: 100 },
  1286. cherry: 97
  1287. };
  1288. var object2 = {
  1289. banana: { price: 200 },
  1290. durian: 100
  1291. };
  1292. // Merge object2 into object1
  1293. $.extend( object1, object2 );
  1294. // Assuming JSON.stringify - not available in IE<8
  1295. $( "#log" ).append( JSON.stringify( object1 ) );
  1296. </script>
  1297. </body>
  1298. </html>
  1299. ```
  1300. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1301. ```html
  1302. <!doctype html>
  1303. <html lang="en">
  1304. <head>
  1305. <meta charset="utf-8">
  1306. <title>jQuery.extend demo</title>
  1307. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1308. </head>
  1309. <body>
  1310. <div id="log"></div>
  1311. <script>
  1312. var defaults = { validate: false, limit: 5, name: "foo" };
  1313. var options = { validate: true, name: "bar" };
  1314. // Merge defaults and options, without modifying defaults
  1315. var settings = $.extend( {}, defaults, options );
  1316. // Assuming JSON.stringify - not available in IE<8
  1317. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1318. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1319. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1320. </script>
  1321. </body>
  1322. </html>
  1323. ```
  1324. */
  1325. extend<T, U, V>(target: T, object1: U, object2: V): T & U & V;
  1326. /**
  1327. * Merge the contents of two or more objects together into the first object.
  1328. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1329. * extend the jQuery namespace if it is the sole argument.
  1330. * @param object1 An object containing additional properties to merge in.
  1331. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1332. * @since 1.0
  1333. * @example ​ ````Merge two objects, modifying the first.
  1334. ```html
  1335. <!doctype html>
  1336. <html lang="en">
  1337. <head>
  1338. <meta charset="utf-8">
  1339. <title>jQuery.extend demo</title>
  1340. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1341. </head>
  1342. <body>
  1343. <div id="log"></div>
  1344. <script>
  1345. var object1 = {
  1346. apple: 0,
  1347. banana: { weight: 52, price: 100 },
  1348. cherry: 97
  1349. };
  1350. var object2 = {
  1351. banana: { price: 200 },
  1352. durian: 100
  1353. };
  1354. // Merge object2 into object1
  1355. $.extend( object1, object2 );
  1356. // Assuming JSON.stringify - not available in IE<8
  1357. $( "#log" ).append( JSON.stringify( object1 ) );
  1358. </script>
  1359. </body>
  1360. </html>
  1361. ```
  1362. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1363. ```html
  1364. <!doctype html>
  1365. <html lang="en">
  1366. <head>
  1367. <meta charset="utf-8">
  1368. <title>jQuery.extend demo</title>
  1369. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1370. </head>
  1371. <body>
  1372. <div id="log"></div>
  1373. <script>
  1374. var defaults = { validate: false, limit: 5, name: "foo" };
  1375. var options = { validate: true, name: "bar" };
  1376. // Merge defaults and options, without modifying defaults
  1377. var settings = $.extend( {}, defaults, options );
  1378. // Assuming JSON.stringify - not available in IE<8
  1379. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1380. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1381. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1382. </script>
  1383. </body>
  1384. </html>
  1385. ```
  1386. */
  1387. extend<T, U>(target: T, object1: U): T & U;
  1388. /**
  1389. * Merge the contents of two or more objects together into the first object.
  1390. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1391. * extend the jQuery namespace if it is the sole argument.
  1392. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1393. * @since 1.0
  1394. */
  1395. extend<T>(target: T): this & T;
  1396. /**
  1397. * Merge the contents of two or more objects together into the first object.
  1398. * @param target An object that will receive the new properties if additional objects are passed in or that will
  1399. * extend the jQuery namespace if it is the sole argument.
  1400. * @param object1 An object containing additional properties to merge in.
  1401. * @param objectN Additional objects containing properties to merge in.
  1402. * @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
  1403. * @since 1.0
  1404. * @example ​ ````Merge two objects, modifying the first.
  1405. ```html
  1406. <!doctype html>
  1407. <html lang="en">
  1408. <head>
  1409. <meta charset="utf-8">
  1410. <title>jQuery.extend demo</title>
  1411. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1412. </head>
  1413. <body>
  1414. <div id="log"></div>
  1415. <script>
  1416. var object1 = {
  1417. apple: 0,
  1418. banana: { weight: 52, price: 100 },
  1419. cherry: 97
  1420. };
  1421. var object2 = {
  1422. banana: { price: 200 },
  1423. durian: 100
  1424. };
  1425. // Merge object2 into object1
  1426. $.extend( object1, object2 );
  1427. // Assuming JSON.stringify - not available in IE<8
  1428. $( "#log" ).append( JSON.stringify( object1 ) );
  1429. </script>
  1430. </body>
  1431. </html>
  1432. ```
  1433. * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.
  1434. ```html
  1435. <!doctype html>
  1436. <html lang="en">
  1437. <head>
  1438. <meta charset="utf-8">
  1439. <title>jQuery.extend demo</title>
  1440. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1441. </head>
  1442. <body>
  1443. <div id="log"></div>
  1444. <script>
  1445. var defaults = { validate: false, limit: 5, name: "foo" };
  1446. var options = { validate: true, name: "bar" };
  1447. // Merge defaults and options, without modifying defaults
  1448. var settings = $.extend( {}, defaults, options );
  1449. // Assuming JSON.stringify - not available in IE<8
  1450. $( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
  1451. $( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
  1452. $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
  1453. </script>
  1454. </body>
  1455. </html>
  1456. ```
  1457. */
  1458. extend(target: any, object1: any, ...objectN: any[]): any;
  1459. /**
  1460. * Load data from the server using a HTTP GET request.
  1461. * @param url A string containing the URL to which the request is sent.
  1462. * @param data A plain object or string that is sent to the server with the request.
  1463. * @param success A callback function that is executed if the request succeeds. Required if `dataType` is provided,
  1464. * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder.
  1465. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  1466. * @see \`{@link https://api.jquery.com/jQuery.get/ }\`
  1467. * @since 1.0
  1468. */
  1469. get(
  1470. url: string,
  1471. data: JQuery.PlainObject | string,
  1472. success: JQuery.jqXHR.DoneCallback | null,
  1473. dataType?: string,
  1474. ): JQuery.jqXHR;
  1475. /**
  1476. * Load data from the server using a HTTP GET request.
  1477. * @param url A string containing the URL to which the request is sent.
  1478. * @param success_data _&#x40;param_ `success_data`
  1479. * <br>
  1480. * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided,
  1481. * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder. <br>
  1482. * * `data` — A plain object or string that is sent to the server with the request.
  1483. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  1484. * @see \`{@link https://api.jquery.com/jQuery.get/ }\`
  1485. * @since 1.0
  1486. * @example ​ ````Get the test.php page contents, which has been returned in json format (&lt;?php echo json_encode( array( &quot;name&quot;=&gt;&quot;John&quot;,&quot;time&quot;=&gt;&quot;2pm&quot; ) ); ?&gt;), and add it to the page.
  1487. ```javascript
  1488. $.get( "test.php", function( data ) {
  1489. $( "body" )
  1490. .append( "Name: " + data.name ) // John
  1491. .append( "Time: " + data.time ); // 2pm
  1492. }, "json" );
  1493. ```
  1494. */
  1495. get(
  1496. url: string,
  1497. data_success: JQuery.PlainObject | string | JQuery.jqXHR.DoneCallback | null,
  1498. dataType: string,
  1499. ): JQuery.jqXHR;
  1500. /**
  1501. * Load data from the server using a HTTP GET request.
  1502. * @param url A string containing the URL to which the request is sent.
  1503. * @param success_data _&#x40;param_ `success_data`
  1504. * <br>
  1505. * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided,
  1506. * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder. <br>
  1507. * * `data` — A plain object or string that is sent to the server with the request.
  1508. * @see \`{@link https://api.jquery.com/jQuery.get/ }\`
  1509. * @since 1.0
  1510. * @example ​ ````Request the test.php page and send some additional data along (while still ignoring the return results).
  1511. ```javascript
  1512. $.get( "test.php", { name: "John", time: "2pm" } );
  1513. ```
  1514. * @example ​ ````Pass arrays of data to the server (while still ignoring the return results).
  1515. ```javascript
  1516. $.get( "test.php", { "choices[]": ["Jon", "Susan"] } );
  1517. ```
  1518. * @example ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned).
  1519. ```javascript
  1520. $.get( "test.php", function( data ) {
  1521. alert( "Data Loaded: " + data );
  1522. });
  1523. ```
  1524. * @example ​ ````Alert the results from requesting test.cgi with an additional payload of data (HTML or XML, depending on what was returned).
  1525. ```javascript
  1526. $.get( "test.cgi", { name: "John", time: "2pm" } )
  1527. .done(function( data ) {
  1528. alert( "Data Loaded: " + data );
  1529. });
  1530. ```
  1531. */
  1532. get(url: string, success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR;
  1533. /**
  1534. * Load data from the server using a HTTP GET request.
  1535. * @param url_settings _&#x40;param_ `url_settings`
  1536. * <br>
  1537. * * `url` — A string containing the URL to which the request is sent. <br>
  1538. * * `settings` — A set of key/value pairs that configure the Ajax request. All properties except for `url` are
  1539. * optional. A default can be set for any option with \`{@link ajaxSetup $.ajaxSetup()}\`. See \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings jQuery.ajax( settings )}\`
  1540. * for a complete list of all settings. The type option will automatically be set to `GET`.
  1541. * @see \`{@link https://api.jquery.com/jQuery.get/ }\`
  1542. * @since 1.0
  1543. * @since 1.12
  1544. * @since 2.2
  1545. * @example ​ ````Request the test.php page, but ignore the return results.
  1546. ```javascript
  1547. $.get( "test.php" );
  1548. ```
  1549. */
  1550. get(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR;
  1551. /**
  1552. * Load JSON-encoded data from the server using a GET HTTP request.
  1553. * @param url A string containing the URL to which the request is sent.
  1554. * @param data A plain object or string that is sent to the server with the request.
  1555. * @param success A callback function that is executed if the request succeeds.
  1556. * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\`
  1557. * @since 1.0
  1558. */
  1559. getJSON(url: string, data: JQuery.PlainObject | string, success: JQuery.jqXHR.DoneCallback): JQuery.jqXHR;
  1560. /**
  1561. * Load JSON-encoded data from the server using a GET HTTP request.
  1562. * @param url A string containing the URL to which the request is sent.
  1563. * @param success_data _&#x40;param_ `url_settings`
  1564. * <br>
  1565. * * `success` — A callback function that is executed if the request succeeds. <br>
  1566. * * `data` — A plain object or string that is sent to the server with the request.
  1567. * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\`
  1568. * @since 1.0
  1569. * @example ​ ````Loads the four most recent pictures of Mount Rainier from the Flickr JSONP API.
  1570. ```html
  1571. <!doctype html>
  1572. <html lang="en">
  1573. <head>
  1574. <meta charset="utf-8">
  1575. <title>jQuery.getJSON demo</title>
  1576. <style>
  1577. img {
  1578. height: 100px;
  1579. float: left;
  1580. }
  1581. </style>
  1582. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1583. </head>
  1584. <body>
  1585. <div id="images"></div>
  1586. <script>
  1587. (function() {
  1588. var flickerAPI = "https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
  1589. $.getJSON( flickerAPI, {
  1590. tags: "mount rainier",
  1591. tagmode: "any",
  1592. format: "json"
  1593. })
  1594. .done(function( data ) {
  1595. $.each( data.items, function( i, item ) {
  1596. $( "<img>" ).attr( "src", item.media.m ).appendTo( "#images" );
  1597. if ( i === 3 ) {
  1598. return false;
  1599. }
  1600. });
  1601. });
  1602. })();
  1603. </script>
  1604. </body>
  1605. </html>
  1606. ```
  1607. * @example ​ ````Load the JSON data from test.js and access a name from the returned JSON data.
  1608. ```javascript
  1609. $.getJSON( "test.js", function( json ) {
  1610. console.log( "JSON Data: " + json.users[ 3 ].name );
  1611. });
  1612. ```
  1613. * @example ​ ````Load the JSON data from test.js, passing along additional data, and access a name from the returned JSON data.
  1614. If an error occurs, log an error message instead.
  1615. ```javascript
  1616. $.getJSON( "test.js", { name: "John", time: "2pm" } )
  1617. .done(function( json ) {
  1618. console.log( "JSON Data: " + json.users[ 3 ].name );
  1619. })
  1620. .fail(function( jqxhr, textStatus, error ) {
  1621. var err = textStatus + ", " + error;
  1622. console.log( "Request Failed: " + err );
  1623. });
  1624. ```
  1625. */
  1626. getJSON(url: string, success_data?: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR;
  1627. /**
  1628. * Load a JavaScript file from the server using a GET HTTP request, then execute it.
  1629. * @param url A string containing the URL to which the request is sent.
  1630. * @param success A callback function that is executed if the request succeeds.
  1631. * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\`
  1632. * @since 1.0
  1633. * @example ​ ````Define a $.cachedScript() method that allows fetching a cached script:
  1634. ```javascript
  1635. jQuery.cachedScript = function( url, options ) {
  1636. // Allow user to set any option except for dataType, cache, and url
  1637. options = $.extend( options || {}, {
  1638. dataType: "script",
  1639. cache: true,
  1640. url: url
  1641. });
  1642. // Use $.ajax() since it is more flexible than $.getScript
  1643. // Return the jqXHR object so we can chain callbacks
  1644. return jQuery.ajax( options );
  1645. };
  1646. // Usage
  1647. $.cachedScript( "ajax/test.js" ).done(function( script, textStatus ) {
  1648. console.log( textStatus );
  1649. });
  1650. ```
  1651. * @example ​ ````Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded.
  1652. ```html
  1653. <!doctype html>
  1654. <html lang="en">
  1655. <head>
  1656. <meta charset="utf-8">
  1657. <title>jQuery.getScript demo</title>
  1658. <style>
  1659. .block {
  1660. background-color: blue;
  1661. width: 150px;
  1662. height: 70px;
  1663. margin: 10px;
  1664. }
  1665. </style>
  1666. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1667. </head>
  1668. <body>
  1669. <button id="go">&raquo; Run</button>
  1670. <div class="block"></div>
  1671. <script>
  1672. var url = "https://code.jquery.com/color/jquery.color.js";
  1673. $.getScript( url, function() {
  1674. $( "#go" ).click(function() {
  1675. $( ".block" )
  1676. .animate({
  1677. backgroundColor: "rgb(255, 180, 180)"
  1678. }, 1000 )
  1679. .delay( 500 )
  1680. .animate({
  1681. backgroundColor: "olive"
  1682. }, 1000 )
  1683. .delay( 500 )
  1684. .animate({
  1685. backgroundColor: "#00f"
  1686. }, 1000 );
  1687. });
  1688. });
  1689. </script>
  1690. </body>
  1691. </html>
  1692. ```
  1693. */
  1694. getScript(url: string, success?: JQuery.jqXHR.DoneCallback<string | undefined>): JQuery.jqXHR<string | undefined>;
  1695. /**
  1696. * Load a JavaScript file from the server using a GET HTTP request, then execute it.
  1697. * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\`
  1698. * @since 1.12
  1699. * @since 2.2
  1700. */
  1701. getScript(options: JQuery.UrlAjaxSettings): JQuery.jqXHR<string | undefined>;
  1702. /**
  1703. * Execute some JavaScript code globally.
  1704. * @param code The JavaScript code to execute.
  1705. * @see \`{@link https://api.jquery.com/jQuery.globalEval/ }\`
  1706. * @since 1.0.4
  1707. * @example ​ ````Execute a script in the global context.
  1708. ```javascript
  1709. function test() {
  1710. jQuery.globalEval( "var newVar = true;" )
  1711. }
  1712. test();
  1713. // newVar === true
  1714. ```
  1715. */
  1716. globalEval(code: string): void;
  1717. /**
  1718. * Finds the elements of an array which satisfy a filter function. The original array is not affected.
  1719. * @param array The array-like object to search through.
  1720. * @param funсtion The function to process each item against. The first argument to the function is the item, and the
  1721. * second argument is the index. The function should return a Boolean value. `this` will be the global
  1722. * window object.
  1723. * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements
  1724. * for which "callback" returns true. If "invert" is true, then the function returns an array
  1725. * consisting of all elements for which "callback" returns false.
  1726. * @see \`{@link https://api.jquery.com/jQuery.grep/ }\`
  1727. * @since 1.0
  1728. * @example ​ ````Filters the original array of numbers leaving that are not 5 and have an index greater than 4. Then it removes all 9s.
  1729. ```html
  1730. <!doctype html>
  1731. <html lang="en">
  1732. <head>
  1733. <meta charset="utf-8">
  1734. <title>jQuery.grep demo</title>
  1735. <style>
  1736. div {
  1737. color: blue;
  1738. }
  1739. p {
  1740. color: green;
  1741. margin: 0;
  1742. }
  1743. span {
  1744. color: red;
  1745. }
  1746. </style>
  1747. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1748. </head>
  1749. <body>
  1750. <div></div>
  1751. <p></p>
  1752. <span></span>
  1753. <script>
  1754. var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
  1755. $( "div" ).text( arr.join( ", " ) );
  1756. arr = jQuery.grep(arr, function( n, i ) {
  1757. return ( n !== 5 && i > 4 );
  1758. });
  1759. $( "p" ).text( arr.join( ", " ) );
  1760. arr = jQuery.grep(arr, function( a ) {
  1761. return a !== 9;
  1762. });
  1763. $( "span" ).text( arr.join( ", " ) );
  1764. </script>
  1765. </body>
  1766. </html>
  1767. ```
  1768. * @example ​ ````Filter an array of numbers to include only numbers bigger then zero.
  1769. ```javascript
  1770. $.grep( [ 0, 1, 2 ], function( n, i ) {
  1771. return n > 0;
  1772. });
  1773. ```
  1774. * @example ​ ````Filter an array of numbers to include numbers that are not bigger than zero.
  1775. ```javascript
  1776. $.grep( [ 0, 1, 2 ], function( n, i ) {
  1777. return n > 0;
  1778. }, true );
  1779. ```
  1780. */
  1781. grep<T>(array: ArrayLike<T>, funсtion: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[];
  1782. /**
  1783. * Determine whether an element has any jQuery data associated with it.
  1784. * @param element A DOM element to be checked for data.
  1785. * @see \`{@link https://api.jquery.com/jQuery.hasData/ }\`
  1786. * @since 1.5
  1787. * @example ​ ````Set data on an element and see the results of hasData.
  1788. ```html
  1789. <!doctype html>
  1790. <html lang="en">
  1791. <head>
  1792. <meta charset="utf-8">
  1793. <title>jQuery.hasData demo</title>
  1794. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1795. </head>
  1796. <body>
  1797. <p>Results: </p>
  1798. <script>
  1799. var $p = jQuery( "p" ), p = $p[ 0 ];
  1800. $p.append( jQuery.hasData( p ) + " " ); // false
  1801. $.data( p, "testing", 123 );
  1802. $p.append( jQuery.hasData( p ) + " " ); // true
  1803. $.removeData( p, "testing" );
  1804. $p.append( jQuery.hasData( p ) + " " ); // false
  1805. $p.on( "click", function() {} );
  1806. $p.append( jQuery.hasData( p ) + " " ); // true
  1807. $p.off( "click" );
  1808. $p.append( jQuery.hasData( p ) + " " ); // false
  1809. </script>
  1810. </body>
  1811. </html>
  1812. ```
  1813. */
  1814. hasData(element: Element | Document | Window | JQuery.PlainObject): boolean;
  1815. /**
  1816. * Holds or releases the execution of jQuery's ready event.
  1817. * @param hold Indicates whether the ready hold is being requested or released
  1818. * @see \`{@link https://api.jquery.com/jQuery.holdReady/ }\`
  1819. * @since 1.6
  1820. * @deprecated ​ Deprecated since 3.2. See \`{@link https://github.com/jquery/jquery/issues/3288 }\`.
  1821. *
  1822. * **Cause**: The `jQuery.holdReady()` method has been deprecated due to its detrimental effect on the global performance of the page. This method can prevent all the code on the page from initializing for extended lengths of time.
  1823. *
  1824. * **Solution**: Rewrite the page so that it does not require all jQuery ready handlers to be delayed. This might be accomplished, for example, by late-loading only the code that requires the delay when it is safe to run. Due to the complexity of this method, jQuery Migrate does not attempt to fill the functionality. If the underlying version of jQuery used with jQuery Migrate no longer contains `jQuery.holdReady()` the code will fail shortly after this warning appears.
  1825. * @example ​ ````Delay the ready event until a custom plugin has loaded.
  1826. ```javascript
  1827. $.holdReady( true );
  1828. $.getScript( "myplugin.js", function() {
  1829. $.holdReady( false );
  1830. });
  1831. ```
  1832. */
  1833. holdReady(hold: boolean): void;
  1834. /**
  1835. * Modify and filter HTML strings passed through jQuery manipulation methods.
  1836. * @param html The HTML string on which to operate.
  1837. * @see \`{@link https://api.jquery.com/jQuery.htmlPrefilter/ }\`
  1838. * @since 1.12
  1839. * @since 2.2
  1840. */
  1841. htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString;
  1842. /**
  1843. * Search for a specified value within an array and return its index (or -1 if not found).
  1844. * @param value The value to search for.
  1845. * @param array An array through which to search.
  1846. * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array.
  1847. * @see \`{@link https://api.jquery.com/jQuery.inArray/ }\`
  1848. * @since 1.2
  1849. * @example ​ ````Report the index of some elements in the array.
  1850. ```html
  1851. <!doctype html>
  1852. <html lang="en">
  1853. <head>
  1854. <meta charset="utf-8">
  1855. <title>jQuery.inArray demo</title>
  1856. <style>
  1857. div {
  1858. color: blue;
  1859. }
  1860. span {
  1861. color: red;
  1862. }
  1863. </style>
  1864. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1865. </head>
  1866. <body>
  1867. <div>"John" found at <span></span></div>
  1868. <div>4 found at <span></span></div>
  1869. <div>"Karl" not found, so <span></span></div>
  1870. <div>"Pete" is in the array, but not at or after index 2, so <span></span></div>
  1871. <script>
  1872. var arr = [ 4, "Pete", 8, "John" ];
  1873. var $spans = $( "span" );
  1874. $spans.eq( 0 ).text( jQuery.inArray( "John", arr ) );
  1875. $spans.eq( 1 ).text( jQuery.inArray( 4, arr ) );
  1876. $spans.eq( 2 ).text( jQuery.inArray( "Karl", arr ) );
  1877. $spans.eq( 3 ).text( jQuery.inArray( "Pete", arr, 2 ) );
  1878. </script>
  1879. </body>
  1880. </html>
  1881. ```
  1882. */
  1883. inArray<T>(value: T, array: T[], fromIndex?: number): number;
  1884. /**
  1885. * Determine whether the argument is an array.
  1886. * @param obj Object to test whether or not it is an array.
  1887. * @see \`{@link https://api.jquery.com/jQuery.isArray/ }\`
  1888. * @since 1.3
  1889. * @deprecated ​ Deprecated since 3.2. Use \`{@link ArrayConstructor.isArray Array.isArray}\`.
  1890. * @example ​ ````Finds out if the parameter is an array.
  1891. ```html
  1892. <!doctype html>
  1893. <html lang="en">
  1894. <head>
  1895. <meta charset="utf-8">
  1896. <title>jQuery.isArray demo</title>
  1897. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1898. </head>
  1899. <body>
  1900. Is [] an Array? <b></b>
  1901. <script>
  1902. $( "b" ).append( "" + $.isArray([]) );
  1903. </script>
  1904. </body>
  1905. </html>
  1906. ```
  1907. */
  1908. isArray(obj: any): obj is any[];
  1909. /**
  1910. * Check to see if an object is empty (contains no enumerable properties).
  1911. * @param obj The object that will be checked to see if it's empty.
  1912. * @see \`{@link https://api.jquery.com/jQuery.isEmptyObject/ }\`
  1913. * @since 1.4
  1914. * @example ​ ````Check an object to see if it&#39;s empty.
  1915. ```javascript
  1916. jQuery.isEmptyObject({}); // true
  1917. jQuery.isEmptyObject({ foo: "bar" }); // false
  1918. ```
  1919. */
  1920. isEmptyObject(obj: any): boolean;
  1921. /**
  1922. * Determine if the argument passed is a JavaScript function object.
  1923. * @param obj Object to test whether or not it is a function.
  1924. * @see \`{@link https://api.jquery.com/jQuery.isFunction/ }\`
  1925. * @since 1.2
  1926. * @deprecated ​ Deprecated since 3.3. Use `typeof x === "function"`.
  1927. * @example ​ ````Test a few parameter examples.
  1928. ```html
  1929. <!doctype html>
  1930. <html lang="en">
  1931. <head>
  1932. <meta charset="utf-8">
  1933. <title>jQuery.isFunction demo</title>
  1934. <style>
  1935. div {
  1936. color: blue;
  1937. margin: 2px;
  1938. font-size: 14px;
  1939. }
  1940. span {
  1941. color: red;
  1942. }
  1943. </style>
  1944. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1945. </head>
  1946. <body>
  1947. <div>jQuery.isFunction( objs[ 0 ] ) = <span></span></div>
  1948. <div>jQuery.isFunction( objs[ 1 ] ) = <span></span></div>
  1949. <div>jQuery.isFunction( objs[ 2 ] ) = <span></span></div>
  1950. <div>jQuery.isFunction( objs[ 3 ] ) = <span></span></div>
  1951. <div>jQuery.isFunction( objs[ 4 ] ) = <span></span></div>
  1952. <script>
  1953. function stub() {}
  1954. var objs = [
  1955. function() {},
  1956. { x:15, y:20 },
  1957. null,
  1958. stub,
  1959. "function"
  1960. ];
  1961. jQuery.each( objs, function( i ) {
  1962. var isFunc = jQuery.isFunction( objs[ i ]);
  1963. $( "span" ).eq( i ).text( isFunc );
  1964. });
  1965. </script>
  1966. </body>
  1967. </html>
  1968. ```
  1969. * @example ​ ````Finds out if the parameter is a function.
  1970. ```javascript
  1971. $.isFunction(function() {});
  1972. ```
  1973. */
  1974. // eslint-disable-next-line @typescript-eslint/ban-types
  1975. isFunction(obj: any): obj is Function;
  1976. /**
  1977. * Determines whether its argument represents a JavaScript number.
  1978. * @param value The value to be tested.
  1979. * @see \`{@link https://api.jquery.com/jQuery.isNumeric/ }\`
  1980. * @since 1.7
  1981. * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/2960 }\`.
  1982. * @example ​ ````Sample return values of $.isNumeric with various inputs.
  1983. ```javascript
  1984. // true (numeric)
  1985. $.isNumeric( "-10" )
  1986. $.isNumeric( "0" )
  1987. $.isNumeric( 0xFF )
  1988. $.isNumeric( "0xFF" )
  1989. $.isNumeric( "8e5" )
  1990. $.isNumeric( "3.1415" )
  1991. $.isNumeric( +10 )
  1992. $.isNumeric( 0144 )
  1993. // false (non-numeric)
  1994. $.isNumeric( "-0x42" )
  1995. $.isNumeric( "7.2acdgs" )
  1996. $.isNumeric( "" )
  1997. $.isNumeric( {} )
  1998. $.isNumeric( NaN )
  1999. $.isNumeric( null )
  2000. $.isNumeric( true )
  2001. $.isNumeric( Infinity )
  2002. $.isNumeric( undefined )
  2003. ```
  2004. */
  2005. isNumeric(value: any): boolean;
  2006. /**
  2007. * Check to see if an object is a plain object (created using "{}" or "new Object").
  2008. * @param obj The object that will be checked to see if it's a plain object.
  2009. * @see \`{@link https://api.jquery.com/jQuery.isPlainObject/ }\`
  2010. * @since 1.4
  2011. * @example ​ ````Check an object to see if it&#39;s a plain object.
  2012. ```javascript
  2013. jQuery.isPlainObject({}) // true
  2014. jQuery.isPlainObject( "test" ) // false
  2015. ```
  2016. */
  2017. isPlainObject(obj: any): boolean;
  2018. /**
  2019. * Determine whether the argument is a window.
  2020. * @param obj Object to test whether or not it is a window.
  2021. * @see \`{@link https://api.jquery.com/jQuery.isWindow/ }\`
  2022. * @since 1.4.3
  2023. * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3629 }\`.
  2024. *
  2025. * **Cause**: This method returns `true` if its argument is thought to be a `window` element. It was created for internal use and is not a reliable way of detecting `window` for public needs.
  2026. *
  2027. * **Solution**: Remove any use of `jQuery.isWindow()` from code. If it is truly needed it can be replaced with a check for `obj != null && obj === obj.window` which was the test used inside this method.
  2028. * @example ​ ````Finds out if the parameter is a window.
  2029. ```html
  2030. <!doctype html>
  2031. <html lang="en">
  2032. <head>
  2033. <meta charset="utf-8">
  2034. <title>jQuery.isWindow demo</title>
  2035. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2036. </head>
  2037. <body>
  2038. Is 'window' a window? <b></b>
  2039. <script>
  2040. $( "b" ).append( "" + $.isWindow( window ) );
  2041. </script>
  2042. </body>
  2043. </html>
  2044. ```
  2045. */
  2046. isWindow(obj: any): obj is Window;
  2047. /**
  2048. * Check to see if a DOM node is within an XML document (or is an XML document).
  2049. * @param node The DOM node that will be checked to see if it's in an XML document.
  2050. * @see \`{@link https://api.jquery.com/jQuery.isXMLDoc/ }\`
  2051. * @since 1.1.4
  2052. * @example ​ ````Check an object to see if it&#39;s in an XML document.
  2053. ```javascript
  2054. jQuery.isXMLDoc( document ) // false
  2055. jQuery.isXMLDoc( document.body ) // false
  2056. ```
  2057. */
  2058. isXMLDoc(node: Node): boolean;
  2059. /**
  2060. * Convert an array-like object into a true JavaScript array.
  2061. * @param obj Any object to turn into a native Array.
  2062. * @see \`{@link https://api.jquery.com/jQuery.makeArray/ }\`
  2063. * @since 1.2
  2064. * @example ​ ````Turn a collection of HTMLElements into an Array of them.
  2065. ```html
  2066. <!doctype html>
  2067. <html lang="en">
  2068. <head>
  2069. <meta charset="utf-8">
  2070. <title>jQuery.makeArray demo</title>
  2071. <style>
  2072. div {
  2073. color: red;
  2074. }
  2075. </style>
  2076. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2077. </head>
  2078. <body>
  2079. <div>First</div>
  2080. <div>Second</div>
  2081. <div>Third</div>
  2082. <div>Fourth</div>
  2083. <script>
  2084. // Returns a NodeList
  2085. var elems = document.getElementsByTagName( "div" );
  2086. // Convert the NodeList to an Array
  2087. var arr = jQuery.makeArray( elems );
  2088. // Use an Array method on list of dom elements
  2089. arr.reverse();
  2090. $( arr ).appendTo( document.body );
  2091. </script>
  2092. </body>
  2093. </html>
  2094. ```
  2095. * @example ​ ````Turn a jQuery object into an array
  2096. ```javascript
  2097. var obj = $( "li" );
  2098. var arr = $.makeArray( obj );
  2099. ```
  2100. */
  2101. makeArray<T>(obj: ArrayLike<T>): T[];
  2102. /**
  2103. * Translate all items in an array or object to new array of items.
  2104. * @param array The Array to translate.
  2105. * @param callback The function to process each item against. The first argument to the function is the array item, the
  2106. * second argument is the index in array The function can return any value. A returned array will be
  2107. * flattened into the resulting array. Within the function, this refers to the global (window) object.
  2108. * @see \`{@link https://api.jquery.com/jQuery.map/ }\`
  2109. * @since 1.0
  2110. * @example ​ ````Use $.map() to change the values of an array.
  2111. ```html
  2112. <!doctype html>
  2113. <html lang="en">
  2114. <head>
  2115. <meta charset="utf-8">
  2116. <title>jQuery.map demo</title>
  2117. <style>
  2118. div {
  2119. color: blue;
  2120. }
  2121. p {
  2122. color: green;
  2123. margin: 0;
  2124. }
  2125. span {
  2126. color: red;
  2127. }
  2128. </style>
  2129. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2130. </head>
  2131. <body>
  2132. <div></div>
  2133. <p></p>
  2134. <span></span>
  2135. <script>
  2136. var arr = [ "a", "b", "c", "d", "e" ];
  2137. $( "div" ).text( arr.join( ", " ) );
  2138. arr = jQuery.map( arr, function( n, i ) {
  2139. return ( n.toUpperCase() + i );
  2140. });
  2141. $( "p" ).text( arr.join( ", " ) );
  2142. arr = jQuery.map( arr, function( a ) {
  2143. return a + a;
  2144. });
  2145. $( "span" ).text( arr.join( ", " ) );
  2146. </script>
  2147. </body>
  2148. </html>
  2149. ```
  2150. * @example ​ ````Map the original array to a new one and add 4 to each value.
  2151. ```javascript
  2152. $.map( [ 0, 1, 2 ], function( n ) {
  2153. return n + 4;
  2154. });
  2155. ```
  2156. * @example ​ ````Map the original array to a new one, adding 1 to each value if it is bigger then zero and removing it if not.
  2157. ```javascript
  2158. $.map( [ 0, 1, 2 ], function( n ) {
  2159. return n > 0 ? n + 1 : null;
  2160. });
  2161. ```
  2162. * @example ​ ````Map the original array to a new one; each element is added with its original value and the value plus one.
  2163. ```javascript
  2164. $.map( [ 0, 1, 2 ], function( n ) {
  2165. return [ n, n + 1 ];
  2166. });
  2167. ```
  2168. * @example ​ ````Map the original array to a new one; each element is squared.
  2169. ```javascript
  2170. $.map( [ 0, 1, 2, 3 ], function( a ) {
  2171. return a * a;
  2172. });
  2173. ```
  2174. * @example ​ ````Map the original array to a new one, removing numbers less than 50 by returning null and subtracting 45 from the rest.
  2175. ```javascript
  2176. $.map( [ 0, 1, 52, 97 ], function( a ) {
  2177. return (a > 50 ? a - 45 : null);
  2178. });
  2179. ```
  2180. * @example ​ ````Augment the resulting array by returning an array inside the function.
  2181. ```javascript
  2182. var array = [ 0, 1, 52, 97 ];
  2183. array = $.map( array, function( a, index ) {
  2184. return [ a - 45, index ];
  2185. });
  2186. ```
  2187. */
  2188. map<T, TReturn>(
  2189. array: T[],
  2190. callback: (
  2191. this: Window,
  2192. elementOfArray: T,
  2193. indexInArray: number,
  2194. ) => JQuery.TypeOrArray<TReturn> | null | undefined,
  2195. ): TReturn[];
  2196. /**
  2197. * Translate all items in an array or object to new array of items.
  2198. * @param obj The Object to translate.
  2199. * @param callback The function to process each item against. The first argument to the function is the value; the
  2200. * second argument is the key of the object property. The function can return any value to add to the
  2201. * array. A returned array will be flattened into the resulting array. Within the function, this refers
  2202. * to the global (window) object.
  2203. * @see \`{@link https://api.jquery.com/jQuery.map/ }\`
  2204. * @since 1.6
  2205. * @example ​ ````Map the original object to a new array and double each value.
  2206. ```javascript
  2207. var dimensions = { width: 10, height: 15, length: 20 };
  2208. dimensions = $.map( dimensions, function( value, index ) {
  2209. return value * 2;
  2210. });
  2211. ```
  2212. * @example ​ ````Map an object&#39;s keys to an array.
  2213. ```javascript
  2214. var dimensions = { width: 10, height: 15, length: 20 };
  2215. var keys = $.map( dimensions, function( value, key ) {
  2216. return key;
  2217. });
  2218. ```
  2219. */
  2220. map<T, K extends keyof T, TReturn>(
  2221. obj: T,
  2222. callback: (this: Window, propertyOfObject: T[K], key: K) => JQuery.TypeOrArray<TReturn> | null | undefined,
  2223. ): TReturn[];
  2224. /**
  2225. * Merge the contents of two arrays together into the first array.
  2226. * @param first The first array-like object to merge, the elements of second added.
  2227. * @param second The second array-like object to merge into the first, unaltered.
  2228. * @see \`{@link https://api.jquery.com/jQuery.merge/ }\`
  2229. * @since 1.0
  2230. * @example ​ ````Merges two arrays, altering the first argument.
  2231. ```javascript
  2232. $.merge( [ 0, 1, 2 ], [ 2, 3, 4 ] )
  2233. ```
  2234. * @example ​ ````Merges two arrays, altering the first argument.
  2235. ```javascript
  2236. $.merge( [ 3, 2, 1 ], [ 4, 3, 2 ] )
  2237. ```
  2238. * @example ​ ````Merges two arrays, but uses a copy, so the original isn&#39;t altered.
  2239. ```javascript
  2240. var first = [ "a", "b", "c" ];
  2241. var second = [ "d", "e", "f" ];
  2242. $.merge( $.merge( [], first ), second );
  2243. ```
  2244. */
  2245. merge<T, U>(first: ArrayLike<T>, second: ArrayLike<U>): Array<T | U>;
  2246. /**
  2247. * Relinquish jQuery's control of the $ variable.
  2248. * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
  2249. * @see \`{@link https://api.jquery.com/jQuery.noConflict/ }\`
  2250. * @since 1.0
  2251. * @example ​ ````Map the original object that was referenced by $ back to $.
  2252. ```javascript
  2253. jQuery.noConflict();
  2254. // Do something with jQuery
  2255. jQuery( "div p" ).hide();
  2256. // Do something with another library's $()
  2257. $( "content" ).style.display = "none";
  2258. ```
  2259. * @example ​ ````Revert the $ alias and then create and execute a function to provide the $ as a jQuery alias inside the function&#39;s scope. Inside the function the original $ object is not available. This works well for most plugins that don&#39;t rely on any other library.
  2260. ```javascript
  2261. jQuery.noConflict();
  2262. (function( $ ) {
  2263. $(function() {
  2264. // More code using $ as alias to jQuery
  2265. });
  2266. })(jQuery);
  2267. // Other code using $ as an alias to the other library
  2268. ```
  2269. * @example ​ ````Create a different alias instead of jQuery to use in the rest of the script.
  2270. ```javascript
  2271. var j = jQuery.noConflict();
  2272. // Do something with jQuery
  2273. j( "div p" ).hide();
  2274. // Do something with another library's $()
  2275. $( "content" ).style.display = "none";
  2276. ```
  2277. * @example ​ ````Completely move jQuery to a new namespace in another object.
  2278. ```javascript
  2279. var dom = {};
  2280. dom.query = jQuery.noConflict( true );
  2281. ```
  2282. * @example ​ ````Load two versions of jQuery (not recommended). Then, restore jQuery&#39;s globally scoped variables to the first loaded jQuery.
  2283. ```html
  2284. <!doctype html>
  2285. <html lang="en">
  2286. <head>
  2287. <meta charset="utf-8">
  2288. <title>jQuery.noConflict demo</title>
  2289. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2290. </head>
  2291. <body>
  2292. <div id="log">
  2293. <h3>Before $.noConflict(true)</h3>
  2294. </div>
  2295. <script src="https://code.jquery.com/jquery-1.6.2.js"></script>
  2296. <script>
  2297. var $log = $( "#log" );
  2298. $log.append( "2nd loaded jQuery version ($): " + $.fn.jquery + "<br>" );
  2299. // Restore globally scoped jQuery variables to the first version loaded
  2300. // (the newer version)
  2301. jq162 = jQuery.noConflict( true );
  2302. $log.append( "<h3>After $.noConflict(true)</h3>" );
  2303. $log.append( "1st loaded jQuery version ($): " + $.fn.jquery + "<br>" );
  2304. $log.append( "2nd loaded jQuery version (jq162): " + jq162.fn.jquery + "<br>" );
  2305. </script>
  2306. </body>
  2307. </html>
  2308. ```
  2309. */
  2310. noConflict(removeAll?: boolean): this;
  2311. /**
  2312. * @deprecated ​ Deprecated since 3.2.
  2313. *
  2314. * **Cause**: This public but never-documented method has been deprecated as of jQuery 3.2.0.
  2315. *
  2316. * **Solution**: Replace calls such as `jQuery.nodeName( elem, "div" )` with a test such as `elem.nodeName.toLowerCase() === "div"`.
  2317. */
  2318. nodeName(elem: Node, name: string): boolean;
  2319. /**
  2320. * An empty function.
  2321. * @see \`{@link https://api.jquery.com/jQuery.noop/ }\`
  2322. * @since 1.4
  2323. */
  2324. noop(): undefined;
  2325. /**
  2326. * Return a number representing the current time.
  2327. * @see \`{@link https://api.jquery.com/jQuery.now/ }\`
  2328. * @since 1.4.3
  2329. * @deprecated ​ Deprecated since 3.3. Use \`{@link DateConstructor.now Date.now}\`.
  2330. */
  2331. now(): number;
  2332. /**
  2333. * Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.
  2334. * @param obj An array, a plain object, or a jQuery object to serialize.
  2335. * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization.
  2336. * @see \`{@link https://api.jquery.com/jQuery.param/ }\`
  2337. * @since 1.2
  2338. * @since 1.4
  2339. * @example ​ ````Serialize a key/value object.
  2340. ```html
  2341. <!doctype html>
  2342. <html lang="en">
  2343. <head>
  2344. <meta charset="utf-8">
  2345. <title>jQuery.param demo</title>
  2346. <style>
  2347. div {
  2348. color: red;
  2349. }
  2350. </style>
  2351. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2352. </head>
  2353. <body>
  2354. <div id="results"></div>
  2355. <script>
  2356. var params = { width:1680, height:1050 };
  2357. var str = jQuery.param( params );
  2358. $( "#results" ).text( str );
  2359. </script>
  2360. </body>
  2361. </html>
  2362. ```
  2363. * @example ​ ````Serialize a few complex objects
  2364. ```html
  2365. <!doctype html>
  2366. <html lang="en">
  2367. <head>
  2368. <meta charset="utf-8">
  2369. <title>jQuery.param demo</title>
  2370. <style>
  2371. div {
  2372. color: red;
  2373. }
  2374. </style>
  2375. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2376. </head>
  2377. <body>
  2378. ​​
  2379. <script>
  2380. // <=1.3.2:
  2381. $.param({ a: [ 2, 3, 4 ] }); // "a=2&a=3&a=4"
  2382. // >=1.4:
  2383. $.param({ a: [ 2, 3, 4 ] }); // "a[]=2&a[]=3&a[]=4"
  2384. // <=1.3.2:
  2385. $.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
  2386. // "a=[object+Object]&d=3&d=4&d=[object+Object]"
  2387. // >=1.4:
  2388. $.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
  2389. // "a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5"
  2390. </script>
  2391. </body>
  2392. </html>
  2393. ```
  2394. */
  2395. param(obj: any[] | JQuery.PlainObject | JQuery, traditional?: boolean): string;
  2396. /**
  2397. * Parses a string into an array of DOM nodes.
  2398. * @param data HTML string to be parsed
  2399. * @param context Document element to serve as the context in which the HTML fragment will be created
  2400. * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
  2401. * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\`
  2402. * @since 1.8
  2403. */
  2404. parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): JQuery.Node[];
  2405. /**
  2406. * Parses a string into an array of DOM nodes.
  2407. * @param data HTML string to be parsed
  2408. * @param context_keepScripts _&#x40;param_ `context_keepScripts`
  2409. * <br>
  2410. * * `context` — Document element to serve as the context in which the HTML fragment will be created <br>
  2411. * * `keepScripts` — A Boolean indicating whether to include scripts passed in the HTML string
  2412. * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\`
  2413. * @since 1.8
  2414. * @example ​ ````Create an array of DOM nodes using an HTML string and insert it into a div.
  2415. ```html
  2416. <!doctype html>
  2417. <html lang="en">
  2418. <head>
  2419. <meta charset="utf-8">
  2420. <title>jQuery.parseHTML demo</title>
  2421. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2422. </head>
  2423. <body>
  2424. <div id="log">
  2425. <h3>Content:</h3>
  2426. </div>
  2427. <script>
  2428. var $log = $( "#log" ),
  2429. str = "hello, <b>my name is</b> jQuery.",
  2430. html = $.parseHTML( str ),
  2431. nodeNames = [];
  2432. // Append the parsed HTML
  2433. $log.append( html );
  2434. // Gather the parsed HTML's node names
  2435. $.each( html, function( i, el ) {
  2436. nodeNames[ i ] = "<li>" + el.nodeName + "</li>";
  2437. });
  2438. // Insert the node names
  2439. $log.append( "<h3>Node Names:</h3>" );
  2440. $( "<ol></ol>" )
  2441. .append( nodeNames.join( "" ) )
  2442. .appendTo( $log );
  2443. </script>
  2444. </body>
  2445. </html>
  2446. ```
  2447. */
  2448. parseHTML(data: string, context_keepScripts?: Document | null | boolean): JQuery.Node[];
  2449. /**
  2450. * Takes a well-formed JSON string and returns the resulting JavaScript value.
  2451. * @param json The JSON string to parse.
  2452. * @see \`{@link https://api.jquery.com/jQuery.parseJSON/ }\`
  2453. * @since 1.4.1
  2454. * @deprecated ​ Deprecated since 3.0. Use \`{@link JSON.parse }\`.
  2455. *
  2456. * **Cause**: The `jQuery.parseJSON` method in recent jQuery is identical to the native `JSON.parse`. As of jQuery 3.0 `jQuery.parseJSON` is deprecated.
  2457. *
  2458. * **Solution**: Replace any use of `jQuery.parseJSON` with `JSON.parse`.
  2459. * @example ​ ````Parse a JSON string.
  2460. ```javascript
  2461. var obj = jQuery.parseJSON( '{ "name": "John" }' );
  2462. alert( obj.name === "John" );
  2463. ```
  2464. */
  2465. parseJSON(json: string): any;
  2466. /**
  2467. * Parses a string into an XML document.
  2468. * @param data a well-formed XML string to be parsed
  2469. * @see \`{@link https://api.jquery.com/jQuery.parseXML/ }\`
  2470. * @since 1.5
  2471. * @example ​ ````Create a jQuery object using an XML string and obtain the value of the title node.
  2472. ```html
  2473. <!doctype html>
  2474. <html lang="en">
  2475. <head>
  2476. <meta charset="utf-8">
  2477. <title>jQuery.parseXML demo</title>
  2478. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2479. </head>
  2480. <body>
  2481. <p id="someElement"></p>
  2482. <p id="anotherElement"></p>
  2483. <script>
  2484. var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
  2485. xmlDoc = $.parseXML( xml ),
  2486. $xml = $( xmlDoc ),
  2487. $title = $xml.find( "title" );
  2488. // Append "RSS Title" to #someElement
  2489. $( "#someElement" ).append( $title.text() );
  2490. // Change the title to "XML Title"
  2491. $title.text( "XML Title" );
  2492. // Append "XML Title" to #anotherElement
  2493. $( "#anotherElement" ).append( $title.text() );
  2494. </script>
  2495. </body>
  2496. </html>
  2497. ```
  2498. */
  2499. parseXML(data: string): XMLDocument;
  2500. /**
  2501. * Load data from the server using a HTTP POST request.
  2502. * @param url A string containing the URL to which the request is sent.
  2503. * @param data A plain object or string that is sent to the server with the request.
  2504. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but
  2505. * can be null in that case.
  2506. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  2507. * @see \`{@link https://api.jquery.com/jQuery.post/ }\`
  2508. * @since 1.0
  2509. * @example ​ ````Post to the test.php page and get content which has been returned in json format (&lt;?php echo json_encode(array(&quot;name&quot;=&gt;&quot;John&quot;,&quot;time&quot;=&gt;&quot;2pm&quot;)); ?&gt;).
  2510. ```javascript
  2511. $.post( "test.php", { func: "getNameAndTime" }, function( data ) {
  2512. console.log( data.name ); // John
  2513. console.log( data.time ); // 2pm
  2514. }, "json");
  2515. ```
  2516. */
  2517. post(
  2518. url: string,
  2519. data: JQuery.PlainObject | string,
  2520. success: JQuery.jqXHR.DoneCallback | null,
  2521. dataType?: string,
  2522. ): JQuery.jqXHR;
  2523. /**
  2524. * Load data from the server using a HTTP POST request.
  2525. * @param url A string containing the URL to which the request is sent.
  2526. * @param success_data _&#x40;param_ `success_data`
  2527. * <br>
  2528. * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided,
  2529. * but can be `null` in that case. <br>
  2530. * * `data` — A plain object or string that is sent to the server with the request.
  2531. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
  2532. * @see \`{@link https://api.jquery.com/jQuery.post/ }\`
  2533. * @since 1.0
  2534. */
  2535. post(
  2536. url: string,
  2537. data_success: JQuery.PlainObject | string | JQuery.jqXHR.DoneCallback | null,
  2538. dataType: string,
  2539. ): JQuery.jqXHR;
  2540. /**
  2541. * Load data from the server using a HTTP POST request.
  2542. * @param url A string containing the URL to which the request is sent.
  2543. * @param success_data _&#x40;param_ `success_data`
  2544. * <br>
  2545. * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided,
  2546. * but can be `null` in that case. <br>
  2547. * * `data` — A plain object or string that is sent to the server with the request.
  2548. * @see \`{@link https://api.jquery.com/jQuery.post/ }\`
  2549. * @since 1.0
  2550. * @example ​ ````Request the test.php page and send some additional data along (while still ignoring the return results).
  2551. ```javascript
  2552. $.post( "test.php", { name: "John", time: "2pm" } );
  2553. ```
  2554. * @example ​ ````Pass arrays of data to the server (while still ignoring the return results).
  2555. ```javascript
  2556. $.post( "test.php", { 'choices[]': [ "Jon", "Susan" ] } );
  2557. ```
  2558. * @example ​ ````Send form data using Ajax requests
  2559. ```javascript
  2560. $.post( "test.php", $( "#testform" ).serialize() );
  2561. ```
  2562. * @example ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned).
  2563. ```javascript
  2564. $.post( "test.php", function( data ) {
  2565. alert( "Data Loaded: " + data );
  2566. });
  2567. ```
  2568. * @example ​ ````Alert the results from requesting test.php with an additional payload of data (HTML or XML, depending on what was returned).
  2569. ```javascript
  2570. $.post( "test.php", { name: "John", time: "2pm" })
  2571. .done(function( data ) {
  2572. alert( "Data Loaded: " + data );
  2573. });
  2574. ```
  2575. * @example ​ ````Post a form using Ajax and put results in a div
  2576. ```html
  2577. <!doctype html>
  2578. <html lang="en">
  2579. <head>
  2580. <meta charset="utf-8">
  2581. <title>jQuery.post demo</title>
  2582. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2583. </head>
  2584. <body>
  2585. <form action="/" id="searchForm">
  2586. <input type="text" name="s" placeholder="Search...">
  2587. <input type="submit" value="Search">
  2588. </form>
  2589. <!-- the result of the search will be rendered inside this div -->
  2590. <div id="result"></div>
  2591. <script>
  2592. // Attach a submit handler to the form
  2593. $( "#searchForm" ).submit(function( event ) {
  2594. // Stop form from submitting normally
  2595. event.preventDefault();
  2596. // Get some values from elements on the page:
  2597. var $form = $( this ),
  2598. term = $form.find( "input[name='s']" ).val(),
  2599. url = $form.attr( "action" );
  2600. // Send the data using post
  2601. var posting = $.post( url, { s: term } );
  2602. // Put the results in a div
  2603. posting.done(function( data ) {
  2604. var content = $( data ).find( "#content" );
  2605. $( "#result" ).empty().append( content );
  2606. });
  2607. });
  2608. </script>
  2609. </body>
  2610. </html>
  2611. ```
  2612. */
  2613. post(url: string, success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR;
  2614. /**
  2615. * Load data from the server using a HTTP POST request.
  2616. * @param url_settings _&#x40;param_ `url_settings`
  2617. * <br>
  2618. * * `url` — A string containing the URL to which the request is sent. <br>
  2619. * * `settings` — A set of key/value pairs that configure the Ajax request. All properties except for `url` are optional.
  2620. * A default can be set for any option with \`{@link ajaxSetup $.ajaxSetup()}\`. See \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings jQuery.ajax( settings )}\`
  2621. * for a complete list of all settings. Type will automatically be set to `POST`.
  2622. * @see \`{@link https://api.jquery.com/jQuery.post/ }\`
  2623. * @since 1.0
  2624. * @since 1.12
  2625. * @since 2.2
  2626. * @example ​ ````Request the test.php page, but ignore the return results.
  2627. ```javascript
  2628. $.post( "test.php" );
  2629. ```
  2630. */
  2631. post(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR;
  2632. // region proxy
  2633. // #region proxy
  2634. // region (funсtion, null | undefined)
  2635. // #region (funсtion, null | undefined)
  2636. // region 0 to 7 additional arguments
  2637. // #region 0 to 7 additional arguments
  2638. // region 0 parameters
  2639. // #region 0 parameters
  2640. /**
  2641. * Takes a function and returns a new one that will always have a particular context.
  2642. * @param funсtion The function whose context will be changed.
  2643. * @param context The object to which the context (`this`) of the function should be set.
  2644. * @param a An argument to be passed to the function referenced in the `function` argument.
  2645. * @param b An argument to be passed to the function referenced in the `function` argument.
  2646. * @param c An argument to be passed to the function referenced in the `function` argument.
  2647. * @param d An argument to be passed to the function referenced in the `function` argument.
  2648. * @param e An argument to be passed to the function referenced in the `function` argument.
  2649. * @param f An argument to be passed to the function referenced in the `function` argument.
  2650. * @param g An argument to be passed to the function referenced in the `function` argument.
  2651. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2652. * @since 1.9
  2653. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2654. */
  2655. proxy<TReturn, A, B, C, D, E, F, G>(
  2656. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn,
  2657. context: null | undefined,
  2658. a: A,
  2659. b: B,
  2660. c: C,
  2661. d: D,
  2662. e: E,
  2663. f: F,
  2664. g: G,
  2665. ): () => TReturn;
  2666. /**
  2667. * Takes a function and returns a new one that will always have a particular context.
  2668. * @param funсtion The function whose context will be changed.
  2669. * @param context The object to which the context (`this`) of the function should be set.
  2670. * @param a An argument to be passed to the function referenced in the `function` argument.
  2671. * @param b An argument to be passed to the function referenced in the `function` argument.
  2672. * @param c An argument to be passed to the function referenced in the `function` argument.
  2673. * @param d An argument to be passed to the function referenced in the `function` argument.
  2674. * @param e An argument to be passed to the function referenced in the `function` argument.
  2675. * @param f An argument to be passed to the function referenced in the `function` argument.
  2676. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2677. * @since 1.9
  2678. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2679. */
  2680. proxy<TReturn, A, B, C, D, E, F>(
  2681. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F) => TReturn,
  2682. context: null | undefined,
  2683. a: A,
  2684. b: B,
  2685. c: C,
  2686. d: D,
  2687. e: E,
  2688. f: F,
  2689. ): () => TReturn;
  2690. /**
  2691. * Takes a function and returns a new one that will always have a particular context.
  2692. * @param funсtion The function whose context will be changed.
  2693. * @param context The object to which the context (`this`) of the function should be set.
  2694. * @param a An argument to be passed to the function referenced in the `function` argument.
  2695. * @param b An argument to be passed to the function referenced in the `function` argument.
  2696. * @param c An argument to be passed to the function referenced in the `function` argument.
  2697. * @param d An argument to be passed to the function referenced in the `function` argument.
  2698. * @param e An argument to be passed to the function referenced in the `function` argument.
  2699. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2700. * @since 1.9
  2701. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2702. */
  2703. proxy<TReturn, A, B, C, D, E>(
  2704. funсtion: (a: A, b: B, c: C, d: D, e: E) => TReturn,
  2705. context: null | undefined,
  2706. a: A,
  2707. b: B,
  2708. c: C,
  2709. d: D,
  2710. e: E,
  2711. ): () => TReturn;
  2712. /**
  2713. * Takes a function and returns a new one that will always have a particular context.
  2714. * @param funсtion The function whose context will be changed.
  2715. * @param context The object to which the context (`this`) of the function should be set.
  2716. * @param a An argument to be passed to the function referenced in the `function` argument.
  2717. * @param b An argument to be passed to the function referenced in the `function` argument.
  2718. * @param c An argument to be passed to the function referenced in the `function` argument.
  2719. * @param d An argument to be passed to the function referenced in the `function` argument.
  2720. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2721. * @since 1.9
  2722. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2723. */
  2724. proxy<TReturn, A, B, C, D>(
  2725. funсtion: (a: A, b: B, c: C, d: D) => TReturn,
  2726. context: null | undefined,
  2727. a: A,
  2728. b: B,
  2729. c: C,
  2730. d: D,
  2731. ): () => TReturn;
  2732. /**
  2733. * Takes a function and returns a new one that will always have a particular context.
  2734. * @param funсtion The function whose context will be changed.
  2735. * @param context The object to which the context (`this`) of the function should be set.
  2736. * @param a An argument to be passed to the function referenced in the `function` argument.
  2737. * @param b An argument to be passed to the function referenced in the `function` argument.
  2738. * @param c An argument to be passed to the function referenced in the `function` argument.
  2739. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2740. * @since 1.9
  2741. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2742. */
  2743. proxy<TReturn, A, B, C>(
  2744. funсtion: (a: A, b: B, c: C) => TReturn,
  2745. context: null | undefined,
  2746. a: A,
  2747. b: B,
  2748. c: C,
  2749. ): () => TReturn;
  2750. /**
  2751. * Takes a function and returns a new one that will always have a particular context.
  2752. * @param funсtion The function whose context will be changed.
  2753. * @param context The object to which the context (`this`) of the function should be set.
  2754. * @param a An argument to be passed to the function referenced in the `function` argument.
  2755. * @param b An argument to be passed to the function referenced in the `function` argument.
  2756. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2757. * @since 1.9
  2758. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2759. */
  2760. proxy<TReturn, A, B>(funсtion: (a: A, b: B) => TReturn, context: null | undefined, a: A, b: B): () => TReturn;
  2761. /**
  2762. * Takes a function and returns a new one that will always have a particular context.
  2763. * @param funсtion The function whose context will be changed.
  2764. * @param context The object to which the context (`this`) of the function should be set.
  2765. * @param a An argument to be passed to the function referenced in the `function` argument.
  2766. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2767. * @since 1.9
  2768. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2769. */
  2770. proxy<TReturn, A>(funсtion: (a: A) => TReturn, context: null | undefined, a: A): () => TReturn;
  2771. /**
  2772. * Takes a function and returns a new one that will always have a particular context.
  2773. * @param funсtion The function whose context will be changed.
  2774. * @param context The object to which the context (`this`) of the function should be set.
  2775. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2776. * @since 1.9
  2777. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2778. */
  2779. proxy<TReturn>(funсtion: () => TReturn, context: null | undefined): () => TReturn;
  2780. // #endregion
  2781. // region 1 parameters
  2782. // #region 1 parameters
  2783. /**
  2784. * Takes a function and returns a new one that will always have a particular context.
  2785. * @param funсtion The function whose context will be changed.
  2786. * @param context The object to which the context (`this`) of the function should be set.
  2787. * @param a An argument to be passed to the function referenced in the `function` argument.
  2788. * @param b An argument to be passed to the function referenced in the `function` argument.
  2789. * @param c An argument to be passed to the function referenced in the `function` argument.
  2790. * @param d An argument to be passed to the function referenced in the `function` argument.
  2791. * @param e An argument to be passed to the function referenced in the `function` argument.
  2792. * @param f An argument to be passed to the function referenced in the `function` argument.
  2793. * @param g An argument to be passed to the function referenced in the `function` argument.
  2794. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2795. * @since 1.9
  2796. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2797. */
  2798. proxy<TReturn, A, B, C, D, E, F, G, T>(
  2799. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn,
  2800. context: null | undefined,
  2801. a: A,
  2802. b: B,
  2803. c: C,
  2804. d: D,
  2805. e: E,
  2806. f: F,
  2807. g: G,
  2808. ): (t: T) => TReturn;
  2809. /**
  2810. * Takes a function and returns a new one that will always have a particular context.
  2811. * @param funсtion The function whose context will be changed.
  2812. * @param context The object to which the context (`this`) of the function should be set.
  2813. * @param a An argument to be passed to the function referenced in the `function` argument.
  2814. * @param b An argument to be passed to the function referenced in the `function` argument.
  2815. * @param c An argument to be passed to the function referenced in the `function` argument.
  2816. * @param d An argument to be passed to the function referenced in the `function` argument.
  2817. * @param e An argument to be passed to the function referenced in the `function` argument.
  2818. * @param f An argument to be passed to the function referenced in the `function` argument.
  2819. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2820. * @since 1.9
  2821. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2822. */
  2823. proxy<TReturn, A, B, C, D, E, F, T>(
  2824. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn,
  2825. context: null | undefined,
  2826. a: A,
  2827. b: B,
  2828. c: C,
  2829. d: D,
  2830. e: E,
  2831. f: F,
  2832. ): (t: T) => TReturn;
  2833. /**
  2834. * Takes a function and returns a new one that will always have a particular context.
  2835. * @param funсtion The function whose context will be changed.
  2836. * @param context The object to which the context (`this`) of the function should be set.
  2837. * @param a An argument to be passed to the function referenced in the `function` argument.
  2838. * @param b An argument to be passed to the function referenced in the `function` argument.
  2839. * @param c An argument to be passed to the function referenced in the `function` argument.
  2840. * @param d An argument to be passed to the function referenced in the `function` argument.
  2841. * @param e An argument to be passed to the function referenced in the `function` argument.
  2842. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2843. * @since 1.9
  2844. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2845. */
  2846. proxy<TReturn, A, B, C, D, E, T>(
  2847. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T) => TReturn,
  2848. context: null | undefined,
  2849. a: A,
  2850. b: B,
  2851. c: C,
  2852. d: D,
  2853. e: E,
  2854. ): (t: T) => TReturn;
  2855. /**
  2856. * Takes a function and returns a new one that will always have a particular context.
  2857. * @param funсtion The function whose context will be changed.
  2858. * @param context The object to which the context (`this`) of the function should be set.
  2859. * @param a An argument to be passed to the function referenced in the `function` argument.
  2860. * @param b An argument to be passed to the function referenced in the `function` argument.
  2861. * @param c An argument to be passed to the function referenced in the `function` argument.
  2862. * @param d An argument to be passed to the function referenced in the `function` argument.
  2863. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2864. * @since 1.9
  2865. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2866. */
  2867. proxy<TReturn, A, B, C, D, T>(
  2868. funсtion: (a: A, b: B, c: C, d: D, t: T) => TReturn,
  2869. context: null | undefined,
  2870. a: A,
  2871. b: B,
  2872. c: C,
  2873. d: D,
  2874. ): (t: T) => TReturn;
  2875. /**
  2876. * Takes a function and returns a new one that will always have a particular context.
  2877. * @param funсtion The function whose context will be changed.
  2878. * @param context The object to which the context (`this`) of the function should be set.
  2879. * @param a An argument to be passed to the function referenced in the `function` argument.
  2880. * @param b An argument to be passed to the function referenced in the `function` argument.
  2881. * @param c An argument to be passed to the function referenced in the `function` argument.
  2882. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2883. * @since 1.9
  2884. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2885. */
  2886. proxy<TReturn, A, B, C, T>(
  2887. funсtion: (a: A, b: B, c: C, t: T) => TReturn,
  2888. context: null | undefined,
  2889. a: A,
  2890. b: B,
  2891. c: C,
  2892. ): (t: T) => TReturn;
  2893. /**
  2894. * Takes a function and returns a new one that will always have a particular context.
  2895. * @param funсtion The function whose context will be changed.
  2896. * @param context The object to which the context (`this`) of the function should be set.
  2897. * @param a An argument to be passed to the function referenced in the `function` argument.
  2898. * @param b An argument to be passed to the function referenced in the `function` argument.
  2899. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2900. * @since 1.9
  2901. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2902. */
  2903. proxy<TReturn, A, B, T>(
  2904. funсtion: (a: A, b: B, t: T) => TReturn,
  2905. context: null | undefined,
  2906. a: A,
  2907. b: B,
  2908. ): (t: T) => TReturn;
  2909. /**
  2910. * Takes a function and returns a new one that will always have a particular context.
  2911. * @param funсtion The function whose context will be changed.
  2912. * @param context The object to which the context (`this`) of the function should be set.
  2913. * @param a An argument to be passed to the function referenced in the `function` argument.
  2914. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2915. * @since 1.9
  2916. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2917. */
  2918. proxy<TReturn, A, T>(funсtion: (a: A, t: T) => TReturn, context: null | undefined, a: A): (t: T) => TReturn;
  2919. /**
  2920. * Takes a function and returns a new one that will always have a particular context.
  2921. * @param funсtion The function whose context will be changed.
  2922. * @param context The object to which the context (`this`) of the function should be set.
  2923. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2924. * @since 1.9
  2925. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2926. */
  2927. proxy<TReturn, T>(funсtion: (t: T) => TReturn, context: null | undefined): (t: T) => TReturn;
  2928. // #endregion
  2929. // region 2 parameters
  2930. // #region 2 parameters
  2931. /**
  2932. * Takes a function and returns a new one that will always have a particular context.
  2933. * @param funсtion The function whose context will be changed.
  2934. * @param context The object to which the context (`this`) of the function should be set.
  2935. * @param a An argument to be passed to the function referenced in the `function` argument.
  2936. * @param b An argument to be passed to the function referenced in the `function` argument.
  2937. * @param c An argument to be passed to the function referenced in the `function` argument.
  2938. * @param d An argument to be passed to the function referenced in the `function` argument.
  2939. * @param e An argument to be passed to the function referenced in the `function` argument.
  2940. * @param f An argument to be passed to the function referenced in the `function` argument.
  2941. * @param g An argument to be passed to the function referenced in the `function` argument.
  2942. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2943. * @since 1.9
  2944. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2945. */
  2946. proxy<TReturn, A, B, C, D, E, F, G, T, U>(
  2947. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn,
  2948. context: null | undefined,
  2949. a: A,
  2950. b: B,
  2951. c: C,
  2952. d: D,
  2953. e: E,
  2954. f: F,
  2955. g: G,
  2956. ): (t: T, u: U) => TReturn;
  2957. /**
  2958. * Takes a function and returns a new one that will always have a particular context.
  2959. * @param funсtion The function whose context will be changed.
  2960. * @param context The object to which the context (`this`) of the function should be set.
  2961. * @param a An argument to be passed to the function referenced in the `function` argument.
  2962. * @param b An argument to be passed to the function referenced in the `function` argument.
  2963. * @param c An argument to be passed to the function referenced in the `function` argument.
  2964. * @param d An argument to be passed to the function referenced in the `function` argument.
  2965. * @param e An argument to be passed to the function referenced in the `function` argument.
  2966. * @param f An argument to be passed to the function referenced in the `function` argument.
  2967. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2968. * @since 1.9
  2969. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2970. */
  2971. proxy<TReturn, A, B, C, D, E, F, T, U>(
  2972. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn,
  2973. context: null | undefined,
  2974. a: A,
  2975. b: B,
  2976. c: C,
  2977. d: D,
  2978. e: E,
  2979. f: F,
  2980. ): (t: T, u: U) => TReturn;
  2981. /**
  2982. * Takes a function and returns a new one that will always have a particular context.
  2983. * @param funсtion The function whose context will be changed.
  2984. * @param context The object to which the context (`this`) of the function should be set.
  2985. * @param a An argument to be passed to the function referenced in the `function` argument.
  2986. * @param b An argument to be passed to the function referenced in the `function` argument.
  2987. * @param c An argument to be passed to the function referenced in the `function` argument.
  2988. * @param d An argument to be passed to the function referenced in the `function` argument.
  2989. * @param e An argument to be passed to the function referenced in the `function` argument.
  2990. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  2991. * @since 1.9
  2992. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  2993. */
  2994. proxy<TReturn, A, B, C, D, E, T, U>(
  2995. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn,
  2996. context: null | undefined,
  2997. a: A,
  2998. b: B,
  2999. c: C,
  3000. d: D,
  3001. e: E,
  3002. ): (t: T, u: U) => TReturn;
  3003. /**
  3004. * Takes a function and returns a new one that will always have a particular context.
  3005. * @param funсtion The function whose context will be changed.
  3006. * @param context The object to which the context (`this`) of the function should be set.
  3007. * @param a An argument to be passed to the function referenced in the `function` argument.
  3008. * @param b An argument to be passed to the function referenced in the `function` argument.
  3009. * @param c An argument to be passed to the function referenced in the `function` argument.
  3010. * @param d An argument to be passed to the function referenced in the `function` argument.
  3011. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3012. * @since 1.9
  3013. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3014. */
  3015. proxy<TReturn, A, B, C, D, T, U>(
  3016. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U) => TReturn,
  3017. context: null | undefined,
  3018. a: A,
  3019. b: B,
  3020. c: C,
  3021. d: D,
  3022. ): (t: T, u: U) => TReturn;
  3023. /**
  3024. * Takes a function and returns a new one that will always have a particular context.
  3025. * @param funсtion The function whose context will be changed.
  3026. * @param context The object to which the context (`this`) of the function should be set.
  3027. * @param a An argument to be passed to the function referenced in the `function` argument.
  3028. * @param b An argument to be passed to the function referenced in the `function` argument.
  3029. * @param c An argument to be passed to the function referenced in the `function` argument.
  3030. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3031. * @since 1.9
  3032. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3033. */
  3034. proxy<TReturn, A, B, C, T, U>(
  3035. funсtion: (a: A, b: B, c: C, t: T, u: U) => TReturn,
  3036. context: null | undefined,
  3037. a: A,
  3038. b: B,
  3039. c: C,
  3040. ): (t: T, u: U) => TReturn;
  3041. /**
  3042. * Takes a function and returns a new one that will always have a particular context.
  3043. * @param funсtion The function whose context will be changed.
  3044. * @param context The object to which the context (`this`) of the function should be set.
  3045. * @param a An argument to be passed to the function referenced in the `function` argument.
  3046. * @param b An argument to be passed to the function referenced in the `function` argument.
  3047. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3048. * @since 1.9
  3049. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3050. */
  3051. proxy<TReturn, A, B, T, U>(
  3052. funсtion: (a: A, b: B, t: T, u: U) => TReturn,
  3053. context: null | undefined,
  3054. a: A,
  3055. b: B,
  3056. ): (t: T, u: U) => TReturn;
  3057. /**
  3058. * Takes a function and returns a new one that will always have a particular context.
  3059. * @param funсtion The function whose context will be changed.
  3060. * @param context The object to which the context (`this`) of the function should be set.
  3061. * @param a An argument to be passed to the function referenced in the `function` argument.
  3062. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3063. * @since 1.9
  3064. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3065. */
  3066. proxy<TReturn, A, T, U>(
  3067. funсtion: (a: A, t: T, u: U) => TReturn,
  3068. context: null | undefined,
  3069. a: A,
  3070. ): (t: T, u: U) => TReturn;
  3071. /**
  3072. * Takes a function and returns a new one that will always have a particular context.
  3073. * @param funсtion The function whose context will be changed.
  3074. * @param context The object to which the context (`this`) of the function should be set.
  3075. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3076. * @since 1.9
  3077. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3078. */
  3079. proxy<TReturn, T, U>(funсtion: (t: T, u: U) => TReturn, context: null | undefined): (t: T, u: U) => TReturn;
  3080. // #endregion
  3081. // region 3 parameters
  3082. // #region 3 parameters
  3083. /**
  3084. * Takes a function and returns a new one that will always have a particular context.
  3085. * @param funсtion The function whose context will be changed.
  3086. * @param context The object to which the context (`this`) of the function should be set.
  3087. * @param a An argument to be passed to the function referenced in the `function` argument.
  3088. * @param b An argument to be passed to the function referenced in the `function` argument.
  3089. * @param c An argument to be passed to the function referenced in the `function` argument.
  3090. * @param d An argument to be passed to the function referenced in the `function` argument.
  3091. * @param e An argument to be passed to the function referenced in the `function` argument.
  3092. * @param f An argument to be passed to the function referenced in the `function` argument.
  3093. * @param g An argument to be passed to the function referenced in the `function` argument.
  3094. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3095. * @since 1.9
  3096. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3097. */
  3098. proxy<TReturn, A, B, C, D, E, F, G, T, U, V>(
  3099. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn,
  3100. context: null | undefined,
  3101. a: A,
  3102. b: B,
  3103. c: C,
  3104. d: D,
  3105. e: E,
  3106. f: F,
  3107. g: G,
  3108. ): (t: T, u: U, v: V) => TReturn;
  3109. /**
  3110. * Takes a function and returns a new one that will always have a particular context.
  3111. * @param funсtion The function whose context will be changed.
  3112. * @param context The object to which the context (`this`) of the function should be set.
  3113. * @param a An argument to be passed to the function referenced in the `function` argument.
  3114. * @param b An argument to be passed to the function referenced in the `function` argument.
  3115. * @param c An argument to be passed to the function referenced in the `function` argument.
  3116. * @param d An argument to be passed to the function referenced in the `function` argument.
  3117. * @param e An argument to be passed to the function referenced in the `function` argument.
  3118. * @param f An argument to be passed to the function referenced in the `function` argument.
  3119. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3120. * @since 1.9
  3121. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3122. */
  3123. proxy<TReturn, A, B, C, D, E, F, T, U, V>(
  3124. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn,
  3125. context: null | undefined,
  3126. a: A,
  3127. b: B,
  3128. c: C,
  3129. d: D,
  3130. e: E,
  3131. f: F,
  3132. ): (t: T, u: U, v: V) => TReturn;
  3133. /**
  3134. * Takes a function and returns a new one that will always have a particular context.
  3135. * @param funсtion The function whose context will be changed.
  3136. * @param context The object to which the context (`this`) of the function should be set.
  3137. * @param a An argument to be passed to the function referenced in the `function` argument.
  3138. * @param b An argument to be passed to the function referenced in the `function` argument.
  3139. * @param c An argument to be passed to the function referenced in the `function` argument.
  3140. * @param d An argument to be passed to the function referenced in the `function` argument.
  3141. * @param e An argument to be passed to the function referenced in the `function` argument.
  3142. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3143. * @since 1.9
  3144. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3145. */
  3146. proxy<TReturn, A, B, C, D, E, T, U, V>(
  3147. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn,
  3148. context: null | undefined,
  3149. a: A,
  3150. b: B,
  3151. c: C,
  3152. d: D,
  3153. e: E,
  3154. ): (t: T, u: U, v: V) => TReturn;
  3155. /**
  3156. * Takes a function and returns a new one that will always have a particular context.
  3157. * @param funсtion The function whose context will be changed.
  3158. * @param context The object to which the context (`this`) of the function should be set.
  3159. * @param a An argument to be passed to the function referenced in the `function` argument.
  3160. * @param b An argument to be passed to the function referenced in the `function` argument.
  3161. * @param c An argument to be passed to the function referenced in the `function` argument.
  3162. * @param d An argument to be passed to the function referenced in the `function` argument.
  3163. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3164. * @since 1.9
  3165. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3166. */
  3167. proxy<TReturn, A, B, C, D, T, U, V>(
  3168. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn,
  3169. context: null | undefined,
  3170. a: A,
  3171. b: B,
  3172. c: C,
  3173. d: D,
  3174. ): (t: T, u: U, v: V) => TReturn;
  3175. /**
  3176. * Takes a function and returns a new one that will always have a particular context.
  3177. * @param funсtion The function whose context will be changed.
  3178. * @param context The object to which the context (`this`) of the function should be set.
  3179. * @param a An argument to be passed to the function referenced in the `function` argument.
  3180. * @param b An argument to be passed to the function referenced in the `function` argument.
  3181. * @param c An argument to be passed to the function referenced in the `function` argument.
  3182. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3183. * @since 1.9
  3184. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3185. */
  3186. proxy<TReturn, A, B, C, T, U, V>(
  3187. funсtion: (a: A, b: B, c: C, t: T, u: U, v: V) => TReturn,
  3188. context: null | undefined,
  3189. a: A,
  3190. b: B,
  3191. c: C,
  3192. ): (t: T, u: U, v: V) => TReturn;
  3193. /**
  3194. * Takes a function and returns a new one that will always have a particular context.
  3195. * @param funсtion The function whose context will be changed.
  3196. * @param context The object to which the context (`this`) of the function should be set.
  3197. * @param a An argument to be passed to the function referenced in the `function` argument.
  3198. * @param b An argument to be passed to the function referenced in the `function` argument.
  3199. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3200. * @since 1.9
  3201. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3202. */
  3203. proxy<TReturn, A, B, T, U, V>(
  3204. funсtion: (a: A, b: B, t: T, u: U, v: V) => TReturn,
  3205. context: null | undefined,
  3206. a: A,
  3207. b: B,
  3208. ): (t: T, u: U, v: V) => TReturn;
  3209. /**
  3210. * Takes a function and returns a new one that will always have a particular context.
  3211. * @param funсtion The function whose context will be changed.
  3212. * @param context The object to which the context (`this`) of the function should be set.
  3213. * @param a An argument to be passed to the function referenced in the `function` argument.
  3214. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3215. * @since 1.9
  3216. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3217. */
  3218. proxy<TReturn, A, T, U, V>(
  3219. funсtion: (a: A, t: T, u: U, v: V) => TReturn,
  3220. context: null | undefined,
  3221. a: A,
  3222. ): (t: T, u: U, v: V) => TReturn;
  3223. /**
  3224. * Takes a function and returns a new one that will always have a particular context.
  3225. * @param funсtion The function whose context will be changed.
  3226. * @param context The object to which the context (`this`) of the function should be set.
  3227. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3228. * @since 1.9
  3229. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3230. */
  3231. proxy<TReturn, T, U, V>(
  3232. funсtion: (t: T, u: U, v: V) => TReturn,
  3233. context: null | undefined,
  3234. ): (t: T, u: U, v: V) => TReturn;
  3235. // #endregion
  3236. // region 4 parameters
  3237. // #region 4 parameters
  3238. /**
  3239. * Takes a function and returns a new one that will always have a particular context.
  3240. * @param funсtion The function whose context will be changed.
  3241. * @param context The object to which the context (`this`) of the function should be set.
  3242. * @param a An argument to be passed to the function referenced in the `function` argument.
  3243. * @param b An argument to be passed to the function referenced in the `function` argument.
  3244. * @param c An argument to be passed to the function referenced in the `function` argument.
  3245. * @param d An argument to be passed to the function referenced in the `function` argument.
  3246. * @param e An argument to be passed to the function referenced in the `function` argument.
  3247. * @param f An argument to be passed to the function referenced in the `function` argument.
  3248. * @param g An argument to be passed to the function referenced in the `function` argument.
  3249. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3250. * @since 1.9
  3251. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3252. */
  3253. proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W>(
  3254. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn,
  3255. context: null | undefined,
  3256. a: A,
  3257. b: B,
  3258. c: C,
  3259. d: D,
  3260. e: E,
  3261. f: F,
  3262. g: G,
  3263. ): (t: T, u: U, v: V, w: W) => TReturn;
  3264. /**
  3265. * Takes a function and returns a new one that will always have a particular context.
  3266. * @param funсtion The function whose context will be changed.
  3267. * @param context The object to which the context (`this`) of the function should be set.
  3268. * @param a An argument to be passed to the function referenced in the `function` argument.
  3269. * @param b An argument to be passed to the function referenced in the `function` argument.
  3270. * @param c An argument to be passed to the function referenced in the `function` argument.
  3271. * @param d An argument to be passed to the function referenced in the `function` argument.
  3272. * @param e An argument to be passed to the function referenced in the `function` argument.
  3273. * @param f An argument to be passed to the function referenced in the `function` argument.
  3274. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3275. * @since 1.9
  3276. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3277. */
  3278. proxy<TReturn, A, B, C, D, E, F, T, U, V, W>(
  3279. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn,
  3280. context: null | undefined,
  3281. a: A,
  3282. b: B,
  3283. c: C,
  3284. d: D,
  3285. e: E,
  3286. f: F,
  3287. ): (t: T, u: U, v: V, w: W) => TReturn;
  3288. /**
  3289. * Takes a function and returns a new one that will always have a particular context.
  3290. * @param funсtion The function whose context will be changed.
  3291. * @param context The object to which the context (`this`) of the function should be set.
  3292. * @param a An argument to be passed to the function referenced in the `function` argument.
  3293. * @param b An argument to be passed to the function referenced in the `function` argument.
  3294. * @param c An argument to be passed to the function referenced in the `function` argument.
  3295. * @param d An argument to be passed to the function referenced in the `function` argument.
  3296. * @param e An argument to be passed to the function referenced in the `function` argument.
  3297. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3298. * @since 1.9
  3299. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3300. */
  3301. proxy<TReturn, A, B, C, D, E, T, U, V, W>(
  3302. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn,
  3303. context: null | undefined,
  3304. a: A,
  3305. b: B,
  3306. c: C,
  3307. d: D,
  3308. e: E,
  3309. ): (t: T, u: U, v: V, w: W) => TReturn;
  3310. /**
  3311. * Takes a function and returns a new one that will always have a particular context.
  3312. * @param funсtion The function whose context will be changed.
  3313. * @param context The object to which the context (`this`) of the function should be set.
  3314. * @param a An argument to be passed to the function referenced in the `function` argument.
  3315. * @param b An argument to be passed to the function referenced in the `function` argument.
  3316. * @param c An argument to be passed to the function referenced in the `function` argument.
  3317. * @param d An argument to be passed to the function referenced in the `function` argument.
  3318. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3319. * @since 1.9
  3320. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3321. */
  3322. proxy<TReturn, A, B, C, D, T, U, V, W>(
  3323. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn,
  3324. context: null | undefined,
  3325. a: A,
  3326. b: B,
  3327. c: C,
  3328. d: D,
  3329. ): (t: T, u: U, v: V, w: W) => TReturn;
  3330. /**
  3331. * Takes a function and returns a new one that will always have a particular context.
  3332. * @param funсtion The function whose context will be changed.
  3333. * @param context The object to which the context (`this`) of the function should be set.
  3334. * @param a An argument to be passed to the function referenced in the `function` argument.
  3335. * @param b An argument to be passed to the function referenced in the `function` argument.
  3336. * @param c An argument to be passed to the function referenced in the `function` argument.
  3337. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3338. * @since 1.9
  3339. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3340. */
  3341. proxy<TReturn, A, B, C, T, U, V, W>(
  3342. funсtion: (a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn,
  3343. context: null | undefined,
  3344. a: A,
  3345. b: B,
  3346. c: C,
  3347. ): (t: T, u: U, v: V, w: W) => TReturn;
  3348. /**
  3349. * Takes a function and returns a new one that will always have a particular context.
  3350. * @param funсtion The function whose context will be changed.
  3351. * @param context The object to which the context (`this`) of the function should be set.
  3352. * @param a An argument to be passed to the function referenced in the `function` argument.
  3353. * @param b An argument to be passed to the function referenced in the `function` argument.
  3354. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3355. * @since 1.9
  3356. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3357. */
  3358. proxy<TReturn, A, B, T, U, V, W>(
  3359. funсtion: (a: A, b: B, t: T, u: U, v: V, w: W) => TReturn,
  3360. context: null | undefined,
  3361. a: A,
  3362. b: B,
  3363. ): (t: T, u: U, v: V, w: W) => TReturn;
  3364. /**
  3365. * Takes a function and returns a new one that will always have a particular context.
  3366. * @param funсtion The function whose context will be changed.
  3367. * @param context The object to which the context (`this`) of the function should be set.
  3368. * @param a An argument to be passed to the function referenced in the `function` argument.
  3369. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3370. * @since 1.9
  3371. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3372. */
  3373. proxy<TReturn, A, T, U, V, W>(
  3374. funсtion: (a: A, t: T, u: U, v: V, w: W) => TReturn,
  3375. context: null | undefined,
  3376. a: A,
  3377. ): (t: T, u: U, v: V, w: W) => TReturn;
  3378. /**
  3379. * Takes a function and returns a new one that will always have a particular context.
  3380. * @param funсtion The function whose context will be changed.
  3381. * @param context The object to which the context (`this`) of the function should be set.
  3382. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3383. * @since 1.9
  3384. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3385. */
  3386. proxy<TReturn, T, U, V, W>(
  3387. funсtion: (t: T, u: U, v: V, w: W) => TReturn,
  3388. context: null | undefined,
  3389. ): (t: T, u: U, v: V, w: W) => TReturn;
  3390. // #endregion
  3391. // region 5 parameters
  3392. // #region 5 parameters
  3393. /**
  3394. * Takes a function and returns a new one that will always have a particular context.
  3395. * @param funсtion The function whose context will be changed.
  3396. * @param context The object to which the context (`this`) of the function should be set.
  3397. * @param a An argument to be passed to the function referenced in the `function` argument.
  3398. * @param b An argument to be passed to the function referenced in the `function` argument.
  3399. * @param c An argument to be passed to the function referenced in the `function` argument.
  3400. * @param d An argument to be passed to the function referenced in the `function` argument.
  3401. * @param e An argument to be passed to the function referenced in the `function` argument.
  3402. * @param f An argument to be passed to the function referenced in the `function` argument.
  3403. * @param g An argument to be passed to the function referenced in the `function` argument.
  3404. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3405. * @since 1.9
  3406. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3407. */
  3408. proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X>(
  3409. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3410. context: null | undefined,
  3411. a: A,
  3412. b: B,
  3413. c: C,
  3414. d: D,
  3415. e: E,
  3416. f: F,
  3417. g: G,
  3418. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3419. /**
  3420. * Takes a function and returns a new one that will always have a particular context.
  3421. * @param funсtion The function whose context will be changed.
  3422. * @param context The object to which the context (`this`) of the function should be set.
  3423. * @param a An argument to be passed to the function referenced in the `function` argument.
  3424. * @param b An argument to be passed to the function referenced in the `function` argument.
  3425. * @param c An argument to be passed to the function referenced in the `function` argument.
  3426. * @param d An argument to be passed to the function referenced in the `function` argument.
  3427. * @param e An argument to be passed to the function referenced in the `function` argument.
  3428. * @param f An argument to be passed to the function referenced in the `function` argument.
  3429. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3430. * @since 1.9
  3431. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3432. */
  3433. proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X>(
  3434. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3435. context: null | undefined,
  3436. a: A,
  3437. b: B,
  3438. c: C,
  3439. d: D,
  3440. e: E,
  3441. f: F,
  3442. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3443. /**
  3444. * Takes a function and returns a new one that will always have a particular context.
  3445. * @param funсtion The function whose context will be changed.
  3446. * @param context The object to which the context (`this`) of the function should be set.
  3447. * @param a An argument to be passed to the function referenced in the `function` argument.
  3448. * @param b An argument to be passed to the function referenced in the `function` argument.
  3449. * @param c An argument to be passed to the function referenced in the `function` argument.
  3450. * @param d An argument to be passed to the function referenced in the `function` argument.
  3451. * @param e An argument to be passed to the function referenced in the `function` argument.
  3452. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3453. * @since 1.9
  3454. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3455. */
  3456. proxy<TReturn, A, B, C, D, E, T, U, V, W, X>(
  3457. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3458. context: null | undefined,
  3459. a: A,
  3460. b: B,
  3461. c: C,
  3462. d: D,
  3463. e: E,
  3464. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3465. /**
  3466. * Takes a function and returns a new one that will always have a particular context.
  3467. * @param funсtion The function whose context will be changed.
  3468. * @param context The object to which the context (`this`) of the function should be set.
  3469. * @param a An argument to be passed to the function referenced in the `function` argument.
  3470. * @param b An argument to be passed to the function referenced in the `function` argument.
  3471. * @param c An argument to be passed to the function referenced in the `function` argument.
  3472. * @param d An argument to be passed to the function referenced in the `function` argument.
  3473. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3474. * @since 1.9
  3475. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3476. */
  3477. proxy<TReturn, A, B, C, D, T, U, V, W, X>(
  3478. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3479. context: null | undefined,
  3480. a: A,
  3481. b: B,
  3482. c: C,
  3483. d: D,
  3484. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3485. /**
  3486. * Takes a function and returns a new one that will always have a particular context.
  3487. * @param funсtion The function whose context will be changed.
  3488. * @param context The object to which the context (`this`) of the function should be set.
  3489. * @param a An argument to be passed to the function referenced in the `function` argument.
  3490. * @param b An argument to be passed to the function referenced in the `function` argument.
  3491. * @param c An argument to be passed to the function referenced in the `function` argument.
  3492. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3493. * @since 1.9
  3494. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3495. */
  3496. proxy<TReturn, A, B, C, T, U, V, W, X>(
  3497. funсtion: (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3498. context: null | undefined,
  3499. a: A,
  3500. b: B,
  3501. c: C,
  3502. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3503. /**
  3504. * Takes a function and returns a new one that will always have a particular context.
  3505. * @param funсtion The function whose context will be changed.
  3506. * @param context The object to which the context (`this`) of the function should be set.
  3507. * @param a An argument to be passed to the function referenced in the `function` argument.
  3508. * @param b An argument to be passed to the function referenced in the `function` argument.
  3509. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3510. * @since 1.9
  3511. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3512. */
  3513. proxy<TReturn, A, B, T, U, V, W, X>(
  3514. funсtion: (a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3515. context: null | undefined,
  3516. a: A,
  3517. b: B,
  3518. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3519. /**
  3520. * Takes a function and returns a new one that will always have a particular context.
  3521. * @param funсtion The function whose context will be changed.
  3522. * @param context The object to which the context (`this`) of the function should be set.
  3523. * @param a An argument to be passed to the function referenced in the `function` argument.
  3524. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3525. * @since 1.9
  3526. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3527. */
  3528. proxy<TReturn, A, T, U, V, W, X>(
  3529. funсtion: (a: A, t: T, u: U, v: V, w: W, x: X) => TReturn,
  3530. context: null | undefined,
  3531. a: A,
  3532. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3533. /**
  3534. * Takes a function and returns a new one that will always have a particular context.
  3535. * @param funсtion The function whose context will be changed.
  3536. * @param context The object to which the context (`this`) of the function should be set.
  3537. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3538. * @since 1.9
  3539. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3540. */
  3541. proxy<TReturn, T, U, V, W, X>(
  3542. funсtion: (t: T, u: U, v: V, w: W, x: X) => TReturn,
  3543. context: null | undefined,
  3544. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  3545. // #endregion
  3546. // region 6 parameters
  3547. // #region 6 parameters
  3548. /**
  3549. * Takes a function and returns a new one that will always have a particular context.
  3550. * @param funсtion The function whose context will be changed.
  3551. * @param context The object to which the context (`this`) of the function should be set.
  3552. * @param a An argument to be passed to the function referenced in the `function` argument.
  3553. * @param b An argument to be passed to the function referenced in the `function` argument.
  3554. * @param c An argument to be passed to the function referenced in the `function` argument.
  3555. * @param d An argument to be passed to the function referenced in the `function` argument.
  3556. * @param e An argument to be passed to the function referenced in the `function` argument.
  3557. * @param f An argument to be passed to the function referenced in the `function` argument.
  3558. * @param g An argument to be passed to the function referenced in the `function` argument.
  3559. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3560. * @since 1.9
  3561. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3562. */
  3563. proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y>(
  3564. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3565. context: null | undefined,
  3566. a: A,
  3567. b: B,
  3568. c: C,
  3569. d: D,
  3570. e: E,
  3571. f: F,
  3572. g: G,
  3573. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3574. /**
  3575. * Takes a function and returns a new one that will always have a particular context.
  3576. * @param funсtion The function whose context will be changed.
  3577. * @param context The object to which the context (`this`) of the function should be set.
  3578. * @param a An argument to be passed to the function referenced in the `function` argument.
  3579. * @param b An argument to be passed to the function referenced in the `function` argument.
  3580. * @param c An argument to be passed to the function referenced in the `function` argument.
  3581. * @param d An argument to be passed to the function referenced in the `function` argument.
  3582. * @param e An argument to be passed to the function referenced in the `function` argument.
  3583. * @param f An argument to be passed to the function referenced in the `function` argument.
  3584. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3585. * @since 1.9
  3586. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3587. */
  3588. proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X, Y>(
  3589. funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3590. context: null | undefined,
  3591. a: A,
  3592. b: B,
  3593. c: C,
  3594. d: D,
  3595. e: E,
  3596. f: F,
  3597. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3598. /**
  3599. * Takes a function and returns a new one that will always have a particular context.
  3600. * @param funсtion The function whose context will be changed.
  3601. * @param context The object to which the context (`this`) of the function should be set.
  3602. * @param a An argument to be passed to the function referenced in the `function` argument.
  3603. * @param b An argument to be passed to the function referenced in the `function` argument.
  3604. * @param c An argument to be passed to the function referenced in the `function` argument.
  3605. * @param d An argument to be passed to the function referenced in the `function` argument.
  3606. * @param e An argument to be passed to the function referenced in the `function` argument.
  3607. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3608. * @since 1.9
  3609. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3610. */
  3611. proxy<TReturn, A, B, C, D, E, T, U, V, W, X, Y>(
  3612. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3613. context: null | undefined,
  3614. a: A,
  3615. b: B,
  3616. c: C,
  3617. d: D,
  3618. e: E,
  3619. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3620. /**
  3621. * Takes a function and returns a new one that will always have a particular context.
  3622. * @param funсtion The function whose context will be changed.
  3623. * @param context The object to which the context (`this`) of the function should be set.
  3624. * @param a An argument to be passed to the function referenced in the `function` argument.
  3625. * @param b An argument to be passed to the function referenced in the `function` argument.
  3626. * @param c An argument to be passed to the function referenced in the `function` argument.
  3627. * @param d An argument to be passed to the function referenced in the `function` argument.
  3628. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3629. * @since 1.9
  3630. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3631. */
  3632. proxy<TReturn, A, B, C, D, T, U, V, W, X, Y>(
  3633. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3634. context: null | undefined,
  3635. a: A,
  3636. b: B,
  3637. c: C,
  3638. d: D,
  3639. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3640. /**
  3641. * Takes a function and returns a new one that will always have a particular context.
  3642. * @param funсtion The function whose context will be changed.
  3643. * @param context The object to which the context (`this`) of the function should be set.
  3644. * @param a An argument to be passed to the function referenced in the `function` argument.
  3645. * @param b An argument to be passed to the function referenced in the `function` argument.
  3646. * @param c An argument to be passed to the function referenced in the `function` argument.
  3647. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3648. * @since 1.9
  3649. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3650. */
  3651. proxy<TReturn, A, B, C, T, U, V, W, X, Y>(
  3652. funсtion: (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3653. context: null | undefined,
  3654. a: A,
  3655. b: B,
  3656. c: C,
  3657. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3658. /**
  3659. * Takes a function and returns a new one that will always have a particular context.
  3660. * @param funсtion The function whose context will be changed.
  3661. * @param context The object to which the context (`this`) of the function should be set.
  3662. * @param a An argument to be passed to the function referenced in the `function` argument.
  3663. * @param b An argument to be passed to the function referenced in the `function` argument.
  3664. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3665. * @since 1.9
  3666. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3667. */
  3668. proxy<TReturn, A, B, T, U, V, W, X, Y>(
  3669. funсtion: (a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3670. context: null | undefined,
  3671. a: A,
  3672. b: B,
  3673. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3674. /**
  3675. * Takes a function and returns a new one that will always have a particular context.
  3676. * @param funсtion The function whose context will be changed.
  3677. * @param context The object to which the context (`this`) of the function should be set.
  3678. * @param a An argument to be passed to the function referenced in the `function` argument.
  3679. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3680. * @since 1.9
  3681. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3682. */
  3683. proxy<TReturn, A, T, U, V, W, X, Y>(
  3684. funсtion: (a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3685. context: null | undefined,
  3686. a: A,
  3687. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3688. /**
  3689. * Takes a function and returns a new one that will always have a particular context.
  3690. * @param funсtion The function whose context will be changed.
  3691. * @param context The object to which the context (`this`) of the function should be set.
  3692. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3693. * @since 1.9
  3694. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3695. */
  3696. proxy<TReturn, T, U, V, W, X, Y>(
  3697. funсtion: (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  3698. context: null | undefined,
  3699. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  3700. // #endregion
  3701. // region 7+ parameters
  3702. // #region 7+ parameters
  3703. /**
  3704. * Takes a function and returns a new one that will always have a particular context.
  3705. * @param funсtion The function whose context will be changed.
  3706. * @param context The object to which the context (`this`) of the function should be set.
  3707. * @param a An argument to be passed to the function referenced in the `function` argument.
  3708. * @param b An argument to be passed to the function referenced in the `function` argument.
  3709. * @param c An argument to be passed to the function referenced in the `function` argument.
  3710. * @param d An argument to be passed to the function referenced in the `function` argument.
  3711. * @param e An argument to be passed to the function referenced in the `function` argument.
  3712. * @param f An argument to be passed to the function referenced in the `function` argument.
  3713. * @param g An argument to be passed to the function referenced in the `function` argument.
  3714. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3715. * @since 1.9
  3716. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3717. */
  3718. proxy<TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(
  3719. funсtion: (
  3720. a: A,
  3721. b: B,
  3722. c: C,
  3723. d: D,
  3724. e: E,
  3725. f: F,
  3726. g: G,
  3727. t: T,
  3728. u: U,
  3729. v: V,
  3730. w: W,
  3731. x: X,
  3732. y: Y,
  3733. z: Z,
  3734. ...args: any[]
  3735. ) => TReturn,
  3736. context: null | undefined,
  3737. a: A,
  3738. b: B,
  3739. c: C,
  3740. d: D,
  3741. e: E,
  3742. f: F,
  3743. g: G,
  3744. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3745. /**
  3746. * Takes a function and returns a new one that will always have a particular context.
  3747. * @param funсtion The function whose context will be changed.
  3748. * @param context The object to which the context (`this`) of the function should be set.
  3749. * @param a An argument to be passed to the function referenced in the `function` argument.
  3750. * @param b An argument to be passed to the function referenced in the `function` argument.
  3751. * @param c An argument to be passed to the function referenced in the `function` argument.
  3752. * @param d An argument to be passed to the function referenced in the `function` argument.
  3753. * @param e An argument to be passed to the function referenced in the `function` argument.
  3754. * @param f An argument to be passed to the function referenced in the `function` argument.
  3755. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3756. * @since 1.9
  3757. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3758. */
  3759. proxy<TReturn, A, B, C, D, E, F, T, U, V, W, X, Y, Z>(
  3760. funсtion: (
  3761. a: A,
  3762. b: B,
  3763. c: C,
  3764. d: D,
  3765. e: E,
  3766. f: F,
  3767. t: T,
  3768. u: U,
  3769. v: V,
  3770. w: W,
  3771. x: X,
  3772. y: Y,
  3773. z: Z,
  3774. ...args: any[]
  3775. ) => TReturn,
  3776. context: null | undefined,
  3777. a: A,
  3778. b: B,
  3779. c: C,
  3780. d: D,
  3781. e: E,
  3782. f: F,
  3783. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3784. /**
  3785. * Takes a function and returns a new one that will always have a particular context.
  3786. * @param funсtion The function whose context will be changed.
  3787. * @param context The object to which the context (`this`) of the function should be set.
  3788. * @param a An argument to be passed to the function referenced in the `function` argument.
  3789. * @param b An argument to be passed to the function referenced in the `function` argument.
  3790. * @param c An argument to be passed to the function referenced in the `function` argument.
  3791. * @param d An argument to be passed to the function referenced in the `function` argument.
  3792. * @param e An argument to be passed to the function referenced in the `function` argument.
  3793. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3794. * @since 1.9
  3795. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3796. */
  3797. proxy<TReturn, A, B, C, D, E, T, U, V, W, X, Y, Z>(
  3798. funсtion: (a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3799. context: null | undefined,
  3800. a: A,
  3801. b: B,
  3802. c: C,
  3803. d: D,
  3804. e: E,
  3805. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3806. /**
  3807. * Takes a function and returns a new one that will always have a particular context.
  3808. * @param funсtion The function whose context will be changed.
  3809. * @param context The object to which the context (`this`) of the function should be set.
  3810. * @param a An argument to be passed to the function referenced in the `function` argument.
  3811. * @param b An argument to be passed to the function referenced in the `function` argument.
  3812. * @param c An argument to be passed to the function referenced in the `function` argument.
  3813. * @param d An argument to be passed to the function referenced in the `function` argument.
  3814. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3815. * @since 1.9
  3816. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3817. */
  3818. proxy<TReturn, A, B, C, D, T, U, V, W, X, Y, Z>(
  3819. funсtion: (a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3820. context: null | undefined,
  3821. a: A,
  3822. b: B,
  3823. c: C,
  3824. d: D,
  3825. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3826. /**
  3827. * Takes a function and returns a new one that will always have a particular context.
  3828. * @param funсtion The function whose context will be changed.
  3829. * @param context The object to which the context (`this`) of the function should be set.
  3830. * @param a An argument to be passed to the function referenced in the `function` argument.
  3831. * @param b An argument to be passed to the function referenced in the `function` argument.
  3832. * @param c An argument to be passed to the function referenced in the `function` argument.
  3833. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3834. * @since 1.9
  3835. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3836. */
  3837. proxy<TReturn, A, B, C, T, U, V, W, X, Y, Z>(
  3838. funсtion: (a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3839. context: null | undefined,
  3840. a: A,
  3841. b: B,
  3842. c: C,
  3843. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3844. /**
  3845. * Takes a function and returns a new one that will always have a particular context.
  3846. * @param funсtion The function whose context will be changed.
  3847. * @param context The object to which the context (`this`) of the function should be set.
  3848. * @param a An argument to be passed to the function referenced in the `function` argument.
  3849. * @param b An argument to be passed to the function referenced in the `function` argument.
  3850. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3851. * @since 1.9
  3852. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3853. */
  3854. proxy<TReturn, A, B, T, U, V, W, X, Y, Z>(
  3855. funсtion: (a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3856. context: null | undefined,
  3857. a: A,
  3858. b: B,
  3859. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3860. /**
  3861. * Takes a function and returns a new one that will always have a particular context.
  3862. * @param funсtion The function whose context will be changed.
  3863. * @param context The object to which the context (`this`) of the function should be set.
  3864. * @param a An argument to be passed to the function referenced in the `function` argument.
  3865. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3866. * @since 1.9
  3867. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3868. */
  3869. proxy<TReturn, A, T, U, V, W, X, Y, Z>(
  3870. funсtion: (a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3871. context: null | undefined,
  3872. a: A,
  3873. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3874. /**
  3875. * Takes a function and returns a new one that will always have a particular context.
  3876. * @param funсtion The function whose context will be changed.
  3877. * @param context The object to which the context (`this`) of the function should be set.
  3878. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3879. * @since 1.9
  3880. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3881. */
  3882. proxy<TReturn, T, U, V, W, X, Y, Z>(
  3883. funсtion: (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  3884. context: null | undefined,
  3885. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  3886. // #endregion
  3887. // #endregion
  3888. // region 8+ additional arguments
  3889. // #region 8+ additional arguments
  3890. /**
  3891. * Takes a function and returns a new one that will always have a particular context.
  3892. * @param funсtion The function whose context will be changed.
  3893. * @param context The object to which the context (`this`) of the function should be set.
  3894. * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument.
  3895. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3896. * @since 1.9
  3897. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3898. */
  3899. proxy<TReturn>(
  3900. funсtion: (...args: any[]) => TReturn,
  3901. context: null | undefined,
  3902. ...additionalArguments: any[]
  3903. ): (...args: any[]) => TReturn;
  3904. // #endregion
  3905. // #endregion
  3906. // region (funсtion, context)
  3907. // #region (funсtion, context)
  3908. // region 0 to 7 additional arguments
  3909. // #region 0 to 7 additional arguments
  3910. // region 0 parameters
  3911. // #region 0 parameters
  3912. /**
  3913. * Takes a function and returns a new one that will always have a particular context.
  3914. * @param funсtion The function whose context will be changed.
  3915. * @param context The object to which the context (`this`) of the function should be set.
  3916. * @param a An argument to be passed to the function referenced in the `function` argument.
  3917. * @param b An argument to be passed to the function referenced in the `function` argument.
  3918. * @param c An argument to be passed to the function referenced in the `function` argument.
  3919. * @param d An argument to be passed to the function referenced in the `function` argument.
  3920. * @param e An argument to be passed to the function referenced in the `function` argument.
  3921. * @param f An argument to be passed to the function referenced in the `function` argument.
  3922. * @param g An argument to be passed to the function referenced in the `function` argument.
  3923. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  3924. * @since 1.4
  3925. * @since 1.6
  3926. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  3927. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  3928. ```html
  3929. <!doctype html>
  3930. <html lang="en">
  3931. <head>
  3932. <meta charset="utf-8">
  3933. <title>jQuery.proxy demo</title>
  3934. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3935. </head>
  3936. <body>
  3937. <p><button type="button" id="test">Test</button></p>
  3938. <div id="log"></div>
  3939. <script>
  3940. var me = {
  3941. type: "zombie",
  3942. test: function( event ) {
  3943. // Without proxy, `this` would refer to the event target
  3944. // use event.target to reference that element.
  3945. var element = event.target;
  3946. $( element ).css( "background-color", "red" );
  3947. // With proxy, `this` refers to the me object encapsulating
  3948. // this function.
  3949. $( "#log" ).append( "Hello " + this.type + "<br>" );
  3950. $( "#test" ).off( "click", this.test );
  3951. }
  3952. };
  3953. var you = {
  3954. type: "person",
  3955. test: function( event ) {
  3956. $( "#log" ).append( this.type + " " );
  3957. }
  3958. };
  3959. // Execute you.test() in the context of the `you` object
  3960. // no matter where it is called
  3961. // i.e. the `this` keyword will refer to `you`
  3962. var youClick = $.proxy( you.test, you );
  3963. // attach click handlers to #test
  3964. $( "#test" )
  3965. // this === "zombie"; handler unbound after first click
  3966. .on( "click", $.proxy( me.test, me ) )
  3967. // this === "person"
  3968. .on( "click", youClick )
  3969. // this === "zombie"
  3970. .on( "click", $.proxy( you.test, me ) )
  3971. // this === "<button> element"
  3972. .on( "click", you.test );
  3973. </script>
  3974. </body>
  3975. </html>
  3976. ```
  3977. * @example ​ ````Change the context of a function bound to the click handler,
  3978. ```html
  3979. <!doctype html>
  3980. <html lang="en">
  3981. <head>
  3982. <meta charset="utf-8">
  3983. <title>jQuery.proxy demo</title>
  3984. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3985. </head>
  3986. <body>
  3987. <p><button type="button" id="test">Test</button></p>
  3988. <div id="log"></div>
  3989. <script>
  3990. var me = {
  3991. // I'm a dog
  3992. type: "dog",
  3993. // Note that event comes *after* one and two
  3994. test: function( one, two, event ) {
  3995. $( "#log" )
  3996. // `one` maps to `you`, the 1st additional
  3997. // argument in the $.proxy function call
  3998. .append( "<h3>Hello " + one.type + ":</h3>" )
  3999. // The `this` keyword refers to `me`
  4000. // (the 2nd, context, argument of $.proxy)
  4001. .append( "I am a " + this.type + ", " )
  4002. // `two` maps to `they`, the 2nd additional
  4003. // argument in the $.proxy function call
  4004. .append( "and they are " + two.type + ".<br>" )
  4005. // The event type is "click"
  4006. .append( "Thanks for " + event.type + "ing." )
  4007. // The clicked element is `event.target`,
  4008. // and its type is "button"
  4009. .append( "the " + event.target.type + "." );
  4010. }
  4011. };
  4012. var you = { type: "cat" };
  4013. var they = { type: "fish" };
  4014. // Set up handler to execute me.test() in the context
  4015. // of `me`, with `you` and `they` as additional arguments
  4016. var proxy = $.proxy( me.test, me, you, they );
  4017. $( "#test" )
  4018. .on( "click", proxy );
  4019. </script>
  4020. </body>
  4021. </html>
  4022. ```
  4023. */
  4024. proxy<TContext, TReturn, A, B, C, D, E, F, G>(
  4025. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn,
  4026. context: TContext,
  4027. a: A,
  4028. b: B,
  4029. c: C,
  4030. d: D,
  4031. e: E,
  4032. f: F,
  4033. g: G,
  4034. ): () => TReturn;
  4035. /**
  4036. * Takes a function and returns a new one that will always have a particular context.
  4037. * @param funсtion The function whose context will be changed.
  4038. * @param context The object to which the context (`this`) of the function should be set.
  4039. * @param a An argument to be passed to the function referenced in the `function` argument.
  4040. * @param b An argument to be passed to the function referenced in the `function` argument.
  4041. * @param c An argument to be passed to the function referenced in the `function` argument.
  4042. * @param d An argument to be passed to the function referenced in the `function` argument.
  4043. * @param e An argument to be passed to the function referenced in the `function` argument.
  4044. * @param f An argument to be passed to the function referenced in the `function` argument.
  4045. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4046. * @since 1.4
  4047. * @since 1.6
  4048. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4049. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4050. ```html
  4051. <!doctype html>
  4052. <html lang="en">
  4053. <head>
  4054. <meta charset="utf-8">
  4055. <title>jQuery.proxy demo</title>
  4056. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4057. </head>
  4058. <body>
  4059. <p><button type="button" id="test">Test</button></p>
  4060. <div id="log"></div>
  4061. <script>
  4062. var me = {
  4063. type: "zombie",
  4064. test: function( event ) {
  4065. // Without proxy, `this` would refer to the event target
  4066. // use event.target to reference that element.
  4067. var element = event.target;
  4068. $( element ).css( "background-color", "red" );
  4069. // With proxy, `this` refers to the me object encapsulating
  4070. // this function.
  4071. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4072. $( "#test" ).off( "click", this.test );
  4073. }
  4074. };
  4075. var you = {
  4076. type: "person",
  4077. test: function( event ) {
  4078. $( "#log" ).append( this.type + " " );
  4079. }
  4080. };
  4081. // Execute you.test() in the context of the `you` object
  4082. // no matter where it is called
  4083. // i.e. the `this` keyword will refer to `you`
  4084. var youClick = $.proxy( you.test, you );
  4085. // attach click handlers to #test
  4086. $( "#test" )
  4087. // this === "zombie"; handler unbound after first click
  4088. .on( "click", $.proxy( me.test, me ) )
  4089. // this === "person"
  4090. .on( "click", youClick )
  4091. // this === "zombie"
  4092. .on( "click", $.proxy( you.test, me ) )
  4093. // this === "<button> element"
  4094. .on( "click", you.test );
  4095. </script>
  4096. </body>
  4097. </html>
  4098. ```
  4099. * @example ​ ````Change the context of a function bound to the click handler,
  4100. ```html
  4101. <!doctype html>
  4102. <html lang="en">
  4103. <head>
  4104. <meta charset="utf-8">
  4105. <title>jQuery.proxy demo</title>
  4106. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4107. </head>
  4108. <body>
  4109. <p><button type="button" id="test">Test</button></p>
  4110. <div id="log"></div>
  4111. <script>
  4112. var me = {
  4113. // I'm a dog
  4114. type: "dog",
  4115. // Note that event comes *after* one and two
  4116. test: function( one, two, event ) {
  4117. $( "#log" )
  4118. // `one` maps to `you`, the 1st additional
  4119. // argument in the $.proxy function call
  4120. .append( "<h3>Hello " + one.type + ":</h3>" )
  4121. // The `this` keyword refers to `me`
  4122. // (the 2nd, context, argument of $.proxy)
  4123. .append( "I am a " + this.type + ", " )
  4124. // `two` maps to `they`, the 2nd additional
  4125. // argument in the $.proxy function call
  4126. .append( "and they are " + two.type + ".<br>" )
  4127. // The event type is "click"
  4128. .append( "Thanks for " + event.type + "ing." )
  4129. // The clicked element is `event.target`,
  4130. // and its type is "button"
  4131. .append( "the " + event.target.type + "." );
  4132. }
  4133. };
  4134. var you = { type: "cat" };
  4135. var they = { type: "fish" };
  4136. // Set up handler to execute me.test() in the context
  4137. // of `me`, with `you` and `they` as additional arguments
  4138. var proxy = $.proxy( me.test, me, you, they );
  4139. $( "#test" )
  4140. .on( "click", proxy );
  4141. </script>
  4142. </body>
  4143. </html>
  4144. ```
  4145. */
  4146. proxy<TContext, TReturn, A, B, C, D, E, F>(
  4147. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F) => TReturn,
  4148. context: TContext,
  4149. a: A,
  4150. b: B,
  4151. c: C,
  4152. d: D,
  4153. e: E,
  4154. f: F,
  4155. ): () => TReturn;
  4156. /**
  4157. * Takes a function and returns a new one that will always have a particular context.
  4158. * @param funсtion The function whose context will be changed.
  4159. * @param context The object to which the context (`this`) of the function should be set.
  4160. * @param a An argument to be passed to the function referenced in the `function` argument.
  4161. * @param b An argument to be passed to the function referenced in the `function` argument.
  4162. * @param c An argument to be passed to the function referenced in the `function` argument.
  4163. * @param d An argument to be passed to the function referenced in the `function` argument.
  4164. * @param e An argument to be passed to the function referenced in the `function` argument.
  4165. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4166. * @since 1.4
  4167. * @since 1.6
  4168. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4169. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4170. ```html
  4171. <!doctype html>
  4172. <html lang="en">
  4173. <head>
  4174. <meta charset="utf-8">
  4175. <title>jQuery.proxy demo</title>
  4176. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4177. </head>
  4178. <body>
  4179. <p><button type="button" id="test">Test</button></p>
  4180. <div id="log"></div>
  4181. <script>
  4182. var me = {
  4183. type: "zombie",
  4184. test: function( event ) {
  4185. // Without proxy, `this` would refer to the event target
  4186. // use event.target to reference that element.
  4187. var element = event.target;
  4188. $( element ).css( "background-color", "red" );
  4189. // With proxy, `this` refers to the me object encapsulating
  4190. // this function.
  4191. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4192. $( "#test" ).off( "click", this.test );
  4193. }
  4194. };
  4195. var you = {
  4196. type: "person",
  4197. test: function( event ) {
  4198. $( "#log" ).append( this.type + " " );
  4199. }
  4200. };
  4201. // Execute you.test() in the context of the `you` object
  4202. // no matter where it is called
  4203. // i.e. the `this` keyword will refer to `you`
  4204. var youClick = $.proxy( you.test, you );
  4205. // attach click handlers to #test
  4206. $( "#test" )
  4207. // this === "zombie"; handler unbound after first click
  4208. .on( "click", $.proxy( me.test, me ) )
  4209. // this === "person"
  4210. .on( "click", youClick )
  4211. // this === "zombie"
  4212. .on( "click", $.proxy( you.test, me ) )
  4213. // this === "<button> element"
  4214. .on( "click", you.test );
  4215. </script>
  4216. </body>
  4217. </html>
  4218. ```
  4219. * @example ​ ````Change the context of a function bound to the click handler,
  4220. ```html
  4221. <!doctype html>
  4222. <html lang="en">
  4223. <head>
  4224. <meta charset="utf-8">
  4225. <title>jQuery.proxy demo</title>
  4226. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4227. </head>
  4228. <body>
  4229. <p><button type="button" id="test">Test</button></p>
  4230. <div id="log"></div>
  4231. <script>
  4232. var me = {
  4233. // I'm a dog
  4234. type: "dog",
  4235. // Note that event comes *after* one and two
  4236. test: function( one, two, event ) {
  4237. $( "#log" )
  4238. // `one` maps to `you`, the 1st additional
  4239. // argument in the $.proxy function call
  4240. .append( "<h3>Hello " + one.type + ":</h3>" )
  4241. // The `this` keyword refers to `me`
  4242. // (the 2nd, context, argument of $.proxy)
  4243. .append( "I am a " + this.type + ", " )
  4244. // `two` maps to `they`, the 2nd additional
  4245. // argument in the $.proxy function call
  4246. .append( "and they are " + two.type + ".<br>" )
  4247. // The event type is "click"
  4248. .append( "Thanks for " + event.type + "ing." )
  4249. // The clicked element is `event.target`,
  4250. // and its type is "button"
  4251. .append( "the " + event.target.type + "." );
  4252. }
  4253. };
  4254. var you = { type: "cat" };
  4255. var they = { type: "fish" };
  4256. // Set up handler to execute me.test() in the context
  4257. // of `me`, with `you` and `they` as additional arguments
  4258. var proxy = $.proxy( me.test, me, you, they );
  4259. $( "#test" )
  4260. .on( "click", proxy );
  4261. </script>
  4262. </body>
  4263. </html>
  4264. ```
  4265. */
  4266. proxy<TContext, TReturn, A, B, C, D, E>(
  4267. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E) => TReturn,
  4268. context: TContext,
  4269. a: A,
  4270. b: B,
  4271. c: C,
  4272. d: D,
  4273. e: E,
  4274. ): () => TReturn;
  4275. /**
  4276. * Takes a function and returns a new one that will always have a particular context.
  4277. * @param funсtion The function whose context will be changed.
  4278. * @param context The object to which the context (`this`) of the function should be set.
  4279. * @param a An argument to be passed to the function referenced in the `function` argument.
  4280. * @param b An argument to be passed to the function referenced in the `function` argument.
  4281. * @param c An argument to be passed to the function referenced in the `function` argument.
  4282. * @param d An argument to be passed to the function referenced in the `function` argument.
  4283. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4284. * @since 1.4
  4285. * @since 1.6
  4286. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4287. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4288. ```html
  4289. <!doctype html>
  4290. <html lang="en">
  4291. <head>
  4292. <meta charset="utf-8">
  4293. <title>jQuery.proxy demo</title>
  4294. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4295. </head>
  4296. <body>
  4297. <p><button type="button" id="test">Test</button></p>
  4298. <div id="log"></div>
  4299. <script>
  4300. var me = {
  4301. type: "zombie",
  4302. test: function( event ) {
  4303. // Without proxy, `this` would refer to the event target
  4304. // use event.target to reference that element.
  4305. var element = event.target;
  4306. $( element ).css( "background-color", "red" );
  4307. // With proxy, `this` refers to the me object encapsulating
  4308. // this function.
  4309. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4310. $( "#test" ).off( "click", this.test );
  4311. }
  4312. };
  4313. var you = {
  4314. type: "person",
  4315. test: function( event ) {
  4316. $( "#log" ).append( this.type + " " );
  4317. }
  4318. };
  4319. // Execute you.test() in the context of the `you` object
  4320. // no matter where it is called
  4321. // i.e. the `this` keyword will refer to `you`
  4322. var youClick = $.proxy( you.test, you );
  4323. // attach click handlers to #test
  4324. $( "#test" )
  4325. // this === "zombie"; handler unbound after first click
  4326. .on( "click", $.proxy( me.test, me ) )
  4327. // this === "person"
  4328. .on( "click", youClick )
  4329. // this === "zombie"
  4330. .on( "click", $.proxy( you.test, me ) )
  4331. // this === "<button> element"
  4332. .on( "click", you.test );
  4333. </script>
  4334. </body>
  4335. </html>
  4336. ```
  4337. * @example ​ ````Change the context of a function bound to the click handler,
  4338. ```html
  4339. <!doctype html>
  4340. <html lang="en">
  4341. <head>
  4342. <meta charset="utf-8">
  4343. <title>jQuery.proxy demo</title>
  4344. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4345. </head>
  4346. <body>
  4347. <p><button type="button" id="test">Test</button></p>
  4348. <div id="log"></div>
  4349. <script>
  4350. var me = {
  4351. // I'm a dog
  4352. type: "dog",
  4353. // Note that event comes *after* one and two
  4354. test: function( one, two, event ) {
  4355. $( "#log" )
  4356. // `one` maps to `you`, the 1st additional
  4357. // argument in the $.proxy function call
  4358. .append( "<h3>Hello " + one.type + ":</h3>" )
  4359. // The `this` keyword refers to `me`
  4360. // (the 2nd, context, argument of $.proxy)
  4361. .append( "I am a " + this.type + ", " )
  4362. // `two` maps to `they`, the 2nd additional
  4363. // argument in the $.proxy function call
  4364. .append( "and they are " + two.type + ".<br>" )
  4365. // The event type is "click"
  4366. .append( "Thanks for " + event.type + "ing." )
  4367. // The clicked element is `event.target`,
  4368. // and its type is "button"
  4369. .append( "the " + event.target.type + "." );
  4370. }
  4371. };
  4372. var you = { type: "cat" };
  4373. var they = { type: "fish" };
  4374. // Set up handler to execute me.test() in the context
  4375. // of `me`, with `you` and `they` as additional arguments
  4376. var proxy = $.proxy( me.test, me, you, they );
  4377. $( "#test" )
  4378. .on( "click", proxy );
  4379. </script>
  4380. </body>
  4381. </html>
  4382. ```
  4383. */
  4384. proxy<TContext, TReturn, A, B, C, D>(
  4385. funсtion: (this: TContext, a: A, b: B, c: C, d: D) => TReturn,
  4386. context: TContext,
  4387. a: A,
  4388. b: B,
  4389. c: C,
  4390. d: D,
  4391. ): () => TReturn;
  4392. /**
  4393. * Takes a function and returns a new one that will always have a particular context.
  4394. * @param funсtion The function whose context will be changed.
  4395. * @param context The object to which the context (`this`) of the function should be set.
  4396. * @param a An argument to be passed to the function referenced in the `function` argument.
  4397. * @param b An argument to be passed to the function referenced in the `function` argument.
  4398. * @param c An argument to be passed to the function referenced in the `function` argument.
  4399. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4400. * @since 1.4
  4401. * @since 1.6
  4402. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4403. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4404. ```html
  4405. <!doctype html>
  4406. <html lang="en">
  4407. <head>
  4408. <meta charset="utf-8">
  4409. <title>jQuery.proxy demo</title>
  4410. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4411. </head>
  4412. <body>
  4413. <p><button type="button" id="test">Test</button></p>
  4414. <div id="log"></div>
  4415. <script>
  4416. var me = {
  4417. type: "zombie",
  4418. test: function( event ) {
  4419. // Without proxy, `this` would refer to the event target
  4420. // use event.target to reference that element.
  4421. var element = event.target;
  4422. $( element ).css( "background-color", "red" );
  4423. // With proxy, `this` refers to the me object encapsulating
  4424. // this function.
  4425. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4426. $( "#test" ).off( "click", this.test );
  4427. }
  4428. };
  4429. var you = {
  4430. type: "person",
  4431. test: function( event ) {
  4432. $( "#log" ).append( this.type + " " );
  4433. }
  4434. };
  4435. // Execute you.test() in the context of the `you` object
  4436. // no matter where it is called
  4437. // i.e. the `this` keyword will refer to `you`
  4438. var youClick = $.proxy( you.test, you );
  4439. // attach click handlers to #test
  4440. $( "#test" )
  4441. // this === "zombie"; handler unbound after first click
  4442. .on( "click", $.proxy( me.test, me ) )
  4443. // this === "person"
  4444. .on( "click", youClick )
  4445. // this === "zombie"
  4446. .on( "click", $.proxy( you.test, me ) )
  4447. // this === "<button> element"
  4448. .on( "click", you.test );
  4449. </script>
  4450. </body>
  4451. </html>
  4452. ```
  4453. * @example ​ ````Change the context of a function bound to the click handler,
  4454. ```html
  4455. <!doctype html>
  4456. <html lang="en">
  4457. <head>
  4458. <meta charset="utf-8">
  4459. <title>jQuery.proxy demo</title>
  4460. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4461. </head>
  4462. <body>
  4463. <p><button type="button" id="test">Test</button></p>
  4464. <div id="log"></div>
  4465. <script>
  4466. var me = {
  4467. // I'm a dog
  4468. type: "dog",
  4469. // Note that event comes *after* one and two
  4470. test: function( one, two, event ) {
  4471. $( "#log" )
  4472. // `one` maps to `you`, the 1st additional
  4473. // argument in the $.proxy function call
  4474. .append( "<h3>Hello " + one.type + ":</h3>" )
  4475. // The `this` keyword refers to `me`
  4476. // (the 2nd, context, argument of $.proxy)
  4477. .append( "I am a " + this.type + ", " )
  4478. // `two` maps to `they`, the 2nd additional
  4479. // argument in the $.proxy function call
  4480. .append( "and they are " + two.type + ".<br>" )
  4481. // The event type is "click"
  4482. .append( "Thanks for " + event.type + "ing." )
  4483. // The clicked element is `event.target`,
  4484. // and its type is "button"
  4485. .append( "the " + event.target.type + "." );
  4486. }
  4487. };
  4488. var you = { type: "cat" };
  4489. var they = { type: "fish" };
  4490. // Set up handler to execute me.test() in the context
  4491. // of `me`, with `you` and `they` as additional arguments
  4492. var proxy = $.proxy( me.test, me, you, they );
  4493. $( "#test" )
  4494. .on( "click", proxy );
  4495. </script>
  4496. </body>
  4497. </html>
  4498. ```
  4499. */
  4500. proxy<TContext, TReturn, A, B, C>(
  4501. funсtion: (this: TContext, a: A, b: B, c: C) => TReturn,
  4502. context: TContext,
  4503. a: A,
  4504. b: B,
  4505. c: C,
  4506. ): () => TReturn;
  4507. /**
  4508. * Takes a function and returns a new one that will always have a particular context.
  4509. * @param funсtion The function whose context will be changed.
  4510. * @param context The object to which the context (`this`) of the function should be set.
  4511. * @param a An argument to be passed to the function referenced in the `function` argument.
  4512. * @param b An argument to be passed to the function referenced in the `function` argument.
  4513. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4514. * @since 1.4
  4515. * @since 1.6
  4516. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4517. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4518. ```html
  4519. <!doctype html>
  4520. <html lang="en">
  4521. <head>
  4522. <meta charset="utf-8">
  4523. <title>jQuery.proxy demo</title>
  4524. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4525. </head>
  4526. <body>
  4527. <p><button type="button" id="test">Test</button></p>
  4528. <div id="log"></div>
  4529. <script>
  4530. var me = {
  4531. type: "zombie",
  4532. test: function( event ) {
  4533. // Without proxy, `this` would refer to the event target
  4534. // use event.target to reference that element.
  4535. var element = event.target;
  4536. $( element ).css( "background-color", "red" );
  4537. // With proxy, `this` refers to the me object encapsulating
  4538. // this function.
  4539. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4540. $( "#test" ).off( "click", this.test );
  4541. }
  4542. };
  4543. var you = {
  4544. type: "person",
  4545. test: function( event ) {
  4546. $( "#log" ).append( this.type + " " );
  4547. }
  4548. };
  4549. // Execute you.test() in the context of the `you` object
  4550. // no matter where it is called
  4551. // i.e. the `this` keyword will refer to `you`
  4552. var youClick = $.proxy( you.test, you );
  4553. // attach click handlers to #test
  4554. $( "#test" )
  4555. // this === "zombie"; handler unbound after first click
  4556. .on( "click", $.proxy( me.test, me ) )
  4557. // this === "person"
  4558. .on( "click", youClick )
  4559. // this === "zombie"
  4560. .on( "click", $.proxy( you.test, me ) )
  4561. // this === "<button> element"
  4562. .on( "click", you.test );
  4563. </script>
  4564. </body>
  4565. </html>
  4566. ```
  4567. * @example ​ ````Change the context of a function bound to the click handler,
  4568. ```html
  4569. <!doctype html>
  4570. <html lang="en">
  4571. <head>
  4572. <meta charset="utf-8">
  4573. <title>jQuery.proxy demo</title>
  4574. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4575. </head>
  4576. <body>
  4577. <p><button type="button" id="test">Test</button></p>
  4578. <div id="log"></div>
  4579. <script>
  4580. var me = {
  4581. // I'm a dog
  4582. type: "dog",
  4583. // Note that event comes *after* one and two
  4584. test: function( one, two, event ) {
  4585. $( "#log" )
  4586. // `one` maps to `you`, the 1st additional
  4587. // argument in the $.proxy function call
  4588. .append( "<h3>Hello " + one.type + ":</h3>" )
  4589. // The `this` keyword refers to `me`
  4590. // (the 2nd, context, argument of $.proxy)
  4591. .append( "I am a " + this.type + ", " )
  4592. // `two` maps to `they`, the 2nd additional
  4593. // argument in the $.proxy function call
  4594. .append( "and they are " + two.type + ".<br>" )
  4595. // The event type is "click"
  4596. .append( "Thanks for " + event.type + "ing." )
  4597. // The clicked element is `event.target`,
  4598. // and its type is "button"
  4599. .append( "the " + event.target.type + "." );
  4600. }
  4601. };
  4602. var you = { type: "cat" };
  4603. var they = { type: "fish" };
  4604. // Set up handler to execute me.test() in the context
  4605. // of `me`, with `you` and `they` as additional arguments
  4606. var proxy = $.proxy( me.test, me, you, they );
  4607. $( "#test" )
  4608. .on( "click", proxy );
  4609. </script>
  4610. </body>
  4611. </html>
  4612. ```
  4613. */
  4614. proxy<TContext, TReturn, A, B>(
  4615. funсtion: (this: TContext, a: A, b: B) => TReturn,
  4616. context: TContext,
  4617. a: A,
  4618. b: B,
  4619. ): () => TReturn;
  4620. /**
  4621. * Takes a function and returns a new one that will always have a particular context.
  4622. * @param funсtion The function whose context will be changed.
  4623. * @param context The object to which the context (`this`) of the function should be set.
  4624. * @param a An argument to be passed to the function referenced in the `function` argument.
  4625. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4626. * @since 1.4`
  4627. * @since 1.6
  4628. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4629. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4630. ```html
  4631. <!doctype html>
  4632. <html lang="en">
  4633. <head>
  4634. <meta charset="utf-8">
  4635. <title>jQuery.proxy demo</title>
  4636. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4637. </head>
  4638. <body>
  4639. <p><button type="button" id="test">Test</button></p>
  4640. <div id="log"></div>
  4641. <script>
  4642. var me = {
  4643. type: "zombie",
  4644. test: function( event ) {
  4645. // Without proxy, `this` would refer to the event target
  4646. // use event.target to reference that element.
  4647. var element = event.target;
  4648. $( element ).css( "background-color", "red" );
  4649. // With proxy, `this` refers to the me object encapsulating
  4650. // this function.
  4651. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4652. $( "#test" ).off( "click", this.test );
  4653. }
  4654. };
  4655. var you = {
  4656. type: "person",
  4657. test: function( event ) {
  4658. $( "#log" ).append( this.type + " " );
  4659. }
  4660. };
  4661. // Execute you.test() in the context of the `you` object
  4662. // no matter where it is called
  4663. // i.e. the `this` keyword will refer to `you`
  4664. var youClick = $.proxy( you.test, you );
  4665. // attach click handlers to #test
  4666. $( "#test" )
  4667. // this === "zombie"; handler unbound after first click
  4668. .on( "click", $.proxy( me.test, me ) )
  4669. // this === "person"
  4670. .on( "click", youClick )
  4671. // this === "zombie"
  4672. .on( "click", $.proxy( you.test, me ) )
  4673. // this === "<button> element"
  4674. .on( "click", you.test );
  4675. </script>
  4676. </body>
  4677. </html>
  4678. ```
  4679. * @example ​ ````Change the context of a function bound to the click handler,
  4680. ```html
  4681. <!doctype html>
  4682. <html lang="en">
  4683. <head>
  4684. <meta charset="utf-8">
  4685. <title>jQuery.proxy demo</title>
  4686. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4687. </head>
  4688. <body>
  4689. <p><button type="button" id="test">Test</button></p>
  4690. <div id="log"></div>
  4691. <script>
  4692. var me = {
  4693. // I'm a dog
  4694. type: "dog",
  4695. // Note that event comes *after* one and two
  4696. test: function( one, two, event ) {
  4697. $( "#log" )
  4698. // `one` maps to `you`, the 1st additional
  4699. // argument in the $.proxy function call
  4700. .append( "<h3>Hello " + one.type + ":</h3>" )
  4701. // The `this` keyword refers to `me`
  4702. // (the 2nd, context, argument of $.proxy)
  4703. .append( "I am a " + this.type + ", " )
  4704. // `two` maps to `they`, the 2nd additional
  4705. // argument in the $.proxy function call
  4706. .append( "and they are " + two.type + ".<br>" )
  4707. // The event type is "click"
  4708. .append( "Thanks for " + event.type + "ing." )
  4709. // The clicked element is `event.target`,
  4710. // and its type is "button"
  4711. .append( "the " + event.target.type + "." );
  4712. }
  4713. };
  4714. var you = { type: "cat" };
  4715. var they = { type: "fish" };
  4716. // Set up handler to execute me.test() in the context
  4717. // of `me`, with `you` and `they` as additional arguments
  4718. var proxy = $.proxy( me.test, me, you, they );
  4719. $( "#test" )
  4720. .on( "click", proxy );
  4721. </script>
  4722. </body>
  4723. </html>
  4724. ```
  4725. */
  4726. proxy<TContext, TReturn, A>(funсtion: (this: TContext, a: A) => TReturn, context: TContext, a: A): () => TReturn;
  4727. /**
  4728. * Takes a function and returns a new one that will always have a particular context.
  4729. * @param funсtion The function whose context will be changed.
  4730. * @param context The object to which the context (`this`) of the function should be set.
  4731. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4732. * @since 1.4
  4733. * @since 1.6
  4734. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4735. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4736. ```html
  4737. <!doctype html>
  4738. <html lang="en">
  4739. <head>
  4740. <meta charset="utf-8">
  4741. <title>jQuery.proxy demo</title>
  4742. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4743. </head>
  4744. <body>
  4745. <p><button type="button" id="test">Test</button></p>
  4746. <div id="log"></div>
  4747. <script>
  4748. var me = {
  4749. type: "zombie",
  4750. test: function( event ) {
  4751. // Without proxy, `this` would refer to the event target
  4752. // use event.target to reference that element.
  4753. var element = event.target;
  4754. $( element ).css( "background-color", "red" );
  4755. // With proxy, `this` refers to the me object encapsulating
  4756. // this function.
  4757. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4758. $( "#test" ).off( "click", this.test );
  4759. }
  4760. };
  4761. var you = {
  4762. type: "person",
  4763. test: function( event ) {
  4764. $( "#log" ).append( this.type + " " );
  4765. }
  4766. };
  4767. // Execute you.test() in the context of the `you` object
  4768. // no matter where it is called
  4769. // i.e. the `this` keyword will refer to `you`
  4770. var youClick = $.proxy( you.test, you );
  4771. // attach click handlers to #test
  4772. $( "#test" )
  4773. // this === "zombie"; handler unbound after first click
  4774. .on( "click", $.proxy( me.test, me ) )
  4775. // this === "person"
  4776. .on( "click", youClick )
  4777. // this === "zombie"
  4778. .on( "click", $.proxy( you.test, me ) )
  4779. // this === "<button> element"
  4780. .on( "click", you.test );
  4781. </script>
  4782. </body>
  4783. </html>
  4784. ```
  4785. * @example ​ ````Change the context of a function bound to the click handler,
  4786. ```html
  4787. <!doctype html>
  4788. <html lang="en">
  4789. <head>
  4790. <meta charset="utf-8">
  4791. <title>jQuery.proxy demo</title>
  4792. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4793. </head>
  4794. <body>
  4795. <p><button type="button" id="test">Test</button></p>
  4796. <div id="log"></div>
  4797. <script>
  4798. var me = {
  4799. // I'm a dog
  4800. type: "dog",
  4801. // Note that event comes *after* one and two
  4802. test: function( one, two, event ) {
  4803. $( "#log" )
  4804. // `one` maps to `you`, the 1st additional
  4805. // argument in the $.proxy function call
  4806. .append( "<h3>Hello " + one.type + ":</h3>" )
  4807. // The `this` keyword refers to `me`
  4808. // (the 2nd, context, argument of $.proxy)
  4809. .append( "I am a " + this.type + ", " )
  4810. // `two` maps to `they`, the 2nd additional
  4811. // argument in the $.proxy function call
  4812. .append( "and they are " + two.type + ".<br>" )
  4813. // The event type is "click"
  4814. .append( "Thanks for " + event.type + "ing." )
  4815. // The clicked element is `event.target`,
  4816. // and its type is "button"
  4817. .append( "the " + event.target.type + "." );
  4818. }
  4819. };
  4820. var you = { type: "cat" };
  4821. var they = { type: "fish" };
  4822. // Set up handler to execute me.test() in the context
  4823. // of `me`, with `you` and `they` as additional arguments
  4824. var proxy = $.proxy( me.test, me, you, they );
  4825. $( "#test" )
  4826. .on( "click", proxy );
  4827. </script>
  4828. </body>
  4829. </html>
  4830. ```
  4831. */
  4832. proxy<TContext, TReturn>(funсtion: (this: TContext) => TReturn, context: TContext): () => TReturn;
  4833. // #endregion
  4834. // region 1 parameters
  4835. // #region 1 parameters
  4836. /**
  4837. * Takes a function and returns a new one that will always have a particular context.
  4838. * @param funсtion The function whose context will be changed.
  4839. * @param context The object to which the context (`this`) of the function should be set.
  4840. * @param a An argument to be passed to the function referenced in the `function` argument.
  4841. * @param b An argument to be passed to the function referenced in the `function` argument.
  4842. * @param c An argument to be passed to the function referenced in the `function` argument.
  4843. * @param d An argument to be passed to the function referenced in the `function` argument.
  4844. * @param e An argument to be passed to the function referenced in the `function` argument.
  4845. * @param f An argument to be passed to the function referenced in the `function` argument.
  4846. * @param g An argument to be passed to the function referenced in the `function` argument.
  4847. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4848. * @since 1.4
  4849. * @since 1.6
  4850. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4851. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4852. ```html
  4853. <!doctype html>
  4854. <html lang="en">
  4855. <head>
  4856. <meta charset="utf-8">
  4857. <title>jQuery.proxy demo</title>
  4858. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4859. </head>
  4860. <body>
  4861. <p><button type="button" id="test">Test</button></p>
  4862. <div id="log"></div>
  4863. <script>
  4864. var me = {
  4865. type: "zombie",
  4866. test: function( event ) {
  4867. // Without proxy, `this` would refer to the event target
  4868. // use event.target to reference that element.
  4869. var element = event.target;
  4870. $( element ).css( "background-color", "red" );
  4871. // With proxy, `this` refers to the me object encapsulating
  4872. // this function.
  4873. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4874. $( "#test" ).off( "click", this.test );
  4875. }
  4876. };
  4877. var you = {
  4878. type: "person",
  4879. test: function( event ) {
  4880. $( "#log" ).append( this.type + " " );
  4881. }
  4882. };
  4883. // Execute you.test() in the context of the `you` object
  4884. // no matter where it is called
  4885. // i.e. the `this` keyword will refer to `you`
  4886. var youClick = $.proxy( you.test, you );
  4887. // attach click handlers to #test
  4888. $( "#test" )
  4889. // this === "zombie"; handler unbound after first click
  4890. .on( "click", $.proxy( me.test, me ) )
  4891. // this === "person"
  4892. .on( "click", youClick )
  4893. // this === "zombie"
  4894. .on( "click", $.proxy( you.test, me ) )
  4895. // this === "<button> element"
  4896. .on( "click", you.test );
  4897. </script>
  4898. </body>
  4899. </html>
  4900. ```
  4901. * @example ​ ````Change the context of a function bound to the click handler,
  4902. ```html
  4903. <!doctype html>
  4904. <html lang="en">
  4905. <head>
  4906. <meta charset="utf-8">
  4907. <title>jQuery.proxy demo</title>
  4908. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4909. </head>
  4910. <body>
  4911. <p><button type="button" id="test">Test</button></p>
  4912. <div id="log"></div>
  4913. <script>
  4914. var me = {
  4915. // I'm a dog
  4916. type: "dog",
  4917. // Note that event comes *after* one and two
  4918. test: function( one, two, event ) {
  4919. $( "#log" )
  4920. // `one` maps to `you`, the 1st additional
  4921. // argument in the $.proxy function call
  4922. .append( "<h3>Hello " + one.type + ":</h3>" )
  4923. // The `this` keyword refers to `me`
  4924. // (the 2nd, context, argument of $.proxy)
  4925. .append( "I am a " + this.type + ", " )
  4926. // `two` maps to `they`, the 2nd additional
  4927. // argument in the $.proxy function call
  4928. .append( "and they are " + two.type + ".<br>" )
  4929. // The event type is "click"
  4930. .append( "Thanks for " + event.type + "ing." )
  4931. // The clicked element is `event.target`,
  4932. // and its type is "button"
  4933. .append( "the " + event.target.type + "." );
  4934. }
  4935. };
  4936. var you = { type: "cat" };
  4937. var they = { type: "fish" };
  4938. // Set up handler to execute me.test() in the context
  4939. // of `me`, with `you` and `they` as additional arguments
  4940. var proxy = $.proxy( me.test, me, you, they );
  4941. $( "#test" )
  4942. .on( "click", proxy );
  4943. </script>
  4944. </body>
  4945. </html>
  4946. ```
  4947. */
  4948. proxy<TContext, TReturn, A, B, C, D, E, F, G, T>(
  4949. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T) => TReturn,
  4950. context: TContext,
  4951. a: A,
  4952. b: B,
  4953. c: C,
  4954. d: D,
  4955. e: E,
  4956. f: F,
  4957. g: G,
  4958. ): (t: T) => TReturn;
  4959. /**
  4960. * Takes a function and returns a new one that will always have a particular context.
  4961. * @param funсtion The function whose context will be changed.
  4962. * @param context The object to which the context (`this`) of the function should be set.
  4963. * @param a An argument to be passed to the function referenced in the `function` argument.
  4964. * @param b An argument to be passed to the function referenced in the `function` argument.
  4965. * @param c An argument to be passed to the function referenced in the `function` argument.
  4966. * @param d An argument to be passed to the function referenced in the `function` argument.
  4967. * @param e An argument to be passed to the function referenced in the `function` argument.
  4968. * @param f An argument to be passed to the function referenced in the `function` argument.
  4969. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  4970. * @since 1.4
  4971. * @since 1.6
  4972. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  4973. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  4974. ```html
  4975. <!doctype html>
  4976. <html lang="en">
  4977. <head>
  4978. <meta charset="utf-8">
  4979. <title>jQuery.proxy demo</title>
  4980. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4981. </head>
  4982. <body>
  4983. <p><button type="button" id="test">Test</button></p>
  4984. <div id="log"></div>
  4985. <script>
  4986. var me = {
  4987. type: "zombie",
  4988. test: function( event ) {
  4989. // Without proxy, `this` would refer to the event target
  4990. // use event.target to reference that element.
  4991. var element = event.target;
  4992. $( element ).css( "background-color", "red" );
  4993. // With proxy, `this` refers to the me object encapsulating
  4994. // this function.
  4995. $( "#log" ).append( "Hello " + this.type + "<br>" );
  4996. $( "#test" ).off( "click", this.test );
  4997. }
  4998. };
  4999. var you = {
  5000. type: "person",
  5001. test: function( event ) {
  5002. $( "#log" ).append( this.type + " " );
  5003. }
  5004. };
  5005. // Execute you.test() in the context of the `you` object
  5006. // no matter where it is called
  5007. // i.e. the `this` keyword will refer to `you`
  5008. var youClick = $.proxy( you.test, you );
  5009. // attach click handlers to #test
  5010. $( "#test" )
  5011. // this === "zombie"; handler unbound after first click
  5012. .on( "click", $.proxy( me.test, me ) )
  5013. // this === "person"
  5014. .on( "click", youClick )
  5015. // this === "zombie"
  5016. .on( "click", $.proxy( you.test, me ) )
  5017. // this === "<button> element"
  5018. .on( "click", you.test );
  5019. </script>
  5020. </body>
  5021. </html>
  5022. ```
  5023. * @example ​ ````Change the context of a function bound to the click handler,
  5024. ```html
  5025. <!doctype html>
  5026. <html lang="en">
  5027. <head>
  5028. <meta charset="utf-8">
  5029. <title>jQuery.proxy demo</title>
  5030. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5031. </head>
  5032. <body>
  5033. <p><button type="button" id="test">Test</button></p>
  5034. <div id="log"></div>
  5035. <script>
  5036. var me = {
  5037. // I'm a dog
  5038. type: "dog",
  5039. // Note that event comes *after* one and two
  5040. test: function( one, two, event ) {
  5041. $( "#log" )
  5042. // `one` maps to `you`, the 1st additional
  5043. // argument in the $.proxy function call
  5044. .append( "<h3>Hello " + one.type + ":</h3>" )
  5045. // The `this` keyword refers to `me`
  5046. // (the 2nd, context, argument of $.proxy)
  5047. .append( "I am a " + this.type + ", " )
  5048. // `two` maps to `they`, the 2nd additional
  5049. // argument in the $.proxy function call
  5050. .append( "and they are " + two.type + ".<br>" )
  5051. // The event type is "click"
  5052. .append( "Thanks for " + event.type + "ing." )
  5053. // The clicked element is `event.target`,
  5054. // and its type is "button"
  5055. .append( "the " + event.target.type + "." );
  5056. }
  5057. };
  5058. var you = { type: "cat" };
  5059. var they = { type: "fish" };
  5060. // Set up handler to execute me.test() in the context
  5061. // of `me`, with `you` and `they` as additional arguments
  5062. var proxy = $.proxy( me.test, me, you, they );
  5063. $( "#test" )
  5064. .on( "click", proxy );
  5065. </script>
  5066. </body>
  5067. </html>
  5068. ```
  5069. */
  5070. proxy<TContext, TReturn, A, B, C, D, E, F, T>(
  5071. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T) => TReturn,
  5072. context: TContext,
  5073. a: A,
  5074. b: B,
  5075. c: C,
  5076. d: D,
  5077. e: E,
  5078. f: F,
  5079. ): (t: T) => TReturn;
  5080. /**
  5081. * Takes a function and returns a new one that will always have a particular context.
  5082. * @param funсtion The function whose context will be changed.
  5083. * @param context The object to which the context (`this`) of the function should be set.
  5084. * @param a An argument to be passed to the function referenced in the `function` argument.
  5085. * @param b An argument to be passed to the function referenced in the `function` argument.
  5086. * @param c An argument to be passed to the function referenced in the `function` argument.
  5087. * @param d An argument to be passed to the function referenced in the `function` argument.
  5088. * @param e An argument to be passed to the function referenced in the `function` argument.
  5089. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5090. * @since 1.4
  5091. * @since 1.6
  5092. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5093. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5094. ```html
  5095. <!doctype html>
  5096. <html lang="en">
  5097. <head>
  5098. <meta charset="utf-8">
  5099. <title>jQuery.proxy demo</title>
  5100. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5101. </head>
  5102. <body>
  5103. <p><button type="button" id="test">Test</button></p>
  5104. <div id="log"></div>
  5105. <script>
  5106. var me = {
  5107. type: "zombie",
  5108. test: function( event ) {
  5109. // Without proxy, `this` would refer to the event target
  5110. // use event.target to reference that element.
  5111. var element = event.target;
  5112. $( element ).css( "background-color", "red" );
  5113. // With proxy, `this` refers to the me object encapsulating
  5114. // this function.
  5115. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5116. $( "#test" ).off( "click", this.test );
  5117. }
  5118. };
  5119. var you = {
  5120. type: "person",
  5121. test: function( event ) {
  5122. $( "#log" ).append( this.type + " " );
  5123. }
  5124. };
  5125. // Execute you.test() in the context of the `you` object
  5126. // no matter where it is called
  5127. // i.e. the `this` keyword will refer to `you`
  5128. var youClick = $.proxy( you.test, you );
  5129. // attach click handlers to #test
  5130. $( "#test" )
  5131. // this === "zombie"; handler unbound after first click
  5132. .on( "click", $.proxy( me.test, me ) )
  5133. // this === "person"
  5134. .on( "click", youClick )
  5135. // this === "zombie"
  5136. .on( "click", $.proxy( you.test, me ) )
  5137. // this === "<button> element"
  5138. .on( "click", you.test );
  5139. </script>
  5140. </body>
  5141. </html>
  5142. ```
  5143. * @example ​ ````Change the context of a function bound to the click handler,
  5144. ```html
  5145. <!doctype html>
  5146. <html lang="en">
  5147. <head>
  5148. <meta charset="utf-8">
  5149. <title>jQuery.proxy demo</title>
  5150. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5151. </head>
  5152. <body>
  5153. <p><button type="button" id="test">Test</button></p>
  5154. <div id="log"></div>
  5155. <script>
  5156. var me = {
  5157. // I'm a dog
  5158. type: "dog",
  5159. // Note that event comes *after* one and two
  5160. test: function( one, two, event ) {
  5161. $( "#log" )
  5162. // `one` maps to `you`, the 1st additional
  5163. // argument in the $.proxy function call
  5164. .append( "<h3>Hello " + one.type + ":</h3>" )
  5165. // The `this` keyword refers to `me`
  5166. // (the 2nd, context, argument of $.proxy)
  5167. .append( "I am a " + this.type + ", " )
  5168. // `two` maps to `they`, the 2nd additional
  5169. // argument in the $.proxy function call
  5170. .append( "and they are " + two.type + ".<br>" )
  5171. // The event type is "click"
  5172. .append( "Thanks for " + event.type + "ing." )
  5173. // The clicked element is `event.target`,
  5174. // and its type is "button"
  5175. .append( "the " + event.target.type + "." );
  5176. }
  5177. };
  5178. var you = { type: "cat" };
  5179. var they = { type: "fish" };
  5180. // Set up handler to execute me.test() in the context
  5181. // of `me`, with `you` and `they` as additional arguments
  5182. var proxy = $.proxy( me.test, me, you, they );
  5183. $( "#test" )
  5184. .on( "click", proxy );
  5185. </script>
  5186. </body>
  5187. </html>
  5188. ```
  5189. */
  5190. proxy<TContext, TReturn, A, B, C, D, E, T>(
  5191. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T) => TReturn,
  5192. context: TContext,
  5193. a: A,
  5194. b: B,
  5195. c: C,
  5196. d: D,
  5197. e: E,
  5198. ): (t: T) => TReturn;
  5199. /**
  5200. * Takes a function and returns a new one that will always have a particular context.
  5201. * @param funсtion The function whose context will be changed.
  5202. * @param context The object to which the context (`this`) of the function should be set.
  5203. * @param a An argument to be passed to the function referenced in the `function` argument.
  5204. * @param b An argument to be passed to the function referenced in the `function` argument.
  5205. * @param c An argument to be passed to the function referenced in the `function` argument.
  5206. * @param d An argument to be passed to the function referenced in the `function` argument.
  5207. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5208. * @since 1.4
  5209. * @since 1.6
  5210. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5211. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5212. ```html
  5213. <!doctype html>
  5214. <html lang="en">
  5215. <head>
  5216. <meta charset="utf-8">
  5217. <title>jQuery.proxy demo</title>
  5218. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5219. </head>
  5220. <body>
  5221. <p><button type="button" id="test">Test</button></p>
  5222. <div id="log"></div>
  5223. <script>
  5224. var me = {
  5225. type: "zombie",
  5226. test: function( event ) {
  5227. // Without proxy, `this` would refer to the event target
  5228. // use event.target to reference that element.
  5229. var element = event.target;
  5230. $( element ).css( "background-color", "red" );
  5231. // With proxy, `this` refers to the me object encapsulating
  5232. // this function.
  5233. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5234. $( "#test" ).off( "click", this.test );
  5235. }
  5236. };
  5237. var you = {
  5238. type: "person",
  5239. test: function( event ) {
  5240. $( "#log" ).append( this.type + " " );
  5241. }
  5242. };
  5243. // Execute you.test() in the context of the `you` object
  5244. // no matter where it is called
  5245. // i.e. the `this` keyword will refer to `you`
  5246. var youClick = $.proxy( you.test, you );
  5247. // attach click handlers to #test
  5248. $( "#test" )
  5249. // this === "zombie"; handler unbound after first click
  5250. .on( "click", $.proxy( me.test, me ) )
  5251. // this === "person"
  5252. .on( "click", youClick )
  5253. // this === "zombie"
  5254. .on( "click", $.proxy( you.test, me ) )
  5255. // this === "<button> element"
  5256. .on( "click", you.test );
  5257. </script>
  5258. </body>
  5259. </html>
  5260. ```
  5261. * @example ​ ````Change the context of a function bound to the click handler,
  5262. ```html
  5263. <!doctype html>
  5264. <html lang="en">
  5265. <head>
  5266. <meta charset="utf-8">
  5267. <title>jQuery.proxy demo</title>
  5268. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5269. </head>
  5270. <body>
  5271. <p><button type="button" id="test">Test</button></p>
  5272. <div id="log"></div>
  5273. <script>
  5274. var me = {
  5275. // I'm a dog
  5276. type: "dog",
  5277. // Note that event comes *after* one and two
  5278. test: function( one, two, event ) {
  5279. $( "#log" )
  5280. // `one` maps to `you`, the 1st additional
  5281. // argument in the $.proxy function call
  5282. .append( "<h3>Hello " + one.type + ":</h3>" )
  5283. // The `this` keyword refers to `me`
  5284. // (the 2nd, context, argument of $.proxy)
  5285. .append( "I am a " + this.type + ", " )
  5286. // `two` maps to `they`, the 2nd additional
  5287. // argument in the $.proxy function call
  5288. .append( "and they are " + two.type + ".<br>" )
  5289. // The event type is "click"
  5290. .append( "Thanks for " + event.type + "ing." )
  5291. // The clicked element is `event.target`,
  5292. // and its type is "button"
  5293. .append( "the " + event.target.type + "." );
  5294. }
  5295. };
  5296. var you = { type: "cat" };
  5297. var they = { type: "fish" };
  5298. // Set up handler to execute me.test() in the context
  5299. // of `me`, with `you` and `they` as additional arguments
  5300. var proxy = $.proxy( me.test, me, you, they );
  5301. $( "#test" )
  5302. .on( "click", proxy );
  5303. </script>
  5304. </body>
  5305. </html>
  5306. ```
  5307. */
  5308. proxy<TContext, TReturn, A, B, C, D, T>(
  5309. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T) => TReturn,
  5310. context: TContext,
  5311. a: A,
  5312. b: B,
  5313. c: C,
  5314. d: D,
  5315. ): (t: T) => TReturn;
  5316. /**
  5317. * Takes a function and returns a new one that will always have a particular context.
  5318. * @param funсtion The function whose context will be changed.
  5319. * @param context The object to which the context (`this`) of the function should be set.
  5320. * @param a An argument to be passed to the function referenced in the `function` argument.
  5321. * @param b An argument to be passed to the function referenced in the `function` argument.
  5322. * @param c An argument to be passed to the function referenced in the `function` argument.
  5323. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5324. * @since 1.4
  5325. * @since 1.6
  5326. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5327. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5328. ```html
  5329. <!doctype html>
  5330. <html lang="en">
  5331. <head>
  5332. <meta charset="utf-8">
  5333. <title>jQuery.proxy demo</title>
  5334. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5335. </head>
  5336. <body>
  5337. <p><button type="button" id="test">Test</button></p>
  5338. <div id="log"></div>
  5339. <script>
  5340. var me = {
  5341. type: "zombie",
  5342. test: function( event ) {
  5343. // Without proxy, `this` would refer to the event target
  5344. // use event.target to reference that element.
  5345. var element = event.target;
  5346. $( element ).css( "background-color", "red" );
  5347. // With proxy, `this` refers to the me object encapsulating
  5348. // this function.
  5349. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5350. $( "#test" ).off( "click", this.test );
  5351. }
  5352. };
  5353. var you = {
  5354. type: "person",
  5355. test: function( event ) {
  5356. $( "#log" ).append( this.type + " " );
  5357. }
  5358. };
  5359. // Execute you.test() in the context of the `you` object
  5360. // no matter where it is called
  5361. // i.e. the `this` keyword will refer to `you`
  5362. var youClick = $.proxy( you.test, you );
  5363. // attach click handlers to #test
  5364. $( "#test" )
  5365. // this === "zombie"; handler unbound after first click
  5366. .on( "click", $.proxy( me.test, me ) )
  5367. // this === "person"
  5368. .on( "click", youClick )
  5369. // this === "zombie"
  5370. .on( "click", $.proxy( you.test, me ) )
  5371. // this === "<button> element"
  5372. .on( "click", you.test );
  5373. </script>
  5374. </body>
  5375. </html>
  5376. ```
  5377. * @example ​ ````Change the context of a function bound to the click handler,
  5378. ```html
  5379. <!doctype html>
  5380. <html lang="en">
  5381. <head>
  5382. <meta charset="utf-8">
  5383. <title>jQuery.proxy demo</title>
  5384. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5385. </head>
  5386. <body>
  5387. <p><button type="button" id="test">Test</button></p>
  5388. <div id="log"></div>
  5389. <script>
  5390. var me = {
  5391. // I'm a dog
  5392. type: "dog",
  5393. // Note that event comes *after* one and two
  5394. test: function( one, two, event ) {
  5395. $( "#log" )
  5396. // `one` maps to `you`, the 1st additional
  5397. // argument in the $.proxy function call
  5398. .append( "<h3>Hello " + one.type + ":</h3>" )
  5399. // The `this` keyword refers to `me`
  5400. // (the 2nd, context, argument of $.proxy)
  5401. .append( "I am a " + this.type + ", " )
  5402. // `two` maps to `they`, the 2nd additional
  5403. // argument in the $.proxy function call
  5404. .append( "and they are " + two.type + ".<br>" )
  5405. // The event type is "click"
  5406. .append( "Thanks for " + event.type + "ing." )
  5407. // The clicked element is `event.target`,
  5408. // and its type is "button"
  5409. .append( "the " + event.target.type + "." );
  5410. }
  5411. };
  5412. var you = { type: "cat" };
  5413. var they = { type: "fish" };
  5414. // Set up handler to execute me.test() in the context
  5415. // of `me`, with `you` and `they` as additional arguments
  5416. var proxy = $.proxy( me.test, me, you, they );
  5417. $( "#test" )
  5418. .on( "click", proxy );
  5419. </script>
  5420. </body>
  5421. </html>
  5422. ```
  5423. */
  5424. proxy<TContext, TReturn, A, B, C, T>(
  5425. funсtion: (this: TContext, a: A, b: B, c: C, t: T) => TReturn,
  5426. context: TContext,
  5427. a: A,
  5428. b: B,
  5429. c: C,
  5430. ): (t: T) => TReturn;
  5431. /**
  5432. * Takes a function and returns a new one that will always have a particular context.
  5433. * @param funсtion The function whose context will be changed.
  5434. * @param context The object to which the context (`this`) of the function should be set.
  5435. * @param a An argument to be passed to the function referenced in the `function` argument.
  5436. * @param b An argument to be passed to the function referenced in the `function` argument.
  5437. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5438. * @since 1.4
  5439. * @since 1.6
  5440. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5441. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5442. ```html
  5443. <!doctype html>
  5444. <html lang="en">
  5445. <head>
  5446. <meta charset="utf-8">
  5447. <title>jQuery.proxy demo</title>
  5448. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5449. </head>
  5450. <body>
  5451. <p><button type="button" id="test">Test</button></p>
  5452. <div id="log"></div>
  5453. <script>
  5454. var me = {
  5455. type: "zombie",
  5456. test: function( event ) {
  5457. // Without proxy, `this` would refer to the event target
  5458. // use event.target to reference that element.
  5459. var element = event.target;
  5460. $( element ).css( "background-color", "red" );
  5461. // With proxy, `this` refers to the me object encapsulating
  5462. // this function.
  5463. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5464. $( "#test" ).off( "click", this.test );
  5465. }
  5466. };
  5467. var you = {
  5468. type: "person",
  5469. test: function( event ) {
  5470. $( "#log" ).append( this.type + " " );
  5471. }
  5472. };
  5473. // Execute you.test() in the context of the `you` object
  5474. // no matter where it is called
  5475. // i.e. the `this` keyword will refer to `you`
  5476. var youClick = $.proxy( you.test, you );
  5477. // attach click handlers to #test
  5478. $( "#test" )
  5479. // this === "zombie"; handler unbound after first click
  5480. .on( "click", $.proxy( me.test, me ) )
  5481. // this === "person"
  5482. .on( "click", youClick )
  5483. // this === "zombie"
  5484. .on( "click", $.proxy( you.test, me ) )
  5485. // this === "<button> element"
  5486. .on( "click", you.test );
  5487. </script>
  5488. </body>
  5489. </html>
  5490. ```
  5491. * @example ​ ````Change the context of a function bound to the click handler,
  5492. ```html
  5493. <!doctype html>
  5494. <html lang="en">
  5495. <head>
  5496. <meta charset="utf-8">
  5497. <title>jQuery.proxy demo</title>
  5498. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5499. </head>
  5500. <body>
  5501. <p><button type="button" id="test">Test</button></p>
  5502. <div id="log"></div>
  5503. <script>
  5504. var me = {
  5505. // I'm a dog
  5506. type: "dog",
  5507. // Note that event comes *after* one and two
  5508. test: function( one, two, event ) {
  5509. $( "#log" )
  5510. // `one` maps to `you`, the 1st additional
  5511. // argument in the $.proxy function call
  5512. .append( "<h3>Hello " + one.type + ":</h3>" )
  5513. // The `this` keyword refers to `me`
  5514. // (the 2nd, context, argument of $.proxy)
  5515. .append( "I am a " + this.type + ", " )
  5516. // `two` maps to `they`, the 2nd additional
  5517. // argument in the $.proxy function call
  5518. .append( "and they are " + two.type + ".<br>" )
  5519. // The event type is "click"
  5520. .append( "Thanks for " + event.type + "ing." )
  5521. // The clicked element is `event.target`,
  5522. // and its type is "button"
  5523. .append( "the " + event.target.type + "." );
  5524. }
  5525. };
  5526. var you = { type: "cat" };
  5527. var they = { type: "fish" };
  5528. // Set up handler to execute me.test() in the context
  5529. // of `me`, with `you` and `they` as additional arguments
  5530. var proxy = $.proxy( me.test, me, you, they );
  5531. $( "#test" )
  5532. .on( "click", proxy );
  5533. </script>
  5534. </body>
  5535. </html>
  5536. ```
  5537. */
  5538. proxy<TContext, TReturn, A, B, T>(
  5539. funсtion: (this: TContext, a: A, b: B, t: T) => TReturn,
  5540. context: TContext,
  5541. a: A,
  5542. b: B,
  5543. ): (t: T) => TReturn;
  5544. /**
  5545. * Takes a function and returns a new one that will always have a particular context.
  5546. * @param funсtion The function whose context will be changed.
  5547. * @param context The object to which the context (`this`) of the function should be set.
  5548. * @param a An argument to be passed to the function referenced in the `function` argument.
  5549. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5550. * @since 1.4
  5551. * @since 1.6
  5552. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5553. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5554. ```html
  5555. <!doctype html>
  5556. <html lang="en">
  5557. <head>
  5558. <meta charset="utf-8">
  5559. <title>jQuery.proxy demo</title>
  5560. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5561. </head>
  5562. <body>
  5563. <p><button type="button" id="test">Test</button></p>
  5564. <div id="log"></div>
  5565. <script>
  5566. var me = {
  5567. type: "zombie",
  5568. test: function( event ) {
  5569. // Without proxy, `this` would refer to the event target
  5570. // use event.target to reference that element.
  5571. var element = event.target;
  5572. $( element ).css( "background-color", "red" );
  5573. // With proxy, `this` refers to the me object encapsulating
  5574. // this function.
  5575. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5576. $( "#test" ).off( "click", this.test );
  5577. }
  5578. };
  5579. var you = {
  5580. type: "person",
  5581. test: function( event ) {
  5582. $( "#log" ).append( this.type + " " );
  5583. }
  5584. };
  5585. // Execute you.test() in the context of the `you` object
  5586. // no matter where it is called
  5587. // i.e. the `this` keyword will refer to `you`
  5588. var youClick = $.proxy( you.test, you );
  5589. // attach click handlers to #test
  5590. $( "#test" )
  5591. // this === "zombie"; handler unbound after first click
  5592. .on( "click", $.proxy( me.test, me ) )
  5593. // this === "person"
  5594. .on( "click", youClick )
  5595. // this === "zombie"
  5596. .on( "click", $.proxy( you.test, me ) )
  5597. // this === "<button> element"
  5598. .on( "click", you.test );
  5599. </script>
  5600. </body>
  5601. </html>
  5602. ```
  5603. * @example ​ ````Change the context of a function bound to the click handler,
  5604. ```html
  5605. <!doctype html>
  5606. <html lang="en">
  5607. <head>
  5608. <meta charset="utf-8">
  5609. <title>jQuery.proxy demo</title>
  5610. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5611. </head>
  5612. <body>
  5613. <p><button type="button" id="test">Test</button></p>
  5614. <div id="log"></div>
  5615. <script>
  5616. var me = {
  5617. // I'm a dog
  5618. type: "dog",
  5619. // Note that event comes *after* one and two
  5620. test: function( one, two, event ) {
  5621. $( "#log" )
  5622. // `one` maps to `you`, the 1st additional
  5623. // argument in the $.proxy function call
  5624. .append( "<h3>Hello " + one.type + ":</h3>" )
  5625. // The `this` keyword refers to `me`
  5626. // (the 2nd, context, argument of $.proxy)
  5627. .append( "I am a " + this.type + ", " )
  5628. // `two` maps to `they`, the 2nd additional
  5629. // argument in the $.proxy function call
  5630. .append( "and they are " + two.type + ".<br>" )
  5631. // The event type is "click"
  5632. .append( "Thanks for " + event.type + "ing." )
  5633. // The clicked element is `event.target`,
  5634. // and its type is "button"
  5635. .append( "the " + event.target.type + "." );
  5636. }
  5637. };
  5638. var you = { type: "cat" };
  5639. var they = { type: "fish" };
  5640. // Set up handler to execute me.test() in the context
  5641. // of `me`, with `you` and `they` as additional arguments
  5642. var proxy = $.proxy( me.test, me, you, they );
  5643. $( "#test" )
  5644. .on( "click", proxy );
  5645. </script>
  5646. </body>
  5647. </html>
  5648. ```
  5649. */
  5650. proxy<TContext, TReturn, A, T>(
  5651. funсtion: (this: TContext, a: A, t: T) => TReturn,
  5652. context: TContext,
  5653. a: A,
  5654. ): (t: T) => TReturn;
  5655. /**
  5656. * Takes a function and returns a new one that will always have a particular context.
  5657. * @param funсtion The function whose context will be changed.
  5658. * @param context The object to which the context (`this`) of the function should be set.
  5659. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5660. * @since 1.4
  5661. * @since 1.6
  5662. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5663. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5664. ```html
  5665. <!doctype html>
  5666. <html lang="en">
  5667. <head>
  5668. <meta charset="utf-8">
  5669. <title>jQuery.proxy demo</title>
  5670. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5671. </head>
  5672. <body>
  5673. <p><button type="button" id="test">Test</button></p>
  5674. <div id="log"></div>
  5675. <script>
  5676. var me = {
  5677. type: "zombie",
  5678. test: function( event ) {
  5679. // Without proxy, `this` would refer to the event target
  5680. // use event.target to reference that element.
  5681. var element = event.target;
  5682. $( element ).css( "background-color", "red" );
  5683. // With proxy, `this` refers to the me object encapsulating
  5684. // this function.
  5685. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5686. $( "#test" ).off( "click", this.test );
  5687. }
  5688. };
  5689. var you = {
  5690. type: "person",
  5691. test: function( event ) {
  5692. $( "#log" ).append( this.type + " " );
  5693. }
  5694. };
  5695. // Execute you.test() in the context of the `you` object
  5696. // no matter where it is called
  5697. // i.e. the `this` keyword will refer to `you`
  5698. var youClick = $.proxy( you.test, you );
  5699. // attach click handlers to #test
  5700. $( "#test" )
  5701. // this === "zombie"; handler unbound after first click
  5702. .on( "click", $.proxy( me.test, me ) )
  5703. // this === "person"
  5704. .on( "click", youClick )
  5705. // this === "zombie"
  5706. .on( "click", $.proxy( you.test, me ) )
  5707. // this === "<button> element"
  5708. .on( "click", you.test );
  5709. </script>
  5710. </body>
  5711. </html>
  5712. ```
  5713. * @example ​ ````Change the context of a function bound to the click handler,
  5714. ```html
  5715. <!doctype html>
  5716. <html lang="en">
  5717. <head>
  5718. <meta charset="utf-8">
  5719. <title>jQuery.proxy demo</title>
  5720. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5721. </head>
  5722. <body>
  5723. <p><button type="button" id="test">Test</button></p>
  5724. <div id="log"></div>
  5725. <script>
  5726. var me = {
  5727. // I'm a dog
  5728. type: "dog",
  5729. // Note that event comes *after* one and two
  5730. test: function( one, two, event ) {
  5731. $( "#log" )
  5732. // `one` maps to `you`, the 1st additional
  5733. // argument in the $.proxy function call
  5734. .append( "<h3>Hello " + one.type + ":</h3>" )
  5735. // The `this` keyword refers to `me`
  5736. // (the 2nd, context, argument of $.proxy)
  5737. .append( "I am a " + this.type + ", " )
  5738. // `two` maps to `they`, the 2nd additional
  5739. // argument in the $.proxy function call
  5740. .append( "and they are " + two.type + ".<br>" )
  5741. // The event type is "click"
  5742. .append( "Thanks for " + event.type + "ing." )
  5743. // The clicked element is `event.target`,
  5744. // and its type is "button"
  5745. .append( "the " + event.target.type + "." );
  5746. }
  5747. };
  5748. var you = { type: "cat" };
  5749. var they = { type: "fish" };
  5750. // Set up handler to execute me.test() in the context
  5751. // of `me`, with `you` and `they` as additional arguments
  5752. var proxy = $.proxy( me.test, me, you, they );
  5753. $( "#test" )
  5754. .on( "click", proxy );
  5755. </script>
  5756. </body>
  5757. </html>
  5758. ```
  5759. */
  5760. proxy<TContext, TReturn, T>(funсtion: (this: TContext, t: T) => TReturn, context: TContext): (t: T) => TReturn;
  5761. // #endregion
  5762. // region 2 parameters
  5763. // #region 2 parameters
  5764. /**
  5765. * Takes a function and returns a new one that will always have a particular context.
  5766. * @param funсtion The function whose context will be changed.
  5767. * @param context The object to which the context (`this`) of the function should be set.
  5768. * @param a An argument to be passed to the function referenced in the `function` argument.
  5769. * @param b An argument to be passed to the function referenced in the `function` argument.
  5770. * @param c An argument to be passed to the function referenced in the `function` argument.
  5771. * @param d An argument to be passed to the function referenced in the `function` argument.
  5772. * @param e An argument to be passed to the function referenced in the `function` argument.
  5773. * @param f An argument to be passed to the function referenced in the `function` argument.
  5774. * @param g An argument to be passed to the function referenced in the `function` argument.
  5775. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5776. * @since 1.4
  5777. * @since 1.6
  5778. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5779. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5780. ```html
  5781. <!doctype html>
  5782. <html lang="en">
  5783. <head>
  5784. <meta charset="utf-8">
  5785. <title>jQuery.proxy demo</title>
  5786. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5787. </head>
  5788. <body>
  5789. <p><button type="button" id="test">Test</button></p>
  5790. <div id="log"></div>
  5791. <script>
  5792. var me = {
  5793. type: "zombie",
  5794. test: function( event ) {
  5795. // Without proxy, `this` would refer to the event target
  5796. // use event.target to reference that element.
  5797. var element = event.target;
  5798. $( element ).css( "background-color", "red" );
  5799. // With proxy, `this` refers to the me object encapsulating
  5800. // this function.
  5801. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5802. $( "#test" ).off( "click", this.test );
  5803. }
  5804. };
  5805. var you = {
  5806. type: "person",
  5807. test: function( event ) {
  5808. $( "#log" ).append( this.type + " " );
  5809. }
  5810. };
  5811. // Execute you.test() in the context of the `you` object
  5812. // no matter where it is called
  5813. // i.e. the `this` keyword will refer to `you`
  5814. var youClick = $.proxy( you.test, you );
  5815. // attach click handlers to #test
  5816. $( "#test" )
  5817. // this === "zombie"; handler unbound after first click
  5818. .on( "click", $.proxy( me.test, me ) )
  5819. // this === "person"
  5820. .on( "click", youClick )
  5821. // this === "zombie"
  5822. .on( "click", $.proxy( you.test, me ) )
  5823. // this === "<button> element"
  5824. .on( "click", you.test );
  5825. </script>
  5826. </body>
  5827. </html>
  5828. ```
  5829. * @example ​ ````Change the context of a function bound to the click handler,
  5830. ```html
  5831. <!doctype html>
  5832. <html lang="en">
  5833. <head>
  5834. <meta charset="utf-8">
  5835. <title>jQuery.proxy demo</title>
  5836. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5837. </head>
  5838. <body>
  5839. <p><button type="button" id="test">Test</button></p>
  5840. <div id="log"></div>
  5841. <script>
  5842. var me = {
  5843. // I'm a dog
  5844. type: "dog",
  5845. // Note that event comes *after* one and two
  5846. test: function( one, two, event ) {
  5847. $( "#log" )
  5848. // `one` maps to `you`, the 1st additional
  5849. // argument in the $.proxy function call
  5850. .append( "<h3>Hello " + one.type + ":</h3>" )
  5851. // The `this` keyword refers to `me`
  5852. // (the 2nd, context, argument of $.proxy)
  5853. .append( "I am a " + this.type + ", " )
  5854. // `two` maps to `they`, the 2nd additional
  5855. // argument in the $.proxy function call
  5856. .append( "and they are " + two.type + ".<br>" )
  5857. // The event type is "click"
  5858. .append( "Thanks for " + event.type + "ing." )
  5859. // The clicked element is `event.target`,
  5860. // and its type is "button"
  5861. .append( "the " + event.target.type + "." );
  5862. }
  5863. };
  5864. var you = { type: "cat" };
  5865. var they = { type: "fish" };
  5866. // Set up handler to execute me.test() in the context
  5867. // of `me`, with `you` and `they` as additional arguments
  5868. var proxy = $.proxy( me.test, me, you, they );
  5869. $( "#test" )
  5870. .on( "click", proxy );
  5871. </script>
  5872. </body>
  5873. </html>
  5874. ```
  5875. */
  5876. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U>(
  5877. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U) => TReturn,
  5878. context: TContext,
  5879. a: A,
  5880. b: B,
  5881. c: C,
  5882. d: D,
  5883. e: E,
  5884. f: F,
  5885. g: G,
  5886. ): (t: T, u: U) => TReturn;
  5887. /**
  5888. * Takes a function and returns a new one that will always have a particular context.
  5889. * @param funсtion The function whose context will be changed.
  5890. * @param context The object to which the context (`this`) of the function should be set.
  5891. * @param a An argument to be passed to the function referenced in the `function` argument.
  5892. * @param b An argument to be passed to the function referenced in the `function` argument.
  5893. * @param c An argument to be passed to the function referenced in the `function` argument.
  5894. * @param d An argument to be passed to the function referenced in the `function` argument.
  5895. * @param e An argument to be passed to the function referenced in the `function` argument.
  5896. * @param f An argument to be passed to the function referenced in the `function` argument.
  5897. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  5898. * @since 1.4
  5899. * @since 1.6
  5900. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  5901. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  5902. ```html
  5903. <!doctype html>
  5904. <html lang="en">
  5905. <head>
  5906. <meta charset="utf-8">
  5907. <title>jQuery.proxy demo</title>
  5908. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5909. </head>
  5910. <body>
  5911. <p><button type="button" id="test">Test</button></p>
  5912. <div id="log"></div>
  5913. <script>
  5914. var me = {
  5915. type: "zombie",
  5916. test: function( event ) {
  5917. // Without proxy, `this` would refer to the event target
  5918. // use event.target to reference that element.
  5919. var element = event.target;
  5920. $( element ).css( "background-color", "red" );
  5921. // With proxy, `this` refers to the me object encapsulating
  5922. // this function.
  5923. $( "#log" ).append( "Hello " + this.type + "<br>" );
  5924. $( "#test" ).off( "click", this.test );
  5925. }
  5926. };
  5927. var you = {
  5928. type: "person",
  5929. test: function( event ) {
  5930. $( "#log" ).append( this.type + " " );
  5931. }
  5932. };
  5933. // Execute you.test() in the context of the `you` object
  5934. // no matter where it is called
  5935. // i.e. the `this` keyword will refer to `you`
  5936. var youClick = $.proxy( you.test, you );
  5937. // attach click handlers to #test
  5938. $( "#test" )
  5939. // this === "zombie"; handler unbound after first click
  5940. .on( "click", $.proxy( me.test, me ) )
  5941. // this === "person"
  5942. .on( "click", youClick )
  5943. // this === "zombie"
  5944. .on( "click", $.proxy( you.test, me ) )
  5945. // this === "<button> element"
  5946. .on( "click", you.test );
  5947. </script>
  5948. </body>
  5949. </html>
  5950. ```
  5951. * @example ​ ````Change the context of a function bound to the click handler,
  5952. ```html
  5953. <!doctype html>
  5954. <html lang="en">
  5955. <head>
  5956. <meta charset="utf-8">
  5957. <title>jQuery.proxy demo</title>
  5958. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5959. </head>
  5960. <body>
  5961. <p><button type="button" id="test">Test</button></p>
  5962. <div id="log"></div>
  5963. <script>
  5964. var me = {
  5965. // I'm a dog
  5966. type: "dog",
  5967. // Note that event comes *after* one and two
  5968. test: function( one, two, event ) {
  5969. $( "#log" )
  5970. // `one` maps to `you`, the 1st additional
  5971. // argument in the $.proxy function call
  5972. .append( "<h3>Hello " + one.type + ":</h3>" )
  5973. // The `this` keyword refers to `me`
  5974. // (the 2nd, context, argument of $.proxy)
  5975. .append( "I am a " + this.type + ", " )
  5976. // `two` maps to `they`, the 2nd additional
  5977. // argument in the $.proxy function call
  5978. .append( "and they are " + two.type + ".<br>" )
  5979. // The event type is "click"
  5980. .append( "Thanks for " + event.type + "ing." )
  5981. // The clicked element is `event.target`,
  5982. // and its type is "button"
  5983. .append( "the " + event.target.type + "." );
  5984. }
  5985. };
  5986. var you = { type: "cat" };
  5987. var they = { type: "fish" };
  5988. // Set up handler to execute me.test() in the context
  5989. // of `me`, with `you` and `they` as additional arguments
  5990. var proxy = $.proxy( me.test, me, you, they );
  5991. $( "#test" )
  5992. .on( "click", proxy );
  5993. </script>
  5994. </body>
  5995. </html>
  5996. ```
  5997. */
  5998. proxy<TContext, TReturn, A, B, C, D, E, F, T, U>(
  5999. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U) => TReturn,
  6000. context: TContext,
  6001. a: A,
  6002. b: B,
  6003. c: C,
  6004. d: D,
  6005. e: E,
  6006. f: F,
  6007. ): (t: T, u: U) => TReturn;
  6008. /**
  6009. * Takes a function and returns a new one that will always have a particular context.
  6010. * @param funсtion The function whose context will be changed.
  6011. * @param context The object to which the context (`this`) of the function should be set.
  6012. * @param a An argument to be passed to the function referenced in the `function` argument.
  6013. * @param b An argument to be passed to the function referenced in the `function` argument.
  6014. * @param c An argument to be passed to the function referenced in the `function` argument.
  6015. * @param d An argument to be passed to the function referenced in the `function` argument.
  6016. * @param e An argument to be passed to the function referenced in the `function` argument.
  6017. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6018. * @since 1.4
  6019. * @since 1.6
  6020. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6021. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6022. ```html
  6023. <!doctype html>
  6024. <html lang="en">
  6025. <head>
  6026. <meta charset="utf-8">
  6027. <title>jQuery.proxy demo</title>
  6028. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6029. </head>
  6030. <body>
  6031. <p><button type="button" id="test">Test</button></p>
  6032. <div id="log"></div>
  6033. <script>
  6034. var me = {
  6035. type: "zombie",
  6036. test: function( event ) {
  6037. // Without proxy, `this` would refer to the event target
  6038. // use event.target to reference that element.
  6039. var element = event.target;
  6040. $( element ).css( "background-color", "red" );
  6041. // With proxy, `this` refers to the me object encapsulating
  6042. // this function.
  6043. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6044. $( "#test" ).off( "click", this.test );
  6045. }
  6046. };
  6047. var you = {
  6048. type: "person",
  6049. test: function( event ) {
  6050. $( "#log" ).append( this.type + " " );
  6051. }
  6052. };
  6053. // Execute you.test() in the context of the `you` object
  6054. // no matter where it is called
  6055. // i.e. the `this` keyword will refer to `you`
  6056. var youClick = $.proxy( you.test, you );
  6057. // attach click handlers to #test
  6058. $( "#test" )
  6059. // this === "zombie"; handler unbound after first click
  6060. .on( "click", $.proxy( me.test, me ) )
  6061. // this === "person"
  6062. .on( "click", youClick )
  6063. // this === "zombie"
  6064. .on( "click", $.proxy( you.test, me ) )
  6065. // this === "<button> element"
  6066. .on( "click", you.test );
  6067. </script>
  6068. </body>
  6069. </html>
  6070. ```
  6071. * @example ​ ````Change the context of a function bound to the click handler,
  6072. ```html
  6073. <!doctype html>
  6074. <html lang="en">
  6075. <head>
  6076. <meta charset="utf-8">
  6077. <title>jQuery.proxy demo</title>
  6078. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6079. </head>
  6080. <body>
  6081. <p><button type="button" id="test">Test</button></p>
  6082. <div id="log"></div>
  6083. <script>
  6084. var me = {
  6085. // I'm a dog
  6086. type: "dog",
  6087. // Note that event comes *after* one and two
  6088. test: function( one, two, event ) {
  6089. $( "#log" )
  6090. // `one` maps to `you`, the 1st additional
  6091. // argument in the $.proxy function call
  6092. .append( "<h3>Hello " + one.type + ":</h3>" )
  6093. // The `this` keyword refers to `me`
  6094. // (the 2nd, context, argument of $.proxy)
  6095. .append( "I am a " + this.type + ", " )
  6096. // `two` maps to `they`, the 2nd additional
  6097. // argument in the $.proxy function call
  6098. .append( "and they are " + two.type + ".<br>" )
  6099. // The event type is "click"
  6100. .append( "Thanks for " + event.type + "ing." )
  6101. // The clicked element is `event.target`,
  6102. // and its type is "button"
  6103. .append( "the " + event.target.type + "." );
  6104. }
  6105. };
  6106. var you = { type: "cat" };
  6107. var they = { type: "fish" };
  6108. // Set up handler to execute me.test() in the context
  6109. // of `me`, with `you` and `they` as additional arguments
  6110. var proxy = $.proxy( me.test, me, you, they );
  6111. $( "#test" )
  6112. .on( "click", proxy );
  6113. </script>
  6114. </body>
  6115. </html>
  6116. ```
  6117. */
  6118. proxy<TContext, TReturn, A, B, C, D, E, T, U>(
  6119. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U) => TReturn,
  6120. context: TContext,
  6121. a: A,
  6122. b: B,
  6123. c: C,
  6124. d: D,
  6125. e: E,
  6126. ): (t: T, u: U) => TReturn;
  6127. /**
  6128. * Takes a function and returns a new one that will always have a particular context.
  6129. * @param funсtion The function whose context will be changed.
  6130. * @param context The object to which the context (`this`) of the function should be set.
  6131. * @param a An argument to be passed to the function referenced in the `function` argument.
  6132. * @param b An argument to be passed to the function referenced in the `function` argument.
  6133. * @param c An argument to be passed to the function referenced in the `function` argument.
  6134. * @param d An argument to be passed to the function referenced in the `function` argument.
  6135. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6136. * @since 1.4
  6137. * @since 1.6
  6138. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6139. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6140. ```html
  6141. <!doctype html>
  6142. <html lang="en">
  6143. <head>
  6144. <meta charset="utf-8">
  6145. <title>jQuery.proxy demo</title>
  6146. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6147. </head>
  6148. <body>
  6149. <p><button type="button" id="test">Test</button></p>
  6150. <div id="log"></div>
  6151. <script>
  6152. var me = {
  6153. type: "zombie",
  6154. test: function( event ) {
  6155. // Without proxy, `this` would refer to the event target
  6156. // use event.target to reference that element.
  6157. var element = event.target;
  6158. $( element ).css( "background-color", "red" );
  6159. // With proxy, `this` refers to the me object encapsulating
  6160. // this function.
  6161. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6162. $( "#test" ).off( "click", this.test );
  6163. }
  6164. };
  6165. var you = {
  6166. type: "person",
  6167. test: function( event ) {
  6168. $( "#log" ).append( this.type + " " );
  6169. }
  6170. };
  6171. // Execute you.test() in the context of the `you` object
  6172. // no matter where it is called
  6173. // i.e. the `this` keyword will refer to `you`
  6174. var youClick = $.proxy( you.test, you );
  6175. // attach click handlers to #test
  6176. $( "#test" )
  6177. // this === "zombie"; handler unbound after first click
  6178. .on( "click", $.proxy( me.test, me ) )
  6179. // this === "person"
  6180. .on( "click", youClick )
  6181. // this === "zombie"
  6182. .on( "click", $.proxy( you.test, me ) )
  6183. // this === "<button> element"
  6184. .on( "click", you.test );
  6185. </script>
  6186. </body>
  6187. </html>
  6188. ```
  6189. * @example ​ ````Change the context of a function bound to the click handler,
  6190. ```html
  6191. <!doctype html>
  6192. <html lang="en">
  6193. <head>
  6194. <meta charset="utf-8">
  6195. <title>jQuery.proxy demo</title>
  6196. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6197. </head>
  6198. <body>
  6199. <p><button type="button" id="test">Test</button></p>
  6200. <div id="log"></div>
  6201. <script>
  6202. var me = {
  6203. // I'm a dog
  6204. type: "dog",
  6205. // Note that event comes *after* one and two
  6206. test: function( one, two, event ) {
  6207. $( "#log" )
  6208. // `one` maps to `you`, the 1st additional
  6209. // argument in the $.proxy function call
  6210. .append( "<h3>Hello " + one.type + ":</h3>" )
  6211. // The `this` keyword refers to `me`
  6212. // (the 2nd, context, argument of $.proxy)
  6213. .append( "I am a " + this.type + ", " )
  6214. // `two` maps to `they`, the 2nd additional
  6215. // argument in the $.proxy function call
  6216. .append( "and they are " + two.type + ".<br>" )
  6217. // The event type is "click"
  6218. .append( "Thanks for " + event.type + "ing." )
  6219. // The clicked element is `event.target`,
  6220. // and its type is "button"
  6221. .append( "the " + event.target.type + "." );
  6222. }
  6223. };
  6224. var you = { type: "cat" };
  6225. var they = { type: "fish" };
  6226. // Set up handler to execute me.test() in the context
  6227. // of `me`, with `you` and `they` as additional arguments
  6228. var proxy = $.proxy( me.test, me, you, they );
  6229. $( "#test" )
  6230. .on( "click", proxy );
  6231. </script>
  6232. </body>
  6233. </html>
  6234. ```
  6235. */
  6236. proxy<TContext, TReturn, A, B, C, D, T, U>(
  6237. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U) => TReturn,
  6238. context: TContext,
  6239. a: A,
  6240. b: B,
  6241. c: C,
  6242. d: D,
  6243. ): (t: T, u: U) => TReturn;
  6244. /**
  6245. * Takes a function and returns a new one that will always have a particular context.
  6246. * @param funсtion The function whose context will be changed.
  6247. * @param context The object to which the context (`this`) of the function should be set.
  6248. * @param a An argument to be passed to the function referenced in the `function` argument.
  6249. * @param b An argument to be passed to the function referenced in the `function` argument.
  6250. * @param c An argument to be passed to the function referenced in the `function` argument.
  6251. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6252. * @since 1.4
  6253. * @since 1.6
  6254. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6255. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6256. ```html
  6257. <!doctype html>
  6258. <html lang="en">
  6259. <head>
  6260. <meta charset="utf-8">
  6261. <title>jQuery.proxy demo</title>
  6262. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6263. </head>
  6264. <body>
  6265. <p><button type="button" id="test">Test</button></p>
  6266. <div id="log"></div>
  6267. <script>
  6268. var me = {
  6269. type: "zombie",
  6270. test: function( event ) {
  6271. // Without proxy, `this` would refer to the event target
  6272. // use event.target to reference that element.
  6273. var element = event.target;
  6274. $( element ).css( "background-color", "red" );
  6275. // With proxy, `this` refers to the me object encapsulating
  6276. // this function.
  6277. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6278. $( "#test" ).off( "click", this.test );
  6279. }
  6280. };
  6281. var you = {
  6282. type: "person",
  6283. test: function( event ) {
  6284. $( "#log" ).append( this.type + " " );
  6285. }
  6286. };
  6287. // Execute you.test() in the context of the `you` object
  6288. // no matter where it is called
  6289. // i.e. the `this` keyword will refer to `you`
  6290. var youClick = $.proxy( you.test, you );
  6291. // attach click handlers to #test
  6292. $( "#test" )
  6293. // this === "zombie"; handler unbound after first click
  6294. .on( "click", $.proxy( me.test, me ) )
  6295. // this === "person"
  6296. .on( "click", youClick )
  6297. // this === "zombie"
  6298. .on( "click", $.proxy( you.test, me ) )
  6299. // this === "<button> element"
  6300. .on( "click", you.test );
  6301. </script>
  6302. </body>
  6303. </html>
  6304. ```
  6305. * @example ​ ````Change the context of a function bound to the click handler,
  6306. ```html
  6307. <!doctype html>
  6308. <html lang="en">
  6309. <head>
  6310. <meta charset="utf-8">
  6311. <title>jQuery.proxy demo</title>
  6312. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6313. </head>
  6314. <body>
  6315. <p><button type="button" id="test">Test</button></p>
  6316. <div id="log"></div>
  6317. <script>
  6318. var me = {
  6319. // I'm a dog
  6320. type: "dog",
  6321. // Note that event comes *after* one and two
  6322. test: function( one, two, event ) {
  6323. $( "#log" )
  6324. // `one` maps to `you`, the 1st additional
  6325. // argument in the $.proxy function call
  6326. .append( "<h3>Hello " + one.type + ":</h3>" )
  6327. // The `this` keyword refers to `me`
  6328. // (the 2nd, context, argument of $.proxy)
  6329. .append( "I am a " + this.type + ", " )
  6330. // `two` maps to `they`, the 2nd additional
  6331. // argument in the $.proxy function call
  6332. .append( "and they are " + two.type + ".<br>" )
  6333. // The event type is "click"
  6334. .append( "Thanks for " + event.type + "ing." )
  6335. // The clicked element is `event.target`,
  6336. // and its type is "button"
  6337. .append( "the " + event.target.type + "." );
  6338. }
  6339. };
  6340. var you = { type: "cat" };
  6341. var they = { type: "fish" };
  6342. // Set up handler to execute me.test() in the context
  6343. // of `me`, with `you` and `they` as additional arguments
  6344. var proxy = $.proxy( me.test, me, you, they );
  6345. $( "#test" )
  6346. .on( "click", proxy );
  6347. </script>
  6348. </body>
  6349. </html>
  6350. ```
  6351. */
  6352. proxy<TContext, TReturn, A, B, C, T, U>(
  6353. funсtion: (this: TContext, a: A, b: B, c: C, t: T, u: U) => TReturn,
  6354. context: TContext,
  6355. a: A,
  6356. b: B,
  6357. c: C,
  6358. ): (t: T, u: U) => TReturn;
  6359. /**
  6360. * Takes a function and returns a new one that will always have a particular context.
  6361. * @param funсtion The function whose context will be changed.
  6362. * @param context The object to which the context (`this`) of the function should be set.
  6363. * @param a An argument to be passed to the function referenced in the `function` argument.
  6364. * @param b An argument to be passed to the function referenced in the `function` argument.
  6365. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6366. * @since 1.4
  6367. * @since 1.6
  6368. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6369. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6370. ```html
  6371. <!doctype html>
  6372. <html lang="en">
  6373. <head>
  6374. <meta charset="utf-8">
  6375. <title>jQuery.proxy demo</title>
  6376. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6377. </head>
  6378. <body>
  6379. <p><button type="button" id="test">Test</button></p>
  6380. <div id="log"></div>
  6381. <script>
  6382. var me = {
  6383. type: "zombie",
  6384. test: function( event ) {
  6385. // Without proxy, `this` would refer to the event target
  6386. // use event.target to reference that element.
  6387. var element = event.target;
  6388. $( element ).css( "background-color", "red" );
  6389. // With proxy, `this` refers to the me object encapsulating
  6390. // this function.
  6391. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6392. $( "#test" ).off( "click", this.test );
  6393. }
  6394. };
  6395. var you = {
  6396. type: "person",
  6397. test: function( event ) {
  6398. $( "#log" ).append( this.type + " " );
  6399. }
  6400. };
  6401. // Execute you.test() in the context of the `you` object
  6402. // no matter where it is called
  6403. // i.e. the `this` keyword will refer to `you`
  6404. var youClick = $.proxy( you.test, you );
  6405. // attach click handlers to #test
  6406. $( "#test" )
  6407. // this === "zombie"; handler unbound after first click
  6408. .on( "click", $.proxy( me.test, me ) )
  6409. // this === "person"
  6410. .on( "click", youClick )
  6411. // this === "zombie"
  6412. .on( "click", $.proxy( you.test, me ) )
  6413. // this === "<button> element"
  6414. .on( "click", you.test );
  6415. </script>
  6416. </body>
  6417. </html>
  6418. ```
  6419. * @example ​ ````Change the context of a function bound to the click handler,
  6420. ```html
  6421. <!doctype html>
  6422. <html lang="en">
  6423. <head>
  6424. <meta charset="utf-8">
  6425. <title>jQuery.proxy demo</title>
  6426. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6427. </head>
  6428. <body>
  6429. <p><button type="button" id="test">Test</button></p>
  6430. <div id="log"></div>
  6431. <script>
  6432. var me = {
  6433. // I'm a dog
  6434. type: "dog",
  6435. // Note that event comes *after* one and two
  6436. test: function( one, two, event ) {
  6437. $( "#log" )
  6438. // `one` maps to `you`, the 1st additional
  6439. // argument in the $.proxy function call
  6440. .append( "<h3>Hello " + one.type + ":</h3>" )
  6441. // The `this` keyword refers to `me`
  6442. // (the 2nd, context, argument of $.proxy)
  6443. .append( "I am a " + this.type + ", " )
  6444. // `two` maps to `they`, the 2nd additional
  6445. // argument in the $.proxy function call
  6446. .append( "and they are " + two.type + ".<br>" )
  6447. // The event type is "click"
  6448. .append( "Thanks for " + event.type + "ing." )
  6449. // The clicked element is `event.target`,
  6450. // and its type is "button"
  6451. .append( "the " + event.target.type + "." );
  6452. }
  6453. };
  6454. var you = { type: "cat" };
  6455. var they = { type: "fish" };
  6456. // Set up handler to execute me.test() in the context
  6457. // of `me`, with `you` and `they` as additional arguments
  6458. var proxy = $.proxy( me.test, me, you, they );
  6459. $( "#test" )
  6460. .on( "click", proxy );
  6461. </script>
  6462. </body>
  6463. </html>
  6464. ```
  6465. */
  6466. proxy<TContext, TReturn, A, B, T, U>(
  6467. funсtion: (this: TContext, a: A, b: B, t: T, u: U) => TReturn,
  6468. context: TContext,
  6469. a: A,
  6470. b: B,
  6471. ): (t: T, u: U) => TReturn;
  6472. /**
  6473. * Takes a function and returns a new one that will always have a particular context.
  6474. * @param funсtion The function whose context will be changed.
  6475. * @param context The object to which the context (`this`) of the function should be set.
  6476. * @param a An argument to be passed to the function referenced in the `function` argument.
  6477. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6478. * @since 1.4
  6479. * @since 1.6
  6480. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6481. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6482. ```html
  6483. <!doctype html>
  6484. <html lang="en">
  6485. <head>
  6486. <meta charset="utf-8">
  6487. <title>jQuery.proxy demo</title>
  6488. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6489. </head>
  6490. <body>
  6491. <p><button type="button" id="test">Test</button></p>
  6492. <div id="log"></div>
  6493. <script>
  6494. var me = {
  6495. type: "zombie",
  6496. test: function( event ) {
  6497. // Without proxy, `this` would refer to the event target
  6498. // use event.target to reference that element.
  6499. var element = event.target;
  6500. $( element ).css( "background-color", "red" );
  6501. // With proxy, `this` refers to the me object encapsulating
  6502. // this function.
  6503. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6504. $( "#test" ).off( "click", this.test );
  6505. }
  6506. };
  6507. var you = {
  6508. type: "person",
  6509. test: function( event ) {
  6510. $( "#log" ).append( this.type + " " );
  6511. }
  6512. };
  6513. // Execute you.test() in the context of the `you` object
  6514. // no matter where it is called
  6515. // i.e. the `this` keyword will refer to `you`
  6516. var youClick = $.proxy( you.test, you );
  6517. // attach click handlers to #test
  6518. $( "#test" )
  6519. // this === "zombie"; handler unbound after first click
  6520. .on( "click", $.proxy( me.test, me ) )
  6521. // this === "person"
  6522. .on( "click", youClick )
  6523. // this === "zombie"
  6524. .on( "click", $.proxy( you.test, me ) )
  6525. // this === "<button> element"
  6526. .on( "click", you.test );
  6527. </script>
  6528. </body>
  6529. </html>
  6530. ```
  6531. * @example ​ ````Change the context of a function bound to the click handler,
  6532. ```html
  6533. <!doctype html>
  6534. <html lang="en">
  6535. <head>
  6536. <meta charset="utf-8">
  6537. <title>jQuery.proxy demo</title>
  6538. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6539. </head>
  6540. <body>
  6541. <p><button type="button" id="test">Test</button></p>
  6542. <div id="log"></div>
  6543. <script>
  6544. var me = {
  6545. // I'm a dog
  6546. type: "dog",
  6547. // Note that event comes *after* one and two
  6548. test: function( one, two, event ) {
  6549. $( "#log" )
  6550. // `one` maps to `you`, the 1st additional
  6551. // argument in the $.proxy function call
  6552. .append( "<h3>Hello " + one.type + ":</h3>" )
  6553. // The `this` keyword refers to `me`
  6554. // (the 2nd, context, argument of $.proxy)
  6555. .append( "I am a " + this.type + ", " )
  6556. // `two` maps to `they`, the 2nd additional
  6557. // argument in the $.proxy function call
  6558. .append( "and they are " + two.type + ".<br>" )
  6559. // The event type is "click"
  6560. .append( "Thanks for " + event.type + "ing." )
  6561. // The clicked element is `event.target`,
  6562. // and its type is "button"
  6563. .append( "the " + event.target.type + "." );
  6564. }
  6565. };
  6566. var you = { type: "cat" };
  6567. var they = { type: "fish" };
  6568. // Set up handler to execute me.test() in the context
  6569. // of `me`, with `you` and `they` as additional arguments
  6570. var proxy = $.proxy( me.test, me, you, they );
  6571. $( "#test" )
  6572. .on( "click", proxy );
  6573. </script>
  6574. </body>
  6575. </html>
  6576. ```
  6577. */
  6578. proxy<TContext, TReturn, A, T, U>(
  6579. funсtion: (this: TContext, a: A, t: T, u: U) => TReturn,
  6580. context: TContext,
  6581. a: A,
  6582. ): (t: T, u: U) => TReturn;
  6583. /**
  6584. * Takes a function and returns a new one that will always have a particular context.
  6585. * @param funсtion The function whose context will be changed.
  6586. * @param context The object to which the context (`this`) of the function should be set.
  6587. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6588. * @since 1.4
  6589. * @since 1.6
  6590. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6591. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6592. ```html
  6593. <!doctype html>
  6594. <html lang="en">
  6595. <head>
  6596. <meta charset="utf-8">
  6597. <title>jQuery.proxy demo</title>
  6598. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6599. </head>
  6600. <body>
  6601. <p><button type="button" id="test">Test</button></p>
  6602. <div id="log"></div>
  6603. <script>
  6604. var me = {
  6605. type: "zombie",
  6606. test: function( event ) {
  6607. // Without proxy, `this` would refer to the event target
  6608. // use event.target to reference that element.
  6609. var element = event.target;
  6610. $( element ).css( "background-color", "red" );
  6611. // With proxy, `this` refers to the me object encapsulating
  6612. // this function.
  6613. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6614. $( "#test" ).off( "click", this.test );
  6615. }
  6616. };
  6617. var you = {
  6618. type: "person",
  6619. test: function( event ) {
  6620. $( "#log" ).append( this.type + " " );
  6621. }
  6622. };
  6623. // Execute you.test() in the context of the `you` object
  6624. // no matter where it is called
  6625. // i.e. the `this` keyword will refer to `you`
  6626. var youClick = $.proxy( you.test, you );
  6627. // attach click handlers to #test
  6628. $( "#test" )
  6629. // this === "zombie"; handler unbound after first click
  6630. .on( "click", $.proxy( me.test, me ) )
  6631. // this === "person"
  6632. .on( "click", youClick )
  6633. // this === "zombie"
  6634. .on( "click", $.proxy( you.test, me ) )
  6635. // this === "<button> element"
  6636. .on( "click", you.test );
  6637. </script>
  6638. </body>
  6639. </html>
  6640. ```
  6641. * @example ​ ````Change the context of a function bound to the click handler,
  6642. ```html
  6643. <!doctype html>
  6644. <html lang="en">
  6645. <head>
  6646. <meta charset="utf-8">
  6647. <title>jQuery.proxy demo</title>
  6648. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6649. </head>
  6650. <body>
  6651. <p><button type="button" id="test">Test</button></p>
  6652. <div id="log"></div>
  6653. <script>
  6654. var me = {
  6655. // I'm a dog
  6656. type: "dog",
  6657. // Note that event comes *after* one and two
  6658. test: function( one, two, event ) {
  6659. $( "#log" )
  6660. // `one` maps to `you`, the 1st additional
  6661. // argument in the $.proxy function call
  6662. .append( "<h3>Hello " + one.type + ":</h3>" )
  6663. // The `this` keyword refers to `me`
  6664. // (the 2nd, context, argument of $.proxy)
  6665. .append( "I am a " + this.type + ", " )
  6666. // `two` maps to `they`, the 2nd additional
  6667. // argument in the $.proxy function call
  6668. .append( "and they are " + two.type + ".<br>" )
  6669. // The event type is "click"
  6670. .append( "Thanks for " + event.type + "ing." )
  6671. // The clicked element is `event.target`,
  6672. // and its type is "button"
  6673. .append( "the " + event.target.type + "." );
  6674. }
  6675. };
  6676. var you = { type: "cat" };
  6677. var they = { type: "fish" };
  6678. // Set up handler to execute me.test() in the context
  6679. // of `me`, with `you` and `they` as additional arguments
  6680. var proxy = $.proxy( me.test, me, you, they );
  6681. $( "#test" )
  6682. .on( "click", proxy );
  6683. </script>
  6684. </body>
  6685. </html>
  6686. ```
  6687. */
  6688. proxy<TContext, TReturn, T, U>(
  6689. funсtion: (this: TContext, t: T, u: U) => TReturn,
  6690. context: TContext,
  6691. ): (t: T, u: U) => TReturn;
  6692. // #endregion
  6693. // region 3 parameters
  6694. // #region 3 parameters
  6695. /**
  6696. * Takes a function and returns a new one that will always have a particular context.
  6697. * @param funсtion The function whose context will be changed.
  6698. * @param context The object to which the context (`this`) of the function should be set.
  6699. * @param a An argument to be passed to the function referenced in the `function` argument.
  6700. * @param b An argument to be passed to the function referenced in the `function` argument.
  6701. * @param c An argument to be passed to the function referenced in the `function` argument.
  6702. * @param d An argument to be passed to the function referenced in the `function` argument.
  6703. * @param e An argument to be passed to the function referenced in the `function` argument.
  6704. * @param f An argument to be passed to the function referenced in the `function` argument.
  6705. * @param g An argument to be passed to the function referenced in the `function` argument.
  6706. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6707. * @since 1.4
  6708. * @since 1.6
  6709. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6710. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6711. ```html
  6712. <!doctype html>
  6713. <html lang="en">
  6714. <head>
  6715. <meta charset="utf-8">
  6716. <title>jQuery.proxy demo</title>
  6717. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6718. </head>
  6719. <body>
  6720. <p><button type="button" id="test">Test</button></p>
  6721. <div id="log"></div>
  6722. <script>
  6723. var me = {
  6724. type: "zombie",
  6725. test: function( event ) {
  6726. // Without proxy, `this` would refer to the event target
  6727. // use event.target to reference that element.
  6728. var element = event.target;
  6729. $( element ).css( "background-color", "red" );
  6730. // With proxy, `this` refers to the me object encapsulating
  6731. // this function.
  6732. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6733. $( "#test" ).off( "click", this.test );
  6734. }
  6735. };
  6736. var you = {
  6737. type: "person",
  6738. test: function( event ) {
  6739. $( "#log" ).append( this.type + " " );
  6740. }
  6741. };
  6742. // Execute you.test() in the context of the `you` object
  6743. // no matter where it is called
  6744. // i.e. the `this` keyword will refer to `you`
  6745. var youClick = $.proxy( you.test, you );
  6746. // attach click handlers to #test
  6747. $( "#test" )
  6748. // this === "zombie"; handler unbound after first click
  6749. .on( "click", $.proxy( me.test, me ) )
  6750. // this === "person"
  6751. .on( "click", youClick )
  6752. // this === "zombie"
  6753. .on( "click", $.proxy( you.test, me ) )
  6754. // this === "<button> element"
  6755. .on( "click", you.test );
  6756. </script>
  6757. </body>
  6758. </html>
  6759. ```
  6760. * @example ​ ````Change the context of a function bound to the click handler,
  6761. ```html
  6762. <!doctype html>
  6763. <html lang="en">
  6764. <head>
  6765. <meta charset="utf-8">
  6766. <title>jQuery.proxy demo</title>
  6767. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6768. </head>
  6769. <body>
  6770. <p><button type="button" id="test">Test</button></p>
  6771. <div id="log"></div>
  6772. <script>
  6773. var me = {
  6774. // I'm a dog
  6775. type: "dog",
  6776. // Note that event comes *after* one and two
  6777. test: function( one, two, event ) {
  6778. $( "#log" )
  6779. // `one` maps to `you`, the 1st additional
  6780. // argument in the $.proxy function call
  6781. .append( "<h3>Hello " + one.type + ":</h3>" )
  6782. // The `this` keyword refers to `me`
  6783. // (the 2nd, context, argument of $.proxy)
  6784. .append( "I am a " + this.type + ", " )
  6785. // `two` maps to `they`, the 2nd additional
  6786. // argument in the $.proxy function call
  6787. .append( "and they are " + two.type + ".<br>" )
  6788. // The event type is "click"
  6789. .append( "Thanks for " + event.type + "ing." )
  6790. // The clicked element is `event.target`,
  6791. // and its type is "button"
  6792. .append( "the " + event.target.type + "." );
  6793. }
  6794. };
  6795. var you = { type: "cat" };
  6796. var they = { type: "fish" };
  6797. // Set up handler to execute me.test() in the context
  6798. // of `me`, with `you` and `they` as additional arguments
  6799. var proxy = $.proxy( me.test, me, you, they );
  6800. $( "#test" )
  6801. .on( "click", proxy );
  6802. </script>
  6803. </body>
  6804. </html>
  6805. ```
  6806. */
  6807. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V>(
  6808. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V) => TReturn,
  6809. context: TContext,
  6810. a: A,
  6811. b: B,
  6812. c: C,
  6813. d: D,
  6814. e: E,
  6815. f: F,
  6816. g: G,
  6817. ): (t: T, u: U, v: V) => TReturn;
  6818. /**
  6819. * Takes a function and returns a new one that will always have a particular context.
  6820. * @param funсtion The function whose context will be changed.
  6821. * @param context The object to which the context (`this`) of the function should be set.
  6822. * @param a An argument to be passed to the function referenced in the `function` argument.
  6823. * @param b An argument to be passed to the function referenced in the `function` argument.
  6824. * @param c An argument to be passed to the function referenced in the `function` argument.
  6825. * @param d An argument to be passed to the function referenced in the `function` argument.
  6826. * @param e An argument to be passed to the function referenced in the `function` argument.
  6827. * @param f An argument to be passed to the function referenced in the `function` argument.
  6828. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6829. * @since 1.4
  6830. * @since 1.6
  6831. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6832. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6833. ```html
  6834. <!doctype html>
  6835. <html lang="en">
  6836. <head>
  6837. <meta charset="utf-8">
  6838. <title>jQuery.proxy demo</title>
  6839. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6840. </head>
  6841. <body>
  6842. <p><button type="button" id="test">Test</button></p>
  6843. <div id="log"></div>
  6844. <script>
  6845. var me = {
  6846. type: "zombie",
  6847. test: function( event ) {
  6848. // Without proxy, `this` would refer to the event target
  6849. // use event.target to reference that element.
  6850. var element = event.target;
  6851. $( element ).css( "background-color", "red" );
  6852. // With proxy, `this` refers to the me object encapsulating
  6853. // this function.
  6854. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6855. $( "#test" ).off( "click", this.test );
  6856. }
  6857. };
  6858. var you = {
  6859. type: "person",
  6860. test: function( event ) {
  6861. $( "#log" ).append( this.type + " " );
  6862. }
  6863. };
  6864. // Execute you.test() in the context of the `you` object
  6865. // no matter where it is called
  6866. // i.e. the `this` keyword will refer to `you`
  6867. var youClick = $.proxy( you.test, you );
  6868. // attach click handlers to #test
  6869. $( "#test" )
  6870. // this === "zombie"; handler unbound after first click
  6871. .on( "click", $.proxy( me.test, me ) )
  6872. // this === "person"
  6873. .on( "click", youClick )
  6874. // this === "zombie"
  6875. .on( "click", $.proxy( you.test, me ) )
  6876. // this === "<button> element"
  6877. .on( "click", you.test );
  6878. </script>
  6879. </body>
  6880. </html>
  6881. ```
  6882. * @example ​ ````Change the context of a function bound to the click handler,
  6883. ```html
  6884. <!doctype html>
  6885. <html lang="en">
  6886. <head>
  6887. <meta charset="utf-8">
  6888. <title>jQuery.proxy demo</title>
  6889. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6890. </head>
  6891. <body>
  6892. <p><button type="button" id="test">Test</button></p>
  6893. <div id="log"></div>
  6894. <script>
  6895. var me = {
  6896. // I'm a dog
  6897. type: "dog",
  6898. // Note that event comes *after* one and two
  6899. test: function( one, two, event ) {
  6900. $( "#log" )
  6901. // `one` maps to `you`, the 1st additional
  6902. // argument in the $.proxy function call
  6903. .append( "<h3>Hello " + one.type + ":</h3>" )
  6904. // The `this` keyword refers to `me`
  6905. // (the 2nd, context, argument of $.proxy)
  6906. .append( "I am a " + this.type + ", " )
  6907. // `two` maps to `they`, the 2nd additional
  6908. // argument in the $.proxy function call
  6909. .append( "and they are " + two.type + ".<br>" )
  6910. // The event type is "click"
  6911. .append( "Thanks for " + event.type + "ing." )
  6912. // The clicked element is `event.target`,
  6913. // and its type is "button"
  6914. .append( "the " + event.target.type + "." );
  6915. }
  6916. };
  6917. var you = { type: "cat" };
  6918. var they = { type: "fish" };
  6919. // Set up handler to execute me.test() in the context
  6920. // of `me`, with `you` and `they` as additional arguments
  6921. var proxy = $.proxy( me.test, me, you, they );
  6922. $( "#test" )
  6923. .on( "click", proxy );
  6924. </script>
  6925. </body>
  6926. </html>
  6927. ```
  6928. */
  6929. proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V>(
  6930. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V) => TReturn,
  6931. context: TContext,
  6932. a: A,
  6933. b: B,
  6934. c: C,
  6935. d: D,
  6936. e: E,
  6937. f: F,
  6938. ): (t: T, u: U, v: V) => TReturn;
  6939. /**
  6940. * Takes a function and returns a new one that will always have a particular context.
  6941. * @param funсtion The function whose context will be changed.
  6942. * @param context The object to which the context (`this`) of the function should be set.
  6943. * @param a An argument to be passed to the function referenced in the `function` argument.
  6944. * @param b An argument to be passed to the function referenced in the `function` argument.
  6945. * @param c An argument to be passed to the function referenced in the `function` argument.
  6946. * @param d An argument to be passed to the function referenced in the `function` argument.
  6947. * @param e An argument to be passed to the function referenced in the `function` argument.
  6948. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  6949. * @since 1.4
  6950. * @since 1.6
  6951. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  6952. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  6953. ```html
  6954. <!doctype html>
  6955. <html lang="en">
  6956. <head>
  6957. <meta charset="utf-8">
  6958. <title>jQuery.proxy demo</title>
  6959. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6960. </head>
  6961. <body>
  6962. <p><button type="button" id="test">Test</button></p>
  6963. <div id="log"></div>
  6964. <script>
  6965. var me = {
  6966. type: "zombie",
  6967. test: function( event ) {
  6968. // Without proxy, `this` would refer to the event target
  6969. // use event.target to reference that element.
  6970. var element = event.target;
  6971. $( element ).css( "background-color", "red" );
  6972. // With proxy, `this` refers to the me object encapsulating
  6973. // this function.
  6974. $( "#log" ).append( "Hello " + this.type + "<br>" );
  6975. $( "#test" ).off( "click", this.test );
  6976. }
  6977. };
  6978. var you = {
  6979. type: "person",
  6980. test: function( event ) {
  6981. $( "#log" ).append( this.type + " " );
  6982. }
  6983. };
  6984. // Execute you.test() in the context of the `you` object
  6985. // no matter where it is called
  6986. // i.e. the `this` keyword will refer to `you`
  6987. var youClick = $.proxy( you.test, you );
  6988. // attach click handlers to #test
  6989. $( "#test" )
  6990. // this === "zombie"; handler unbound after first click
  6991. .on( "click", $.proxy( me.test, me ) )
  6992. // this === "person"
  6993. .on( "click", youClick )
  6994. // this === "zombie"
  6995. .on( "click", $.proxy( you.test, me ) )
  6996. // this === "<button> element"
  6997. .on( "click", you.test );
  6998. </script>
  6999. </body>
  7000. </html>
  7001. ```
  7002. * @example ​ ````Change the context of a function bound to the click handler,
  7003. ```html
  7004. <!doctype html>
  7005. <html lang="en">
  7006. <head>
  7007. <meta charset="utf-8">
  7008. <title>jQuery.proxy demo</title>
  7009. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7010. </head>
  7011. <body>
  7012. <p><button type="button" id="test">Test</button></p>
  7013. <div id="log"></div>
  7014. <script>
  7015. var me = {
  7016. // I'm a dog
  7017. type: "dog",
  7018. // Note that event comes *after* one and two
  7019. test: function( one, two, event ) {
  7020. $( "#log" )
  7021. // `one` maps to `you`, the 1st additional
  7022. // argument in the $.proxy function call
  7023. .append( "<h3>Hello " + one.type + ":</h3>" )
  7024. // The `this` keyword refers to `me`
  7025. // (the 2nd, context, argument of $.proxy)
  7026. .append( "I am a " + this.type + ", " )
  7027. // `two` maps to `they`, the 2nd additional
  7028. // argument in the $.proxy function call
  7029. .append( "and they are " + two.type + ".<br>" )
  7030. // The event type is "click"
  7031. .append( "Thanks for " + event.type + "ing." )
  7032. // The clicked element is `event.target`,
  7033. // and its type is "button"
  7034. .append( "the " + event.target.type + "." );
  7035. }
  7036. };
  7037. var you = { type: "cat" };
  7038. var they = { type: "fish" };
  7039. // Set up handler to execute me.test() in the context
  7040. // of `me`, with `you` and `they` as additional arguments
  7041. var proxy = $.proxy( me.test, me, you, they );
  7042. $( "#test" )
  7043. .on( "click", proxy );
  7044. </script>
  7045. </body>
  7046. </html>
  7047. ```
  7048. */
  7049. proxy<TContext, TReturn, A, B, C, D, E, T, U, V>(
  7050. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V) => TReturn,
  7051. context: TContext,
  7052. a: A,
  7053. b: B,
  7054. c: C,
  7055. d: D,
  7056. e: E,
  7057. ): (t: T, u: U, v: V) => TReturn;
  7058. /**
  7059. * Takes a function and returns a new one that will always have a particular context.
  7060. * @param funсtion The function whose context will be changed.
  7061. * @param context The object to which the context (`this`) of the function should be set.
  7062. * @param a An argument to be passed to the function referenced in the `function` argument.
  7063. * @param b An argument to be passed to the function referenced in the `function` argument.
  7064. * @param c An argument to be passed to the function referenced in the `function` argument.
  7065. * @param d An argument to be passed to the function referenced in the `function` argument.
  7066. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7067. * @since 1.4
  7068. * @since 1.6
  7069. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7070. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7071. ```html
  7072. <!doctype html>
  7073. <html lang="en">
  7074. <head>
  7075. <meta charset="utf-8">
  7076. <title>jQuery.proxy demo</title>
  7077. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7078. </head>
  7079. <body>
  7080. <p><button type="button" id="test">Test</button></p>
  7081. <div id="log"></div>
  7082. <script>
  7083. var me = {
  7084. type: "zombie",
  7085. test: function( event ) {
  7086. // Without proxy, `this` would refer to the event target
  7087. // use event.target to reference that element.
  7088. var element = event.target;
  7089. $( element ).css( "background-color", "red" );
  7090. // With proxy, `this` refers to the me object encapsulating
  7091. // this function.
  7092. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7093. $( "#test" ).off( "click", this.test );
  7094. }
  7095. };
  7096. var you = {
  7097. type: "person",
  7098. test: function( event ) {
  7099. $( "#log" ).append( this.type + " " );
  7100. }
  7101. };
  7102. // Execute you.test() in the context of the `you` object
  7103. // no matter where it is called
  7104. // i.e. the `this` keyword will refer to `you`
  7105. var youClick = $.proxy( you.test, you );
  7106. // attach click handlers to #test
  7107. $( "#test" )
  7108. // this === "zombie"; handler unbound after first click
  7109. .on( "click", $.proxy( me.test, me ) )
  7110. // this === "person"
  7111. .on( "click", youClick )
  7112. // this === "zombie"
  7113. .on( "click", $.proxy( you.test, me ) )
  7114. // this === "<button> element"
  7115. .on( "click", you.test );
  7116. </script>
  7117. </body>
  7118. </html>
  7119. ```
  7120. * @example ​ ````Change the context of a function bound to the click handler,
  7121. ```html
  7122. <!doctype html>
  7123. <html lang="en">
  7124. <head>
  7125. <meta charset="utf-8">
  7126. <title>jQuery.proxy demo</title>
  7127. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7128. </head>
  7129. <body>
  7130. <p><button type="button" id="test">Test</button></p>
  7131. <div id="log"></div>
  7132. <script>
  7133. var me = {
  7134. // I'm a dog
  7135. type: "dog",
  7136. // Note that event comes *after* one and two
  7137. test: function( one, two, event ) {
  7138. $( "#log" )
  7139. // `one` maps to `you`, the 1st additional
  7140. // argument in the $.proxy function call
  7141. .append( "<h3>Hello " + one.type + ":</h3>" )
  7142. // The `this` keyword refers to `me`
  7143. // (the 2nd, context, argument of $.proxy)
  7144. .append( "I am a " + this.type + ", " )
  7145. // `two` maps to `they`, the 2nd additional
  7146. // argument in the $.proxy function call
  7147. .append( "and they are " + two.type + ".<br>" )
  7148. // The event type is "click"
  7149. .append( "Thanks for " + event.type + "ing." )
  7150. // The clicked element is `event.target`,
  7151. // and its type is "button"
  7152. .append( "the " + event.target.type + "." );
  7153. }
  7154. };
  7155. var you = { type: "cat" };
  7156. var they = { type: "fish" };
  7157. // Set up handler to execute me.test() in the context
  7158. // of `me`, with `you` and `they` as additional arguments
  7159. var proxy = $.proxy( me.test, me, you, they );
  7160. $( "#test" )
  7161. .on( "click", proxy );
  7162. </script>
  7163. </body>
  7164. </html>
  7165. ```
  7166. */
  7167. proxy<TContext, TReturn, A, B, C, D, T, U, V>(
  7168. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V) => TReturn,
  7169. context: TContext,
  7170. a: A,
  7171. b: B,
  7172. c: C,
  7173. d: D,
  7174. ): (t: T, u: U, v: V) => TReturn;
  7175. /**
  7176. * Takes a function and returns a new one that will always have a particular context.
  7177. * @param funсtion The function whose context will be changed.
  7178. * @param context The object to which the context (`this`) of the function should be set.
  7179. * @param a An argument to be passed to the function referenced in the `function` argument.
  7180. * @param b An argument to be passed to the function referenced in the `function` argument.
  7181. * @param c An argument to be passed to the function referenced in the `function` argument.
  7182. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7183. * @since 1.4
  7184. * @since 1.6
  7185. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7186. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7187. ```html
  7188. <!doctype html>
  7189. <html lang="en">
  7190. <head>
  7191. <meta charset="utf-8">
  7192. <title>jQuery.proxy demo</title>
  7193. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7194. </head>
  7195. <body>
  7196. <p><button type="button" id="test">Test</button></p>
  7197. <div id="log"></div>
  7198. <script>
  7199. var me = {
  7200. type: "zombie",
  7201. test: function( event ) {
  7202. // Without proxy, `this` would refer to the event target
  7203. // use event.target to reference that element.
  7204. var element = event.target;
  7205. $( element ).css( "background-color", "red" );
  7206. // With proxy, `this` refers to the me object encapsulating
  7207. // this function.
  7208. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7209. $( "#test" ).off( "click", this.test );
  7210. }
  7211. };
  7212. var you = {
  7213. type: "person",
  7214. test: function( event ) {
  7215. $( "#log" ).append( this.type + " " );
  7216. }
  7217. };
  7218. // Execute you.test() in the context of the `you` object
  7219. // no matter where it is called
  7220. // i.e. the `this` keyword will refer to `you`
  7221. var youClick = $.proxy( you.test, you );
  7222. // attach click handlers to #test
  7223. $( "#test" )
  7224. // this === "zombie"; handler unbound after first click
  7225. .on( "click", $.proxy( me.test, me ) )
  7226. // this === "person"
  7227. .on( "click", youClick )
  7228. // this === "zombie"
  7229. .on( "click", $.proxy( you.test, me ) )
  7230. // this === "<button> element"
  7231. .on( "click", you.test );
  7232. </script>
  7233. </body>
  7234. </html>
  7235. ```
  7236. * @example ​ ````Change the context of a function bound to the click handler,
  7237. ```html
  7238. <!doctype html>
  7239. <html lang="en">
  7240. <head>
  7241. <meta charset="utf-8">
  7242. <title>jQuery.proxy demo</title>
  7243. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7244. </head>
  7245. <body>
  7246. <p><button type="button" id="test">Test</button></p>
  7247. <div id="log"></div>
  7248. <script>
  7249. var me = {
  7250. // I'm a dog
  7251. type: "dog",
  7252. // Note that event comes *after* one and two
  7253. test: function( one, two, event ) {
  7254. $( "#log" )
  7255. // `one` maps to `you`, the 1st additional
  7256. // argument in the $.proxy function call
  7257. .append( "<h3>Hello " + one.type + ":</h3>" )
  7258. // The `this` keyword refers to `me`
  7259. // (the 2nd, context, argument of $.proxy)
  7260. .append( "I am a " + this.type + ", " )
  7261. // `two` maps to `they`, the 2nd additional
  7262. // argument in the $.proxy function call
  7263. .append( "and they are " + two.type + ".<br>" )
  7264. // The event type is "click"
  7265. .append( "Thanks for " + event.type + "ing." )
  7266. // The clicked element is `event.target`,
  7267. // and its type is "button"
  7268. .append( "the " + event.target.type + "." );
  7269. }
  7270. };
  7271. var you = { type: "cat" };
  7272. var they = { type: "fish" };
  7273. // Set up handler to execute me.test() in the context
  7274. // of `me`, with `you` and `they` as additional arguments
  7275. var proxy = $.proxy( me.test, me, you, they );
  7276. $( "#test" )
  7277. .on( "click", proxy );
  7278. </script>
  7279. </body>
  7280. </html>
  7281. ```
  7282. */
  7283. proxy<TContext, TReturn, A, B, C, T, U, V>(
  7284. funсtion: (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V) => TReturn,
  7285. context: TContext,
  7286. a: A,
  7287. b: B,
  7288. c: C,
  7289. ): (t: T, u: U, v: V) => TReturn;
  7290. /**
  7291. * Takes a function and returns a new one that will always have a particular context.
  7292. * @param funсtion The function whose context will be changed.
  7293. * @param context The object to which the context (`this`) of the function should be set.
  7294. * @param a An argument to be passed to the function referenced in the `function` argument.
  7295. * @param b An argument to be passed to the function referenced in the `function` argument.
  7296. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7297. * @since 1.4
  7298. * @since 1.6
  7299. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7300. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7301. ```html
  7302. <!doctype html>
  7303. <html lang="en">
  7304. <head>
  7305. <meta charset="utf-8">
  7306. <title>jQuery.proxy demo</title>
  7307. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7308. </head>
  7309. <body>
  7310. <p><button type="button" id="test">Test</button></p>
  7311. <div id="log"></div>
  7312. <script>
  7313. var me = {
  7314. type: "zombie",
  7315. test: function( event ) {
  7316. // Without proxy, `this` would refer to the event target
  7317. // use event.target to reference that element.
  7318. var element = event.target;
  7319. $( element ).css( "background-color", "red" );
  7320. // With proxy, `this` refers to the me object encapsulating
  7321. // this function.
  7322. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7323. $( "#test" ).off( "click", this.test );
  7324. }
  7325. };
  7326. var you = {
  7327. type: "person",
  7328. test: function( event ) {
  7329. $( "#log" ).append( this.type + " " );
  7330. }
  7331. };
  7332. // Execute you.test() in the context of the `you` object
  7333. // no matter where it is called
  7334. // i.e. the `this` keyword will refer to `you`
  7335. var youClick = $.proxy( you.test, you );
  7336. // attach click handlers to #test
  7337. $( "#test" )
  7338. // this === "zombie"; handler unbound after first click
  7339. .on( "click", $.proxy( me.test, me ) )
  7340. // this === "person"
  7341. .on( "click", youClick )
  7342. // this === "zombie"
  7343. .on( "click", $.proxy( you.test, me ) )
  7344. // this === "<button> element"
  7345. .on( "click", you.test );
  7346. </script>
  7347. </body>
  7348. </html>
  7349. ```
  7350. * @example ​ ````Change the context of a function bound to the click handler,
  7351. ```html
  7352. <!doctype html>
  7353. <html lang="en">
  7354. <head>
  7355. <meta charset="utf-8">
  7356. <title>jQuery.proxy demo</title>
  7357. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7358. </head>
  7359. <body>
  7360. <p><button type="button" id="test">Test</button></p>
  7361. <div id="log"></div>
  7362. <script>
  7363. var me = {
  7364. // I'm a dog
  7365. type: "dog",
  7366. // Note that event comes *after* one and two
  7367. test: function( one, two, event ) {
  7368. $( "#log" )
  7369. // `one` maps to `you`, the 1st additional
  7370. // argument in the $.proxy function call
  7371. .append( "<h3>Hello " + one.type + ":</h3>" )
  7372. // The `this` keyword refers to `me`
  7373. // (the 2nd, context, argument of $.proxy)
  7374. .append( "I am a " + this.type + ", " )
  7375. // `two` maps to `they`, the 2nd additional
  7376. // argument in the $.proxy function call
  7377. .append( "and they are " + two.type + ".<br>" )
  7378. // The event type is "click"
  7379. .append( "Thanks for " + event.type + "ing." )
  7380. // The clicked element is `event.target`,
  7381. // and its type is "button"
  7382. .append( "the " + event.target.type + "." );
  7383. }
  7384. };
  7385. var you = { type: "cat" };
  7386. var they = { type: "fish" };
  7387. // Set up handler to execute me.test() in the context
  7388. // of `me`, with `you` and `they` as additional arguments
  7389. var proxy = $.proxy( me.test, me, you, they );
  7390. $( "#test" )
  7391. .on( "click", proxy );
  7392. </script>
  7393. </body>
  7394. </html>
  7395. ```
  7396. */
  7397. proxy<TContext, TReturn, A, B, T, U, V>(
  7398. funсtion: (this: TContext, a: A, b: B, t: T, u: U, v: V) => TReturn,
  7399. context: TContext,
  7400. a: A,
  7401. b: B,
  7402. ): (t: T, u: U, v: V) => TReturn;
  7403. /**
  7404. * Takes a function and returns a new one that will always have a particular context.
  7405. * @param funсtion The function whose context will be changed.
  7406. * @param context The object to which the context (`this`) of the function should be set.
  7407. * @param a An argument to be passed to the function referenced in the `function` argument.
  7408. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7409. * @since 1.4
  7410. * @since 1.6
  7411. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7412. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7413. ```html
  7414. <!doctype html>
  7415. <html lang="en">
  7416. <head>
  7417. <meta charset="utf-8">
  7418. <title>jQuery.proxy demo</title>
  7419. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7420. </head>
  7421. <body>
  7422. <p><button type="button" id="test">Test</button></p>
  7423. <div id="log"></div>
  7424. <script>
  7425. var me = {
  7426. type: "zombie",
  7427. test: function( event ) {
  7428. // Without proxy, `this` would refer to the event target
  7429. // use event.target to reference that element.
  7430. var element = event.target;
  7431. $( element ).css( "background-color", "red" );
  7432. // With proxy, `this` refers to the me object encapsulating
  7433. // this function.
  7434. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7435. $( "#test" ).off( "click", this.test );
  7436. }
  7437. };
  7438. var you = {
  7439. type: "person",
  7440. test: function( event ) {
  7441. $( "#log" ).append( this.type + " " );
  7442. }
  7443. };
  7444. // Execute you.test() in the context of the `you` object
  7445. // no matter where it is called
  7446. // i.e. the `this` keyword will refer to `you`
  7447. var youClick = $.proxy( you.test, you );
  7448. // attach click handlers to #test
  7449. $( "#test" )
  7450. // this === "zombie"; handler unbound after first click
  7451. .on( "click", $.proxy( me.test, me ) )
  7452. // this === "person"
  7453. .on( "click", youClick )
  7454. // this === "zombie"
  7455. .on( "click", $.proxy( you.test, me ) )
  7456. // this === "<button> element"
  7457. .on( "click", you.test );
  7458. </script>
  7459. </body>
  7460. </html>
  7461. ```
  7462. * @example ​ ````Change the context of a function bound to the click handler,
  7463. ```html
  7464. <!doctype html>
  7465. <html lang="en">
  7466. <head>
  7467. <meta charset="utf-8">
  7468. <title>jQuery.proxy demo</title>
  7469. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7470. </head>
  7471. <body>
  7472. <p><button type="button" id="test">Test</button></p>
  7473. <div id="log"></div>
  7474. <script>
  7475. var me = {
  7476. // I'm a dog
  7477. type: "dog",
  7478. // Note that event comes *after* one and two
  7479. test: function( one, two, event ) {
  7480. $( "#log" )
  7481. // `one` maps to `you`, the 1st additional
  7482. // argument in the $.proxy function call
  7483. .append( "<h3>Hello " + one.type + ":</h3>" )
  7484. // The `this` keyword refers to `me`
  7485. // (the 2nd, context, argument of $.proxy)
  7486. .append( "I am a " + this.type + ", " )
  7487. // `two` maps to `they`, the 2nd additional
  7488. // argument in the $.proxy function call
  7489. .append( "and they are " + two.type + ".<br>" )
  7490. // The event type is "click"
  7491. .append( "Thanks for " + event.type + "ing." )
  7492. // The clicked element is `event.target`,
  7493. // and its type is "button"
  7494. .append( "the " + event.target.type + "." );
  7495. }
  7496. };
  7497. var you = { type: "cat" };
  7498. var they = { type: "fish" };
  7499. // Set up handler to execute me.test() in the context
  7500. // of `me`, with `you` and `they` as additional arguments
  7501. var proxy = $.proxy( me.test, me, you, they );
  7502. $( "#test" )
  7503. .on( "click", proxy );
  7504. </script>
  7505. </body>
  7506. </html>
  7507. ```
  7508. */
  7509. proxy<TContext, TReturn, A, T, U, V>(
  7510. funсtion: (this: TContext, a: A, t: T, u: U, v: V) => TReturn,
  7511. context: TContext,
  7512. a: A,
  7513. ): (t: T, u: U, v: V) => TReturn;
  7514. /**
  7515. * Takes a function and returns a new one that will always have a particular context.
  7516. * @param funсtion The function whose context will be changed.
  7517. * @param context The object to which the context (`this`) of the function should be set.
  7518. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7519. * @since 1.4
  7520. * @since 1.6
  7521. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7522. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7523. ```html
  7524. <!doctype html>
  7525. <html lang="en">
  7526. <head>
  7527. <meta charset="utf-8">
  7528. <title>jQuery.proxy demo</title>
  7529. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7530. </head>
  7531. <body>
  7532. <p><button type="button" id="test">Test</button></p>
  7533. <div id="log"></div>
  7534. <script>
  7535. var me = {
  7536. type: "zombie",
  7537. test: function( event ) {
  7538. // Without proxy, `this` would refer to the event target
  7539. // use event.target to reference that element.
  7540. var element = event.target;
  7541. $( element ).css( "background-color", "red" );
  7542. // With proxy, `this` refers to the me object encapsulating
  7543. // this function.
  7544. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7545. $( "#test" ).off( "click", this.test );
  7546. }
  7547. };
  7548. var you = {
  7549. type: "person",
  7550. test: function( event ) {
  7551. $( "#log" ).append( this.type + " " );
  7552. }
  7553. };
  7554. // Execute you.test() in the context of the `you` object
  7555. // no matter where it is called
  7556. // i.e. the `this` keyword will refer to `you`
  7557. var youClick = $.proxy( you.test, you );
  7558. // attach click handlers to #test
  7559. $( "#test" )
  7560. // this === "zombie"; handler unbound after first click
  7561. .on( "click", $.proxy( me.test, me ) )
  7562. // this === "person"
  7563. .on( "click", youClick )
  7564. // this === "zombie"
  7565. .on( "click", $.proxy( you.test, me ) )
  7566. // this === "<button> element"
  7567. .on( "click", you.test );
  7568. </script>
  7569. </body>
  7570. </html>
  7571. ```
  7572. * @example ​ ````Change the context of a function bound to the click handler,
  7573. ```html
  7574. <!doctype html>
  7575. <html lang="en">
  7576. <head>
  7577. <meta charset="utf-8">
  7578. <title>jQuery.proxy demo</title>
  7579. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7580. </head>
  7581. <body>
  7582. <p><button type="button" id="test">Test</button></p>
  7583. <div id="log"></div>
  7584. <script>
  7585. var me = {
  7586. // I'm a dog
  7587. type: "dog",
  7588. // Note that event comes *after* one and two
  7589. test: function( one, two, event ) {
  7590. $( "#log" )
  7591. // `one` maps to `you`, the 1st additional
  7592. // argument in the $.proxy function call
  7593. .append( "<h3>Hello " + one.type + ":</h3>" )
  7594. // The `this` keyword refers to `me`
  7595. // (the 2nd, context, argument of $.proxy)
  7596. .append( "I am a " + this.type + ", " )
  7597. // `two` maps to `they`, the 2nd additional
  7598. // argument in the $.proxy function call
  7599. .append( "and they are " + two.type + ".<br>" )
  7600. // The event type is "click"
  7601. .append( "Thanks for " + event.type + "ing." )
  7602. // The clicked element is `event.target`,
  7603. // and its type is "button"
  7604. .append( "the " + event.target.type + "." );
  7605. }
  7606. };
  7607. var you = { type: "cat" };
  7608. var they = { type: "fish" };
  7609. // Set up handler to execute me.test() in the context
  7610. // of `me`, with `you` and `they` as additional arguments
  7611. var proxy = $.proxy( me.test, me, you, they );
  7612. $( "#test" )
  7613. .on( "click", proxy );
  7614. </script>
  7615. </body>
  7616. </html>
  7617. ```
  7618. */
  7619. proxy<TContext, TReturn, T, U, V>(
  7620. funсtion: (this: TContext, t: T, u: U, v: V) => TReturn,
  7621. context: TContext,
  7622. ): (t: T, u: U, v: V) => TReturn;
  7623. // #endregion
  7624. // region 4 parameters
  7625. // #region 4 parameters
  7626. /**
  7627. * Takes a function and returns a new one that will always have a particular context.
  7628. * @param funсtion The function whose context will be changed.
  7629. * @param context The object to which the context (`this`) of the function should be set.
  7630. * @param a An argument to be passed to the function referenced in the `function` argument.
  7631. * @param b An argument to be passed to the function referenced in the `function` argument.
  7632. * @param c An argument to be passed to the function referenced in the `function` argument.
  7633. * @param d An argument to be passed to the function referenced in the `function` argument.
  7634. * @param e An argument to be passed to the function referenced in the `function` argument.
  7635. * @param f An argument to be passed to the function referenced in the `function` argument.
  7636. * @param g An argument to be passed to the function referenced in the `function` argument.
  7637. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7638. * @since 1.4
  7639. * @since 1.6
  7640. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7641. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7642. ```html
  7643. <!doctype html>
  7644. <html lang="en">
  7645. <head>
  7646. <meta charset="utf-8">
  7647. <title>jQuery.proxy demo</title>
  7648. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7649. </head>
  7650. <body>
  7651. <p><button type="button" id="test">Test</button></p>
  7652. <div id="log"></div>
  7653. <script>
  7654. var me = {
  7655. type: "zombie",
  7656. test: function( event ) {
  7657. // Without proxy, `this` would refer to the event target
  7658. // use event.target to reference that element.
  7659. var element = event.target;
  7660. $( element ).css( "background-color", "red" );
  7661. // With proxy, `this` refers to the me object encapsulating
  7662. // this function.
  7663. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7664. $( "#test" ).off( "click", this.test );
  7665. }
  7666. };
  7667. var you = {
  7668. type: "person",
  7669. test: function( event ) {
  7670. $( "#log" ).append( this.type + " " );
  7671. }
  7672. };
  7673. // Execute you.test() in the context of the `you` object
  7674. // no matter where it is called
  7675. // i.e. the `this` keyword will refer to `you`
  7676. var youClick = $.proxy( you.test, you );
  7677. // attach click handlers to #test
  7678. $( "#test" )
  7679. // this === "zombie"; handler unbound after first click
  7680. .on( "click", $.proxy( me.test, me ) )
  7681. // this === "person"
  7682. .on( "click", youClick )
  7683. // this === "zombie"
  7684. .on( "click", $.proxy( you.test, me ) )
  7685. // this === "<button> element"
  7686. .on( "click", you.test );
  7687. </script>
  7688. </body>
  7689. </html>
  7690. ```
  7691. * @example ​ ````Change the context of a function bound to the click handler,
  7692. ```html
  7693. <!doctype html>
  7694. <html lang="en">
  7695. <head>
  7696. <meta charset="utf-8">
  7697. <title>jQuery.proxy demo</title>
  7698. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7699. </head>
  7700. <body>
  7701. <p><button type="button" id="test">Test</button></p>
  7702. <div id="log"></div>
  7703. <script>
  7704. var me = {
  7705. // I'm a dog
  7706. type: "dog",
  7707. // Note that event comes *after* one and two
  7708. test: function( one, two, event ) {
  7709. $( "#log" )
  7710. // `one` maps to `you`, the 1st additional
  7711. // argument in the $.proxy function call
  7712. .append( "<h3>Hello " + one.type + ":</h3>" )
  7713. // The `this` keyword refers to `me`
  7714. // (the 2nd, context, argument of $.proxy)
  7715. .append( "I am a " + this.type + ", " )
  7716. // `two` maps to `they`, the 2nd additional
  7717. // argument in the $.proxy function call
  7718. .append( "and they are " + two.type + ".<br>" )
  7719. // The event type is "click"
  7720. .append( "Thanks for " + event.type + "ing." )
  7721. // The clicked element is `event.target`,
  7722. // and its type is "button"
  7723. .append( "the " + event.target.type + "." );
  7724. }
  7725. };
  7726. var you = { type: "cat" };
  7727. var they = { type: "fish" };
  7728. // Set up handler to execute me.test() in the context
  7729. // of `me`, with `you` and `they` as additional arguments
  7730. var proxy = $.proxy( me.test, me, you, they );
  7731. $( "#test" )
  7732. .on( "click", proxy );
  7733. </script>
  7734. </body>
  7735. </html>
  7736. ```
  7737. */
  7738. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W>(
  7739. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W) => TReturn,
  7740. context: TContext,
  7741. a: A,
  7742. b: B,
  7743. c: C,
  7744. d: D,
  7745. e: E,
  7746. f: F,
  7747. g: G,
  7748. ): (t: T, u: U, v: V, w: W) => TReturn;
  7749. /**
  7750. * Takes a function and returns a new one that will always have a particular context.
  7751. * @param funсtion The function whose context will be changed.
  7752. * @param context The object to which the context (`this`) of the function should be set.
  7753. * @param a An argument to be passed to the function referenced in the `function` argument.
  7754. * @param b An argument to be passed to the function referenced in the `function` argument.
  7755. * @param c An argument to be passed to the function referenced in the `function` argument.
  7756. * @param d An argument to be passed to the function referenced in the `function` argument.
  7757. * @param e An argument to be passed to the function referenced in the `function` argument.
  7758. * @param f An argument to be passed to the function referenced in the `function` argument.
  7759. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7760. * @since 1.4
  7761. * @since 1.6
  7762. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7763. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7764. ```html
  7765. <!doctype html>
  7766. <html lang="en">
  7767. <head>
  7768. <meta charset="utf-8">
  7769. <title>jQuery.proxy demo</title>
  7770. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7771. </head>
  7772. <body>
  7773. <p><button type="button" id="test">Test</button></p>
  7774. <div id="log"></div>
  7775. <script>
  7776. var me = {
  7777. type: "zombie",
  7778. test: function( event ) {
  7779. // Without proxy, `this` would refer to the event target
  7780. // use event.target to reference that element.
  7781. var element = event.target;
  7782. $( element ).css( "background-color", "red" );
  7783. // With proxy, `this` refers to the me object encapsulating
  7784. // this function.
  7785. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7786. $( "#test" ).off( "click", this.test );
  7787. }
  7788. };
  7789. var you = {
  7790. type: "person",
  7791. test: function( event ) {
  7792. $( "#log" ).append( this.type + " " );
  7793. }
  7794. };
  7795. // Execute you.test() in the context of the `you` object
  7796. // no matter where it is called
  7797. // i.e. the `this` keyword will refer to `you`
  7798. var youClick = $.proxy( you.test, you );
  7799. // attach click handlers to #test
  7800. $( "#test" )
  7801. // this === "zombie"; handler unbound after first click
  7802. .on( "click", $.proxy( me.test, me ) )
  7803. // this === "person"
  7804. .on( "click", youClick )
  7805. // this === "zombie"
  7806. .on( "click", $.proxy( you.test, me ) )
  7807. // this === "<button> element"
  7808. .on( "click", you.test );
  7809. </script>
  7810. </body>
  7811. </html>
  7812. ```
  7813. * @example ​ ````Change the context of a function bound to the click handler,
  7814. ```html
  7815. <!doctype html>
  7816. <html lang="en">
  7817. <head>
  7818. <meta charset="utf-8">
  7819. <title>jQuery.proxy demo</title>
  7820. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7821. </head>
  7822. <body>
  7823. <p><button type="button" id="test">Test</button></p>
  7824. <div id="log"></div>
  7825. <script>
  7826. var me = {
  7827. // I'm a dog
  7828. type: "dog",
  7829. // Note that event comes *after* one and two
  7830. test: function( one, two, event ) {
  7831. $( "#log" )
  7832. // `one` maps to `you`, the 1st additional
  7833. // argument in the $.proxy function call
  7834. .append( "<h3>Hello " + one.type + ":</h3>" )
  7835. // The `this` keyword refers to `me`
  7836. // (the 2nd, context, argument of $.proxy)
  7837. .append( "I am a " + this.type + ", " )
  7838. // `two` maps to `they`, the 2nd additional
  7839. // argument in the $.proxy function call
  7840. .append( "and they are " + two.type + ".<br>" )
  7841. // The event type is "click"
  7842. .append( "Thanks for " + event.type + "ing." )
  7843. // The clicked element is `event.target`,
  7844. // and its type is "button"
  7845. .append( "the " + event.target.type + "." );
  7846. }
  7847. };
  7848. var you = { type: "cat" };
  7849. var they = { type: "fish" };
  7850. // Set up handler to execute me.test() in the context
  7851. // of `me`, with `you` and `they` as additional arguments
  7852. var proxy = $.proxy( me.test, me, you, they );
  7853. $( "#test" )
  7854. .on( "click", proxy );
  7855. </script>
  7856. </body>
  7857. </html>
  7858. ```
  7859. */
  7860. proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W>(
  7861. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W) => TReturn,
  7862. context: TContext,
  7863. a: A,
  7864. b: B,
  7865. c: C,
  7866. d: D,
  7867. e: E,
  7868. f: F,
  7869. ): (t: T, u: U, v: V, w: W) => TReturn;
  7870. /**
  7871. * Takes a function and returns a new one that will always have a particular context.
  7872. * @param funсtion The function whose context will be changed.
  7873. * @param context The object to which the context (`this`) of the function should be set.
  7874. * @param a An argument to be passed to the function referenced in the `function` argument.
  7875. * @param b An argument to be passed to the function referenced in the `function` argument.
  7876. * @param c An argument to be passed to the function referenced in the `function` argument.
  7877. * @param d An argument to be passed to the function referenced in the `function` argument.
  7878. * @param e An argument to be passed to the function referenced in the `function` argument.
  7879. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7880. * @since 1.4
  7881. * @since 1.6
  7882. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  7883. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  7884. ```html
  7885. <!doctype html>
  7886. <html lang="en">
  7887. <head>
  7888. <meta charset="utf-8">
  7889. <title>jQuery.proxy demo</title>
  7890. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7891. </head>
  7892. <body>
  7893. <p><button type="button" id="test">Test</button></p>
  7894. <div id="log"></div>
  7895. <script>
  7896. var me = {
  7897. type: "zombie",
  7898. test: function( event ) {
  7899. // Without proxy, `this` would refer to the event target
  7900. // use event.target to reference that element.
  7901. var element = event.target;
  7902. $( element ).css( "background-color", "red" );
  7903. // With proxy, `this` refers to the me object encapsulating
  7904. // this function.
  7905. $( "#log" ).append( "Hello " + this.type + "<br>" );
  7906. $( "#test" ).off( "click", this.test );
  7907. }
  7908. };
  7909. var you = {
  7910. type: "person",
  7911. test: function( event ) {
  7912. $( "#log" ).append( this.type + " " );
  7913. }
  7914. };
  7915. // Execute you.test() in the context of the `you` object
  7916. // no matter where it is called
  7917. // i.e. the `this` keyword will refer to `you`
  7918. var youClick = $.proxy( you.test, you );
  7919. // attach click handlers to #test
  7920. $( "#test" )
  7921. // this === "zombie"; handler unbound after first click
  7922. .on( "click", $.proxy( me.test, me ) )
  7923. // this === "person"
  7924. .on( "click", youClick )
  7925. // this === "zombie"
  7926. .on( "click", $.proxy( you.test, me ) )
  7927. // this === "<button> element"
  7928. .on( "click", you.test );
  7929. </script>
  7930. </body>
  7931. </html>
  7932. ```
  7933. * @example ​ ````Change the context of a function bound to the click handler,
  7934. ```html
  7935. <!doctype html>
  7936. <html lang="en">
  7937. <head>
  7938. <meta charset="utf-8">
  7939. <title>jQuery.proxy demo</title>
  7940. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  7941. </head>
  7942. <body>
  7943. <p><button type="button" id="test">Test</button></p>
  7944. <div id="log"></div>
  7945. <script>
  7946. var me = {
  7947. // I'm a dog
  7948. type: "dog",
  7949. // Note that event comes *after* one and two
  7950. test: function( one, two, event ) {
  7951. $( "#log" )
  7952. // `one` maps to `you`, the 1st additional
  7953. // argument in the $.proxy function call
  7954. .append( "<h3>Hello " + one.type + ":</h3>" )
  7955. // The `this` keyword refers to `me`
  7956. // (the 2nd, context, argument of $.proxy)
  7957. .append( "I am a " + this.type + ", " )
  7958. // `two` maps to `they`, the 2nd additional
  7959. // argument in the $.proxy function call
  7960. .append( "and they are " + two.type + ".<br>" )
  7961. // The event type is "click"
  7962. .append( "Thanks for " + event.type + "ing." )
  7963. // The clicked element is `event.target`,
  7964. // and its type is "button"
  7965. .append( "the " + event.target.type + "." );
  7966. }
  7967. };
  7968. var you = { type: "cat" };
  7969. var they = { type: "fish" };
  7970. // Set up handler to execute me.test() in the context
  7971. // of `me`, with `you` and `they` as additional arguments
  7972. var proxy = $.proxy( me.test, me, you, they );
  7973. $( "#test" )
  7974. .on( "click", proxy );
  7975. </script>
  7976. </body>
  7977. </html>
  7978. ```
  7979. */
  7980. proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W>(
  7981. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W) => TReturn,
  7982. context: TContext,
  7983. a: A,
  7984. b: B,
  7985. c: C,
  7986. d: D,
  7987. e: E,
  7988. ): (t: T, u: U, v: V, w: W) => TReturn;
  7989. /**
  7990. * Takes a function and returns a new one that will always have a particular context.
  7991. * @param funсtion The function whose context will be changed.
  7992. * @param context The object to which the context (`this`) of the function should be set.
  7993. * @param a An argument to be passed to the function referenced in the `function` argument.
  7994. * @param b An argument to be passed to the function referenced in the `function` argument.
  7995. * @param c An argument to be passed to the function referenced in the `function` argument.
  7996. * @param d An argument to be passed to the function referenced in the `function` argument.
  7997. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  7998. * @since 1.4
  7999. * @since 1.6
  8000. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8001. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8002. ```html
  8003. <!doctype html>
  8004. <html lang="en">
  8005. <head>
  8006. <meta charset="utf-8">
  8007. <title>jQuery.proxy demo</title>
  8008. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8009. </head>
  8010. <body>
  8011. <p><button type="button" id="test">Test</button></p>
  8012. <div id="log"></div>
  8013. <script>
  8014. var me = {
  8015. type: "zombie",
  8016. test: function( event ) {
  8017. // Without proxy, `this` would refer to the event target
  8018. // use event.target to reference that element.
  8019. var element = event.target;
  8020. $( element ).css( "background-color", "red" );
  8021. // With proxy, `this` refers to the me object encapsulating
  8022. // this function.
  8023. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8024. $( "#test" ).off( "click", this.test );
  8025. }
  8026. };
  8027. var you = {
  8028. type: "person",
  8029. test: function( event ) {
  8030. $( "#log" ).append( this.type + " " );
  8031. }
  8032. };
  8033. // Execute you.test() in the context of the `you` object
  8034. // no matter where it is called
  8035. // i.e. the `this` keyword will refer to `you`
  8036. var youClick = $.proxy( you.test, you );
  8037. // attach click handlers to #test
  8038. $( "#test" )
  8039. // this === "zombie"; handler unbound after first click
  8040. .on( "click", $.proxy( me.test, me ) )
  8041. // this === "person"
  8042. .on( "click", youClick )
  8043. // this === "zombie"
  8044. .on( "click", $.proxy( you.test, me ) )
  8045. // this === "<button> element"
  8046. .on( "click", you.test );
  8047. </script>
  8048. </body>
  8049. </html>
  8050. ```
  8051. * @example ​ ````Change the context of a function bound to the click handler,
  8052. ```html
  8053. <!doctype html>
  8054. <html lang="en">
  8055. <head>
  8056. <meta charset="utf-8">
  8057. <title>jQuery.proxy demo</title>
  8058. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8059. </head>
  8060. <body>
  8061. <p><button type="button" id="test">Test</button></p>
  8062. <div id="log"></div>
  8063. <script>
  8064. var me = {
  8065. // I'm a dog
  8066. type: "dog",
  8067. // Note that event comes *after* one and two
  8068. test: function( one, two, event ) {
  8069. $( "#log" )
  8070. // `one` maps to `you`, the 1st additional
  8071. // argument in the $.proxy function call
  8072. .append( "<h3>Hello " + one.type + ":</h3>" )
  8073. // The `this` keyword refers to `me`
  8074. // (the 2nd, context, argument of $.proxy)
  8075. .append( "I am a " + this.type + ", " )
  8076. // `two` maps to `they`, the 2nd additional
  8077. // argument in the $.proxy function call
  8078. .append( "and they are " + two.type + ".<br>" )
  8079. // The event type is "click"
  8080. .append( "Thanks for " + event.type + "ing." )
  8081. // The clicked element is `event.target`,
  8082. // and its type is "button"
  8083. .append( "the " + event.target.type + "." );
  8084. }
  8085. };
  8086. var you = { type: "cat" };
  8087. var they = { type: "fish" };
  8088. // Set up handler to execute me.test() in the context
  8089. // of `me`, with `you` and `they` as additional arguments
  8090. var proxy = $.proxy( me.test, me, you, they );
  8091. $( "#test" )
  8092. .on( "click", proxy );
  8093. </script>
  8094. </body>
  8095. </html>
  8096. ```
  8097. */
  8098. proxy<TContext, TReturn, A, B, C, D, T, U, V, W>(
  8099. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W) => TReturn,
  8100. context: TContext,
  8101. a: A,
  8102. b: B,
  8103. c: C,
  8104. d: D,
  8105. ): (t: T, u: U, v: V, w: W) => TReturn;
  8106. /**
  8107. * Takes a function and returns a new one that will always have a particular context.
  8108. * @param funсtion The function whose context will be changed.
  8109. * @param context The object to which the context (`this`) of the function should be set.
  8110. * @param a An argument to be passed to the function referenced in the `function` argument.
  8111. * @param b An argument to be passed to the function referenced in the `function` argument.
  8112. * @param c An argument to be passed to the function referenced in the `function` argument.
  8113. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8114. * @since 1.4
  8115. * @since 1.6
  8116. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8117. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8118. ```html
  8119. <!doctype html>
  8120. <html lang="en">
  8121. <head>
  8122. <meta charset="utf-8">
  8123. <title>jQuery.proxy demo</title>
  8124. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8125. </head>
  8126. <body>
  8127. <p><button type="button" id="test">Test</button></p>
  8128. <div id="log"></div>
  8129. <script>
  8130. var me = {
  8131. type: "zombie",
  8132. test: function( event ) {
  8133. // Without proxy, `this` would refer to the event target
  8134. // use event.target to reference that element.
  8135. var element = event.target;
  8136. $( element ).css( "background-color", "red" );
  8137. // With proxy, `this` refers to the me object encapsulating
  8138. // this function.
  8139. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8140. $( "#test" ).off( "click", this.test );
  8141. }
  8142. };
  8143. var you = {
  8144. type: "person",
  8145. test: function( event ) {
  8146. $( "#log" ).append( this.type + " " );
  8147. }
  8148. };
  8149. // Execute you.test() in the context of the `you` object
  8150. // no matter where it is called
  8151. // i.e. the `this` keyword will refer to `you`
  8152. var youClick = $.proxy( you.test, you );
  8153. // attach click handlers to #test
  8154. $( "#test" )
  8155. // this === "zombie"; handler unbound after first click
  8156. .on( "click", $.proxy( me.test, me ) )
  8157. // this === "person"
  8158. .on( "click", youClick )
  8159. // this === "zombie"
  8160. .on( "click", $.proxy( you.test, me ) )
  8161. // this === "<button> element"
  8162. .on( "click", you.test );
  8163. </script>
  8164. </body>
  8165. </html>
  8166. ```
  8167. * @example ​ ````Change the context of a function bound to the click handler,
  8168. ```html
  8169. <!doctype html>
  8170. <html lang="en">
  8171. <head>
  8172. <meta charset="utf-8">
  8173. <title>jQuery.proxy demo</title>
  8174. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8175. </head>
  8176. <body>
  8177. <p><button type="button" id="test">Test</button></p>
  8178. <div id="log"></div>
  8179. <script>
  8180. var me = {
  8181. // I'm a dog
  8182. type: "dog",
  8183. // Note that event comes *after* one and two
  8184. test: function( one, two, event ) {
  8185. $( "#log" )
  8186. // `one` maps to `you`, the 1st additional
  8187. // argument in the $.proxy function call
  8188. .append( "<h3>Hello " + one.type + ":</h3>" )
  8189. // The `this` keyword refers to `me`
  8190. // (the 2nd, context, argument of $.proxy)
  8191. .append( "I am a " + this.type + ", " )
  8192. // `two` maps to `they`, the 2nd additional
  8193. // argument in the $.proxy function call
  8194. .append( "and they are " + two.type + ".<br>" )
  8195. // The event type is "click"
  8196. .append( "Thanks for " + event.type + "ing." )
  8197. // The clicked element is `event.target`,
  8198. // and its type is "button"
  8199. .append( "the " + event.target.type + "." );
  8200. }
  8201. };
  8202. var you = { type: "cat" };
  8203. var they = { type: "fish" };
  8204. // Set up handler to execute me.test() in the context
  8205. // of `me`, with `you` and `they` as additional arguments
  8206. var proxy = $.proxy( me.test, me, you, they );
  8207. $( "#test" )
  8208. .on( "click", proxy );
  8209. </script>
  8210. </body>
  8211. </html>
  8212. ```
  8213. */
  8214. proxy<TContext, TReturn, A, B, C, T, U, V, W>(
  8215. funсtion: (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W) => TReturn,
  8216. context: TContext,
  8217. a: A,
  8218. b: B,
  8219. c: C,
  8220. ): (t: T, u: U, v: V, w: W) => TReturn;
  8221. /**
  8222. * Takes a function and returns a new one that will always have a particular context.
  8223. * @param funсtion The function whose context will be changed.
  8224. * @param context The object to which the context (`this`) of the function should be set.
  8225. * @param a An argument to be passed to the function referenced in the `function` argument.
  8226. * @param b An argument to be passed to the function referenced in the `function` argument.
  8227. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8228. * @since 1.4
  8229. * @since 1.6
  8230. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8231. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8232. ```html
  8233. <!doctype html>
  8234. <html lang="en">
  8235. <head>
  8236. <meta charset="utf-8">
  8237. <title>jQuery.proxy demo</title>
  8238. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8239. </head>
  8240. <body>
  8241. <p><button type="button" id="test">Test</button></p>
  8242. <div id="log"></div>
  8243. <script>
  8244. var me = {
  8245. type: "zombie",
  8246. test: function( event ) {
  8247. // Without proxy, `this` would refer to the event target
  8248. // use event.target to reference that element.
  8249. var element = event.target;
  8250. $( element ).css( "background-color", "red" );
  8251. // With proxy, `this` refers to the me object encapsulating
  8252. // this function.
  8253. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8254. $( "#test" ).off( "click", this.test );
  8255. }
  8256. };
  8257. var you = {
  8258. type: "person",
  8259. test: function( event ) {
  8260. $( "#log" ).append( this.type + " " );
  8261. }
  8262. };
  8263. // Execute you.test() in the context of the `you` object
  8264. // no matter where it is called
  8265. // i.e. the `this` keyword will refer to `you`
  8266. var youClick = $.proxy( you.test, you );
  8267. // attach click handlers to #test
  8268. $( "#test" )
  8269. // this === "zombie"; handler unbound after first click
  8270. .on( "click", $.proxy( me.test, me ) )
  8271. // this === "person"
  8272. .on( "click", youClick )
  8273. // this === "zombie"
  8274. .on( "click", $.proxy( you.test, me ) )
  8275. // this === "<button> element"
  8276. .on( "click", you.test );
  8277. </script>
  8278. </body>
  8279. </html>
  8280. ```
  8281. * @example ​ ````Change the context of a function bound to the click handler,
  8282. ```html
  8283. <!doctype html>
  8284. <html lang="en">
  8285. <head>
  8286. <meta charset="utf-8">
  8287. <title>jQuery.proxy demo</title>
  8288. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8289. </head>
  8290. <body>
  8291. <p><button type="button" id="test">Test</button></p>
  8292. <div id="log"></div>
  8293. <script>
  8294. var me = {
  8295. // I'm a dog
  8296. type: "dog",
  8297. // Note that event comes *after* one and two
  8298. test: function( one, two, event ) {
  8299. $( "#log" )
  8300. // `one` maps to `you`, the 1st additional
  8301. // argument in the $.proxy function call
  8302. .append( "<h3>Hello " + one.type + ":</h3>" )
  8303. // The `this` keyword refers to `me`
  8304. // (the 2nd, context, argument of $.proxy)
  8305. .append( "I am a " + this.type + ", " )
  8306. // `two` maps to `they`, the 2nd additional
  8307. // argument in the $.proxy function call
  8308. .append( "and they are " + two.type + ".<br>" )
  8309. // The event type is "click"
  8310. .append( "Thanks for " + event.type + "ing." )
  8311. // The clicked element is `event.target`,
  8312. // and its type is "button"
  8313. .append( "the " + event.target.type + "." );
  8314. }
  8315. };
  8316. var you = { type: "cat" };
  8317. var they = { type: "fish" };
  8318. // Set up handler to execute me.test() in the context
  8319. // of `me`, with `you` and `they` as additional arguments
  8320. var proxy = $.proxy( me.test, me, you, they );
  8321. $( "#test" )
  8322. .on( "click", proxy );
  8323. </script>
  8324. </body>
  8325. </html>
  8326. ```
  8327. */
  8328. proxy<TContext, TReturn, A, B, T, U, V, W>(
  8329. funсtion: (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W) => TReturn,
  8330. context: TContext,
  8331. a: A,
  8332. b: B,
  8333. ): (t: T, u: U, v: V, w: W) => TReturn;
  8334. /**
  8335. * Takes a function and returns a new one that will always have a particular context.
  8336. * @param funсtion The function whose context will be changed.
  8337. * @param context The object to which the context (`this`) of the function should be set.
  8338. * @param a An argument to be passed to the function referenced in the `function` argument.
  8339. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8340. * @since 1.4
  8341. * @since 1.6
  8342. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8343. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8344. ```html
  8345. <!doctype html>
  8346. <html lang="en">
  8347. <head>
  8348. <meta charset="utf-8">
  8349. <title>jQuery.proxy demo</title>
  8350. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8351. </head>
  8352. <body>
  8353. <p><button type="button" id="test">Test</button></p>
  8354. <div id="log"></div>
  8355. <script>
  8356. var me = {
  8357. type: "zombie",
  8358. test: function( event ) {
  8359. // Without proxy, `this` would refer to the event target
  8360. // use event.target to reference that element.
  8361. var element = event.target;
  8362. $( element ).css( "background-color", "red" );
  8363. // With proxy, `this` refers to the me object encapsulating
  8364. // this function.
  8365. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8366. $( "#test" ).off( "click", this.test );
  8367. }
  8368. };
  8369. var you = {
  8370. type: "person",
  8371. test: function( event ) {
  8372. $( "#log" ).append( this.type + " " );
  8373. }
  8374. };
  8375. // Execute you.test() in the context of the `you` object
  8376. // no matter where it is called
  8377. // i.e. the `this` keyword will refer to `you`
  8378. var youClick = $.proxy( you.test, you );
  8379. // attach click handlers to #test
  8380. $( "#test" )
  8381. // this === "zombie"; handler unbound after first click
  8382. .on( "click", $.proxy( me.test, me ) )
  8383. // this === "person"
  8384. .on( "click", youClick )
  8385. // this === "zombie"
  8386. .on( "click", $.proxy( you.test, me ) )
  8387. // this === "<button> element"
  8388. .on( "click", you.test );
  8389. </script>
  8390. </body>
  8391. </html>
  8392. ```
  8393. * @example ​ ````Change the context of a function bound to the click handler,
  8394. ```html
  8395. <!doctype html>
  8396. <html lang="en">
  8397. <head>
  8398. <meta charset="utf-8">
  8399. <title>jQuery.proxy demo</title>
  8400. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8401. </head>
  8402. <body>
  8403. <p><button type="button" id="test">Test</button></p>
  8404. <div id="log"></div>
  8405. <script>
  8406. var me = {
  8407. // I'm a dog
  8408. type: "dog",
  8409. // Note that event comes *after* one and two
  8410. test: function( one, two, event ) {
  8411. $( "#log" )
  8412. // `one` maps to `you`, the 1st additional
  8413. // argument in the $.proxy function call
  8414. .append( "<h3>Hello " + one.type + ":</h3>" )
  8415. // The `this` keyword refers to `me`
  8416. // (the 2nd, context, argument of $.proxy)
  8417. .append( "I am a " + this.type + ", " )
  8418. // `two` maps to `they`, the 2nd additional
  8419. // argument in the $.proxy function call
  8420. .append( "and they are " + two.type + ".<br>" )
  8421. // The event type is "click"
  8422. .append( "Thanks for " + event.type + "ing." )
  8423. // The clicked element is `event.target`,
  8424. // and its type is "button"
  8425. .append( "the " + event.target.type + "." );
  8426. }
  8427. };
  8428. var you = { type: "cat" };
  8429. var they = { type: "fish" };
  8430. // Set up handler to execute me.test() in the context
  8431. // of `me`, with `you` and `they` as additional arguments
  8432. var proxy = $.proxy( me.test, me, you, they );
  8433. $( "#test" )
  8434. .on( "click", proxy );
  8435. </script>
  8436. </body>
  8437. </html>
  8438. ```
  8439. */
  8440. proxy<TContext, TReturn, A, T, U, V, W>(
  8441. funсtion: (this: TContext, a: A, t: T, u: U, v: V, w: W) => TReturn,
  8442. context: TContext,
  8443. a: A,
  8444. ): (t: T, u: U, v: V, w: W) => TReturn;
  8445. /**
  8446. * Takes a function and returns a new one that will always have a particular context.
  8447. * @param funсtion The function whose context will be changed.
  8448. * @param context The object to which the context (`this`) of the function should be set.
  8449. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8450. * @since 1.4
  8451. * @since 1.6
  8452. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8453. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8454. ```html
  8455. <!doctype html>
  8456. <html lang="en">
  8457. <head>
  8458. <meta charset="utf-8">
  8459. <title>jQuery.proxy demo</title>
  8460. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8461. </head>
  8462. <body>
  8463. <p><button type="button" id="test">Test</button></p>
  8464. <div id="log"></div>
  8465. <script>
  8466. var me = {
  8467. type: "zombie",
  8468. test: function( event ) {
  8469. // Without proxy, `this` would refer to the event target
  8470. // use event.target to reference that element.
  8471. var element = event.target;
  8472. $( element ).css( "background-color", "red" );
  8473. // With proxy, `this` refers to the me object encapsulating
  8474. // this function.
  8475. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8476. $( "#test" ).off( "click", this.test );
  8477. }
  8478. };
  8479. var you = {
  8480. type: "person",
  8481. test: function( event ) {
  8482. $( "#log" ).append( this.type + " " );
  8483. }
  8484. };
  8485. // Execute you.test() in the context of the `you` object
  8486. // no matter where it is called
  8487. // i.e. the `this` keyword will refer to `you`
  8488. var youClick = $.proxy( you.test, you );
  8489. // attach click handlers to #test
  8490. $( "#test" )
  8491. // this === "zombie"; handler unbound after first click
  8492. .on( "click", $.proxy( me.test, me ) )
  8493. // this === "person"
  8494. .on( "click", youClick )
  8495. // this === "zombie"
  8496. .on( "click", $.proxy( you.test, me ) )
  8497. // this === "<button> element"
  8498. .on( "click", you.test );
  8499. </script>
  8500. </body>
  8501. </html>
  8502. ```
  8503. * @example ​ ````Change the context of a function bound to the click handler,
  8504. ```html
  8505. <!doctype html>
  8506. <html lang="en">
  8507. <head>
  8508. <meta charset="utf-8">
  8509. <title>jQuery.proxy demo</title>
  8510. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8511. </head>
  8512. <body>
  8513. <p><button type="button" id="test">Test</button></p>
  8514. <div id="log"></div>
  8515. <script>
  8516. var me = {
  8517. // I'm a dog
  8518. type: "dog",
  8519. // Note that event comes *after* one and two
  8520. test: function( one, two, event ) {
  8521. $( "#log" )
  8522. // `one` maps to `you`, the 1st additional
  8523. // argument in the $.proxy function call
  8524. .append( "<h3>Hello " + one.type + ":</h3>" )
  8525. // The `this` keyword refers to `me`
  8526. // (the 2nd, context, argument of $.proxy)
  8527. .append( "I am a " + this.type + ", " )
  8528. // `two` maps to `they`, the 2nd additional
  8529. // argument in the $.proxy function call
  8530. .append( "and they are " + two.type + ".<br>" )
  8531. // The event type is "click"
  8532. .append( "Thanks for " + event.type + "ing." )
  8533. // The clicked element is `event.target`,
  8534. // and its type is "button"
  8535. .append( "the " + event.target.type + "." );
  8536. }
  8537. };
  8538. var you = { type: "cat" };
  8539. var they = { type: "fish" };
  8540. // Set up handler to execute me.test() in the context
  8541. // of `me`, with `you` and `they` as additional arguments
  8542. var proxy = $.proxy( me.test, me, you, they );
  8543. $( "#test" )
  8544. .on( "click", proxy );
  8545. </script>
  8546. </body>
  8547. </html>
  8548. ```
  8549. */
  8550. proxy<TContext, TReturn, T, U, V, W>(
  8551. funсtion: (this: TContext, t: T, u: U, v: V, w: W) => TReturn,
  8552. context: TContext,
  8553. ): (t: T, u: U, v: V, w: W) => TReturn;
  8554. // #endregion
  8555. // region 5 parameters
  8556. // #region 5 parameters
  8557. /**
  8558. * Takes a function and returns a new one that will always have a particular context.
  8559. * @param funсtion The function whose context will be changed.
  8560. * @param context The object to which the context (`this`) of the function should be set.
  8561. * @param a An argument to be passed to the function referenced in the `function` argument.
  8562. * @param b An argument to be passed to the function referenced in the `function` argument.
  8563. * @param c An argument to be passed to the function referenced in the `function` argument.
  8564. * @param d An argument to be passed to the function referenced in the `function` argument.
  8565. * @param e An argument to be passed to the function referenced in the `function` argument.
  8566. * @param f An argument to be passed to the function referenced in the `function` argument.
  8567. * @param g An argument to be passed to the function referenced in the `function` argument.
  8568. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8569. * @since 1.4
  8570. * @since 1.6
  8571. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8572. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8573. ```html
  8574. <!doctype html>
  8575. <html lang="en">
  8576. <head>
  8577. <meta charset="utf-8">
  8578. <title>jQuery.proxy demo</title>
  8579. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8580. </head>
  8581. <body>
  8582. <p><button type="button" id="test">Test</button></p>
  8583. <div id="log"></div>
  8584. <script>
  8585. var me = {
  8586. type: "zombie",
  8587. test: function( event ) {
  8588. // Without proxy, `this` would refer to the event target
  8589. // use event.target to reference that element.
  8590. var element = event.target;
  8591. $( element ).css( "background-color", "red" );
  8592. // With proxy, `this` refers to the me object encapsulating
  8593. // this function.
  8594. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8595. $( "#test" ).off( "click", this.test );
  8596. }
  8597. };
  8598. var you = {
  8599. type: "person",
  8600. test: function( event ) {
  8601. $( "#log" ).append( this.type + " " );
  8602. }
  8603. };
  8604. // Execute you.test() in the context of the `you` object
  8605. // no matter where it is called
  8606. // i.e. the `this` keyword will refer to `you`
  8607. var youClick = $.proxy( you.test, you );
  8608. // attach click handlers to #test
  8609. $( "#test" )
  8610. // this === "zombie"; handler unbound after first click
  8611. .on( "click", $.proxy( me.test, me ) )
  8612. // this === "person"
  8613. .on( "click", youClick )
  8614. // this === "zombie"
  8615. .on( "click", $.proxy( you.test, me ) )
  8616. // this === "<button> element"
  8617. .on( "click", you.test );
  8618. </script>
  8619. </body>
  8620. </html>
  8621. ```
  8622. * @example ​ ````Change the context of a function bound to the click handler,
  8623. ```html
  8624. <!doctype html>
  8625. <html lang="en">
  8626. <head>
  8627. <meta charset="utf-8">
  8628. <title>jQuery.proxy demo</title>
  8629. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8630. </head>
  8631. <body>
  8632. <p><button type="button" id="test">Test</button></p>
  8633. <div id="log"></div>
  8634. <script>
  8635. var me = {
  8636. // I'm a dog
  8637. type: "dog",
  8638. // Note that event comes *after* one and two
  8639. test: function( one, two, event ) {
  8640. $( "#log" )
  8641. // `one` maps to `you`, the 1st additional
  8642. // argument in the $.proxy function call
  8643. .append( "<h3>Hello " + one.type + ":</h3>" )
  8644. // The `this` keyword refers to `me`
  8645. // (the 2nd, context, argument of $.proxy)
  8646. .append( "I am a " + this.type + ", " )
  8647. // `two` maps to `they`, the 2nd additional
  8648. // argument in the $.proxy function call
  8649. .append( "and they are " + two.type + ".<br>" )
  8650. // The event type is "click"
  8651. .append( "Thanks for " + event.type + "ing." )
  8652. // The clicked element is `event.target`,
  8653. // and its type is "button"
  8654. .append( "the " + event.target.type + "." );
  8655. }
  8656. };
  8657. var you = { type: "cat" };
  8658. var they = { type: "fish" };
  8659. // Set up handler to execute me.test() in the context
  8660. // of `me`, with `you` and `they` as additional arguments
  8661. var proxy = $.proxy( me.test, me, you, they );
  8662. $( "#test" )
  8663. .on( "click", proxy );
  8664. </script>
  8665. </body>
  8666. </html>
  8667. ```
  8668. */
  8669. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X>(
  8670. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: T, u: U, v: V, w: W, x: X) => TReturn,
  8671. context: TContext,
  8672. a: A,
  8673. b: B,
  8674. c: C,
  8675. d: D,
  8676. e: E,
  8677. f: F,
  8678. g: G,
  8679. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  8680. /**
  8681. * Takes a function and returns a new one that will always have a particular context.
  8682. * @param funсtion The function whose context will be changed.
  8683. * @param context The object to which the context (`this`) of the function should be set.
  8684. * @param a An argument to be passed to the function referenced in the `function` argument.
  8685. * @param b An argument to be passed to the function referenced in the `function` argument.
  8686. * @param c An argument to be passed to the function referenced in the `function` argument.
  8687. * @param d An argument to be passed to the function referenced in the `function` argument.
  8688. * @param e An argument to be passed to the function referenced in the `function` argument.
  8689. * @param f An argument to be passed to the function referenced in the `function` argument.
  8690. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8691. * @since 1.4
  8692. * @since 1.6
  8693. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8694. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8695. ```html
  8696. <!doctype html>
  8697. <html lang="en">
  8698. <head>
  8699. <meta charset="utf-8">
  8700. <title>jQuery.proxy demo</title>
  8701. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8702. </head>
  8703. <body>
  8704. <p><button type="button" id="test">Test</button></p>
  8705. <div id="log"></div>
  8706. <script>
  8707. var me = {
  8708. type: "zombie",
  8709. test: function( event ) {
  8710. // Without proxy, `this` would refer to the event target
  8711. // use event.target to reference that element.
  8712. var element = event.target;
  8713. $( element ).css( "background-color", "red" );
  8714. // With proxy, `this` refers to the me object encapsulating
  8715. // this function.
  8716. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8717. $( "#test" ).off( "click", this.test );
  8718. }
  8719. };
  8720. var you = {
  8721. type: "person",
  8722. test: function( event ) {
  8723. $( "#log" ).append( this.type + " " );
  8724. }
  8725. };
  8726. // Execute you.test() in the context of the `you` object
  8727. // no matter where it is called
  8728. // i.e. the `this` keyword will refer to `you`
  8729. var youClick = $.proxy( you.test, you );
  8730. // attach click handlers to #test
  8731. $( "#test" )
  8732. // this === "zombie"; handler unbound after first click
  8733. .on( "click", $.proxy( me.test, me ) )
  8734. // this === "person"
  8735. .on( "click", youClick )
  8736. // this === "zombie"
  8737. .on( "click", $.proxy( you.test, me ) )
  8738. // this === "<button> element"
  8739. .on( "click", you.test );
  8740. </script>
  8741. </body>
  8742. </html>
  8743. ```
  8744. * @example ​ ````Change the context of a function bound to the click handler,
  8745. ```html
  8746. <!doctype html>
  8747. <html lang="en">
  8748. <head>
  8749. <meta charset="utf-8">
  8750. <title>jQuery.proxy demo</title>
  8751. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8752. </head>
  8753. <body>
  8754. <p><button type="button" id="test">Test</button></p>
  8755. <div id="log"></div>
  8756. <script>
  8757. var me = {
  8758. // I'm a dog
  8759. type: "dog",
  8760. // Note that event comes *after* one and two
  8761. test: function( one, two, event ) {
  8762. $( "#log" )
  8763. // `one` maps to `you`, the 1st additional
  8764. // argument in the $.proxy function call
  8765. .append( "<h3>Hello " + one.type + ":</h3>" )
  8766. // The `this` keyword refers to `me`
  8767. // (the 2nd, context, argument of $.proxy)
  8768. .append( "I am a " + this.type + ", " )
  8769. // `two` maps to `they`, the 2nd additional
  8770. // argument in the $.proxy function call
  8771. .append( "and they are " + two.type + ".<br>" )
  8772. // The event type is "click"
  8773. .append( "Thanks for " + event.type + "ing." )
  8774. // The clicked element is `event.target`,
  8775. // and its type is "button"
  8776. .append( "the " + event.target.type + "." );
  8777. }
  8778. };
  8779. var you = { type: "cat" };
  8780. var they = { type: "fish" };
  8781. // Set up handler to execute me.test() in the context
  8782. // of `me`, with `you` and `they` as additional arguments
  8783. var proxy = $.proxy( me.test, me, you, they );
  8784. $( "#test" )
  8785. .on( "click", proxy );
  8786. </script>
  8787. </body>
  8788. </html>
  8789. ```
  8790. */
  8791. proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X>(
  8792. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X) => TReturn,
  8793. context: TContext,
  8794. a: A,
  8795. b: B,
  8796. c: C,
  8797. d: D,
  8798. e: E,
  8799. f: F,
  8800. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  8801. /**
  8802. * Takes a function and returns a new one that will always have a particular context.
  8803. * @param funсtion The function whose context will be changed.
  8804. * @param context The object to which the context (`this`) of the function should be set.
  8805. * @param a An argument to be passed to the function referenced in the `function` argument.
  8806. * @param b An argument to be passed to the function referenced in the `function` argument.
  8807. * @param c An argument to be passed to the function referenced in the `function` argument.
  8808. * @param d An argument to be passed to the function referenced in the `function` argument.
  8809. * @param e An argument to be passed to the function referenced in the `function` argument.
  8810. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8811. * @since 1.4
  8812. * @since 1.6
  8813. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8814. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8815. ```html
  8816. <!doctype html>
  8817. <html lang="en">
  8818. <head>
  8819. <meta charset="utf-8">
  8820. <title>jQuery.proxy demo</title>
  8821. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8822. </head>
  8823. <body>
  8824. <p><button type="button" id="test">Test</button></p>
  8825. <div id="log"></div>
  8826. <script>
  8827. var me = {
  8828. type: "zombie",
  8829. test: function( event ) {
  8830. // Without proxy, `this` would refer to the event target
  8831. // use event.target to reference that element.
  8832. var element = event.target;
  8833. $( element ).css( "background-color", "red" );
  8834. // With proxy, `this` refers to the me object encapsulating
  8835. // this function.
  8836. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8837. $( "#test" ).off( "click", this.test );
  8838. }
  8839. };
  8840. var you = {
  8841. type: "person",
  8842. test: function( event ) {
  8843. $( "#log" ).append( this.type + " " );
  8844. }
  8845. };
  8846. // Execute you.test() in the context of the `you` object
  8847. // no matter where it is called
  8848. // i.e. the `this` keyword will refer to `you`
  8849. var youClick = $.proxy( you.test, you );
  8850. // attach click handlers to #test
  8851. $( "#test" )
  8852. // this === "zombie"; handler unbound after first click
  8853. .on( "click", $.proxy( me.test, me ) )
  8854. // this === "person"
  8855. .on( "click", youClick )
  8856. // this === "zombie"
  8857. .on( "click", $.proxy( you.test, me ) )
  8858. // this === "<button> element"
  8859. .on( "click", you.test );
  8860. </script>
  8861. </body>
  8862. </html>
  8863. ```
  8864. * @example ​ ````Change the context of a function bound to the click handler,
  8865. ```html
  8866. <!doctype html>
  8867. <html lang="en">
  8868. <head>
  8869. <meta charset="utf-8">
  8870. <title>jQuery.proxy demo</title>
  8871. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8872. </head>
  8873. <body>
  8874. <p><button type="button" id="test">Test</button></p>
  8875. <div id="log"></div>
  8876. <script>
  8877. var me = {
  8878. // I'm a dog
  8879. type: "dog",
  8880. // Note that event comes *after* one and two
  8881. test: function( one, two, event ) {
  8882. $( "#log" )
  8883. // `one` maps to `you`, the 1st additional
  8884. // argument in the $.proxy function call
  8885. .append( "<h3>Hello " + one.type + ":</h3>" )
  8886. // The `this` keyword refers to `me`
  8887. // (the 2nd, context, argument of $.proxy)
  8888. .append( "I am a " + this.type + ", " )
  8889. // `two` maps to `they`, the 2nd additional
  8890. // argument in the $.proxy function call
  8891. .append( "and they are " + two.type + ".<br>" )
  8892. // The event type is "click"
  8893. .append( "Thanks for " + event.type + "ing." )
  8894. // The clicked element is `event.target`,
  8895. // and its type is "button"
  8896. .append( "the " + event.target.type + "." );
  8897. }
  8898. };
  8899. var you = { type: "cat" };
  8900. var they = { type: "fish" };
  8901. // Set up handler to execute me.test() in the context
  8902. // of `me`, with `you` and `they` as additional arguments
  8903. var proxy = $.proxy( me.test, me, you, they );
  8904. $( "#test" )
  8905. .on( "click", proxy );
  8906. </script>
  8907. </body>
  8908. </html>
  8909. ```
  8910. */
  8911. proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X>(
  8912. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X) => TReturn,
  8913. context: TContext,
  8914. a: A,
  8915. b: B,
  8916. c: C,
  8917. d: D,
  8918. e: E,
  8919. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  8920. /**
  8921. * Takes a function and returns a new one that will always have a particular context.
  8922. * @param funсtion The function whose context will be changed.
  8923. * @param context The object to which the context (`this`) of the function should be set.
  8924. * @param a An argument to be passed to the function referenced in the `function` argument.
  8925. * @param b An argument to be passed to the function referenced in the `function` argument.
  8926. * @param c An argument to be passed to the function referenced in the `function` argument.
  8927. * @param d An argument to be passed to the function referenced in the `function` argument.
  8928. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  8929. * @since 1.4
  8930. * @since 1.6
  8931. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  8932. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  8933. ```html
  8934. <!doctype html>
  8935. <html lang="en">
  8936. <head>
  8937. <meta charset="utf-8">
  8938. <title>jQuery.proxy demo</title>
  8939. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8940. </head>
  8941. <body>
  8942. <p><button type="button" id="test">Test</button></p>
  8943. <div id="log"></div>
  8944. <script>
  8945. var me = {
  8946. type: "zombie",
  8947. test: function( event ) {
  8948. // Without proxy, `this` would refer to the event target
  8949. // use event.target to reference that element.
  8950. var element = event.target;
  8951. $( element ).css( "background-color", "red" );
  8952. // With proxy, `this` refers to the me object encapsulating
  8953. // this function.
  8954. $( "#log" ).append( "Hello " + this.type + "<br>" );
  8955. $( "#test" ).off( "click", this.test );
  8956. }
  8957. };
  8958. var you = {
  8959. type: "person",
  8960. test: function( event ) {
  8961. $( "#log" ).append( this.type + " " );
  8962. }
  8963. };
  8964. // Execute you.test() in the context of the `you` object
  8965. // no matter where it is called
  8966. // i.e. the `this` keyword will refer to `you`
  8967. var youClick = $.proxy( you.test, you );
  8968. // attach click handlers to #test
  8969. $( "#test" )
  8970. // this === "zombie"; handler unbound after first click
  8971. .on( "click", $.proxy( me.test, me ) )
  8972. // this === "person"
  8973. .on( "click", youClick )
  8974. // this === "zombie"
  8975. .on( "click", $.proxy( you.test, me ) )
  8976. // this === "<button> element"
  8977. .on( "click", you.test );
  8978. </script>
  8979. </body>
  8980. </html>
  8981. ```
  8982. * @example ​ ````Change the context of a function bound to the click handler,
  8983. ```html
  8984. <!doctype html>
  8985. <html lang="en">
  8986. <head>
  8987. <meta charset="utf-8">
  8988. <title>jQuery.proxy demo</title>
  8989. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  8990. </head>
  8991. <body>
  8992. <p><button type="button" id="test">Test</button></p>
  8993. <div id="log"></div>
  8994. <script>
  8995. var me = {
  8996. // I'm a dog
  8997. type: "dog",
  8998. // Note that event comes *after* one and two
  8999. test: function( one, two, event ) {
  9000. $( "#log" )
  9001. // `one` maps to `you`, the 1st additional
  9002. // argument in the $.proxy function call
  9003. .append( "<h3>Hello " + one.type + ":</h3>" )
  9004. // The `this` keyword refers to `me`
  9005. // (the 2nd, context, argument of $.proxy)
  9006. .append( "I am a " + this.type + ", " )
  9007. // `two` maps to `they`, the 2nd additional
  9008. // argument in the $.proxy function call
  9009. .append( "and they are " + two.type + ".<br>" )
  9010. // The event type is "click"
  9011. .append( "Thanks for " + event.type + "ing." )
  9012. // The clicked element is `event.target`,
  9013. // and its type is "button"
  9014. .append( "the " + event.target.type + "." );
  9015. }
  9016. };
  9017. var you = { type: "cat" };
  9018. var they = { type: "fish" };
  9019. // Set up handler to execute me.test() in the context
  9020. // of `me`, with `you` and `they` as additional arguments
  9021. var proxy = $.proxy( me.test, me, you, they );
  9022. $( "#test" )
  9023. .on( "click", proxy );
  9024. </script>
  9025. </body>
  9026. </html>
  9027. ```
  9028. */
  9029. proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X>(
  9030. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X) => TReturn,
  9031. context: TContext,
  9032. a: A,
  9033. b: B,
  9034. c: C,
  9035. d: D,
  9036. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  9037. /**
  9038. * Takes a function and returns a new one that will always have a particular context.
  9039. * @param funсtion The function whose context will be changed.
  9040. * @param context The object to which the context (`this`) of the function should be set.
  9041. * @param a An argument to be passed to the function referenced in the `function` argument.
  9042. * @param b An argument to be passed to the function referenced in the `function` argument.
  9043. * @param c An argument to be passed to the function referenced in the `function` argument.
  9044. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9045. * @since 1.4
  9046. * @since 1.6
  9047. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9048. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9049. ```html
  9050. <!doctype html>
  9051. <html lang="en">
  9052. <head>
  9053. <meta charset="utf-8">
  9054. <title>jQuery.proxy demo</title>
  9055. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9056. </head>
  9057. <body>
  9058. <p><button type="button" id="test">Test</button></p>
  9059. <div id="log"></div>
  9060. <script>
  9061. var me = {
  9062. type: "zombie",
  9063. test: function( event ) {
  9064. // Without proxy, `this` would refer to the event target
  9065. // use event.target to reference that element.
  9066. var element = event.target;
  9067. $( element ).css( "background-color", "red" );
  9068. // With proxy, `this` refers to the me object encapsulating
  9069. // this function.
  9070. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9071. $( "#test" ).off( "click", this.test );
  9072. }
  9073. };
  9074. var you = {
  9075. type: "person",
  9076. test: function( event ) {
  9077. $( "#log" ).append( this.type + " " );
  9078. }
  9079. };
  9080. // Execute you.test() in the context of the `you` object
  9081. // no matter where it is called
  9082. // i.e. the `this` keyword will refer to `you`
  9083. var youClick = $.proxy( you.test, you );
  9084. // attach click handlers to #test
  9085. $( "#test" )
  9086. // this === "zombie"; handler unbound after first click
  9087. .on( "click", $.proxy( me.test, me ) )
  9088. // this === "person"
  9089. .on( "click", youClick )
  9090. // this === "zombie"
  9091. .on( "click", $.proxy( you.test, me ) )
  9092. // this === "<button> element"
  9093. .on( "click", you.test );
  9094. </script>
  9095. </body>
  9096. </html>
  9097. ```
  9098. * @example ​ ````Change the context of a function bound to the click handler,
  9099. ```html
  9100. <!doctype html>
  9101. <html lang="en">
  9102. <head>
  9103. <meta charset="utf-8">
  9104. <title>jQuery.proxy demo</title>
  9105. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9106. </head>
  9107. <body>
  9108. <p><button type="button" id="test">Test</button></p>
  9109. <div id="log"></div>
  9110. <script>
  9111. var me = {
  9112. // I'm a dog
  9113. type: "dog",
  9114. // Note that event comes *after* one and two
  9115. test: function( one, two, event ) {
  9116. $( "#log" )
  9117. // `one` maps to `you`, the 1st additional
  9118. // argument in the $.proxy function call
  9119. .append( "<h3>Hello " + one.type + ":</h3>" )
  9120. // The `this` keyword refers to `me`
  9121. // (the 2nd, context, argument of $.proxy)
  9122. .append( "I am a " + this.type + ", " )
  9123. // `two` maps to `they`, the 2nd additional
  9124. // argument in the $.proxy function call
  9125. .append( "and they are " + two.type + ".<br>" )
  9126. // The event type is "click"
  9127. .append( "Thanks for " + event.type + "ing." )
  9128. // The clicked element is `event.target`,
  9129. // and its type is "button"
  9130. .append( "the " + event.target.type + "." );
  9131. }
  9132. };
  9133. var you = { type: "cat" };
  9134. var they = { type: "fish" };
  9135. // Set up handler to execute me.test() in the context
  9136. // of `me`, with `you` and `they` as additional arguments
  9137. var proxy = $.proxy( me.test, me, you, they );
  9138. $( "#test" )
  9139. .on( "click", proxy );
  9140. </script>
  9141. </body>
  9142. </html>
  9143. ```
  9144. */
  9145. proxy<TContext, TReturn, A, B, C, T, U, V, W, X>(
  9146. funсtion: (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X) => TReturn,
  9147. context: TContext,
  9148. a: A,
  9149. b: B,
  9150. c: C,
  9151. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  9152. /**
  9153. * Takes a function and returns a new one that will always have a particular context.
  9154. * @param funсtion The function whose context will be changed.
  9155. * @param context The object to which the context (`this`) of the function should be set.
  9156. * @param a An argument to be passed to the function referenced in the `function` argument.
  9157. * @param b An argument to be passed to the function referenced in the `function` argument.
  9158. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9159. * @since 1.4
  9160. * @since 1.6
  9161. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9162. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9163. ```html
  9164. <!doctype html>
  9165. <html lang="en">
  9166. <head>
  9167. <meta charset="utf-8">
  9168. <title>jQuery.proxy demo</title>
  9169. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9170. </head>
  9171. <body>
  9172. <p><button type="button" id="test">Test</button></p>
  9173. <div id="log"></div>
  9174. <script>
  9175. var me = {
  9176. type: "zombie",
  9177. test: function( event ) {
  9178. // Without proxy, `this` would refer to the event target
  9179. // use event.target to reference that element.
  9180. var element = event.target;
  9181. $( element ).css( "background-color", "red" );
  9182. // With proxy, `this` refers to the me object encapsulating
  9183. // this function.
  9184. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9185. $( "#test" ).off( "click", this.test );
  9186. }
  9187. };
  9188. var you = {
  9189. type: "person",
  9190. test: function( event ) {
  9191. $( "#log" ).append( this.type + " " );
  9192. }
  9193. };
  9194. // Execute you.test() in the context of the `you` object
  9195. // no matter where it is called
  9196. // i.e. the `this` keyword will refer to `you`
  9197. var youClick = $.proxy( you.test, you );
  9198. // attach click handlers to #test
  9199. $( "#test" )
  9200. // this === "zombie"; handler unbound after first click
  9201. .on( "click", $.proxy( me.test, me ) )
  9202. // this === "person"
  9203. .on( "click", youClick )
  9204. // this === "zombie"
  9205. .on( "click", $.proxy( you.test, me ) )
  9206. // this === "<button> element"
  9207. .on( "click", you.test );
  9208. </script>
  9209. </body>
  9210. </html>
  9211. ```
  9212. * @example ​ ````Change the context of a function bound to the click handler,
  9213. ```html
  9214. <!doctype html>
  9215. <html lang="en">
  9216. <head>
  9217. <meta charset="utf-8">
  9218. <title>jQuery.proxy demo</title>
  9219. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9220. </head>
  9221. <body>
  9222. <p><button type="button" id="test">Test</button></p>
  9223. <div id="log"></div>
  9224. <script>
  9225. var me = {
  9226. // I'm a dog
  9227. type: "dog",
  9228. // Note that event comes *after* one and two
  9229. test: function( one, two, event ) {
  9230. $( "#log" )
  9231. // `one` maps to `you`, the 1st additional
  9232. // argument in the $.proxy function call
  9233. .append( "<h3>Hello " + one.type + ":</h3>" )
  9234. // The `this` keyword refers to `me`
  9235. // (the 2nd, context, argument of $.proxy)
  9236. .append( "I am a " + this.type + ", " )
  9237. // `two` maps to `they`, the 2nd additional
  9238. // argument in the $.proxy function call
  9239. .append( "and they are " + two.type + ".<br>" )
  9240. // The event type is "click"
  9241. .append( "Thanks for " + event.type + "ing." )
  9242. // The clicked element is `event.target`,
  9243. // and its type is "button"
  9244. .append( "the " + event.target.type + "." );
  9245. }
  9246. };
  9247. var you = { type: "cat" };
  9248. var they = { type: "fish" };
  9249. // Set up handler to execute me.test() in the context
  9250. // of `me`, with `you` and `they` as additional arguments
  9251. var proxy = $.proxy( me.test, me, you, they );
  9252. $( "#test" )
  9253. .on( "click", proxy );
  9254. </script>
  9255. </body>
  9256. </html>
  9257. ```
  9258. */
  9259. proxy<TContext, TReturn, A, B, T, U, V, W, X>(
  9260. funсtion: (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X) => TReturn,
  9261. context: TContext,
  9262. a: A,
  9263. b: B,
  9264. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  9265. /**
  9266. * Takes a function and returns a new one that will always have a particular context.
  9267. * @param funсtion The function whose context will be changed.
  9268. * @param context The object to which the context (`this`) of the function should be set.
  9269. * @param a An argument to be passed to the function referenced in the `function` argument.
  9270. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9271. * @since 1.4
  9272. * @since 1.6
  9273. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9274. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9275. ```html
  9276. <!doctype html>
  9277. <html lang="en">
  9278. <head>
  9279. <meta charset="utf-8">
  9280. <title>jQuery.proxy demo</title>
  9281. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9282. </head>
  9283. <body>
  9284. <p><button type="button" id="test">Test</button></p>
  9285. <div id="log"></div>
  9286. <script>
  9287. var me = {
  9288. type: "zombie",
  9289. test: function( event ) {
  9290. // Without proxy, `this` would refer to the event target
  9291. // use event.target to reference that element.
  9292. var element = event.target;
  9293. $( element ).css( "background-color", "red" );
  9294. // With proxy, `this` refers to the me object encapsulating
  9295. // this function.
  9296. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9297. $( "#test" ).off( "click", this.test );
  9298. }
  9299. };
  9300. var you = {
  9301. type: "person",
  9302. test: function( event ) {
  9303. $( "#log" ).append( this.type + " " );
  9304. }
  9305. };
  9306. // Execute you.test() in the context of the `you` object
  9307. // no matter where it is called
  9308. // i.e. the `this` keyword will refer to `you`
  9309. var youClick = $.proxy( you.test, you );
  9310. // attach click handlers to #test
  9311. $( "#test" )
  9312. // this === "zombie"; handler unbound after first click
  9313. .on( "click", $.proxy( me.test, me ) )
  9314. // this === "person"
  9315. .on( "click", youClick )
  9316. // this === "zombie"
  9317. .on( "click", $.proxy( you.test, me ) )
  9318. // this === "<button> element"
  9319. .on( "click", you.test );
  9320. </script>
  9321. </body>
  9322. </html>
  9323. ```
  9324. * @example ​ ````Change the context of a function bound to the click handler,
  9325. ```html
  9326. <!doctype html>
  9327. <html lang="en">
  9328. <head>
  9329. <meta charset="utf-8">
  9330. <title>jQuery.proxy demo</title>
  9331. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9332. </head>
  9333. <body>
  9334. <p><button type="button" id="test">Test</button></p>
  9335. <div id="log"></div>
  9336. <script>
  9337. var me = {
  9338. // I'm a dog
  9339. type: "dog",
  9340. // Note that event comes *after* one and two
  9341. test: function( one, two, event ) {
  9342. $( "#log" )
  9343. // `one` maps to `you`, the 1st additional
  9344. // argument in the $.proxy function call
  9345. .append( "<h3>Hello " + one.type + ":</h3>" )
  9346. // The `this` keyword refers to `me`
  9347. // (the 2nd, context, argument of $.proxy)
  9348. .append( "I am a " + this.type + ", " )
  9349. // `two` maps to `they`, the 2nd additional
  9350. // argument in the $.proxy function call
  9351. .append( "and they are " + two.type + ".<br>" )
  9352. // The event type is "click"
  9353. .append( "Thanks for " + event.type + "ing." )
  9354. // The clicked element is `event.target`,
  9355. // and its type is "button"
  9356. .append( "the " + event.target.type + "." );
  9357. }
  9358. };
  9359. var you = { type: "cat" };
  9360. var they = { type: "fish" };
  9361. // Set up handler to execute me.test() in the context
  9362. // of `me`, with `you` and `they` as additional arguments
  9363. var proxy = $.proxy( me.test, me, you, they );
  9364. $( "#test" )
  9365. .on( "click", proxy );
  9366. </script>
  9367. </body>
  9368. </html>
  9369. ```
  9370. */
  9371. proxy<TContext, TReturn, A, T, U, V, W, X>(
  9372. funсtion: (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X) => TReturn,
  9373. context: TContext,
  9374. a: A,
  9375. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  9376. /**
  9377. * Takes a function and returns a new one that will always have a particular context.
  9378. * @param funсtion The function whose context will be changed.
  9379. * @param context The object to which the context (`this`) of the function should be set.
  9380. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9381. * @since 1.4
  9382. * @since 1.6
  9383. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9384. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9385. ```html
  9386. <!doctype html>
  9387. <html lang="en">
  9388. <head>
  9389. <meta charset="utf-8">
  9390. <title>jQuery.proxy demo</title>
  9391. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9392. </head>
  9393. <body>
  9394. <p><button type="button" id="test">Test</button></p>
  9395. <div id="log"></div>
  9396. <script>
  9397. var me = {
  9398. type: "zombie",
  9399. test: function( event ) {
  9400. // Without proxy, `this` would refer to the event target
  9401. // use event.target to reference that element.
  9402. var element = event.target;
  9403. $( element ).css( "background-color", "red" );
  9404. // With proxy, `this` refers to the me object encapsulating
  9405. // this function.
  9406. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9407. $( "#test" ).off( "click", this.test );
  9408. }
  9409. };
  9410. var you = {
  9411. type: "person",
  9412. test: function( event ) {
  9413. $( "#log" ).append( this.type + " " );
  9414. }
  9415. };
  9416. // Execute you.test() in the context of the `you` object
  9417. // no matter where it is called
  9418. // i.e. the `this` keyword will refer to `you`
  9419. var youClick = $.proxy( you.test, you );
  9420. // attach click handlers to #test
  9421. $( "#test" )
  9422. // this === "zombie"; handler unbound after first click
  9423. .on( "click", $.proxy( me.test, me ) )
  9424. // this === "person"
  9425. .on( "click", youClick )
  9426. // this === "zombie"
  9427. .on( "click", $.proxy( you.test, me ) )
  9428. // this === "<button> element"
  9429. .on( "click", you.test );
  9430. </script>
  9431. </body>
  9432. </html>
  9433. ```
  9434. * @example ​ ````Change the context of a function bound to the click handler,
  9435. ```html
  9436. <!doctype html>
  9437. <html lang="en">
  9438. <head>
  9439. <meta charset="utf-8">
  9440. <title>jQuery.proxy demo</title>
  9441. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9442. </head>
  9443. <body>
  9444. <p><button type="button" id="test">Test</button></p>
  9445. <div id="log"></div>
  9446. <script>
  9447. var me = {
  9448. // I'm a dog
  9449. type: "dog",
  9450. // Note that event comes *after* one and two
  9451. test: function( one, two, event ) {
  9452. $( "#log" )
  9453. // `one` maps to `you`, the 1st additional
  9454. // argument in the $.proxy function call
  9455. .append( "<h3>Hello " + one.type + ":</h3>" )
  9456. // The `this` keyword refers to `me`
  9457. // (the 2nd, context, argument of $.proxy)
  9458. .append( "I am a " + this.type + ", " )
  9459. // `two` maps to `they`, the 2nd additional
  9460. // argument in the $.proxy function call
  9461. .append( "and they are " + two.type + ".<br>" )
  9462. // The event type is "click"
  9463. .append( "Thanks for " + event.type + "ing." )
  9464. // The clicked element is `event.target`,
  9465. // and its type is "button"
  9466. .append( "the " + event.target.type + "." );
  9467. }
  9468. };
  9469. var you = { type: "cat" };
  9470. var they = { type: "fish" };
  9471. // Set up handler to execute me.test() in the context
  9472. // of `me`, with `you` and `they` as additional arguments
  9473. var proxy = $.proxy( me.test, me, you, they );
  9474. $( "#test" )
  9475. .on( "click", proxy );
  9476. </script>
  9477. </body>
  9478. </html>
  9479. ```
  9480. */
  9481. proxy<TContext, TReturn, T, U, V, W, X>(
  9482. funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn,
  9483. context: TContext,
  9484. ): (t: T, u: U, v: V, w: W, x: X) => TReturn;
  9485. // #endregion
  9486. // region 6 parameters
  9487. // #region 6 parameters
  9488. /**
  9489. * Takes a function and returns a new one that will always have a particular context.
  9490. * @param funсtion The function whose context will be changed.
  9491. * @param context The object to which the context (`this`) of the function should be set.
  9492. * @param a An argument to be passed to the function referenced in the `function` argument.
  9493. * @param b An argument to be passed to the function referenced in the `function` argument.
  9494. * @param c An argument to be passed to the function referenced in the `function` argument.
  9495. * @param d An argument to be passed to the function referenced in the `function` argument.
  9496. * @param e An argument to be passed to the function referenced in the `function` argument.
  9497. * @param f An argument to be passed to the function referenced in the `function` argument.
  9498. * @param g An argument to be passed to the function referenced in the `function` argument.
  9499. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9500. * @since 1.4
  9501. * @since 1.6
  9502. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9503. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9504. ```html
  9505. <!doctype html>
  9506. <html lang="en">
  9507. <head>
  9508. <meta charset="utf-8">
  9509. <title>jQuery.proxy demo</title>
  9510. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9511. </head>
  9512. <body>
  9513. <p><button type="button" id="test">Test</button></p>
  9514. <div id="log"></div>
  9515. <script>
  9516. var me = {
  9517. type: "zombie",
  9518. test: function( event ) {
  9519. // Without proxy, `this` would refer to the event target
  9520. // use event.target to reference that element.
  9521. var element = event.target;
  9522. $( element ).css( "background-color", "red" );
  9523. // With proxy, `this` refers to the me object encapsulating
  9524. // this function.
  9525. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9526. $( "#test" ).off( "click", this.test );
  9527. }
  9528. };
  9529. var you = {
  9530. type: "person",
  9531. test: function( event ) {
  9532. $( "#log" ).append( this.type + " " );
  9533. }
  9534. };
  9535. // Execute you.test() in the context of the `you` object
  9536. // no matter where it is called
  9537. // i.e. the `this` keyword will refer to `you`
  9538. var youClick = $.proxy( you.test, you );
  9539. // attach click handlers to #test
  9540. $( "#test" )
  9541. // this === "zombie"; handler unbound after first click
  9542. .on( "click", $.proxy( me.test, me ) )
  9543. // this === "person"
  9544. .on( "click", youClick )
  9545. // this === "zombie"
  9546. .on( "click", $.proxy( you.test, me ) )
  9547. // this === "<button> element"
  9548. .on( "click", you.test );
  9549. </script>
  9550. </body>
  9551. </html>
  9552. ```
  9553. * @example ​ ````Change the context of a function bound to the click handler,
  9554. ```html
  9555. <!doctype html>
  9556. <html lang="en">
  9557. <head>
  9558. <meta charset="utf-8">
  9559. <title>jQuery.proxy demo</title>
  9560. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9561. </head>
  9562. <body>
  9563. <p><button type="button" id="test">Test</button></p>
  9564. <div id="log"></div>
  9565. <script>
  9566. var me = {
  9567. // I'm a dog
  9568. type: "dog",
  9569. // Note that event comes *after* one and two
  9570. test: function( one, two, event ) {
  9571. $( "#log" )
  9572. // `one` maps to `you`, the 1st additional
  9573. // argument in the $.proxy function call
  9574. .append( "<h3>Hello " + one.type + ":</h3>" )
  9575. // The `this` keyword refers to `me`
  9576. // (the 2nd, context, argument of $.proxy)
  9577. .append( "I am a " + this.type + ", " )
  9578. // `two` maps to `they`, the 2nd additional
  9579. // argument in the $.proxy function call
  9580. .append( "and they are " + two.type + ".<br>" )
  9581. // The event type is "click"
  9582. .append( "Thanks for " + event.type + "ing." )
  9583. // The clicked element is `event.target`,
  9584. // and its type is "button"
  9585. .append( "the " + event.target.type + "." );
  9586. }
  9587. };
  9588. var you = { type: "cat" };
  9589. var they = { type: "fish" };
  9590. // Set up handler to execute me.test() in the context
  9591. // of `me`, with `you` and `they` as additional arguments
  9592. var proxy = $.proxy( me.test, me, you, they );
  9593. $( "#test" )
  9594. .on( "click", proxy );
  9595. </script>
  9596. </body>
  9597. </html>
  9598. ```
  9599. */
  9600. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y>(
  9601. funсtion: (
  9602. this: TContext,
  9603. a: A,
  9604. b: B,
  9605. c: C,
  9606. d: D,
  9607. e: E,
  9608. f: F,
  9609. g: G,
  9610. t: T,
  9611. u: U,
  9612. v: V,
  9613. w: W,
  9614. x: X,
  9615. y: Y,
  9616. ) => TReturn,
  9617. context: TContext,
  9618. a: A,
  9619. b: B,
  9620. c: C,
  9621. d: D,
  9622. e: E,
  9623. f: F,
  9624. g: G,
  9625. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  9626. /**
  9627. * Takes a function and returns a new one that will always have a particular context.
  9628. * @param funсtion The function whose context will be changed.
  9629. * @param context The object to which the context (`this`) of the function should be set.
  9630. * @param a An argument to be passed to the function referenced in the `function` argument.
  9631. * @param b An argument to be passed to the function referenced in the `function` argument.
  9632. * @param c An argument to be passed to the function referenced in the `function` argument.
  9633. * @param d An argument to be passed to the function referenced in the `function` argument.
  9634. * @param e An argument to be passed to the function referenced in the `function` argument.
  9635. * @param f An argument to be passed to the function referenced in the `function` argument.
  9636. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9637. * @since 1.4
  9638. * @since 1.6
  9639. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9640. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9641. ```html
  9642. <!doctype html>
  9643. <html lang="en">
  9644. <head>
  9645. <meta charset="utf-8">
  9646. <title>jQuery.proxy demo</title>
  9647. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9648. </head>
  9649. <body>
  9650. <p><button type="button" id="test">Test</button></p>
  9651. <div id="log"></div>
  9652. <script>
  9653. var me = {
  9654. type: "zombie",
  9655. test: function( event ) {
  9656. // Without proxy, `this` would refer to the event target
  9657. // use event.target to reference that element.
  9658. var element = event.target;
  9659. $( element ).css( "background-color", "red" );
  9660. // With proxy, `this` refers to the me object encapsulating
  9661. // this function.
  9662. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9663. $( "#test" ).off( "click", this.test );
  9664. }
  9665. };
  9666. var you = {
  9667. type: "person",
  9668. test: function( event ) {
  9669. $( "#log" ).append( this.type + " " );
  9670. }
  9671. };
  9672. // Execute you.test() in the context of the `you` object
  9673. // no matter where it is called
  9674. // i.e. the `this` keyword will refer to `you`
  9675. var youClick = $.proxy( you.test, you );
  9676. // attach click handlers to #test
  9677. $( "#test" )
  9678. // this === "zombie"; handler unbound after first click
  9679. .on( "click", $.proxy( me.test, me ) )
  9680. // this === "person"
  9681. .on( "click", youClick )
  9682. // this === "zombie"
  9683. .on( "click", $.proxy( you.test, me ) )
  9684. // this === "<button> element"
  9685. .on( "click", you.test );
  9686. </script>
  9687. </body>
  9688. </html>
  9689. ```
  9690. * @example ​ ````Change the context of a function bound to the click handler,
  9691. ```html
  9692. <!doctype html>
  9693. <html lang="en">
  9694. <head>
  9695. <meta charset="utf-8">
  9696. <title>jQuery.proxy demo</title>
  9697. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9698. </head>
  9699. <body>
  9700. <p><button type="button" id="test">Test</button></p>
  9701. <div id="log"></div>
  9702. <script>
  9703. var me = {
  9704. // I'm a dog
  9705. type: "dog",
  9706. // Note that event comes *after* one and two
  9707. test: function( one, two, event ) {
  9708. $( "#log" )
  9709. // `one` maps to `you`, the 1st additional
  9710. // argument in the $.proxy function call
  9711. .append( "<h3>Hello " + one.type + ":</h3>" )
  9712. // The `this` keyword refers to `me`
  9713. // (the 2nd, context, argument of $.proxy)
  9714. .append( "I am a " + this.type + ", " )
  9715. // `two` maps to `they`, the 2nd additional
  9716. // argument in the $.proxy function call
  9717. .append( "and they are " + two.type + ".<br>" )
  9718. // The event type is "click"
  9719. .append( "Thanks for " + event.type + "ing." )
  9720. // The clicked element is `event.target`,
  9721. // and its type is "button"
  9722. .append( "the " + event.target.type + "." );
  9723. }
  9724. };
  9725. var you = { type: "cat" };
  9726. var they = { type: "fish" };
  9727. // Set up handler to execute me.test() in the context
  9728. // of `me`, with `you` and `they` as additional arguments
  9729. var proxy = $.proxy( me.test, me, you, they );
  9730. $( "#test" )
  9731. .on( "click", proxy );
  9732. </script>
  9733. </body>
  9734. </html>
  9735. ```
  9736. */
  9737. proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X, Y>(
  9738. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  9739. context: TContext,
  9740. a: A,
  9741. b: B,
  9742. c: C,
  9743. d: D,
  9744. e: E,
  9745. f: F,
  9746. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  9747. /**
  9748. * Takes a function and returns a new one that will always have a particular context.
  9749. * @param funсtion The function whose context will be changed.
  9750. * @param context The object to which the context (`this`) of the function should be set.
  9751. * @param a An argument to be passed to the function referenced in the `function` argument.
  9752. * @param b An argument to be passed to the function referenced in the `function` argument.
  9753. * @param c An argument to be passed to the function referenced in the `function` argument.
  9754. * @param d An argument to be passed to the function referenced in the `function` argument.
  9755. * @param e An argument to be passed to the function referenced in the `function` argument.
  9756. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9757. * @since 1.4
  9758. * @since 1.6
  9759. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9760. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9761. ```html
  9762. <!doctype html>
  9763. <html lang="en">
  9764. <head>
  9765. <meta charset="utf-8">
  9766. <title>jQuery.proxy demo</title>
  9767. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9768. </head>
  9769. <body>
  9770. <p><button type="button" id="test">Test</button></p>
  9771. <div id="log"></div>
  9772. <script>
  9773. var me = {
  9774. type: "zombie",
  9775. test: function( event ) {
  9776. // Without proxy, `this` would refer to the event target
  9777. // use event.target to reference that element.
  9778. var element = event.target;
  9779. $( element ).css( "background-color", "red" );
  9780. // With proxy, `this` refers to the me object encapsulating
  9781. // this function.
  9782. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9783. $( "#test" ).off( "click", this.test );
  9784. }
  9785. };
  9786. var you = {
  9787. type: "person",
  9788. test: function( event ) {
  9789. $( "#log" ).append( this.type + " " );
  9790. }
  9791. };
  9792. // Execute you.test() in the context of the `you` object
  9793. // no matter where it is called
  9794. // i.e. the `this` keyword will refer to `you`
  9795. var youClick = $.proxy( you.test, you );
  9796. // attach click handlers to #test
  9797. $( "#test" )
  9798. // this === "zombie"; handler unbound after first click
  9799. .on( "click", $.proxy( me.test, me ) )
  9800. // this === "person"
  9801. .on( "click", youClick )
  9802. // this === "zombie"
  9803. .on( "click", $.proxy( you.test, me ) )
  9804. // this === "<button> element"
  9805. .on( "click", you.test );
  9806. </script>
  9807. </body>
  9808. </html>
  9809. ```
  9810. * @example ​ ````Change the context of a function bound to the click handler,
  9811. ```html
  9812. <!doctype html>
  9813. <html lang="en">
  9814. <head>
  9815. <meta charset="utf-8">
  9816. <title>jQuery.proxy demo</title>
  9817. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9818. </head>
  9819. <body>
  9820. <p><button type="button" id="test">Test</button></p>
  9821. <div id="log"></div>
  9822. <script>
  9823. var me = {
  9824. // I'm a dog
  9825. type: "dog",
  9826. // Note that event comes *after* one and two
  9827. test: function( one, two, event ) {
  9828. $( "#log" )
  9829. // `one` maps to `you`, the 1st additional
  9830. // argument in the $.proxy function call
  9831. .append( "<h3>Hello " + one.type + ":</h3>" )
  9832. // The `this` keyword refers to `me`
  9833. // (the 2nd, context, argument of $.proxy)
  9834. .append( "I am a " + this.type + ", " )
  9835. // `two` maps to `they`, the 2nd additional
  9836. // argument in the $.proxy function call
  9837. .append( "and they are " + two.type + ".<br>" )
  9838. // The event type is "click"
  9839. .append( "Thanks for " + event.type + "ing." )
  9840. // The clicked element is `event.target`,
  9841. // and its type is "button"
  9842. .append( "the " + event.target.type + "." );
  9843. }
  9844. };
  9845. var you = { type: "cat" };
  9846. var they = { type: "fish" };
  9847. // Set up handler to execute me.test() in the context
  9848. // of `me`, with `you` and `they` as additional arguments
  9849. var proxy = $.proxy( me.test, me, you, they );
  9850. $( "#test" )
  9851. .on( "click", proxy );
  9852. </script>
  9853. </body>
  9854. </html>
  9855. ```
  9856. */
  9857. proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X, Y>(
  9858. funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  9859. context: TContext,
  9860. a: A,
  9861. b: B,
  9862. c: C,
  9863. d: D,
  9864. e: E,
  9865. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  9866. /**
  9867. * Takes a function and returns a new one that will always have a particular context.
  9868. * @param funсtion The function whose context will be changed.
  9869. * @param context The object to which the context (`this`) of the function should be set.
  9870. * @param a An argument to be passed to the function referenced in the `function` argument.
  9871. * @param b An argument to be passed to the function referenced in the `function` argument.
  9872. * @param c An argument to be passed to the function referenced in the `function` argument.
  9873. * @param d An argument to be passed to the function referenced in the `function` argument.
  9874. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9875. * @since 1.4
  9876. * @since 1.6
  9877. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9878. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9879. ```html
  9880. <!doctype html>
  9881. <html lang="en">
  9882. <head>
  9883. <meta charset="utf-8">
  9884. <title>jQuery.proxy demo</title>
  9885. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9886. </head>
  9887. <body>
  9888. <p><button type="button" id="test">Test</button></p>
  9889. <div id="log"></div>
  9890. <script>
  9891. var me = {
  9892. type: "zombie",
  9893. test: function( event ) {
  9894. // Without proxy, `this` would refer to the event target
  9895. // use event.target to reference that element.
  9896. var element = event.target;
  9897. $( element ).css( "background-color", "red" );
  9898. // With proxy, `this` refers to the me object encapsulating
  9899. // this function.
  9900. $( "#log" ).append( "Hello " + this.type + "<br>" );
  9901. $( "#test" ).off( "click", this.test );
  9902. }
  9903. };
  9904. var you = {
  9905. type: "person",
  9906. test: function( event ) {
  9907. $( "#log" ).append( this.type + " " );
  9908. }
  9909. };
  9910. // Execute you.test() in the context of the `you` object
  9911. // no matter where it is called
  9912. // i.e. the `this` keyword will refer to `you`
  9913. var youClick = $.proxy( you.test, you );
  9914. // attach click handlers to #test
  9915. $( "#test" )
  9916. // this === "zombie"; handler unbound after first click
  9917. .on( "click", $.proxy( me.test, me ) )
  9918. // this === "person"
  9919. .on( "click", youClick )
  9920. // this === "zombie"
  9921. .on( "click", $.proxy( you.test, me ) )
  9922. // this === "<button> element"
  9923. .on( "click", you.test );
  9924. </script>
  9925. </body>
  9926. </html>
  9927. ```
  9928. * @example ​ ````Change the context of a function bound to the click handler,
  9929. ```html
  9930. <!doctype html>
  9931. <html lang="en">
  9932. <head>
  9933. <meta charset="utf-8">
  9934. <title>jQuery.proxy demo</title>
  9935. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  9936. </head>
  9937. <body>
  9938. <p><button type="button" id="test">Test</button></p>
  9939. <div id="log"></div>
  9940. <script>
  9941. var me = {
  9942. // I'm a dog
  9943. type: "dog",
  9944. // Note that event comes *after* one and two
  9945. test: function( one, two, event ) {
  9946. $( "#log" )
  9947. // `one` maps to `you`, the 1st additional
  9948. // argument in the $.proxy function call
  9949. .append( "<h3>Hello " + one.type + ":</h3>" )
  9950. // The `this` keyword refers to `me`
  9951. // (the 2nd, context, argument of $.proxy)
  9952. .append( "I am a " + this.type + ", " )
  9953. // `two` maps to `they`, the 2nd additional
  9954. // argument in the $.proxy function call
  9955. .append( "and they are " + two.type + ".<br>" )
  9956. // The event type is "click"
  9957. .append( "Thanks for " + event.type + "ing." )
  9958. // The clicked element is `event.target`,
  9959. // and its type is "button"
  9960. .append( "the " + event.target.type + "." );
  9961. }
  9962. };
  9963. var you = { type: "cat" };
  9964. var they = { type: "fish" };
  9965. // Set up handler to execute me.test() in the context
  9966. // of `me`, with `you` and `they` as additional arguments
  9967. var proxy = $.proxy( me.test, me, you, they );
  9968. $( "#test" )
  9969. .on( "click", proxy );
  9970. </script>
  9971. </body>
  9972. </html>
  9973. ```
  9974. */
  9975. proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X, Y>(
  9976. funсtion: (this: TContext, a: A, b: B, c: C, d: D, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  9977. context: TContext,
  9978. a: A,
  9979. b: B,
  9980. c: C,
  9981. d: D,
  9982. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  9983. /**
  9984. * Takes a function and returns a new one that will always have a particular context.
  9985. * @param funсtion The function whose context will be changed.
  9986. * @param context The object to which the context (`this`) of the function should be set.
  9987. * @param a An argument to be passed to the function referenced in the `function` argument.
  9988. * @param b An argument to be passed to the function referenced in the `function` argument.
  9989. * @param c An argument to be passed to the function referenced in the `function` argument.
  9990. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  9991. * @since 1.4
  9992. * @since 1.6
  9993. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  9994. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  9995. ```html
  9996. <!doctype html>
  9997. <html lang="en">
  9998. <head>
  9999. <meta charset="utf-8">
  10000. <title>jQuery.proxy demo</title>
  10001. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10002. </head>
  10003. <body>
  10004. <p><button type="button" id="test">Test</button></p>
  10005. <div id="log"></div>
  10006. <script>
  10007. var me = {
  10008. type: "zombie",
  10009. test: function( event ) {
  10010. // Without proxy, `this` would refer to the event target
  10011. // use event.target to reference that element.
  10012. var element = event.target;
  10013. $( element ).css( "background-color", "red" );
  10014. // With proxy, `this` refers to the me object encapsulating
  10015. // this function.
  10016. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10017. $( "#test" ).off( "click", this.test );
  10018. }
  10019. };
  10020. var you = {
  10021. type: "person",
  10022. test: function( event ) {
  10023. $( "#log" ).append( this.type + " " );
  10024. }
  10025. };
  10026. // Execute you.test() in the context of the `you` object
  10027. // no matter where it is called
  10028. // i.e. the `this` keyword will refer to `you`
  10029. var youClick = $.proxy( you.test, you );
  10030. // attach click handlers to #test
  10031. $( "#test" )
  10032. // this === "zombie"; handler unbound after first click
  10033. .on( "click", $.proxy( me.test, me ) )
  10034. // this === "person"
  10035. .on( "click", youClick )
  10036. // this === "zombie"
  10037. .on( "click", $.proxy( you.test, me ) )
  10038. // this === "<button> element"
  10039. .on( "click", you.test );
  10040. </script>
  10041. </body>
  10042. </html>
  10043. ```
  10044. * @example ​ ````Change the context of a function bound to the click handler,
  10045. ```html
  10046. <!doctype html>
  10047. <html lang="en">
  10048. <head>
  10049. <meta charset="utf-8">
  10050. <title>jQuery.proxy demo</title>
  10051. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10052. </head>
  10053. <body>
  10054. <p><button type="button" id="test">Test</button></p>
  10055. <div id="log"></div>
  10056. <script>
  10057. var me = {
  10058. // I'm a dog
  10059. type: "dog",
  10060. // Note that event comes *after* one and two
  10061. test: function( one, two, event ) {
  10062. $( "#log" )
  10063. // `one` maps to `you`, the 1st additional
  10064. // argument in the $.proxy function call
  10065. .append( "<h3>Hello " + one.type + ":</h3>" )
  10066. // The `this` keyword refers to `me`
  10067. // (the 2nd, context, argument of $.proxy)
  10068. .append( "I am a " + this.type + ", " )
  10069. // `two` maps to `they`, the 2nd additional
  10070. // argument in the $.proxy function call
  10071. .append( "and they are " + two.type + ".<br>" )
  10072. // The event type is "click"
  10073. .append( "Thanks for " + event.type + "ing." )
  10074. // The clicked element is `event.target`,
  10075. // and its type is "button"
  10076. .append( "the " + event.target.type + "." );
  10077. }
  10078. };
  10079. var you = { type: "cat" };
  10080. var they = { type: "fish" };
  10081. // Set up handler to execute me.test() in the context
  10082. // of `me`, with `you` and `they` as additional arguments
  10083. var proxy = $.proxy( me.test, me, you, they );
  10084. $( "#test" )
  10085. .on( "click", proxy );
  10086. </script>
  10087. </body>
  10088. </html>
  10089. ```
  10090. */
  10091. proxy<TContext, TReturn, A, B, C, T, U, V, W, X, Y>(
  10092. funсtion: (this: TContext, a: A, b: B, c: C, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  10093. context: TContext,
  10094. a: A,
  10095. b: B,
  10096. c: C,
  10097. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  10098. /**
  10099. * Takes a function and returns a new one that will always have a particular context.
  10100. * @param funсtion The function whose context will be changed.
  10101. * @param context The object to which the context (`this`) of the function should be set.
  10102. * @param a An argument to be passed to the function referenced in the `function` argument.
  10103. * @param b An argument to be passed to the function referenced in the `function` argument.
  10104. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10105. * @since 1.4
  10106. * @since 1.6
  10107. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10108. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10109. ```html
  10110. <!doctype html>
  10111. <html lang="en">
  10112. <head>
  10113. <meta charset="utf-8">
  10114. <title>jQuery.proxy demo</title>
  10115. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10116. </head>
  10117. <body>
  10118. <p><button type="button" id="test">Test</button></p>
  10119. <div id="log"></div>
  10120. <script>
  10121. var me = {
  10122. type: "zombie",
  10123. test: function( event ) {
  10124. // Without proxy, `this` would refer to the event target
  10125. // use event.target to reference that element.
  10126. var element = event.target;
  10127. $( element ).css( "background-color", "red" );
  10128. // With proxy, `this` refers to the me object encapsulating
  10129. // this function.
  10130. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10131. $( "#test" ).off( "click", this.test );
  10132. }
  10133. };
  10134. var you = {
  10135. type: "person",
  10136. test: function( event ) {
  10137. $( "#log" ).append( this.type + " " );
  10138. }
  10139. };
  10140. // Execute you.test() in the context of the `you` object
  10141. // no matter where it is called
  10142. // i.e. the `this` keyword will refer to `you`
  10143. var youClick = $.proxy( you.test, you );
  10144. // attach click handlers to #test
  10145. $( "#test" )
  10146. // this === "zombie"; handler unbound after first click
  10147. .on( "click", $.proxy( me.test, me ) )
  10148. // this === "person"
  10149. .on( "click", youClick )
  10150. // this === "zombie"
  10151. .on( "click", $.proxy( you.test, me ) )
  10152. // this === "<button> element"
  10153. .on( "click", you.test );
  10154. </script>
  10155. </body>
  10156. </html>
  10157. ```
  10158. * @example ​ ````Change the context of a function bound to the click handler,
  10159. ```html
  10160. <!doctype html>
  10161. <html lang="en">
  10162. <head>
  10163. <meta charset="utf-8">
  10164. <title>jQuery.proxy demo</title>
  10165. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10166. </head>
  10167. <body>
  10168. <p><button type="button" id="test">Test</button></p>
  10169. <div id="log"></div>
  10170. <script>
  10171. var me = {
  10172. // I'm a dog
  10173. type: "dog",
  10174. // Note that event comes *after* one and two
  10175. test: function( one, two, event ) {
  10176. $( "#log" )
  10177. // `one` maps to `you`, the 1st additional
  10178. // argument in the $.proxy function call
  10179. .append( "<h3>Hello " + one.type + ":</h3>" )
  10180. // The `this` keyword refers to `me`
  10181. // (the 2nd, context, argument of $.proxy)
  10182. .append( "I am a " + this.type + ", " )
  10183. // `two` maps to `they`, the 2nd additional
  10184. // argument in the $.proxy function call
  10185. .append( "and they are " + two.type + ".<br>" )
  10186. // The event type is "click"
  10187. .append( "Thanks for " + event.type + "ing." )
  10188. // The clicked element is `event.target`,
  10189. // and its type is "button"
  10190. .append( "the " + event.target.type + "." );
  10191. }
  10192. };
  10193. var you = { type: "cat" };
  10194. var they = { type: "fish" };
  10195. // Set up handler to execute me.test() in the context
  10196. // of `me`, with `you` and `they` as additional arguments
  10197. var proxy = $.proxy( me.test, me, you, they );
  10198. $( "#test" )
  10199. .on( "click", proxy );
  10200. </script>
  10201. </body>
  10202. </html>
  10203. ```
  10204. */
  10205. proxy<TContext, TReturn, A, B, T, U, V, W, X, Y>(
  10206. funсtion: (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  10207. context: TContext,
  10208. a: A,
  10209. b: B,
  10210. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  10211. /**
  10212. * Takes a function and returns a new one that will always have a particular context.
  10213. * @param funсtion The function whose context will be changed.
  10214. * @param context The object to which the context (`this`) of the function should be set.
  10215. * @param a An argument to be passed to the function referenced in the `function` argument.
  10216. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10217. * @since 1.4
  10218. * @since 1.6
  10219. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10220. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10221. ```html
  10222. <!doctype html>
  10223. <html lang="en">
  10224. <head>
  10225. <meta charset="utf-8">
  10226. <title>jQuery.proxy demo</title>
  10227. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10228. </head>
  10229. <body>
  10230. <p><button type="button" id="test">Test</button></p>
  10231. <div id="log"></div>
  10232. <script>
  10233. var me = {
  10234. type: "zombie",
  10235. test: function( event ) {
  10236. // Without proxy, `this` would refer to the event target
  10237. // use event.target to reference that element.
  10238. var element = event.target;
  10239. $( element ).css( "background-color", "red" );
  10240. // With proxy, `this` refers to the me object encapsulating
  10241. // this function.
  10242. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10243. $( "#test" ).off( "click", this.test );
  10244. }
  10245. };
  10246. var you = {
  10247. type: "person",
  10248. test: function( event ) {
  10249. $( "#log" ).append( this.type + " " );
  10250. }
  10251. };
  10252. // Execute you.test() in the context of the `you` object
  10253. // no matter where it is called
  10254. // i.e. the `this` keyword will refer to `you`
  10255. var youClick = $.proxy( you.test, you );
  10256. // attach click handlers to #test
  10257. $( "#test" )
  10258. // this === "zombie"; handler unbound after first click
  10259. .on( "click", $.proxy( me.test, me ) )
  10260. // this === "person"
  10261. .on( "click", youClick )
  10262. // this === "zombie"
  10263. .on( "click", $.proxy( you.test, me ) )
  10264. // this === "<button> element"
  10265. .on( "click", you.test );
  10266. </script>
  10267. </body>
  10268. </html>
  10269. ```
  10270. * @example ​ ````Change the context of a function bound to the click handler,
  10271. ```html
  10272. <!doctype html>
  10273. <html lang="en">
  10274. <head>
  10275. <meta charset="utf-8">
  10276. <title>jQuery.proxy demo</title>
  10277. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10278. </head>
  10279. <body>
  10280. <p><button type="button" id="test">Test</button></p>
  10281. <div id="log"></div>
  10282. <script>
  10283. var me = {
  10284. // I'm a dog
  10285. type: "dog",
  10286. // Note that event comes *after* one and two
  10287. test: function( one, two, event ) {
  10288. $( "#log" )
  10289. // `one` maps to `you`, the 1st additional
  10290. // argument in the $.proxy function call
  10291. .append( "<h3>Hello " + one.type + ":</h3>" )
  10292. // The `this` keyword refers to `me`
  10293. // (the 2nd, context, argument of $.proxy)
  10294. .append( "I am a " + this.type + ", " )
  10295. // `two` maps to `they`, the 2nd additional
  10296. // argument in the $.proxy function call
  10297. .append( "and they are " + two.type + ".<br>" )
  10298. // The event type is "click"
  10299. .append( "Thanks for " + event.type + "ing." )
  10300. // The clicked element is `event.target`,
  10301. // and its type is "button"
  10302. .append( "the " + event.target.type + "." );
  10303. }
  10304. };
  10305. var you = { type: "cat" };
  10306. var they = { type: "fish" };
  10307. // Set up handler to execute me.test() in the context
  10308. // of `me`, with `you` and `they` as additional arguments
  10309. var proxy = $.proxy( me.test, me, you, they );
  10310. $( "#test" )
  10311. .on( "click", proxy );
  10312. </script>
  10313. </body>
  10314. </html>
  10315. ```
  10316. */
  10317. proxy<TContext, TReturn, A, T, U, V, W, X, Y>(
  10318. funсtion: (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  10319. context: TContext,
  10320. a: A,
  10321. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  10322. /**
  10323. * Takes a function and returns a new one that will always have a particular context.
  10324. * @param funсtion The function whose context will be changed.
  10325. * @param context The object to which the context (`this`) of the function should be set.
  10326. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10327. * @since 1.4
  10328. * @since 1.6
  10329. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10330. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10331. ```html
  10332. <!doctype html>
  10333. <html lang="en">
  10334. <head>
  10335. <meta charset="utf-8">
  10336. <title>jQuery.proxy demo</title>
  10337. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10338. </head>
  10339. <body>
  10340. <p><button type="button" id="test">Test</button></p>
  10341. <div id="log"></div>
  10342. <script>
  10343. var me = {
  10344. type: "zombie",
  10345. test: function( event ) {
  10346. // Without proxy, `this` would refer to the event target
  10347. // use event.target to reference that element.
  10348. var element = event.target;
  10349. $( element ).css( "background-color", "red" );
  10350. // With proxy, `this` refers to the me object encapsulating
  10351. // this function.
  10352. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10353. $( "#test" ).off( "click", this.test );
  10354. }
  10355. };
  10356. var you = {
  10357. type: "person",
  10358. test: function( event ) {
  10359. $( "#log" ).append( this.type + " " );
  10360. }
  10361. };
  10362. // Execute you.test() in the context of the `you` object
  10363. // no matter where it is called
  10364. // i.e. the `this` keyword will refer to `you`
  10365. var youClick = $.proxy( you.test, you );
  10366. // attach click handlers to #test
  10367. $( "#test" )
  10368. // this === "zombie"; handler unbound after first click
  10369. .on( "click", $.proxy( me.test, me ) )
  10370. // this === "person"
  10371. .on( "click", youClick )
  10372. // this === "zombie"
  10373. .on( "click", $.proxy( you.test, me ) )
  10374. // this === "<button> element"
  10375. .on( "click", you.test );
  10376. </script>
  10377. </body>
  10378. </html>
  10379. ```
  10380. * @example ​ ````Change the context of a function bound to the click handler,
  10381. ```html
  10382. <!doctype html>
  10383. <html lang="en">
  10384. <head>
  10385. <meta charset="utf-8">
  10386. <title>jQuery.proxy demo</title>
  10387. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10388. </head>
  10389. <body>
  10390. <p><button type="button" id="test">Test</button></p>
  10391. <div id="log"></div>
  10392. <script>
  10393. var me = {
  10394. // I'm a dog
  10395. type: "dog",
  10396. // Note that event comes *after* one and two
  10397. test: function( one, two, event ) {
  10398. $( "#log" )
  10399. // `one` maps to `you`, the 1st additional
  10400. // argument in the $.proxy function call
  10401. .append( "<h3>Hello " + one.type + ":</h3>" )
  10402. // The `this` keyword refers to `me`
  10403. // (the 2nd, context, argument of $.proxy)
  10404. .append( "I am a " + this.type + ", " )
  10405. // `two` maps to `they`, the 2nd additional
  10406. // argument in the $.proxy function call
  10407. .append( "and they are " + two.type + ".<br>" )
  10408. // The event type is "click"
  10409. .append( "Thanks for " + event.type + "ing." )
  10410. // The clicked element is `event.target`,
  10411. // and its type is "button"
  10412. .append( "the " + event.target.type + "." );
  10413. }
  10414. };
  10415. var you = { type: "cat" };
  10416. var they = { type: "fish" };
  10417. // Set up handler to execute me.test() in the context
  10418. // of `me`, with `you` and `they` as additional arguments
  10419. var proxy = $.proxy( me.test, me, you, they );
  10420. $( "#test" )
  10421. .on( "click", proxy );
  10422. </script>
  10423. </body>
  10424. </html>
  10425. ```
  10426. */
  10427. proxy<TContext, TReturn, T, U, V, W, X, Y>(
  10428. funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn,
  10429. context: TContext,
  10430. ): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn;
  10431. // #endregion
  10432. // region 7+ parameters
  10433. // #region 7+ parameters
  10434. /**
  10435. * Takes a function and returns a new one that will always have a particular context.
  10436. * @param funсtion The function whose context will be changed.
  10437. * @param context The object to which the context (`this`) of the function should be set.
  10438. * @param a An argument to be passed to the function referenced in the `function` argument.
  10439. * @param b An argument to be passed to the function referenced in the `function` argument.
  10440. * @param c An argument to be passed to the function referenced in the `function` argument.
  10441. * @param d An argument to be passed to the function referenced in the `function` argument.
  10442. * @param e An argument to be passed to the function referenced in the `function` argument.
  10443. * @param f An argument to be passed to the function referenced in the `function` argument.
  10444. * @param g An argument to be passed to the function referenced in the `function` argument.
  10445. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10446. * @since 1.4
  10447. * @since 1.6
  10448. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10449. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10450. ```html
  10451. <!doctype html>
  10452. <html lang="en">
  10453. <head>
  10454. <meta charset="utf-8">
  10455. <title>jQuery.proxy demo</title>
  10456. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10457. </head>
  10458. <body>
  10459. <p><button type="button" id="test">Test</button></p>
  10460. <div id="log"></div>
  10461. <script>
  10462. var me = {
  10463. type: "zombie",
  10464. test: function( event ) {
  10465. // Without proxy, `this` would refer to the event target
  10466. // use event.target to reference that element.
  10467. var element = event.target;
  10468. $( element ).css( "background-color", "red" );
  10469. // With proxy, `this` refers to the me object encapsulating
  10470. // this function.
  10471. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10472. $( "#test" ).off( "click", this.test );
  10473. }
  10474. };
  10475. var you = {
  10476. type: "person",
  10477. test: function( event ) {
  10478. $( "#log" ).append( this.type + " " );
  10479. }
  10480. };
  10481. // Execute you.test() in the context of the `you` object
  10482. // no matter where it is called
  10483. // i.e. the `this` keyword will refer to `you`
  10484. var youClick = $.proxy( you.test, you );
  10485. // attach click handlers to #test
  10486. $( "#test" )
  10487. // this === "zombie"; handler unbound after first click
  10488. .on( "click", $.proxy( me.test, me ) )
  10489. // this === "person"
  10490. .on( "click", youClick )
  10491. // this === "zombie"
  10492. .on( "click", $.proxy( you.test, me ) )
  10493. // this === "<button> element"
  10494. .on( "click", you.test );
  10495. </script>
  10496. </body>
  10497. </html>
  10498. ```
  10499. * @example ​ ````Change the context of a function bound to the click handler,
  10500. ```html
  10501. <!doctype html>
  10502. <html lang="en">
  10503. <head>
  10504. <meta charset="utf-8">
  10505. <title>jQuery.proxy demo</title>
  10506. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10507. </head>
  10508. <body>
  10509. <p><button type="button" id="test">Test</button></p>
  10510. <div id="log"></div>
  10511. <script>
  10512. var me = {
  10513. // I'm a dog
  10514. type: "dog",
  10515. // Note that event comes *after* one and two
  10516. test: function( one, two, event ) {
  10517. $( "#log" )
  10518. // `one` maps to `you`, the 1st additional
  10519. // argument in the $.proxy function call
  10520. .append( "<h3>Hello " + one.type + ":</h3>" )
  10521. // The `this` keyword refers to `me`
  10522. // (the 2nd, context, argument of $.proxy)
  10523. .append( "I am a " + this.type + ", " )
  10524. // `two` maps to `they`, the 2nd additional
  10525. // argument in the $.proxy function call
  10526. .append( "and they are " + two.type + ".<br>" )
  10527. // The event type is "click"
  10528. .append( "Thanks for " + event.type + "ing." )
  10529. // The clicked element is `event.target`,
  10530. // and its type is "button"
  10531. .append( "the " + event.target.type + "." );
  10532. }
  10533. };
  10534. var you = { type: "cat" };
  10535. var they = { type: "fish" };
  10536. // Set up handler to execute me.test() in the context
  10537. // of `me`, with `you` and `they` as additional arguments
  10538. var proxy = $.proxy( me.test, me, you, they );
  10539. $( "#test" )
  10540. .on( "click", proxy );
  10541. </script>
  10542. </body>
  10543. </html>
  10544. ```
  10545. */
  10546. proxy<TContext, TReturn, A, B, C, D, E, F, G, T, U, V, W, X, Y, Z>(
  10547. funсtion: (
  10548. this: TContext,
  10549. a: A,
  10550. b: B,
  10551. c: C,
  10552. d: D,
  10553. e: E,
  10554. f: F,
  10555. g: G,
  10556. t: T,
  10557. u: U,
  10558. v: V,
  10559. w: W,
  10560. x: X,
  10561. y: Y,
  10562. z: Z,
  10563. ...args: any[]
  10564. ) => TReturn,
  10565. context: TContext,
  10566. a: A,
  10567. b: B,
  10568. c: C,
  10569. d: D,
  10570. e: E,
  10571. f: F,
  10572. g: G,
  10573. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  10574. /**
  10575. * Takes a function and returns a new one that will always have a particular context.
  10576. * @param funсtion The function whose context will be changed.
  10577. * @param context The object to which the context (`this`) of the function should be set.
  10578. * @param a An argument to be passed to the function referenced in the `function` argument.
  10579. * @param b An argument to be passed to the function referenced in the `function` argument.
  10580. * @param c An argument to be passed to the function referenced in the `function` argument.
  10581. * @param d An argument to be passed to the function referenced in the `function` argument.
  10582. * @param e An argument to be passed to the function referenced in the `function` argument.
  10583. * @param f An argument to be passed to the function referenced in the `function` argument.
  10584. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10585. * @since 1.4
  10586. * @since 1.6
  10587. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10588. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10589. ```html
  10590. <!doctype html>
  10591. <html lang="en">
  10592. <head>
  10593. <meta charset="utf-8">
  10594. <title>jQuery.proxy demo</title>
  10595. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10596. </head>
  10597. <body>
  10598. <p><button type="button" id="test">Test</button></p>
  10599. <div id="log"></div>
  10600. <script>
  10601. var me = {
  10602. type: "zombie",
  10603. test: function( event ) {
  10604. // Without proxy, `this` would refer to the event target
  10605. // use event.target to reference that element.
  10606. var element = event.target;
  10607. $( element ).css( "background-color", "red" );
  10608. // With proxy, `this` refers to the me object encapsulating
  10609. // this function.
  10610. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10611. $( "#test" ).off( "click", this.test );
  10612. }
  10613. };
  10614. var you = {
  10615. type: "person",
  10616. test: function( event ) {
  10617. $( "#log" ).append( this.type + " " );
  10618. }
  10619. };
  10620. // Execute you.test() in the context of the `you` object
  10621. // no matter where it is called
  10622. // i.e. the `this` keyword will refer to `you`
  10623. var youClick = $.proxy( you.test, you );
  10624. // attach click handlers to #test
  10625. $( "#test" )
  10626. // this === "zombie"; handler unbound after first click
  10627. .on( "click", $.proxy( me.test, me ) )
  10628. // this === "person"
  10629. .on( "click", youClick )
  10630. // this === "zombie"
  10631. .on( "click", $.proxy( you.test, me ) )
  10632. // this === "<button> element"
  10633. .on( "click", you.test );
  10634. </script>
  10635. </body>
  10636. </html>
  10637. ```
  10638. * @example ​ ````Change the context of a function bound to the click handler,
  10639. ```html
  10640. <!doctype html>
  10641. <html lang="en">
  10642. <head>
  10643. <meta charset="utf-8">
  10644. <title>jQuery.proxy demo</title>
  10645. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10646. </head>
  10647. <body>
  10648. <p><button type="button" id="test">Test</button></p>
  10649. <div id="log"></div>
  10650. <script>
  10651. var me = {
  10652. // I'm a dog
  10653. type: "dog",
  10654. // Note that event comes *after* one and two
  10655. test: function( one, two, event ) {
  10656. $( "#log" )
  10657. // `one` maps to `you`, the 1st additional
  10658. // argument in the $.proxy function call
  10659. .append( "<h3>Hello " + one.type + ":</h3>" )
  10660. // The `this` keyword refers to `me`
  10661. // (the 2nd, context, argument of $.proxy)
  10662. .append( "I am a " + this.type + ", " )
  10663. // `two` maps to `they`, the 2nd additional
  10664. // argument in the $.proxy function call
  10665. .append( "and they are " + two.type + ".<br>" )
  10666. // The event type is "click"
  10667. .append( "Thanks for " + event.type + "ing." )
  10668. // The clicked element is `event.target`,
  10669. // and its type is "button"
  10670. .append( "the " + event.target.type + "." );
  10671. }
  10672. };
  10673. var you = { type: "cat" };
  10674. var they = { type: "fish" };
  10675. // Set up handler to execute me.test() in the context
  10676. // of `me`, with `you` and `they` as additional arguments
  10677. var proxy = $.proxy( me.test, me, you, they );
  10678. $( "#test" )
  10679. .on( "click", proxy );
  10680. </script>
  10681. </body>
  10682. </html>
  10683. ```
  10684. */
  10685. proxy<TContext, TReturn, A, B, C, D, E, F, T, U, V, W, X, Y, Z>(
  10686. funсtion: (
  10687. this: TContext,
  10688. a: A,
  10689. b: B,
  10690. c: C,
  10691. d: D,
  10692. e: E,
  10693. f: F,
  10694. t: T,
  10695. u: U,
  10696. v: V,
  10697. w: W,
  10698. x: X,
  10699. y: Y,
  10700. z: Z,
  10701. ...args: any[]
  10702. ) => TReturn,
  10703. context: TContext,
  10704. a: A,
  10705. b: B,
  10706. c: C,
  10707. d: D,
  10708. e: E,
  10709. f: F,
  10710. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  10711. /**
  10712. * Takes a function and returns a new one that will always have a particular context.
  10713. * @param funсtion The function whose context will be changed.
  10714. * @param context The object to which the context (`this`) of the function should be set.
  10715. * @param a An argument to be passed to the function referenced in the `function` argument.
  10716. * @param b An argument to be passed to the function referenced in the `function` argument.
  10717. * @param c An argument to be passed to the function referenced in the `function` argument.
  10718. * @param d An argument to be passed to the function referenced in the `function` argument.
  10719. * @param e An argument to be passed to the function referenced in the `function` argument.
  10720. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10721. * @since 1.4
  10722. * @since 1.6
  10723. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10724. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10725. ```html
  10726. <!doctype html>
  10727. <html lang="en">
  10728. <head>
  10729. <meta charset="utf-8">
  10730. <title>jQuery.proxy demo</title>
  10731. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10732. </head>
  10733. <body>
  10734. <p><button type="button" id="test">Test</button></p>
  10735. <div id="log"></div>
  10736. <script>
  10737. var me = {
  10738. type: "zombie",
  10739. test: function( event ) {
  10740. // Without proxy, `this` would refer to the event target
  10741. // use event.target to reference that element.
  10742. var element = event.target;
  10743. $( element ).css( "background-color", "red" );
  10744. // With proxy, `this` refers to the me object encapsulating
  10745. // this function.
  10746. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10747. $( "#test" ).off( "click", this.test );
  10748. }
  10749. };
  10750. var you = {
  10751. type: "person",
  10752. test: function( event ) {
  10753. $( "#log" ).append( this.type + " " );
  10754. }
  10755. };
  10756. // Execute you.test() in the context of the `you` object
  10757. // no matter where it is called
  10758. // i.e. the `this` keyword will refer to `you`
  10759. var youClick = $.proxy( you.test, you );
  10760. // attach click handlers to #test
  10761. $( "#test" )
  10762. // this === "zombie"; handler unbound after first click
  10763. .on( "click", $.proxy( me.test, me ) )
  10764. // this === "person"
  10765. .on( "click", youClick )
  10766. // this === "zombie"
  10767. .on( "click", $.proxy( you.test, me ) )
  10768. // this === "<button> element"
  10769. .on( "click", you.test );
  10770. </script>
  10771. </body>
  10772. </html>
  10773. ```
  10774. * @example ​ ````Change the context of a function bound to the click handler,
  10775. ```html
  10776. <!doctype html>
  10777. <html lang="en">
  10778. <head>
  10779. <meta charset="utf-8">
  10780. <title>jQuery.proxy demo</title>
  10781. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10782. </head>
  10783. <body>
  10784. <p><button type="button" id="test">Test</button></p>
  10785. <div id="log"></div>
  10786. <script>
  10787. var me = {
  10788. // I'm a dog
  10789. type: "dog",
  10790. // Note that event comes *after* one and two
  10791. test: function( one, two, event ) {
  10792. $( "#log" )
  10793. // `one` maps to `you`, the 1st additional
  10794. // argument in the $.proxy function call
  10795. .append( "<h3>Hello " + one.type + ":</h3>" )
  10796. // The `this` keyword refers to `me`
  10797. // (the 2nd, context, argument of $.proxy)
  10798. .append( "I am a " + this.type + ", " )
  10799. // `two` maps to `they`, the 2nd additional
  10800. // argument in the $.proxy function call
  10801. .append( "and they are " + two.type + ".<br>" )
  10802. // The event type is "click"
  10803. .append( "Thanks for " + event.type + "ing." )
  10804. // The clicked element is `event.target`,
  10805. // and its type is "button"
  10806. .append( "the " + event.target.type + "." );
  10807. }
  10808. };
  10809. var you = { type: "cat" };
  10810. var they = { type: "fish" };
  10811. // Set up handler to execute me.test() in the context
  10812. // of `me`, with `you` and `they` as additional arguments
  10813. var proxy = $.proxy( me.test, me, you, they );
  10814. $( "#test" )
  10815. .on( "click", proxy );
  10816. </script>
  10817. </body>
  10818. </html>
  10819. ```
  10820. */
  10821. proxy<TContext, TReturn, A, B, C, D, E, T, U, V, W, X, Y, Z>(
  10822. funсtion: (
  10823. this: TContext,
  10824. a: A,
  10825. b: B,
  10826. c: C,
  10827. d: D,
  10828. e: E,
  10829. t: T,
  10830. u: U,
  10831. v: V,
  10832. w: W,
  10833. x: X,
  10834. y: Y,
  10835. z: Z,
  10836. ...args: any[]
  10837. ) => TReturn,
  10838. context: TContext,
  10839. a: A,
  10840. b: B,
  10841. c: C,
  10842. d: D,
  10843. e: E,
  10844. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  10845. /**
  10846. * Takes a function and returns a new one that will always have a particular context.
  10847. * @param funсtion The function whose context will be changed.
  10848. * @param context The object to which the context (`this`) of the function should be set.
  10849. * @param a An argument to be passed to the function referenced in the `function` argument.
  10850. * @param b An argument to be passed to the function referenced in the `function` argument.
  10851. * @param c An argument to be passed to the function referenced in the `function` argument.
  10852. * @param d An argument to be passed to the function referenced in the `function` argument.
  10853. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10854. * @since 1.4
  10855. * @since 1.6
  10856. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10857. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10858. ```html
  10859. <!doctype html>
  10860. <html lang="en">
  10861. <head>
  10862. <meta charset="utf-8">
  10863. <title>jQuery.proxy demo</title>
  10864. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10865. </head>
  10866. <body>
  10867. <p><button type="button" id="test">Test</button></p>
  10868. <div id="log"></div>
  10869. <script>
  10870. var me = {
  10871. type: "zombie",
  10872. test: function( event ) {
  10873. // Without proxy, `this` would refer to the event target
  10874. // use event.target to reference that element.
  10875. var element = event.target;
  10876. $( element ).css( "background-color", "red" );
  10877. // With proxy, `this` refers to the me object encapsulating
  10878. // this function.
  10879. $( "#log" ).append( "Hello " + this.type + "<br>" );
  10880. $( "#test" ).off( "click", this.test );
  10881. }
  10882. };
  10883. var you = {
  10884. type: "person",
  10885. test: function( event ) {
  10886. $( "#log" ).append( this.type + " " );
  10887. }
  10888. };
  10889. // Execute you.test() in the context of the `you` object
  10890. // no matter where it is called
  10891. // i.e. the `this` keyword will refer to `you`
  10892. var youClick = $.proxy( you.test, you );
  10893. // attach click handlers to #test
  10894. $( "#test" )
  10895. // this === "zombie"; handler unbound after first click
  10896. .on( "click", $.proxy( me.test, me ) )
  10897. // this === "person"
  10898. .on( "click", youClick )
  10899. // this === "zombie"
  10900. .on( "click", $.proxy( you.test, me ) )
  10901. // this === "<button> element"
  10902. .on( "click", you.test );
  10903. </script>
  10904. </body>
  10905. </html>
  10906. ```
  10907. * @example ​ ````Change the context of a function bound to the click handler,
  10908. ```html
  10909. <!doctype html>
  10910. <html lang="en">
  10911. <head>
  10912. <meta charset="utf-8">
  10913. <title>jQuery.proxy demo</title>
  10914. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10915. </head>
  10916. <body>
  10917. <p><button type="button" id="test">Test</button></p>
  10918. <div id="log"></div>
  10919. <script>
  10920. var me = {
  10921. // I'm a dog
  10922. type: "dog",
  10923. // Note that event comes *after* one and two
  10924. test: function( one, two, event ) {
  10925. $( "#log" )
  10926. // `one` maps to `you`, the 1st additional
  10927. // argument in the $.proxy function call
  10928. .append( "<h3>Hello " + one.type + ":</h3>" )
  10929. // The `this` keyword refers to `me`
  10930. // (the 2nd, context, argument of $.proxy)
  10931. .append( "I am a " + this.type + ", " )
  10932. // `two` maps to `they`, the 2nd additional
  10933. // argument in the $.proxy function call
  10934. .append( "and they are " + two.type + ".<br>" )
  10935. // The event type is "click"
  10936. .append( "Thanks for " + event.type + "ing." )
  10937. // The clicked element is `event.target`,
  10938. // and its type is "button"
  10939. .append( "the " + event.target.type + "." );
  10940. }
  10941. };
  10942. var you = { type: "cat" };
  10943. var they = { type: "fish" };
  10944. // Set up handler to execute me.test() in the context
  10945. // of `me`, with `you` and `they` as additional arguments
  10946. var proxy = $.proxy( me.test, me, you, they );
  10947. $( "#test" )
  10948. .on( "click", proxy );
  10949. </script>
  10950. </body>
  10951. </html>
  10952. ```
  10953. */
  10954. proxy<TContext, TReturn, A, B, C, D, T, U, V, W, X, Y, Z>(
  10955. funсtion: (
  10956. this: TContext,
  10957. a: A,
  10958. b: B,
  10959. c: C,
  10960. d: D,
  10961. t: T,
  10962. u: U,
  10963. v: V,
  10964. w: W,
  10965. x: X,
  10966. y: Y,
  10967. z: Z,
  10968. ...args: any[]
  10969. ) => TReturn,
  10970. context: TContext,
  10971. a: A,
  10972. b: B,
  10973. c: C,
  10974. d: D,
  10975. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  10976. /**
  10977. * Takes a function and returns a new one that will always have a particular context.
  10978. * @param funсtion The function whose context will be changed.
  10979. * @param context The object to which the context (`this`) of the function should be set.
  10980. * @param a An argument to be passed to the function referenced in the `function` argument.
  10981. * @param b An argument to be passed to the function referenced in the `function` argument.
  10982. * @param c An argument to be passed to the function referenced in the `function` argument.
  10983. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  10984. * @since 1.4
  10985. * @since 1.6
  10986. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  10987. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  10988. ```html
  10989. <!doctype html>
  10990. <html lang="en">
  10991. <head>
  10992. <meta charset="utf-8">
  10993. <title>jQuery.proxy demo</title>
  10994. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  10995. </head>
  10996. <body>
  10997. <p><button type="button" id="test">Test</button></p>
  10998. <div id="log"></div>
  10999. <script>
  11000. var me = {
  11001. type: "zombie",
  11002. test: function( event ) {
  11003. // Without proxy, `this` would refer to the event target
  11004. // use event.target to reference that element.
  11005. var element = event.target;
  11006. $( element ).css( "background-color", "red" );
  11007. // With proxy, `this` refers to the me object encapsulating
  11008. // this function.
  11009. $( "#log" ).append( "Hello " + this.type + "<br>" );
  11010. $( "#test" ).off( "click", this.test );
  11011. }
  11012. };
  11013. var you = {
  11014. type: "person",
  11015. test: function( event ) {
  11016. $( "#log" ).append( this.type + " " );
  11017. }
  11018. };
  11019. // Execute you.test() in the context of the `you` object
  11020. // no matter where it is called
  11021. // i.e. the `this` keyword will refer to `you`
  11022. var youClick = $.proxy( you.test, you );
  11023. // attach click handlers to #test
  11024. $( "#test" )
  11025. // this === "zombie"; handler unbound after first click
  11026. .on( "click", $.proxy( me.test, me ) )
  11027. // this === "person"
  11028. .on( "click", youClick )
  11029. // this === "zombie"
  11030. .on( "click", $.proxy( you.test, me ) )
  11031. // this === "<button> element"
  11032. .on( "click", you.test );
  11033. </script>
  11034. </body>
  11035. </html>
  11036. ```
  11037. * @example ​ ````Change the context of a function bound to the click handler,
  11038. ```html
  11039. <!doctype html>
  11040. <html lang="en">
  11041. <head>
  11042. <meta charset="utf-8">
  11043. <title>jQuery.proxy demo</title>
  11044. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11045. </head>
  11046. <body>
  11047. <p><button type="button" id="test">Test</button></p>
  11048. <div id="log"></div>
  11049. <script>
  11050. var me = {
  11051. // I'm a dog
  11052. type: "dog",
  11053. // Note that event comes *after* one and two
  11054. test: function( one, two, event ) {
  11055. $( "#log" )
  11056. // `one` maps to `you`, the 1st additional
  11057. // argument in the $.proxy function call
  11058. .append( "<h3>Hello " + one.type + ":</h3>" )
  11059. // The `this` keyword refers to `me`
  11060. // (the 2nd, context, argument of $.proxy)
  11061. .append( "I am a " + this.type + ", " )
  11062. // `two` maps to `they`, the 2nd additional
  11063. // argument in the $.proxy function call
  11064. .append( "and they are " + two.type + ".<br>" )
  11065. // The event type is "click"
  11066. .append( "Thanks for " + event.type + "ing." )
  11067. // The clicked element is `event.target`,
  11068. // and its type is "button"
  11069. .append( "the " + event.target.type + "." );
  11070. }
  11071. };
  11072. var you = { type: "cat" };
  11073. var they = { type: "fish" };
  11074. // Set up handler to execute me.test() in the context
  11075. // of `me`, with `you` and `they` as additional arguments
  11076. var proxy = $.proxy( me.test, me, you, they );
  11077. $( "#test" )
  11078. .on( "click", proxy );
  11079. </script>
  11080. </body>
  11081. </html>
  11082. ```
  11083. */
  11084. proxy<TContext, TReturn, A, B, C, T, U, V, W, X, Y, Z>(
  11085. funсtion: (
  11086. this: TContext,
  11087. a: A,
  11088. b: B,
  11089. c: C,
  11090. t: T,
  11091. u: U,
  11092. v: V,
  11093. w: W,
  11094. x: X,
  11095. y: Y,
  11096. z: Z,
  11097. ...args: any[]
  11098. ) => TReturn,
  11099. context: TContext,
  11100. a: A,
  11101. b: B,
  11102. c: C,
  11103. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  11104. /**
  11105. * Takes a function and returns a new one that will always have a particular context.
  11106. * @param funсtion The function whose context will be changed.
  11107. * @param context The object to which the context (`this`) of the function should be set.
  11108. * @param a An argument to be passed to the function referenced in the `function` argument.
  11109. * @param b An argument to be passed to the function referenced in the `function` argument.
  11110. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  11111. * @since 1.4
  11112. * @since 1.6
  11113. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  11114. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  11115. ```html
  11116. <!doctype html>
  11117. <html lang="en">
  11118. <head>
  11119. <meta charset="utf-8">
  11120. <title>jQuery.proxy demo</title>
  11121. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11122. </head>
  11123. <body>
  11124. <p><button type="button" id="test">Test</button></p>
  11125. <div id="log"></div>
  11126. <script>
  11127. var me = {
  11128. type: "zombie",
  11129. test: function( event ) {
  11130. // Without proxy, `this` would refer to the event target
  11131. // use event.target to reference that element.
  11132. var element = event.target;
  11133. $( element ).css( "background-color", "red" );
  11134. // With proxy, `this` refers to the me object encapsulating
  11135. // this function.
  11136. $( "#log" ).append( "Hello " + this.type + "<br>" );
  11137. $( "#test" ).off( "click", this.test );
  11138. }
  11139. };
  11140. var you = {
  11141. type: "person",
  11142. test: function( event ) {
  11143. $( "#log" ).append( this.type + " " );
  11144. }
  11145. };
  11146. // Execute you.test() in the context of the `you` object
  11147. // no matter where it is called
  11148. // i.e. the `this` keyword will refer to `you`
  11149. var youClick = $.proxy( you.test, you );
  11150. // attach click handlers to #test
  11151. $( "#test" )
  11152. // this === "zombie"; handler unbound after first click
  11153. .on( "click", $.proxy( me.test, me ) )
  11154. // this === "person"
  11155. .on( "click", youClick )
  11156. // this === "zombie"
  11157. .on( "click", $.proxy( you.test, me ) )
  11158. // this === "<button> element"
  11159. .on( "click", you.test );
  11160. </script>
  11161. </body>
  11162. </html>
  11163. ```
  11164. * @example ​ ````Change the context of a function bound to the click handler,
  11165. ```html
  11166. <!doctype html>
  11167. <html lang="en">
  11168. <head>
  11169. <meta charset="utf-8">
  11170. <title>jQuery.proxy demo</title>
  11171. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11172. </head>
  11173. <body>
  11174. <p><button type="button" id="test">Test</button></p>
  11175. <div id="log"></div>
  11176. <script>
  11177. var me = {
  11178. // I'm a dog
  11179. type: "dog",
  11180. // Note that event comes *after* one and two
  11181. test: function( one, two, event ) {
  11182. $( "#log" )
  11183. // `one` maps to `you`, the 1st additional
  11184. // argument in the $.proxy function call
  11185. .append( "<h3>Hello " + one.type + ":</h3>" )
  11186. // The `this` keyword refers to `me`
  11187. // (the 2nd, context, argument of $.proxy)
  11188. .append( "I am a " + this.type + ", " )
  11189. // `two` maps to `they`, the 2nd additional
  11190. // argument in the $.proxy function call
  11191. .append( "and they are " + two.type + ".<br>" )
  11192. // The event type is "click"
  11193. .append( "Thanks for " + event.type + "ing." )
  11194. // The clicked element is `event.target`,
  11195. // and its type is "button"
  11196. .append( "the " + event.target.type + "." );
  11197. }
  11198. };
  11199. var you = { type: "cat" };
  11200. var they = { type: "fish" };
  11201. // Set up handler to execute me.test() in the context
  11202. // of `me`, with `you` and `they` as additional arguments
  11203. var proxy = $.proxy( me.test, me, you, they );
  11204. $( "#test" )
  11205. .on( "click", proxy );
  11206. </script>
  11207. </body>
  11208. </html>
  11209. ```
  11210. */
  11211. proxy<TContext, TReturn, A, B, T, U, V, W, X, Y, Z>(
  11212. funсtion: (this: TContext, a: A, b: B, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  11213. context: TContext,
  11214. a: A,
  11215. b: B,
  11216. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  11217. /**
  11218. * Takes a function and returns a new one that will always have a particular context.
  11219. * @param funсtion The function whose context will be changed.
  11220. * @param context The object to which the context (`this`) of the function should be set.
  11221. * @param a An argument to be passed to the function referenced in the `function` argument.
  11222. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  11223. * @since 1.4
  11224. * @since 1.6
  11225. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  11226. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  11227. ```html
  11228. <!doctype html>
  11229. <html lang="en">
  11230. <head>
  11231. <meta charset="utf-8">
  11232. <title>jQuery.proxy demo</title>
  11233. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11234. </head>
  11235. <body>
  11236. <p><button type="button" id="test">Test</button></p>
  11237. <div id="log"></div>
  11238. <script>
  11239. var me = {
  11240. type: "zombie",
  11241. test: function( event ) {
  11242. // Without proxy, `this` would refer to the event target
  11243. // use event.target to reference that element.
  11244. var element = event.target;
  11245. $( element ).css( "background-color", "red" );
  11246. // With proxy, `this` refers to the me object encapsulating
  11247. // this function.
  11248. $( "#log" ).append( "Hello " + this.type + "<br>" );
  11249. $( "#test" ).off( "click", this.test );
  11250. }
  11251. };
  11252. var you = {
  11253. type: "person",
  11254. test: function( event ) {
  11255. $( "#log" ).append( this.type + " " );
  11256. }
  11257. };
  11258. // Execute you.test() in the context of the `you` object
  11259. // no matter where it is called
  11260. // i.e. the `this` keyword will refer to `you`
  11261. var youClick = $.proxy( you.test, you );
  11262. // attach click handlers to #test
  11263. $( "#test" )
  11264. // this === "zombie"; handler unbound after first click
  11265. .on( "click", $.proxy( me.test, me ) )
  11266. // this === "person"
  11267. .on( "click", youClick )
  11268. // this === "zombie"
  11269. .on( "click", $.proxy( you.test, me ) )
  11270. // this === "<button> element"
  11271. .on( "click", you.test );
  11272. </script>
  11273. </body>
  11274. </html>
  11275. ```
  11276. * @example ​ ````Change the context of a function bound to the click handler,
  11277. ```html
  11278. <!doctype html>
  11279. <html lang="en">
  11280. <head>
  11281. <meta charset="utf-8">
  11282. <title>jQuery.proxy demo</title>
  11283. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11284. </head>
  11285. <body>
  11286. <p><button type="button" id="test">Test</button></p>
  11287. <div id="log"></div>
  11288. <script>
  11289. var me = {
  11290. // I'm a dog
  11291. type: "dog",
  11292. // Note that event comes *after* one and two
  11293. test: function( one, two, event ) {
  11294. $( "#log" )
  11295. // `one` maps to `you`, the 1st additional
  11296. // argument in the $.proxy function call
  11297. .append( "<h3>Hello " + one.type + ":</h3>" )
  11298. // The `this` keyword refers to `me`
  11299. // (the 2nd, context, argument of $.proxy)
  11300. .append( "I am a " + this.type + ", " )
  11301. // `two` maps to `they`, the 2nd additional
  11302. // argument in the $.proxy function call
  11303. .append( "and they are " + two.type + ".<br>" )
  11304. // The event type is "click"
  11305. .append( "Thanks for " + event.type + "ing." )
  11306. // The clicked element is `event.target`,
  11307. // and its type is "button"
  11308. .append( "the " + event.target.type + "." );
  11309. }
  11310. };
  11311. var you = { type: "cat" };
  11312. var they = { type: "fish" };
  11313. // Set up handler to execute me.test() in the context
  11314. // of `me`, with `you` and `they` as additional arguments
  11315. var proxy = $.proxy( me.test, me, you, they );
  11316. $( "#test" )
  11317. .on( "click", proxy );
  11318. </script>
  11319. </body>
  11320. </html>
  11321. ```
  11322. */
  11323. proxy<TContext, TReturn, A, T, U, V, W, X, Y, Z>(
  11324. funсtion: (this: TContext, a: A, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  11325. context: TContext,
  11326. a: A,
  11327. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  11328. /**
  11329. * Takes a function and returns a new one that will always have a particular context.
  11330. * @param funсtion The function whose context will be changed.
  11331. * @param context The object to which the context (`this`) of the function should be set.
  11332. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  11333. * @since 1.4
  11334. * @since 1.6
  11335. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  11336. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  11337. ```html
  11338. <!doctype html>
  11339. <html lang="en">
  11340. <head>
  11341. <meta charset="utf-8">
  11342. <title>jQuery.proxy demo</title>
  11343. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11344. </head>
  11345. <body>
  11346. <p><button type="button" id="test">Test</button></p>
  11347. <div id="log"></div>
  11348. <script>
  11349. var me = {
  11350. type: "zombie",
  11351. test: function( event ) {
  11352. // Without proxy, `this` would refer to the event target
  11353. // use event.target to reference that element.
  11354. var element = event.target;
  11355. $( element ).css( "background-color", "red" );
  11356. // With proxy, `this` refers to the me object encapsulating
  11357. // this function.
  11358. $( "#log" ).append( "Hello " + this.type + "<br>" );
  11359. $( "#test" ).off( "click", this.test );
  11360. }
  11361. };
  11362. var you = {
  11363. type: "person",
  11364. test: function( event ) {
  11365. $( "#log" ).append( this.type + " " );
  11366. }
  11367. };
  11368. // Execute you.test() in the context of the `you` object
  11369. // no matter where it is called
  11370. // i.e. the `this` keyword will refer to `you`
  11371. var youClick = $.proxy( you.test, you );
  11372. // attach click handlers to #test
  11373. $( "#test" )
  11374. // this === "zombie"; handler unbound after first click
  11375. .on( "click", $.proxy( me.test, me ) )
  11376. // this === "person"
  11377. .on( "click", youClick )
  11378. // this === "zombie"
  11379. .on( "click", $.proxy( you.test, me ) )
  11380. // this === "<button> element"
  11381. .on( "click", you.test );
  11382. </script>
  11383. </body>
  11384. </html>
  11385. ```
  11386. * @example ​ ````Change the context of a function bound to the click handler,
  11387. ```html
  11388. <!doctype html>
  11389. <html lang="en">
  11390. <head>
  11391. <meta charset="utf-8">
  11392. <title>jQuery.proxy demo</title>
  11393. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11394. </head>
  11395. <body>
  11396. <p><button type="button" id="test">Test</button></p>
  11397. <div id="log"></div>
  11398. <script>
  11399. var me = {
  11400. // I'm a dog
  11401. type: "dog",
  11402. // Note that event comes *after* one and two
  11403. test: function( one, two, event ) {
  11404. $( "#log" )
  11405. // `one` maps to `you`, the 1st additional
  11406. // argument in the $.proxy function call
  11407. .append( "<h3>Hello " + one.type + ":</h3>" )
  11408. // The `this` keyword refers to `me`
  11409. // (the 2nd, context, argument of $.proxy)
  11410. .append( "I am a " + this.type + ", " )
  11411. // `two` maps to `they`, the 2nd additional
  11412. // argument in the $.proxy function call
  11413. .append( "and they are " + two.type + ".<br>" )
  11414. // The event type is "click"
  11415. .append( "Thanks for " + event.type + "ing." )
  11416. // The clicked element is `event.target`,
  11417. // and its type is "button"
  11418. .append( "the " + event.target.type + "." );
  11419. }
  11420. };
  11421. var you = { type: "cat" };
  11422. var they = { type: "fish" };
  11423. // Set up handler to execute me.test() in the context
  11424. // of `me`, with `you` and `they` as additional arguments
  11425. var proxy = $.proxy( me.test, me, you, they );
  11426. $( "#test" )
  11427. .on( "click", proxy );
  11428. </script>
  11429. </body>
  11430. </html>
  11431. ```
  11432. */
  11433. proxy<TContext, TReturn, T, U, V, W, X, Y, Z>(
  11434. funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn,
  11435. context: TContext,
  11436. ): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn;
  11437. // #endregion
  11438. // #endregion
  11439. // region 8+ additional arguments
  11440. // #region 8+ additional arguments
  11441. /**
  11442. * Takes a function and returns a new one that will always have a particular context.
  11443. * @param funсtion The function whose context will be changed.
  11444. * @param context The object to which the context (`this`) of the function should be set.
  11445. * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument.
  11446. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  11447. * @since 1.4
  11448. * @since 1.6
  11449. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  11450. * @example ​ ````Change the context of functions bound to a click handler using the &quot;function, context&quot; signature. Unbind the first handler after first click.
  11451. ```html
  11452. <!doctype html>
  11453. <html lang="en">
  11454. <head>
  11455. <meta charset="utf-8">
  11456. <title>jQuery.proxy demo</title>
  11457. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11458. </head>
  11459. <body>
  11460. <p><button type="button" id="test">Test</button></p>
  11461. <div id="log"></div>
  11462. <script>
  11463. var me = {
  11464. type: "zombie",
  11465. test: function( event ) {
  11466. // Without proxy, `this` would refer to the event target
  11467. // use event.target to reference that element.
  11468. var element = event.target;
  11469. $( element ).css( "background-color", "red" );
  11470. // With proxy, `this` refers to the me object encapsulating
  11471. // this function.
  11472. $( "#log" ).append( "Hello " + this.type + "<br>" );
  11473. $( "#test" ).off( "click", this.test );
  11474. }
  11475. };
  11476. var you = {
  11477. type: "person",
  11478. test: function( event ) {
  11479. $( "#log" ).append( this.type + " " );
  11480. }
  11481. };
  11482. // Execute you.test() in the context of the `you` object
  11483. // no matter where it is called
  11484. // i.e. the `this` keyword will refer to `you`
  11485. var youClick = $.proxy( you.test, you );
  11486. // attach click handlers to #test
  11487. $( "#test" )
  11488. // this === "zombie"; handler unbound after first click
  11489. .on( "click", $.proxy( me.test, me ) )
  11490. // this === "person"
  11491. .on( "click", youClick )
  11492. // this === "zombie"
  11493. .on( "click", $.proxy( you.test, me ) )
  11494. // this === "<button> element"
  11495. .on( "click", you.test );
  11496. </script>
  11497. </body>
  11498. </html>
  11499. ```
  11500. * @example ​ ````Change the context of a function bound to the click handler,
  11501. ```html
  11502. <!doctype html>
  11503. <html lang="en">
  11504. <head>
  11505. <meta charset="utf-8">
  11506. <title>jQuery.proxy demo</title>
  11507. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11508. </head>
  11509. <body>
  11510. <p><button type="button" id="test">Test</button></p>
  11511. <div id="log"></div>
  11512. <script>
  11513. var me = {
  11514. // I'm a dog
  11515. type: "dog",
  11516. // Note that event comes *after* one and two
  11517. test: function( one, two, event ) {
  11518. $( "#log" )
  11519. // `one` maps to `you`, the 1st additional
  11520. // argument in the $.proxy function call
  11521. .append( "<h3>Hello " + one.type + ":</h3>" )
  11522. // The `this` keyword refers to `me`
  11523. // (the 2nd, context, argument of $.proxy)
  11524. .append( "I am a " + this.type + ", " )
  11525. // `two` maps to `they`, the 2nd additional
  11526. // argument in the $.proxy function call
  11527. .append( "and they are " + two.type + ".<br>" )
  11528. // The event type is "click"
  11529. .append( "Thanks for " + event.type + "ing." )
  11530. // The clicked element is `event.target`,
  11531. // and its type is "button"
  11532. .append( "the " + event.target.type + "." );
  11533. }
  11534. };
  11535. var you = { type: "cat" };
  11536. var they = { type: "fish" };
  11537. // Set up handler to execute me.test() in the context
  11538. // of `me`, with `you` and `they` as additional arguments
  11539. var proxy = $.proxy( me.test, me, you, they );
  11540. $( "#test" )
  11541. .on( "click", proxy );
  11542. </script>
  11543. </body>
  11544. </html>
  11545. ```
  11546. */
  11547. proxy<TContext, TReturn>(
  11548. funсtion: (this: TContext, ...args: any[]) => TReturn,
  11549. context: TContext,
  11550. ...additionalArguments: any[]
  11551. ): (...args: any[]) => TReturn;
  11552. // #endregion
  11553. // #endregion
  11554. // region (context, name)
  11555. // #region (context, name)
  11556. /**
  11557. * Takes a function and returns a new one that will always have a particular context.
  11558. * @param context The object to which the context of the function should be set.
  11559. * @param name The name of the function whose context will be changed (should be a property of the context object).
  11560. * @param additionalArguments Any number of arguments to be passed to the function named in the name argument.
  11561. * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\`
  11562. * @since 1.4
  11563. * @since 1.6
  11564. * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`.
  11565. * @example ​ ````Enforce the context of the function using the &quot;context, function name&quot; signature. Unbind the handler after first click.
  11566. ```html
  11567. <!doctype html>
  11568. <html lang="en">
  11569. <head>
  11570. <meta charset="utf-8">
  11571. <title>jQuery.proxy demo</title>
  11572. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11573. </head>
  11574. <body>
  11575. <p><button id="test">Test</button></p>
  11576. <p id="log"></p>
  11577. <script>
  11578. var obj = {
  11579. name: "John",
  11580. test: function() {
  11581. $( "#log" ).append( this.name );
  11582. $( "#test" ).off( "click", obj.test );
  11583. }
  11584. };
  11585. $( "#test" ).on( "click", jQuery.proxy( obj, "test" ) );
  11586. </script>
  11587. </body>
  11588. </html>
  11589. ```
  11590. */
  11591. proxy<TContext>(context: TContext, name: keyof TContext, ...additionalArguments: any[]): (...args: any[]) => any;
  11592. // #endregion
  11593. // #endregion
  11594. /**
  11595. * Manipulate the queue of functions to be executed on the matched element.
  11596. * @param element A DOM element where the array of queued functions is attached.
  11597. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
  11598. * @param newQueue The new function to add to the queue.
  11599. * An array of functions to replace the current queue contents.
  11600. * @see \`{@link https://api.jquery.com/jQuery.queue/ }\`
  11601. * @since 1.3
  11602. * @example ​ ````Show the length of the queue.
  11603. ```html
  11604. <!doctype html>
  11605. <html lang="en">
  11606. <head>
  11607. <meta charset="utf-8">
  11608. <title>jQuery.queue demo</title>
  11609. <style>
  11610. div {
  11611. margin: 3px;
  11612. width: 40px;
  11613. height: 40px;
  11614. position: absolute;
  11615. left: 0px;
  11616. top: 30px;
  11617. background: green;
  11618. display: none;
  11619. }
  11620. div.newcolor {
  11621. background: blue;
  11622. }
  11623. span {
  11624. color: red;
  11625. }
  11626. </style>
  11627. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11628. </head>
  11629. <body>
  11630. <button id="show">Show Length of Queue</button>
  11631. <span></span>
  11632. <div></div>
  11633. <script>
  11634. $( "#show" ).click(function() {
  11635. var n = jQuery.queue( $( "div" )[ 0 ], "fx" );
  11636. $( "span" ).text( "Queue length is: " + n.length );
  11637. });
  11638. function runIt() {
  11639. $( "div" )
  11640. .show( "slow" )
  11641. .animate({
  11642. left: "+=200"
  11643. }, 2000 )
  11644. .slideToggle( 1000 )
  11645. .slideToggle( "fast" )
  11646. .animate({
  11647. left: "-=200"
  11648. }, 1500 )
  11649. .hide( "slow" )
  11650. .show( 1200 )
  11651. .slideUp( "normal", runIt );
  11652. }
  11653. runIt();
  11654. </script>
  11655. </body>
  11656. </html>
  11657. ```
  11658. * @example ​ ````Queue a custom function.
  11659. ```html
  11660. <!doctype html>
  11661. <html lang="en">
  11662. <head>
  11663. <meta charset="utf-8">
  11664. <title>jQuery.queue demo</title>
  11665. <style>
  11666. div {
  11667. margin: 3px;
  11668. width: 40px;
  11669. height: 40px;
  11670. position: absolute;
  11671. left: 0px;
  11672. top: 30px;
  11673. background: green;
  11674. display: none;
  11675. }
  11676. div.newcolor {
  11677. background: blue;
  11678. }
  11679. </style>
  11680. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11681. </head>
  11682. <body>
  11683. Click here...
  11684. <div></div>
  11685. <script>
  11686. $( document.body ).click(function() {
  11687. var divs = $( "div" )
  11688. .show( "slow" )
  11689. .animate({ left: "+=200" }, 2000 );
  11690. jQuery.queue( divs[ 0 ], "fx", function() {
  11691. $( this ).addClass( "newcolor" );
  11692. jQuery.dequeue( this );
  11693. });
  11694. divs.animate({ left: "-=200" }, 500 );
  11695. jQuery.queue( divs[ 0 ], "fx", function() {
  11696. $( this ).removeClass( "newcolor" );
  11697. jQuery.dequeue( this );
  11698. });
  11699. divs.slideUp();
  11700. });
  11701. </script>
  11702. </body>
  11703. </html>
  11704. ```
  11705. * @example ​ ````Set a queue array to delete the queue.
  11706. ```html
  11707. <!doctype html>
  11708. <html lang="en">
  11709. <head>
  11710. <meta charset="utf-8">
  11711. <title>jQuery.queue demo</title>
  11712. <style>
  11713. div {
  11714. margin: 3px;
  11715. width: 40px;
  11716. height: 40px;
  11717. position: absolute;
  11718. left: 0px;
  11719. top: 30px;
  11720. background: green;
  11721. display: none;
  11722. }
  11723. div.newcolor {
  11724. background: blue;
  11725. }
  11726. </style>
  11727. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11728. </head>
  11729. <body>
  11730. <button id="start">Start</button>
  11731. <button id="stop">Stop</button>
  11732. <div></div>
  11733. <script>
  11734. $( "#start" ).click(function() {
  11735. var divs = $( "div" )
  11736. .show( "slow" )
  11737. .animate({ left: "+=200" }, 5000 );
  11738. jQuery.queue( divs[ 0 ], "fx", function() {
  11739. $( this ).addClass( "newcolor" );
  11740. jQuery.dequeue( this );
  11741. });
  11742. divs.animate({ left: "-=200" }, 1500 );
  11743. jQuery.queue( divs[ 0 ], "fx", function() {
  11744. $( this ).removeClass( "newcolor" );
  11745. jQuery.dequeue( this );
  11746. });
  11747. divs.slideUp();
  11748. });
  11749. $( "#stop" ).click(function() {
  11750. jQuery.queue( $( "div" )[ 0 ], "fx", [] );
  11751. $( "div" ).stop();
  11752. });
  11753. </script>
  11754. </body>
  11755. </html>
  11756. ```
  11757. */
  11758. queue<T extends Element>(
  11759. element: T,
  11760. queueName?: string,
  11761. newQueue?: JQuery.TypeOrArray<JQuery.QueueFunction<T>>,
  11762. ): JQuery.Queue<T>;
  11763. /**
  11764. * Handles errors thrown synchronously in functions wrapped in jQuery().
  11765. * @param error An error thrown in the function wrapped in jQuery().
  11766. * @see \`{@link https://api.jquery.com/jQuery.readyException/ }\`
  11767. * @since 3.1
  11768. * @example ​ ````Pass the received error to console.error.
  11769. ```javascript
  11770. jQuery.readyException = function( error ) {
  11771. console.error( error );
  11772. };
  11773. ```
  11774. */
  11775. readyException(error: Error): any;
  11776. /**
  11777. * Remove a previously-stored piece of data.
  11778. * @param element A DOM element from which to remove data.
  11779. * @param name A string naming the piece of data to remove.
  11780. * @see \`{@link https://api.jquery.com/jQuery.removeData/ }\`
  11781. * @since 1.2.3
  11782. * @example ​ ````Set a data store for 2 names then remove one of them.
  11783. ```html
  11784. <!doctype html>
  11785. <html lang="en">
  11786. <head>
  11787. <meta charset="utf-8">
  11788. <title>jQuery.removeData demo</title>
  11789. <style>
  11790. div {
  11791. margin: 2px;
  11792. color: blue;
  11793. }
  11794. span {
  11795. color: red;
  11796. }
  11797. </style>
  11798. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11799. </head>
  11800. <body>
  11801. <div>value1 before creation: <span></span></div>
  11802. <div>value1 after creation: <span></span></div>
  11803. <div>value1 after removal: <span></span></div>
  11804. <div>value2 after removal: <span></span></div>
  11805. <script>
  11806. var div = $( "div" )[ 0 ];
  11807. $( "span:eq(0)" ).text( "" + $( "div" ).data( "test1" ) );
  11808. jQuery.data( div, "test1", "VALUE-1" );
  11809. jQuery.data( div, "test2", "VALUE-2" );
  11810. $( "span:eq(1)" ).text( "" + jQuery.data( div, "test1" ) );
  11811. jQuery.removeData( div, "test1" );
  11812. $( "span:eq(2)" ).text( "" + jQuery.data( div, "test1" ) );
  11813. $( "span:eq(3)" ).text( "" + jQuery.data( div, "test2" ) );
  11814. </script>
  11815. </body>
  11816. </html>
  11817. ```
  11818. */
  11819. removeData(element: Element | Document | Window | JQuery.PlainObject, name?: string): void;
  11820. /**
  11821. * Creates an object containing a set of properties ready to be used in the definition of custom animations.
  11822. * @param duration A string or number determining how long the animation will run.
  11823. * @param easing A string indicating which easing function to use for the transition.
  11824. * @param complete A function to call once the animation is complete, called once per matched element.
  11825. * @see \`{@link https://api.jquery.com/jQuery.speed/ }\`
  11826. * @since 1.1
  11827. */
  11828. speed<TElement extends Element = HTMLElement>(
  11829. duration: JQuery.Duration,
  11830. easing: string,
  11831. complete: (this: TElement) => void,
  11832. ): JQuery.EffectsOptions<TElement>;
  11833. /**
  11834. * Creates an object containing a set of properties ready to be used in the definition of custom animations.
  11835. * @param duration A string or number determining how long the animation will run.
  11836. * @param easing_complete _&#x40;param_ `easing_complete`
  11837. * <br>
  11838. * * `easing` — A string indicating which easing function to use for the transition. <br>
  11839. * * `complete` — A function to call once the animation is complete, called once per matched element.
  11840. * @see \`{@link https://api.jquery.com/jQuery.speed/ }\`
  11841. * @since 1.0
  11842. * @since 1.1
  11843. */
  11844. speed<TElement extends Element = HTMLElement>(
  11845. duration: JQuery.Duration,
  11846. easing_complete: string | ((this: TElement) => void),
  11847. ): JQuery.EffectsOptions<TElement>;
  11848. /**
  11849. * Creates an object containing a set of properties ready to be used in the definition of custom animations.
  11850. * @param duration_complete_settings _&#x40;param_ `duration_complete_settings`
  11851. * <br>
  11852. * * `duration` — A string or number determining how long the animation will run. <br>
  11853. * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
  11854. * * `settings` —
  11855. * @see \`{@link https://api.jquery.com/jQuery.speed/ }\`
  11856. * @since 1.0
  11857. * @since 1.1
  11858. */
  11859. speed<TElement extends Element = HTMLElement>(
  11860. duration_complete_settings?: JQuery.Duration | ((this: TElement) => void) | JQuery.SpeedSettings<TElement>,
  11861. ): JQuery.EffectsOptions<TElement>;
  11862. /**
  11863. * Remove the whitespace from the beginning and end of a string.
  11864. * @param str The string to trim.
  11865. * @see \`{@link https://api.jquery.com/jQuery.trim/ }\`
  11866. * @since 1.0
  11867. * @deprecated ​ Deprecated since 3.5. Use \`{@link String.prototype.trim String.prototype.trim}\`.
  11868. * @example ​ ````Remove the white spaces at the start and at the end of the string.
  11869. ```html
  11870. <!doctype html>
  11871. <html lang="en">
  11872. <head>
  11873. <meta charset="utf-8">
  11874. <title>jQuery.trim demo</title>
  11875. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11876. </head>
  11877. <body>
  11878. <pre id="original"></pre>
  11879. <pre id="trimmed"></pre>
  11880. <script>
  11881. var str = " lots of spaces before and after ";
  11882. $( "#original" ).html( "Original String: '" + str + "'" );
  11883. $( "#trimmed" ).html( "$.trim()'ed: '" + $.trim(str) + "'" );
  11884. </script>
  11885. </body>
  11886. </html>
  11887. ```
  11888. * @example ​ ````Remove the white spaces at the start and at the end of the string.
  11889. ```javascript
  11890. $.trim(" hello, how are you? ");
  11891. ```
  11892. * @example ​ ````Remove the white spaces at the start and at the end of the string.
  11893. ```javascript
  11894. $.trim(" hello, how are you? ");
  11895. ```
  11896. */
  11897. trim(str: string): string;
  11898. /**
  11899. * Determine the internal JavaScript [[Class]] of an object.
  11900. * @param obj Object to get the internal JavaScript [[Class]] of.
  11901. * @see \`{@link https://api.jquery.com/jQuery.type/ }\`
  11902. * @since 1.4.3
  11903. * @deprecated ​ Deprecated since 3.3. See \`{@link https://github.com/jquery/jquery/issues/3605 }\`.
  11904. * @example ​ ````Find out if the parameter is a RegExp.
  11905. ```html
  11906. <!doctype html>
  11907. <html lang="en">
  11908. <head>
  11909. <meta charset="utf-8">
  11910. <title>jQuery.type demo</title>
  11911. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11912. </head>
  11913. <body>
  11914. Is it a RegExp? <b></b>
  11915. <script>
  11916. $( "b" ).append( "" + jQuery.type( /test/ ) );
  11917. </script>
  11918. </body>
  11919. </html>
  11920. ```
  11921. */
  11922. type(
  11923. obj: any,
  11924. ):
  11925. | "array"
  11926. | "boolean"
  11927. | "date"
  11928. | "error"
  11929. | "function"
  11930. | "null"
  11931. | "number"
  11932. | "object"
  11933. | "regexp"
  11934. | "string"
  11935. | "symbol"
  11936. | "undefined";
  11937. /**
  11938. * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
  11939. * @param array The Array of DOM elements.
  11940. * @see \`{@link https://api.jquery.com/jQuery.unique/ }\`
  11941. * @since 1.1.3
  11942. * @deprecated ​ Deprecated since 3.0. Use \`{@link uniqueSort }\`.
  11943. *
  11944. * **Cause**: The fact that `jQuery.unique` sorted its results in DOM order was surprising to many who did not read the documentation carefully. As of jQuery 3.0 this function is being renamed to make it clear.
  11945. *
  11946. * **Solution**: Replace all uses of `jQuery.unique` with `jQuery.uniqueSort` which is the same function with a better name.
  11947. * @example ​ ````Removes any duplicate elements from the array of divs.
  11948. ```html
  11949. <!doctype html>
  11950. <html lang="en">
  11951. <head>
  11952. <meta charset="utf-8">
  11953. <title>jQuery.unique demo</title>
  11954. <style>
  11955. div {
  11956. color: blue;
  11957. }
  11958. </style>
  11959. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  11960. </head>
  11961. <body>
  11962. <div>There are 6 divs in this document.</div>
  11963. <div></div>
  11964. <div class="dup"></div>
  11965. <div class="dup"></div>
  11966. <div class="dup"></div>
  11967. <div></div>
  11968. <script>
  11969. // unique() must take a native array
  11970. var divs = $( "div" ).get();
  11971. // Add 3 elements of class dup too (they are divs)
  11972. divs = divs.concat( $( ".dup" ).get() );
  11973. $( "div:eq(1)" ).text( "Pre-unique there are " + divs.length + " elements." );
  11974. divs = jQuery.unique( divs );
  11975. $( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." )
  11976. .css( "color", "red" );
  11977. </script>
  11978. </body>
  11979. </html>
  11980. ```
  11981. */
  11982. unique<T extends Element>(array: T[]): T[];
  11983. /**
  11984. * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
  11985. * @param array The Array of DOM elements.
  11986. * @see \`{@link https://api.jquery.com/jQuery.uniqueSort/ }\`
  11987. * @since 1.12
  11988. * @since 2.2
  11989. * @example ​ ````Removes any duplicate elements from the array of divs.
  11990. ```html
  11991. <!doctype html>
  11992. <html lang="en">
  11993. <head>
  11994. <meta charset="utf-8">
  11995. <title>jQuery.uniqueSort demo</title>
  11996. <style>
  11997. div {
  11998. color: blue;
  11999. }
  12000. </style>
  12001. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  12002. </head>
  12003. <body>
  12004. <div>There are 6 divs in this document.</div>
  12005. <div></div>
  12006. <div class="dup"></div>
  12007. <div class="dup"></div>
  12008. <div class="dup"></div>
  12009. <div></div>
  12010. <script>
  12011. // unique() must take a native array
  12012. var divs = $( "div" ).get();
  12013. // Add 3 elements of class dup too (they are divs)
  12014. divs = divs.concat( $( ".dup" ).get() );
  12015. $( "div:eq(1)" ).text( "Pre-unique there are " + divs.length + " elements." );
  12016. divs = jQuery.uniqueSort( divs );
  12017. $( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." )
  12018. .css( "color", "red" );
  12019. </script>
  12020. </body>
  12021. </html>
  12022. ```
  12023. */
  12024. uniqueSort<T extends Element>(array: T[]): T[];
  12025. /**
  12026. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12027. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12028. * @since 1.5
  12029. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12030. ```javascript
  12031. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12032. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12033. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12034. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12035. if ( /Whip It/.test( data ) ) {
  12036. alert( "We got what we came for!" );
  12037. }
  12038. });
  12039. ```
  12040. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12041. ```javascript
  12042. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12043. .then( myFunc, myFailure );
  12044. ```
  12045. */
  12046. when<TR1, UR1, VR1, TJ1 = any, UJ1 = any, VJ1 = any>(
  12047. deferredT: JQuery.Promise<TR1, TJ1> | JQuery.Thenable<TR1> | TR1,
  12048. deferredU: JQuery.Promise<UR1, UJ1> | JQuery.Thenable<UR1> | UR1,
  12049. deferredV: JQuery.Promise<VR1, VJ1> | JQuery.Thenable<VR1> | VR1,
  12050. ): JQuery.Promise3<
  12051. TR1,
  12052. TJ1,
  12053. never,
  12054. UR1,
  12055. UJ1,
  12056. never,
  12057. VR1,
  12058. VJ1,
  12059. never
  12060. >;
  12061. /**
  12062. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12063. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12064. * @since 1.5
  12065. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12066. ```javascript
  12067. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12068. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12069. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12070. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12071. if ( /Whip It/.test( data ) ) {
  12072. alert( "We got what we came for!" );
  12073. }
  12074. });
  12075. ```
  12076. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12077. ```javascript
  12078. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12079. .then( myFunc, myFailure );
  12080. ```
  12081. */
  12082. when<TR1, UR1, TJ1 = any, UJ1 = any>(
  12083. deferredT: JQuery.Promise<TR1, TJ1> | JQuery.Thenable<TR1> | TR1,
  12084. deferredU: JQuery.Promise<UR1, UJ1> | JQuery.Thenable<UR1> | UR1,
  12085. ): JQuery.Promise2<
  12086. TR1,
  12087. TJ1,
  12088. never,
  12089. UR1,
  12090. UJ1,
  12091. never
  12092. >;
  12093. /**
  12094. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12095. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12096. * @since 1.5
  12097. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12098. ```javascript
  12099. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12100. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12101. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12102. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12103. if ( /Whip It/.test( data ) ) {
  12104. alert( "We got what we came for!" );
  12105. }
  12106. });
  12107. ```
  12108. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12109. ```javascript
  12110. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12111. .then( myFunc, myFailure );
  12112. ```
  12113. */
  12114. when<TR1, TJ1, TR2, TJ2, TR3 = never, TJ3 = never>(
  12115. deferredT:
  12116. | JQuery.Promise3<TR1, TJ1, any, TR2, TJ2, any, TR3, TJ3, any>
  12117. | JQuery.Promise2<TR1, TJ1, any, TR2, TJ2, any>,
  12118. ): JQuery.Promise3<
  12119. TR1,
  12120. TJ1,
  12121. never,
  12122. TR2,
  12123. TJ2,
  12124. never,
  12125. TR3,
  12126. TJ3,
  12127. never
  12128. >;
  12129. /**
  12130. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12131. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12132. * @since 1.5
  12133. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12134. ```javascript
  12135. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12136. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12137. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12138. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12139. if ( /Whip It/.test( data ) ) {
  12140. alert( "We got what we came for!" );
  12141. }
  12142. });
  12143. ```
  12144. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12145. ```javascript
  12146. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12147. .then( myFunc, myFailure );
  12148. ```
  12149. */
  12150. when<TR1, TJ1 = any>(
  12151. deferred: JQuery.Promise<TR1, TJ1> | JQuery.Thenable<TR1> | TR1,
  12152. ): JQuery.Promise<TR1, TJ1, never>;
  12153. /**
  12154. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12155. * @param deferreds Zero or more Thenable objects.
  12156. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12157. * @since 1.5
  12158. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12159. ```javascript
  12160. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12161. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12162. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12163. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12164. if ( /Whip It/.test( data ) ) {
  12165. alert( "We got what we came for!" );
  12166. }
  12167. });
  12168. ```
  12169. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12170. ```javascript
  12171. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12172. .then( myFunc, myFailure );
  12173. ```
  12174. */
  12175. when<TR1 = never, TJ1 = never>(
  12176. ...deferreds: Array<JQuery.Promise<TR1, TJ1> | JQuery.Thenable<TR1> | TR1>
  12177. ): JQuery.Promise<TR1, TJ1, never>;
  12178. /**
  12179. * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events.
  12180. * @param deferreds Zero or more Thenable objects.
  12181. * @see \`{@link https://api.jquery.com/jQuery.when/ }\`
  12182. * @since 1.5
  12183. * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).
  12184. ```javascript
  12185. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {
  12186. // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.
  12187. // Each argument is an array with the following structure: [ data, statusText, jqXHR ]
  12188. var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It"
  12189. if ( /Whip It/.test( data ) ) {
  12190. alert( "We got what we came for!" );
  12191. }
  12192. });
  12193. ```
  12194. * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.
  12195. ```javascript
  12196. $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
  12197. .then( myFunc, myFailure );
  12198. ```
  12199. */
  12200. when(...deferreds: any[]): JQuery.Promise<any, any, never>;
  12201. }